/** * Class constructor. * * @param \BackBee\BBApplication $application */ public function __construct(BBApplication $application) { $this->application = $application; if (null !== ($rewritingConfig = $this->application->getConfig()->getRewritingConfig())) { if (array_key_exists('preserve-online', $rewritingConfig)) { $this->setPreserveOnline(true === $rewritingConfig['preserve-online']); } if (array_key_exists('preserve-unicity', $rewritingConfig)) { $this->setPreserveUnicity(true === $rewritingConfig['preserve-unicity']); } if (isset($rewritingConfig['scheme']) && is_array($rewritingConfig['scheme'])) { $this->schemes = $rewritingConfig['scheme']; } } }
/** * Loads every declared persistors in application config.yml, config section. * * @throws PersistorListNotFoundException occurs if there is no persistor list in config.yml, section: config * it also occurs if config section does not exist in application config.yml * @throws InvalidArgumentException raises if one of declared persistors does not implement PersistorInterface */ private function loadPersistors() { if (null !== ($config = $this->application->getConfig())) { $config_config = $config->getConfigConfig(); if (false === is_array($config_config) || false === array_key_exists('persistor', $config_config)) { throw new PersistorListNotFoundException(); } $persistors = (array) $config_config['persistor']; foreach ($persistors as $persistor_classname) { $persistor = new $persistor_classname($this->application); if (false === $persistor instanceof PersistorInterface) { throw new InvalidArgumentException(get_class($persistor) . ' must implements BackBee\\Config\\Persistor\\PersistorInterface'); } $this->persistors[] = $persistor; } } else { throw new BBException('Application\'s Config must be different to null'); } }