Skip to content
Permalink
Browse files

refactor method

  • Loading branch information
taylorotwell committed Jan 2, 2020
1 parent 2d09053 commit 08887f99d05bb85affd3cbc6f7fdbc32a9297eea
Showing with 21 additions and 10 deletions.
  1. +21 −10 src/Illuminate/View/Compilers/BladeCompiler.php
@@ -186,17 +186,9 @@ public function setPath($path)
*/
public function compileString($value)
{
if (strpos($value, '@verbatim') !== false) {
$value = $this->storeVerbatimBlocks($value);
}

$this->footer = [];
[$this->footer, $result] = [[], ''];

if (strpos($value, '@php') !== false) {
$value = $this->storePhpBlocks($value);
}

$result = '';
$value = $this->storeUncompiledBlocks($value);

// Here we will loop through all of the tokens returned by the Zend lexer and
// parse each one into the corresponding valid PHP. We will then have this
@@ -219,6 +211,25 @@ public function compileString($value)
return $result;
}

/**
* Store the blocks that do not receive compilation.
*
* @param string $value
* @return string
*/
protected function storeUncompiledBlocks($value)
{
if (strpos($value, '@verbatim') !== false) {
$value = $this->storeVerbatimBlocks($value);
}

if (strpos($value, '@php') !== false) {
$value = $this->storePhpBlocks($value);
}

return $value;
}

/**
* Store the verbatim blocks and replace them with a temporary placeholder.
*

0 comments on commit 08887f9

Please sign in to comment.
You can’t perform that action at this time.