private function getConfig() { $dispatcher = new \phmLabs\Components\Annovent\Dispatcher(); \PhmLabs\Components\Init\Init::registerGlobalParameter('_eventDispatcher', $dispatcher); \PhmLabs\Components\Init\Init::registerGlobalParameter('_output', null); return new \whm\Smoke\Config\Configuration(new \whm\Html\Uri('http://www.example.com'), $dispatcher, \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__ . '/fixtures/filter.yml'))); }
public function init(OutputInterface $_output, Configuration $_configuration) { $this->output = $_output; $this->config = $_configuration; if ($_configuration->hasSection('reporter')) { $this->reporters = Init::initializeAll($_configuration->getSection('reporter')); } }
public function init(Configuration $_configuration) { if ($_configuration->hasSection('responseRetriever')) { $this->retriever = Init::initialize($_configuration->getSection('responseRetriever')); } else { throw new \RuntimeException("No response retriever set. Please check the config file if a section 'responseRetriever' exists."); } }
public function init(Configuration $_configuration, Dispatcher $_eventDispatcher) { if ($_configuration->hasSection('stop')) { $strategies = $_configuration->getSection('stop'); foreach ($strategies as $name => $strategy) { $this->stopStrategies[$name] = Init::initialize($strategy); $_eventDispatcher->connectListener($this->stopStrategies[$name]); } } }
protected function init(InputInterface $input, OutputInterface $output, $url = null) { if ($input->hasOption('bootstrap') && !is_null($input->getOption('bootstrap'))) { include $input->getOption('bootstrap'); } $this->output = $output; $this->eventDispatcher = new Dispatcher(); Init::registerGlobalParameter('_eventDispatcher', $this->eventDispatcher); Init::registerGlobalParameter('_output', $output); $this->writeSmokeCredentials($url); }
private function initPageContainer($pageContainerArray) { $this->pageContainer = Init::initialize($pageContainerArray); // @todo this should be done inside a factory if ($this->pageContainer instanceof PatternAwareContainer) { if (array_key_exists('parameters', $pageContainerArray) && array_key_exists('pattern', $pageContainerArray['parameters'])) { foreach ($pageContainerArray['parameters']['pattern'] as $name => $pattern) { $this->pageContainer->registerPattern($name, $pattern); } } } }
private function renderRuleOutput() { $this->output->writeln("\n\n <comment>Rules and Violations:</comment> \n"); foreach ($this->rules as $ruleKey => $rule) { $info = Init::getInitInformationByClass($rule); $failedUrls = $this->getFailedUrls($ruleKey); if (count($failedUrls) > 0) { $this->output->writeln(' <error> ' . get_class($rule) . ' </error>'); } else { $this->output->writeln(' <info> ' . get_class($rule) . ' </info>'); } $this->output->writeln(' ' . str_replace("\n", "\n ", $info['documentation']) . "\n"); foreach ($failedUrls as $failedUrl) { $this->output->writeln(' - ' . $failedUrl); } $this->output->writeln(''); } }
/** * Runs the analysis of the given website with all given parameters. * * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $this->init($input, $output); $config = $this->initConfiguration($input->getOption('config_file')); $rules = $config->getRules(); foreach ($rules as $name => $rule) { $info = Init::getInitInformationByClass(get_class($rule)); $output->writeln(' ' . $name . ':'); $output->writeln(' class: ' . get_class($rule)); $output->writeln(' description: ' . str_replace("\n", "\n ", $info['documentation'])); if (count($info['parameters']) > 0) { $output->writeln(' parameter:'); foreach ($info['parameters'] as $parameter) { $output->writeln(' ' . $parameter['name'] . ': ' . $parameter['description'] . ' (default: ' . $parameter['default'] . ')'); } } $output->writeln(''); } }
/** * This function initializes all the rules and sets the log level. * * @param array $rulesArray */ private function initRules(array $rulesArray) { $this->rules = Init::initializeAll($rulesArray); }