Esempio n. 1
0
 /**
  * @param \SiteChecker\Asset $asset
  * @return bool
  */
 protected function isAlreadyChecked(Asset $asset)
 {
     return in_array($asset->getURL(), $this->checkedAssets);
 }
Esempio n. 2
0
 /**
  * Called when the checker has checked the given page.
  *
  * @param Asset $asset
  */
 public function logResult($asset)
 {
     $code = $asset instanceof Asset ? $asset->getResponseCode() : Asset::CODE_ERROR;
     $messageParts = ['Checking'];
     $messageParts[] = 'asset: ' . $asset->getURL();
     if ($parent = $asset->getParentPage()) {
         $messageParts[] = 'on a page: ' . $parent->getURL() . '.';
     }
     if ($this->config->showFullTags && ($html = $asset->getFullHtml())) {
         $messageParts[] = 'Full html of it is: ' . $html . '.';
     }
     $messageParts[] = 'Received code: ' . $code;
     $message = implode(' ', $messageParts);
     if ($asset->isError()) {
         $this->logger->error($message);
     } elseif ($asset->isWarning()) {
         $this->logger->warning($message);
     } else {
         $this->logger->info($message);
     }
 }