protected function addLink(Link $link) { if (!$this->subscription->insideScope($link)) { $this->logger('outside the scope' . "\n" . '[' . $this->subscription->getDomainString() . "]\n[" . $link->get('href') . ']', 'info', 5); return 0; } //Prevents invalid links if (!SpiderAsserts::isDocumentLink($link)) { $this->logger('Href refused', 'info', 5); return 0; } $this->logger('Check Cache for id:' . $link->getId('string'), 'info', 5); //Prevents duplicates if ($this->requests > 0 && $this->cache && $this->cache->isObject($link->getId('string'))) { $this->logger('cached', 'info', 5); $this->cached++; return 0; } $this->pool->save($link); return 1; }