1 | <?php |
||
9 | class Directory extends Dictionary |
||
10 | { |
||
11 | const ANY = '*'; |
||
12 | const GET = 'GET'; |
||
13 | const POST = 'POST'; |
||
14 | const PUT = 'PUT'; |
||
15 | const PATCH = 'PATCH'; |
||
16 | const HEAD = 'HEAD'; |
||
17 | const DELETE = 'DELETE'; |
||
18 | const OPTIONS = 'OPTIONS'; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $prefix = ''; |
||
24 | |||
25 | /** |
||
26 | * Set the directory path prefix. |
||
27 | * |
||
28 | * @param string $prefix |
||
29 | * |
||
30 | * @return static |
||
31 | */ |
||
32 | 2 | public function withPrefix($prefix) |
|
39 | |||
40 | /** |
||
41 | * Remove the directory path prefix. |
||
42 | * |
||
43 | * @return static |
||
44 | */ |
||
45 | 1 | public function withoutPrefix() |
|
52 | |||
53 | /** |
||
54 | * Add the prefix to a path. |
||
55 | * |
||
56 | * @param string $path |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | 4 | public function prefix($path) |
|
64 | |||
65 | /** |
||
66 | * @param string $path |
||
67 | * @param string|Action $domainOrAction |
||
68 | * |
||
69 | * @return static |
||
70 | */ |
||
71 | 1 | public function any($path, $domainOrAction) |
|
75 | |||
76 | /** |
||
77 | * @param string $path |
||
78 | * @param string|Action $domainOrAction |
||
79 | * |
||
80 | * @return static |
||
81 | */ |
||
82 | 4 | public function get($path, $domainOrAction) |
|
86 | |||
87 | /** |
||
88 | * @param string $path |
||
89 | * @param string|Action $domainOrAction |
||
90 | * |
||
91 | * @return static |
||
92 | */ |
||
93 | 1 | public function post($path, $domainOrAction) |
|
97 | |||
98 | /** |
||
99 | * @param string $path |
||
100 | * @param string|Action $domainOrAction |
||
101 | * |
||
102 | * @return static |
||
103 | */ |
||
104 | 1 | public function put($path, $domainOrAction) |
|
108 | |||
109 | /** |
||
110 | * @param string $path |
||
111 | * @param string|Action $domainOrAction |
||
112 | * |
||
113 | * @return static |
||
114 | */ |
||
115 | 1 | public function patch($path, $domainOrAction) |
|
119 | |||
120 | /** |
||
121 | * @param string $path |
||
122 | * @param string|Action $domainOrAction |
||
123 | * |
||
124 | * @return static |
||
125 | */ |
||
126 | 1 | public function head($path, $domainOrAction) |
|
130 | |||
131 | /** |
||
132 | * @param string $path |
||
133 | * @param string|Action $domainOrAction |
||
134 | * |
||
135 | * @return static |
||
136 | */ |
||
137 | 1 | public function delete($path, $domainOrAction) |
|
141 | |||
142 | /** |
||
143 | * @param string $path |
||
144 | * @param string|Action $domainOrAction |
||
145 | * |
||
146 | * @return static |
||
147 | */ |
||
148 | 1 | public function options($path, $domainOrAction) |
|
152 | |||
153 | /** |
||
154 | * @param string $method |
||
155 | * @param string $path |
||
156 | * @param string|Action $domainOrAction |
||
157 | * |
||
158 | * @return static |
||
159 | */ |
||
160 | 13 | public function action($method, $path, $domainOrAction) |
|
170 | |||
171 | /** |
||
172 | * @inheritDoc |
||
173 | * |
||
174 | * @throws DirectoryException If a value is not an Action instance |
||
175 | */ |
||
176 | 17 | protected function assertValid(array $data) |
|
186 | } |
||
187 |