コード例 #1
0
 /**
  * @throws \RuntimeException
  * @return StrategyInterface
  */
 private function loadStrategy()
 {
     $strategy = $this->strategyLoader->get($this->fqcn);
     if (!$strategy instanceof StrategyInterface) {
         throw new \RuntimeException(sprintf('Strategy \'%s\' must implement PhpDA\\Writer\\Strategy\\StrategyInterface', $this->fqcn));
     }
     return $strategy;
 }
コード例 #2
0
 /**
  * @param string $type
  * @param array  $options
  * @throws \RuntimeException
  * @return StrategyInterface
  */
 private function loadStrategy($type, array $options = null)
 {
     $fqcn = 'PhpDA\\Command\\Strategy\\' . ucfirst($type) . 'Factory';
     $strategy = $this->strategyLoader->get($fqcn, $options);
     if (!$strategy instanceof StrategyInterface) {
         throw new \RuntimeException(sprintf('Strategy \'%s\' must implement PhpDA\\Command\\Strategy\\StrategyInterface', $fqcn));
     }
     return $strategy;
 }
コード例 #3
0
 /**
  * @throws \RuntimeException
  */
 private function bindNamespaceFilterToVisitorOptions()
 {
     if ($fqcn = $this->getConfig()->getNamespaceFilter()) {
         $namespaceFilter = $this->pluginLoader->get($fqcn);
         if (!$namespaceFilter instanceof NamespaceFilterInterface) {
             throw new \RuntimeException(sprintf('NamespaceFilter \'%s\' must implement PhpDA\\Parser\\Filter\\NamespaceFilterInterface', $fqcn));
         }
         $this->getConfig()->setGlobalVisitorOption('namespaceFilter', $namespaceFilter);
     }
 }