@@ -24,7 +24,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -44,6 +44,6 @@ |
||
44 | 44 | */ |
45 | 45 | private static function getModifiedRegexPattern($pattern) |
46 | 46 | { |
47 | - return '/(\|\|\|\||<.*?>|<.*?>|%{.*?})(*SKIP)(*FAIL)|'. ltrim($pattern, $pattern[0]); |
|
47 | + return '/(\|\|\|\||<.*?>|<.*?>|%{.*?})(*SKIP)(*FAIL)|' . ltrim($pattern, $pattern[0]); |
|
48 | 48 | } |
49 | 49 | } |
@@ -21,7 +21,7 @@ discard block |
||
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 |
||
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,34 +94,34 @@ discard block |
||
94 | 94 | { |
95 | 95 | preg_match_all('/<(.*?)>|<(.*?)>/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(["<", ">", "<", ">", "/"], "", $tag[0]); |
102 | 102 | |
103 | 103 | // opening tags |
104 | - if(!self::contains("/", $element)){ |
|
104 | + if (!self::contains("/", $element)) { |
|
105 | 105 | |
106 | 106 | $tagMatch = false; |
107 | 107 | |
108 | 108 | // check for the closing tag |
109 | - for($i = ($index+1); $i < count($matches[0]); $i++){ |
|
109 | + for ($i = ($index + 1); $i < count($matches[0]); $i++) { |
|
110 | 110 | $nextElement = $matches[0][$i] ?? null; |
111 | 111 | |
112 | - if($nextElement === null){ |
|
112 | + if ($nextElement === null) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | 116 | $nextTag = explode(" ", $nextElement); |
117 | 117 | $nextTag = str_replace(["<", ">", "<", ">", "/"], "", $nextTag[0]); |
118 | 118 | |
119 | - if($nextTag === $tag){ |
|
119 | + if ($nextTag === $tag) { |
|
120 | 120 | $tagMatch = true; |
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | - if($tagMatch === false){ |
|
124 | + if ($tagMatch === false) { |
|
125 | 125 | continue; |
126 | 126 | } |
127 | 127 | } |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | $closingTag = explode(" ", $element); |
131 | 131 | $closingTag = str_replace(["<", ">", "<", ">"], "", $closingTag[0]); |
132 | 132 | |
133 | - if(empty($closingTag)){ |
|
133 | + if (empty($closingTag)) { |
|
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
137 | - if(!(self::firstChar($closingTag) === "/" or self::lastChar($closingTag) === "/")){ |
|
137 | + if (!(self::firstChar($closingTag) === "/" or self::lastChar($closingTag) === "/")) { |
|
138 | 138 | continue; |
139 | 139 | } |
140 | 140 | } |