1 | <?php |
||
23 | class Core extends RobotsTxtParser |
||
24 | { |
||
25 | use UrlParser; |
||
26 | |||
27 | /** |
||
28 | * Base uri |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $base; |
||
32 | |||
33 | /** |
||
34 | * Status code |
||
35 | * @var int|null |
||
36 | */ |
||
37 | protected $statusCode; |
||
38 | |||
39 | /** |
||
40 | * Robots.txt content |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $content; |
||
44 | |||
45 | /** |
||
46 | * Core constructor. |
||
47 | * |
||
48 | * @param string $baseUri |
||
49 | * @param int $statusCode |
||
50 | * @param string|null $content |
||
51 | * @param string $encoding |
||
52 | * @param int|null $byteLimit |
||
53 | */ |
||
54 | public function __construct($baseUri, $statusCode, $content, $encoding = self::ENCODING, $byteLimit = self::BYTE_LIMIT) |
||
63 | |||
64 | /** |
||
65 | * Convert character encoding |
||
66 | * |
||
67 | * @param string $encoding |
||
68 | * @return string |
||
69 | */ |
||
70 | private function convertEncoding($encoding) |
||
79 | |||
80 | /** |
||
81 | * Byte limit |
||
82 | * |
||
83 | * @param int|null $bytes |
||
84 | * @return string |
||
85 | */ |
||
86 | private function limitBytes($bytes) |
||
95 | |||
96 | /** |
||
97 | * Clean-param |
||
98 | * |
||
99 | * @return CleanParamClient |
||
100 | */ |
||
101 | public function cleanParam() |
||
105 | |||
106 | /** |
||
107 | * Host |
||
108 | * |
||
109 | * @return HostClient |
||
110 | */ |
||
111 | public function host() |
||
115 | |||
116 | /** |
||
117 | * Sitemaps |
||
118 | * |
||
119 | * @return SitemapClient |
||
120 | */ |
||
121 | public function sitemap() |
||
125 | |||
126 | /** |
||
127 | * Get User-agent list |
||
128 | * |
||
129 | * @return string[] |
||
130 | */ |
||
131 | public function getUserAgents() |
||
135 | |||
136 | /** |
||
137 | * Client User-agent specific rules |
||
138 | * |
||
139 | * @param string $string |
||
140 | * @return UserAgentClient |
||
141 | */ |
||
142 | public function userAgent($string = self::USER_AGENT) |
||
146 | } |
||
147 |