1 | <?php |
||
11 | class SubDirectiveHandler implements RobotsTxtInterface |
||
12 | { |
||
13 | /** |
||
14 | * Allow |
||
15 | * @var DisAllowParser |
||
16 | */ |
||
17 | private $allow; |
||
18 | |||
19 | /** |
||
20 | * Cache-delay |
||
21 | * @var DelayParser |
||
22 | */ |
||
23 | private $cacheDelay; |
||
24 | |||
25 | /** |
||
26 | * Comment |
||
27 | * @var CommentParser |
||
28 | */ |
||
29 | private $comment; |
||
30 | |||
31 | /** |
||
32 | * Crawl-delay |
||
33 | * @var DelayParser |
||
34 | */ |
||
35 | private $crawlDelay; |
||
36 | |||
37 | /** |
||
38 | * Disallow |
||
39 | * @var DisAllowParser |
||
40 | */ |
||
41 | private $disallow; |
||
42 | |||
43 | /** |
||
44 | * Request-rate |
||
45 | * @var RequestRateParser |
||
46 | */ |
||
47 | private $requestRate; |
||
48 | |||
49 | /** |
||
50 | * Robot-version |
||
51 | * @var RobotVersionParser |
||
52 | */ |
||
53 | private $robotVersion; |
||
54 | |||
55 | /** |
||
56 | * Visit-time |
||
57 | * @var VisitTimeParser |
||
58 | */ |
||
59 | private $visitTime; |
||
60 | |||
61 | /** |
||
62 | * SubDirectiveHandler constructor. |
||
63 | * |
||
64 | * @param string $base |
||
65 | * @param string $userAgent |
||
66 | */ |
||
67 | public function __construct($base, $userAgent) |
||
68 | { |
||
69 | $this->allow = new DisAllowParser($base, self::DIRECTIVE_ALLOW); |
||
70 | $this->cacheDelay = new DelayParser($base, $userAgent, self::DIRECTIVE_CACHE_DELAY); |
||
71 | $this->comment = new CommentParser($base, $userAgent); |
||
72 | $this->crawlDelay = new DelayParser($base, $userAgent, self::DIRECTIVE_CRAWL_DELAY); |
||
73 | $this->disallow = new DisAllowParser($base, self::DIRECTIVE_DISALLOW); |
||
74 | $this->requestRate = new RequestRateParser($base, $userAgent); |
||
75 | $this->robotVersion = new RobotVersionParser(); |
||
76 | $this->visitTime = new VisitTimeParser(); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * Allow |
||
81 | * |
||
82 | * @return DisAllowParser |
||
83 | */ |
||
84 | public function allow() |
||
88 | |||
89 | /** |
||
90 | * Cache-delay |
||
91 | * |
||
92 | * @return DelayParser |
||
93 | */ |
||
94 | public function cacheDelay() |
||
98 | |||
99 | /** |
||
100 | * Comment |
||
101 | * |
||
102 | * @return CommentParser |
||
103 | */ |
||
104 | public function comment() |
||
108 | |||
109 | /** |
||
110 | * Crawl-delay |
||
111 | * |
||
112 | * @return DelayParser |
||
113 | */ |
||
114 | public function crawlDelay() |
||
118 | |||
119 | /** |
||
120 | * Disallow |
||
121 | * |
||
122 | * @return DisAllowParser |
||
123 | */ |
||
124 | public function disallow() |
||
128 | |||
129 | /** |
||
130 | * Request-rate |
||
131 | * |
||
132 | * @return RequestRateParser |
||
133 | */ |
||
134 | public function requestRate() |
||
138 | |||
139 | /** |
||
140 | * Robot-version |
||
141 | * |
||
142 | * @return RobotVersionParser |
||
143 | */ |
||
144 | public function robotVersion() |
||
148 | |||
149 | /** |
||
150 | * Visit-time |
||
151 | * |
||
152 | * @return VisitTimeParser |
||
153 | */ |
||
154 | public function visitTime() |
||
158 | } |
||
159 |