Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-adapter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
eterfund
retypos-adapter
Commits
55fbe198
Commit
55fbe198
authored
May 08, 2019
by
Vadim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Entry in error_log only when errors occur
parent
277650a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
TyposClientInterface.php
src/TyposClientInterface.php
+5
-7
No files found.
src/TyposClientInterface.php
View file @
55fbe198
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
/**
/**
* Created by PhpStorm.
* Created by PhpStorm.
* User: ambulance
* User: ambulance
* Date: 0
3
.05.19
* Date: 0
7
.05.19
* Time: 2
0:3
0
* Time: 2
3:0
0
*/
*/
namespace
Etersoft\Typos
;
namespace
Etersoft\Typos
;
...
@@ -151,11 +151,10 @@ abstract class TyposClientInterface
...
@@ -151,11 +151,10 @@ abstract class TyposClientInterface
// Trying to replace typo in text
// Trying to replace typo in text
try
{
try
{
error_log
(
"Trying to find a typo in article text..."
);
$article
->
text
=
$this
->
replaceTypoInText
(
$typo
,
$corrected
,
$context
,
$article
->
text
);
$article
->
text
=
$this
->
replaceTypoInText
(
$typo
,
$corrected
,
$context
,
$article
->
text
);
return
;
return
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
error_log
(
$e
->
getMessage
());
error_log
(
"Error while find a typo in article text. "
.
$e
->
getMessage
());
// If a corrected of the typo is found in the text, remember this and,
// If a corrected of the typo is found in the text, remember this and,
// if in other parts (title and subtitle) the typo or context is not found,
// if in other parts (title and subtitle) the typo or context is not found,
...
@@ -173,11 +172,10 @@ abstract class TyposClientInterface
...
@@ -173,11 +172,10 @@ abstract class TyposClientInterface
// Trying to replace typo in title
// Trying to replace typo in title
try
{
try
{
error_log
(
"Trying to find a typo in article title..."
);
$article
->
title
=
$this
->
replaceTypoInText
(
$typo
,
$corrected
,
$context
,
$article
->
title
);
$article
->
title
=
$this
->
replaceTypoInText
(
$typo
,
$corrected
,
$context
,
$article
->
title
);
return
;
return
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
error_log
(
$e
->
getMessage
());
error_log
(
"Error while find a typo in article title. "
.
$e
->
getMessage
());
if
(
$e
->
getCode
()
==
208
)
{
if
(
$e
->
getCode
()
==
208
)
{
$isAlreadyFixed
=
true
;
$isAlreadyFixed
=
true
;
}
}
...
@@ -188,9 +186,9 @@ abstract class TyposClientInterface
...
@@ -188,9 +186,9 @@ abstract class TyposClientInterface
// Trying to replace typo in subtitle
// Trying to replace typo in subtitle
try
{
try
{
error_log
(
"Trying to find a typo in article subtitle..."
);
$article
->
subtitle
=
$this
->
replaceTypoInText
(
$typo
,
$corrected
,
$context
,
$article
->
subtitle
);
$article
->
subtitle
=
$this
->
replaceTypoInText
(
$typo
,
$corrected
,
$context
,
$article
->
subtitle
);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
error_log
(
"Error while find a typo in article subtitle. "
.
$e
->
getMessage
());
if
((
$e
->
getCode
()
==
404
||
$e
->
getCode
()
==
405
)
&&
$isAlreadyFixed
)
{
if
((
$e
->
getCode
()
==
404
||
$e
->
getCode
()
==
405
)
&&
$isAlreadyFixed
)
{
throw
new
\Exception
(
"Already fixed"
,
208
);
throw
new
\Exception
(
"Already fixed"
,
208
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment