1 | <?php |
||
20 | class RenderClient implements RobotsTxtInterface |
||
21 | { |
||
22 | /** |
||
23 | * Handler |
||
24 | * @var RootDirectiveHandler |
||
25 | */ |
||
26 | private $root; |
||
27 | |||
28 | /** |
||
29 | * RenderClient constructor. |
||
30 | * |
||
31 | * @param RootDirectiveHandler $handler |
||
32 | */ |
||
33 | public function __construct(RootDirectiveHandler $handler) |
||
37 | |||
38 | /** |
||
39 | * Compatibility optimized robots.txt |
||
40 | * |
||
41 | * Differences compared to Normal: |
||
42 | * - Each User-agent is listed with it's own separate rule set (even if it's equal to others) |
||
43 | * - Byte consuming, may be multiple times larger (depending on the number of user-agents) |
||
44 | * - Maximum compatibility, optimized for badly written 3rd party parsers with limited specification support |
||
45 | * |
||
46 | * @param string $eol |
||
47 | * @return string |
||
48 | */ |
||
49 | public function compatibility($eol = "\r\n") |
||
53 | |||
54 | /** |
||
55 | * Generate an rule string array |
||
56 | * |
||
57 | * @param int $level |
||
58 | * @param string $eol |
||
59 | * @return string |
||
60 | */ |
||
61 | private function generate($level, $eol) |
||
75 | |||
76 | /** |
||
77 | * Normal looking robots.txt |
||
78 | * |
||
79 | * Differences compared to Compressed: |
||
80 | * - The directives first character is uppercase |
||
81 | * - Whitespace between the directive and it's value |
||
82 | * - Easy to edit |
||
83 | * - User-agent groups are separated with blank lines |
||
84 | * |
||
85 | * @param string $eol |
||
86 | * @return string |
||
87 | */ |
||
88 | public function normal($eol = "\r\n") |
||
92 | |||
93 | /** |
||
94 | * Compressed robots.txt |
||
95 | * |
||
96 | * Generates an robots.txt compressed to a absolute minimum. |
||
97 | * Best suited for parsing purposes and storage in databases. |
||
98 | * |
||
99 | * @param string $eol |
||
100 | * @return string |
||
101 | */ |
||
102 | public function compressed($eol = PHP_EOL) |
||
106 | } |
||
107 |