/**
  * @test
  */
 public function testParser()
 {
     $siteChecker = SiteChecker::create();
     $html = '<a href="/xxx"></a><img src="/yyy">';
     /** @var Asset[] $assets */
     $assets = self::callMethod($siteChecker, 'getAllAssets', array($html, null));
     $link = $assets[0];
     $this->assertEquals('/xxx', $link->getPath());
     $this->assertEquals('page', $link->getType());
     $image = $assets[1];
     $this->assertEquals('/yyy', $image->getPath());
     $this->assertEquals('image', $image->getType());
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $header_style = new OutputFormatterStyle('white', 'green', array('bold'));
     $output->getFormatter()->setStyle('header', $header_style);
     $site = $input->getArgument('site');
     $output->writeln('<header>Checking ' . $site . '... </header>');
     $site = new Asset($site);
     $verbosityLevelMap = [];
     if ($input->getOption('log-success')) {
         $verbosityLevelMap = array(LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL);
     }
     $logger = new ConsoleLogger($output, $verbosityLevelMap);
     $observer = new ConsoleObserver($logger);
     $siteChecker = SiteChecker::create($observer);
     if ($input->getOptions()) {
         $config = new Config();
         // Load configuration from file if any
         $conf = json_decode(file_get_contents(__DIR__ . CONFIG_PATH));
         $siteConf = isset($conf->{$site->host}) ? $conf->{$site->host} : null;
         if (!is_null($siteConf) || !is_null($conf)) {
             foreach ((array) $config as $key => $value) {
                 // First use general values
                 if (!empty($conf->{$key})) {
                     $config->{$key} = $conf->{$key};
                 }
                 // Then rewrite them with site-specific
                 if (!empty($siteConf->{$key})) {
                     $config->{$key} = $siteConf->{$key};
                 }
             }
         }
         if ($input->getOption('log-success')) {
             $config->showOnlyProblems = false;
         }
         if ($input->getOption('check-external')) {
             $config->checkExternal = true;
         }
         if ($input->getOption('full-html')) {
             $config->showFullTags = true;
         }
         $siteChecker->setConfig($config);
         $observer->setConfig($config);
     }
     $siteChecker->check($site);
 }