Author: Victor Farazdagi
コード例 #1
0
ファイル: FactoryTest.php プロジェクト: JamieS/phrozn
 public function testProviderNotFoundException()
 {
     $this->setExpectedException('Exception', "Provider of type 'SpeedyJoe' not found..");
     $input = dirname(__FILE__) . '/data/LoadFromFile.txt';
     $options = array();
     $factory = new Factory();
     $provider = $factory->create('SpeedyJoe', $options);
     $provider->setProjectPath(dirname($input));
 }
コード例 #2
0
ファイル: Base.php プロジェクト: negativespace/phrozn
 /**
  * Render view
  *
  * @param array $vars List of variables passed to text processors
  *
  * @return string
  */
 public function render($vars = array())
 {
     // inject front matter options into template
     $vars = array_merge($vars, $this->getParams());
     // inject providers content
     if ($providers = $this->getParam('page.providers', false)) {
         $factory = new ProviderFactory();
         $projectPath = new ProjectPath($this->getOutputDir());
         foreach ($providers as $varname => $data) {
             if (!isset($data['provider'])) {
                 continue;
             }
             $provider = $factory->create($data['provider'], $data);
             $provider->setProjectPath($projectPath->get());
             $providedContent = $provider->get();
             $vars['page']['providers'][$varname] = $providedContent;
             $vars['this']['providers'][$varname] = $providedContent;
         }
     }
     // convert view into static representation
     $view = $this->getTemplate();
     foreach ($this->getProcessors() as $processor) {
         $view = $processor->render($view, $vars);
     }
     return $view;
 }