コード例 #1
0
 protected function getConnector($name, ConfigInterface $config)
 {
     if (!$config->has('directory')) {
         $settings = $config->toArray();
         $settings['directory'] = __DIR__ . '/Fixture';
         $config = new ArrayConfig($settings);
     }
     return new LocalConnector($name, $config);
 }
コード例 #2
0
ファイル: RendererLocator.php プロジェクト: honeybee/honeybee
 /**
  * Tries to find renderer implementor given via config 'renderer' key and
  * then tries to find a renderer based on the type/class of the subject.
  *
  * @param mixed $subject subject to render
  * @param ConfigInterface $renderer_config configuration for the renderer when one is found
  *
  * @return string renderer implementor for the given subject (including namespace)
  */
 public function locateRendererFor($subject, ConfigInterface $renderer_config = null)
 {
     if (!empty($renderer_config) && $renderer_config->has('renderer')) {
         $implementor = $renderer_config->get('renderer', '');
         if (!empty($renderer_config) && $renderer_config->get('logging_enabled', false) === true) {
             $this->logger->debug(sprintf('[%s] [OutputFormat=%s] [Subject=%s] Renderer set via renderer config: %s', __METHOD__, $this->output_format_name, is_object($subject) ? get_class($subject) : gettype($subject), $implementor));
         }
     } else {
         $implementor = $this->locateRendererImplementor($subject, $renderer_config);
     }
     if (!class_exists($implementor)) {
         throw new RuntimeError(sprintf('Determined "%s" renderer for subject "%s" not found: %s', $this->output_format_name, is_object($subject) ? get_class($subject) : gettype($subject), $implementor));
         // TODO add some hints about 'renderer' config key or specifying a locator in output_formats.xml?
     }
     return $implementor;
 }