1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* vipnytt/RobotsTxtParser |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/VIPnytt/RobotsTxtParser |
6
|
|
|
* @license https://github.com/VIPnytt/RobotsTxtParser/blob/master/LICENSE The MIT License (MIT) |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace vipnytt\RobotsTxtParser\Client\Directives; |
10
|
|
|
|
11
|
|
|
use vipnytt\RobotsTxtParser\Handler\Directives\SubDirectiveHandler; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class UserAgentClient |
15
|
|
|
* |
16
|
|
|
* @see https://github.com/VIPnytt/RobotsTxtParser/blob/master/docs/methods/UserAgentClient.md for documentation |
17
|
|
|
* @package vipnytt\RobotsTxtParser\Client\Directives |
18
|
|
|
*/ |
19
|
|
|
class UserAgentClient extends UserAgentTools |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* User-agent |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private $product; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* UserAgentClient constructor. |
29
|
|
|
* |
30
|
|
|
* @param SubDirectiveHandler $handler |
31
|
|
|
* @param string $baseUri |
32
|
|
|
* @param int|null $statusCode |
33
|
|
|
* @param string $product |
34
|
|
|
*/ |
35
|
|
|
public function __construct(SubDirectiveHandler $handler, $baseUri, $statusCode, $product) |
36
|
|
|
{ |
37
|
|
|
parent::__construct($handler, $baseUri, $statusCode); |
38
|
|
|
$this->product = $product; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Allow |
43
|
|
|
* |
44
|
|
|
* @return AllowClient |
45
|
|
|
*/ |
46
|
|
|
public function allow() |
47
|
|
|
{ |
48
|
|
|
return $this->handler->allow->client(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Cache-delay |
53
|
|
|
* |
54
|
|
|
* @return DelayClient |
55
|
|
|
*/ |
56
|
|
|
public function cacheDelay() |
57
|
|
|
{ |
58
|
|
|
return $this->handler->cacheDelay->client($this->product, $this->crawlDelay()->getValue()); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Crawl-delay |
63
|
|
|
* |
64
|
|
|
* @return DelayClient |
65
|
|
|
*/ |
66
|
|
|
public function crawlDelay() |
67
|
|
|
{ |
68
|
|
|
return $this->handler->crawlDelay->client($this->product); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* RequestClient-rate |
73
|
|
|
* |
74
|
|
|
* @return RequestRateClient |
75
|
|
|
*/ |
76
|
|
|
public function requestRate() |
77
|
|
|
{ |
78
|
|
|
return $this->handler->requestRate->client($this->product, $this->crawlDelay()->getValue()); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Comment |
83
|
|
|
* |
84
|
|
|
* @return CommentClient |
85
|
|
|
*/ |
86
|
|
|
public function comment() |
87
|
|
|
{ |
88
|
|
|
return $this->handler->comment->client(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Disallow |
93
|
|
|
* |
94
|
|
|
* @return AllowClient |
95
|
|
|
*/ |
96
|
|
|
public function disallow() |
97
|
|
|
{ |
98
|
|
|
return $this->handler->disallow->client(); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* NoIndex |
103
|
|
|
* |
104
|
|
|
* @return AllowClient |
105
|
|
|
*/ |
106
|
|
|
public function noIndex() |
107
|
|
|
{ |
108
|
|
|
return $this->handler->noIndex->client(); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Robot-version |
113
|
|
|
* |
114
|
|
|
* @return RobotVersionClient |
115
|
|
|
*/ |
116
|
|
|
public function robotVersion() |
117
|
|
|
{ |
118
|
|
|
return $this->handler->robotVersion->client(); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Visit-time |
123
|
|
|
* |
124
|
|
|
* @return VisitTimeClient |
125
|
|
|
*/ |
126
|
|
|
public function visitTime() |
127
|
|
|
{ |
128
|
|
|
return $this->handler->visitTime->client(); |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
|