Ejemplo n.º 1
0
 private function twigExtractAssetMethods($file)
 {
     $output = $this->output;
     preg_replace_callback('/aphet_[url|script|link]*\\((.*)\\)/', function ($match) use($output) {
         $match = str_replace("'", '"', $match[1]);
         $name = null;
         if (substr($match, 0, 1) === '[' && substr($match, -1) !== ']') {
             $split = explode(']', $match);
             $match = $split[0] . ']';
             $split = explode(',', $split[1]);
             $name = json_decode(str_replace("'", '"', $split[1]));
         }
         $urls = json_decode($match);
         $output->writeln("<info>compile: {$match} </info>");
         $start = microtime(true);
         $urls = $this->assetManager->computeAssetsUrl($urls, $name);
         $output->writeln((microtime(true) - $start) * 1000 . ' ms');
         $stringify = json_encode($urls);
         $output->writeln("  ===> {$stringify}");
     }, file_get_contents($file));
 }