コード例 #1
0
ファイル: HtmlTokenizer.php プロジェクト: jwdeitch/components
 /**
  * Will restore all existing PHP blocks to their original content.
  *
  * @param string $source
  * @return string
  */
 protected function repairPHP($source)
 {
     if (!$this->isolatePHP) {
         return $source;
     }
     return $this->isolator->repairPHP($source);
 }
コード例 #2
0
ファイル: PrettifyProcessor.php プロジェクト: vvval/spiral
 /**
  * Remove blank lines.
  *
  * @param string   $source
  * @param Isolator $isolator
  * @return string
  */
 protected function normalizeEndings($source, Isolator $isolator)
 {
     //Step #1, \n only
     $source = $isolator->isolatePHP(Strings::normalizeEndings($source));
     //Step #2, chunk by lines
     $sourceLines = explode("\n", $source);
     //Step #3, no blank lines and html comments (will keep conditional commends)
     $sourceLines = array_filter($sourceLines, function ($line) {
         return trim($line);
     });
     $source = $isolator->repairPHP(join("\n", $sourceLines));
     $isolator->reset();
     return $source;
 }