Passed
Pull Request — master (#6)
by Mauro
08:26
created
src/WholeTextFinder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
         preg_match_all($patternAndHaystack['pattern'], $patternAndHaystack['haystack'], $matches, PREG_OFFSET_CAPTURE);
26 26
 
27
-        if($skipHtmlEntities === true){
27
+        if ($skipHtmlEntities === true) {
28 28
             $patternAndHaystack['haystack'] = Strings::unprotectHTMLTags($patternAndHaystack['haystack']);
29 29
         }
30 30
 
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @return mixed
43 43
      */
44
-    private static function mbCorrectMatchPositions( $haystack, &$matches)
44
+    private static function mbCorrectMatchPositions($haystack, &$matches)
45 45
     {
46
-        if(!Strings::isMultibyte($haystack) ){
46
+        if (!Strings::isMultibyte($haystack)) {
47 47
             return $matches[0];
48 48
         }
49 49
 
50
-        foreach ($matches[0] as $index => $match){
50
+        foreach ($matches[0] as $index => $match) {
51 51
             $word = $match[0];
52 52
             $position = $match[1];
53 53
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return int
65 65
      */
66
-    private static function mbFindTheCorrectPosition( $haystack, $word, &$position)
66
+    private static function mbFindTheCorrectPosition($haystack, $word, &$position)
67 67
     {
68 68
         $wordCheck = mb_substr($haystack, $position, mb_strlen($word));
69 69
 
70
-        if($wordCheck !== $word){
70
+        if ($wordCheck !== $word) {
71 71
             $position = $position - 1;
72 72
 
73 73
             self::mbFindTheCorrectPosition($haystack, $word, $position);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         $patternAndHaystack = self::getPatternAndHaystack($haystack, $needle, $skipHtmlEntities, $exactMatch, $caseSensitive, $preserveNbsps);
138 138
         $replacement = Replacer::replace($patternAndHaystack['pattern'], $replacement, $patternAndHaystack['haystack']);
139 139
 
140
-        if($skipHtmlEntities === true){
140
+        if ($skipHtmlEntities === true) {
141 141
             $replacement = Strings::unprotectHTMLTags($replacement);
142 142
         }
143 143
 
Please login to merge, or discard this patch.
src/Helper/Replacer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,6 +44,6 @@
 block discarded – undo
44 44
      */
45 45
     private static function getModifiedRegexPattern($pattern)
46 46
     {
47
-        return '/(\|\|\|\||<.*?>|&lt;.*?&gt;|%{.*?})(*SKIP)(*FAIL)|'. ltrim($pattern, $pattern[0]);
47
+        return '/(\|\|\|\||<.*?>|&lt;.*?&gt;|%{.*?})(*SKIP)(*FAIL)|' . ltrim($pattern, $pattern[0]);
48 48
     }
49 49
 }
Please login to merge, or discard this patch.
src/Helper/Strings.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public static function htmlEntityDecode($string)
23 23
     {
24
-        return html_entity_decode($string, ENT_QUOTES|ENT_XHTML, 'UTF-8');
24
+        return html_entity_decode($string, ENT_QUOTES | ENT_XHTML, 'UTF-8');
25 25
     }
26 26
 
27 27
     /**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public static function contains($needle, $haystack)
71 71
     {
72
-        if(empty($haystack)){
72
+        if (empty($haystack)) {
73 73
             return false;
74 74
         }
75 75
 
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
     {
95 95
         preg_match_all('/&lt;(.*?)&gt;|<(.*?)>/sm', $string, $matches);
96 96
 
97
-        if(!empty($matches[0])){
98
-            foreach ($matches[0] as $index => $element){
97
+        if (!empty($matches[0])) {
98
+            foreach ($matches[0] as $index => $element) {
99 99
 
100 100
                 $tag = explode(" ", $element);
101 101
                 $tag = str_replace(["<", ">", "&lt;", "&gt;", "/"], "", $tag[0]);
102 102
 
103
-                $nextElement = $matches[0][$index+1] ?? null;
103
+                $nextElement = $matches[0][$index + 1] ?? null;
104 104
 
105
-                if(!self::contains("/", $element)){
105
+                if (!self::contains("/", $element)) {
106 106
 
107
-                    if($nextElement === null){
107
+                    if ($nextElement === null) {
108 108
                         continue;
109 109
                     }
110 110
 
111 111
                     $nextTag = explode(" ", $nextElement);
112 112
                     $nextTag = str_replace(["<", ">", "&lt;", "&gt;", "/"], "", $nextTag[0]);
113 113
 
114
-                    if($nextTag !== $tag){
114
+                    if ($nextTag !== $tag) {
115 115
                         continue;
116 116
                     }
117 117
                 } else {
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
                     $closingTag = explode(" ", $element);
120 120
                     $closingTag = str_replace(["<", ">", "&lt;", "&gt;"], "", $closingTag[0]);
121 121
 
122
-                    if(empty($closingTag)){
122
+                    if (empty($closingTag)) {
123 123
                         continue;
124 124
                     }
125 125
 
126
-                    if(!(self::firstChar($closingTag) === "/" or self::lastChar($closingTag) === "/")){
126
+                    if (!(self::firstChar($closingTag) === "/" or self::lastChar($closingTag) === "/")) {
127 127
                         continue;
128 128
                     }
129 129
                 }
Please login to merge, or discard this patch.