@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function getContentSize($contentsWithPlaceholders) |
| 85 | 85 | { |
| 86 | - $placeholderSize = $this->map(function ($value, $key) use (&$contentsWithPlaceholders){ |
|
| 86 | + $placeholderSize = $this->map(function($value, $key) use (&$contentsWithPlaceholders){ |
|
| 87 | 87 | $count = substr_count($contentsWithPlaceholders, $key); |
| 88 | 88 | |
| 89 | 89 | return strlen($key) * $count - strlen($value) * $count; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function removeNestedPlaceholders($originalContent) |
| 113 | 113 | { |
| 114 | - return preg_replace_callback('/'.Constants::PLACEHOLDER_PATTERN.'/', function ($match) { |
|
| 114 | + return preg_replace_callback('/'.Constants::PLACEHOLDER_PATTERN.'/', function($match) { |
|
| 115 | 115 | return $this->pull($match[0]); |
| 116 | 116 | }, $originalContent); |
| 117 | 117 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | protected function setCDataPlaceholder($contents, PlaceholderContainer $placeholderContainer) |
| 32 | 32 | { |
| 33 | - return preg_replace_callback('/<!\[CDATA\[((?!\]\]>).)*\]\]>/s', function ($match) use ($placeholderContainer) { |
|
| 33 | + return preg_replace_callback('/<!\[CDATA\[((?!\]\]>).)*\]\]>/s', function($match) use ($placeholderContainer) { |
|
| 34 | 34 | return $placeholderContainer->createPlaceholder($match[0]); |
| 35 | 35 | }, $contents); |
| 36 | 36 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | > # Match the endif with the captured dashes |
| 67 | 67 | ) |
| 68 | 68 | /xis', |
| 69 | - function ($match) use ($placeholderContainer) { |
|
| 69 | + function($match) use ($placeholderContainer) { |
|
| 70 | 70 | if (!empty(preg_replace('/\s*/', '', $match[3]))) { |
| 71 | 71 | return $placeholderContainer->createPlaceholder($match[1]).$match[3].$placeholderContainer->createPlaceholder($match[4]); |
| 72 | 72 | } else { |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | public function process($context) |
| 17 | 17 | { |
| 18 | 18 | $contents = $context->getContents(); |
| 19 | - $contents = preg_replace_callback('/<\?=((?!\?>).)*\?>/s', function ($match) use ($context) { |
|
| 19 | + $contents = preg_replace_callback('/<\?=((?!\?>).)*\?>/s', function($match) use ($context) { |
|
| 20 | 20 | return $context->getPlaceholderContainer()->createPlaceholder($match[0]); |
| 21 | 21 | }, $contents); |
| 22 | - $contents = preg_replace_callback('/<\?php((?!\?>).)*(\?>)?/s', function ($match) use ($context) { |
|
| 22 | + $contents = preg_replace_callback('/<\?php((?!\?>).)*(\?>)?/s', function($match) use ($context) { |
|
| 23 | 23 | return $context->getPlaceholderContainer()->createPlaceholder($match[0]); |
| 24 | 24 | }, $contents); |
| 25 | 25 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | \s+ # Match minimal 1 whitespace between the elements |
| 64 | 64 | <('.$elementsRegex.') # Match the start of the next inline element |
| 65 | 65 | /xi', |
| 66 | - function ($match) use ($placeholderContainer) { |
|
| 66 | + function($match) use ($placeholderContainer) { |
|
| 67 | 67 | // Where going to respect one space between the inline elements. |
| 68 | 68 | $placeholder = $placeholderContainer->createPlaceholder(' '); |
| 69 | 69 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | ) |
| 94 | 94 | <('.$elementsRegex.') # Match starting tag |
| 95 | 95 | /xis', |
| 96 | - function ($match) use ($placeholderContainer) { |
|
| 96 | + function($match) use ($placeholderContainer) { |
|
| 97 | 97 | return $this->replaceWhitespacesInInlineElements($match[1], $placeholderContainer).'<'.$match[3]; |
| 98 | 98 | }, $contents); |
| 99 | 99 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | private function replaceWhitespacesInInlineElements($element, PlaceholderContainer $placeholderContainer) |
| 110 | 110 | { |
| 111 | - return preg_replace_callback('/>\s/', function ($match) use ($placeholderContainer) { |
|
| 111 | + return preg_replace_callback('/>\s/', function($match) use ($placeholderContainer) { |
|
| 112 | 112 | return '>'.$placeholderContainer->createPlaceholder(' '); |
| 113 | 113 | }, $element); |
| 114 | 114 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $pattern = '/ |
| 127 | 127 | ( |
| 128 | - <(' . $htmlTags . ') # Match html start tag and capture |
|
| 128 | + <(' . $htmlTags.') # Match html start tag and capture |
|
| 129 | 129 | (?: |
| 130 | 130 | [^"\'>]*|"[^"]*"|\'[^\']*\' |
| 131 | 131 | )* # Match all attributes |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | (<\/\2>) # Match end tag by back referencing the start tag |
| 141 | 141 | /xis'; |
| 142 | 142 | |
| 143 | - return preg_replace_callback($pattern, function ($match) use ($placeholderContainer) { |
|
| 143 | + return preg_replace_callback($pattern, function($match) use ($placeholderContainer) { |
|
| 144 | 144 | return $match[1].$placeholderContainer->createPlaceholder($match[3]).$match[4]; |
| 145 | 145 | }, $contents); |
| 146 | 146 | } |