示例#1
0
 /**
  * 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]));
     }
 }
示例#2
0
文件: Rules.php 项目: bee4/robots.txt
 public function testInvalidSitemapUrl()
 {
     $this->given($sut = new SUT())->exception(function () use($sut) {
         $sut->addSitemap('sitemap.xml');
     })->isInstanceOf('Bee4\\RobotsTxt\\Exception\\InvalidUrlException');
 }