Example #1
0
 public function filterConfig($target)
 {
     $value = $this->getArrayCopy();
     if ($target === 'JS') {
         $value = new Dictionary(ConfigHelper::filterConfig($value, $target));
     }
     return $value;
 }
Example #2
0
 public function getParser(array $config = \null)
 {
     $this->configOptimizer->reset();
     $rendererGenerator = new XSLT();
     $this->xsl = $rendererGenerator->getXSL($this->configurator->rendering);
     $this->config = isset($config) ? $config : $this->configurator->asConfig();
     $this->config = ConfigHelper::filterConfig($this->config, 'JS');
     $this->config = $this->callbackGenerator->replaceCallbacks($this->config);
     $src = $this->getHints() . $this->injectConfig($this->getSource());
     $src .= $this->getExports();
     $src = $this->getMinifier()->get($src);
     $src = '(function(){' . $src . '})()';
     return $src;
 }
 public function getHelper()
 {
     $config = $this->asConfig();
     if (isset($config)) {
         $config = ConfigHelper::filterConfig($config, 'PHP');
     } else {
         $config = array('attrName' => $this->attrName, 'regexp' => '/(?!)/', 'tagName' => $this->tagName);
     }
     return new Helper($config);
 }
 public function finalize(array $options = array())
 {
     $return = array();
     $options += array('addHTML5Rules' => \true, 'optimizeConfig' => \true, 'returnJS' => isset($this->javascript), 'returnParser' => \true, 'returnRenderer' => \true);
     if ($options['addHTML5Rules']) {
         $this->addHTML5Rules($options);
     }
     if ($options['returnRenderer']) {
         $renderer = $this->rendering->getRenderer();
         if (isset($options['finalizeRenderer'])) {
             \call_user_func($options['finalizeRenderer'], $renderer);
         }
         $return['renderer'] = $renderer;
     }
     if ($options['returnJS'] || $options['returnParser']) {
         $config = $this->asConfig();
         if ($options['returnJS']) {
             $return['js'] = $this->javascript->getParser(ConfigHelper::filterConfig($config, 'JS'));
         }
         if ($options['returnParser']) {
             $config = ConfigHelper::filterConfig($config, 'PHP');
             if ($options['optimizeConfig']) {
                 ConfigHelper::optimizeArray($config);
             }
             $parser = new Parser($config);
             if (isset($options['finalizeParser'])) {
                 \call_user_func($options['finalizeParser'], $parser);
             }
             $return['parser'] = $parser;
         }
     }
     return $return;
 }