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
308b40b8
Commit
308b40b8
authored
Aug 01, 2018
by
Jorgen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error handling when searching for typo context
parent
4fd6c29a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
.gitignore
.gitignore
+2
-0
TyposClientInterface.php
src/TyposClientInterface.php
+7
-0
No files found.
.gitignore
View file @
308b40b8
.idea/
vendor/
.vscode/
\ No newline at end of file
src/TyposClientInterface.php
View file @
308b40b8
...
...
@@ -79,8 +79,15 @@ abstract class TyposClientInterface
// Find a context in text, capture it offset
$contextMatch
=
[];
preg_match_all
(
"#
{
$context
}
#"
,
$text
,
$contextMatch
,
PREG_OFFSET_CAPTURE
);
error_log
(
"Context match = "
.
print_r
(
$contextMatch
,
true
));
$contextMatch
=
$contextMatch
[
0
];
if
(
!
isset
(
$contextMatch
[
0
]))
{
throw
new
\Exception
(
"Failed to find the context in article"
);
}
$contextOffset
=
$contextMatch
[
0
][
1
];
// Find a concrete typo that we want to fix
...
...
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