/** * Parse a line of data * @param array &$current * @param string $line */ private function parseLine(array &$current, $line, Rules $rules) { if (preg_match('/^\\s*(Allow|Disallow):[ ]*((\\*)[^#]+|(\\/[^#]*))/i', $line, $matches)) { $match = array_values(array_filter(array_slice($matches, 3))); $this->apply($current, strtolower($matches[1]), trim($match[0])); } elseif (preg_match('/^\\s*Sitemap:([^#]*)/i', $line, $matches)) { $rules->addSitemap(trim($matches[1])); } }
public function testInvalidSitemapUrl() { $this->given($sut = new SUT())->exception(function () use($sut) { $sut->addSitemap('sitemap.xml'); })->isInstanceOf('Bee4\\RobotsTxt\\Exception\\InvalidUrlException'); }