@@ -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,24 +94,24 @@ 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 | - $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(["<", ">", "<", ">", "/"], "", $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 |
||
| 119 | 119 | $closingTag = explode(" ", $element); |
| 120 | 120 | $closingTag = str_replace(["<", ">", "<", ">"], "", $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 | } |