1 | <?php |
||
13 | class AllowParser implements ParserInterface, RobotsTxtInterface |
||
14 | { |
||
15 | use DirectiveParserCommons; |
||
16 | |||
17 | /** |
||
18 | * Supported directives |
||
19 | */ |
||
20 | const SUPPORTED_DIRECTIVES = [ |
||
21 | self::DIRECTIVE_ALLOW, |
||
22 | self::DIRECTIVE_DISALLOW, |
||
23 | self::DIRECTIVE_NO_INDEX, |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * Sub directives white list |
||
28 | */ |
||
29 | const SUB_DIRECTIVES = [ |
||
30 | self::DIRECTIVE_CLEAN_PARAM, |
||
31 | self::DIRECTIVE_HOST, |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * Directive |
||
36 | * @var string |
||
37 | */ |
||
38 | private $directive; |
||
39 | |||
40 | /** |
||
41 | * Path |
||
42 | * @var array |
||
43 | */ |
||
44 | private $path = []; |
||
45 | |||
46 | /** |
||
47 | * Sub-directive Clean-param |
||
48 | * @var CleanParamParser |
||
49 | */ |
||
50 | private $cleanParam; |
||
51 | |||
52 | /** |
||
53 | * Sub-directive Host |
||
54 | * @var HostParser |
||
55 | */ |
||
56 | private $host; |
||
57 | |||
58 | /** |
||
59 | * AllowParser constructor |
||
60 | * |
||
61 | * @param string $base |
||
62 | * @param string $effective |
||
63 | * @param string $directive |
||
64 | */ |
||
65 | public function __construct($base, $effective, $directive) |
||
71 | |||
72 | /** |
||
73 | * Add |
||
74 | * |
||
75 | * @param string $line |
||
76 | * @return bool |
||
77 | */ |
||
78 | public function add($line) |
||
89 | |||
90 | /** |
||
91 | * Add plain path to allow/disallow |
||
92 | * |
||
93 | * @param string $path |
||
94 | * @return bool |
||
95 | */ |
||
96 | private function addPath($path) |
||
104 | |||
105 | /** |
||
106 | * Render |
||
107 | * |
||
108 | * @return string[] |
||
109 | */ |
||
110 | public function render() |
||
124 | |||
125 | /** |
||
126 | * Client |
||
127 | * |
||
128 | * @return AllowClient |
||
129 | */ |
||
130 | public function client() |
||
134 | } |
||
135 |