Completed
Push — develop ( 990136...183c36 )
by Stéphane
02:08
created

DuplicateRuleException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 60%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
c 3
b 0
f 1
lcom 0
cbo 0
dl 0
loc 49
ccs 6
cts 10
cp 0.6
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setRule() 0 5 1
A getRule() 0 4 1
A setUserAgent() 0 5 1
A getUserAgent() 0 4 1
1
<?php
2
3
namespace Bee4\RobotsTxt\Exception;
4
5
use Exception;
6
use Bee4\RobotsTxt\Rule;
7
8
/**
9
 * Class DuplicateRuleException
10
 * Error thrown when the parser try to add 2 rules for the same UA
11
 *
12
 * @copyright Bee4 2015
13
 * @author    Stephane HULARD <[email protected]>
14
 */
15
class DuplicateRuleException extends Exception
16
{
17
    /**
18
     * @var Rule
19
     */
20
    protected $rule;
21
22
    /**
23
     * @var string
24
     */
25
    protected $ua;
26
27
    /**
28
     * Rule setter
29
     * @param Rule $rule
30
     * @return DuplicateRuleException
31
     */
32 1
    public function setRule(Rule $rule)
33
    {
34 1
        $this->rule = $rule;
35 1
        return $this;
36
    }
37
38
    /**
39
     * @return Rule
40
     */
41
    public function getRule()
42
    {
43
        return $this->rule;
44
    }
45
46
    /**
47
     * User Agent setter
48
     * @param string $ua
49
     * @return DuplicateRuleException
50
     */
51 1
    public function setUserAgent($ua)
52
    {
53 1
        $this->ua = $ua;
54 1
        return $this;
55
    }
56
    /**
57
     * @return string
58
     */
59
    public function getUserAgent()
60
    {
61
        return $this->ua;
62
    }
63
}
64