示例#1
0
文件: Rules.php 项目: bee4/robots.txt
 /**
  * Add a new rule to the collection
  * @param Rule $rule
  * @return Rules
  */
 public function add(Rule $rule)
 {
     $userAgent = $this->handleUa($rule->getUserAgent());
     if (isset($this->collection[$userAgent]) && $this->collection[$userAgent] !== $this->defaultRule) {
         throw (new DuplicateRuleException('You can\'t add 2 rules for the same UserAgent'))->setRule($rule);
     }
     $this->collection[$userAgent] = $rule;
     return $this;
 }
示例#2
0
文件: Rule.php 项目: bee4/robots.txt
 public function testUserAgent()
 {
     $this->given($sut = new SUT('UA'))->then->string($sut->getUserAgent())->isEqualTo('UA');
 }