1 | <?php |
||
57 | class Server |
||
58 | { |
||
59 | /** |
||
60 | * Server instance |
||
61 | * |
||
62 | * @var \Apparat\Server\Domain\Model\Server |
||
63 | */ |
||
64 | protected static $server = null; |
||
65 | /** |
||
66 | * Year route token |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | protected static $TOKEN_YEAR = ['year' => self::REGEX_ASTERISK.'|(?:\d{4})']; |
||
71 | /** |
||
72 | * Month route token |
||
73 | * |
||
74 | * @var array |
||
75 | */ |
||
76 | protected static $TOKEN_MONTH = ['month' => self::REGEX_ASTERISK.'|(?:0[1-9])|(?:1[0-2])']; |
||
77 | /** |
||
78 | * Day route token |
||
79 | * |
||
80 | * @var array |
||
81 | */ |
||
82 | protected static $TOKEN_DAY = ['day' => self::REGEX_ASTERISK.'|(?:0[1-9])|(?:[1-2]\d)|(?:3[0-1])']; |
||
83 | /** |
||
84 | * Hour route token |
||
85 | * |
||
86 | * @var array |
||
87 | */ |
||
88 | protected static $TOKEN_HOUR = ['hour' => self::REGEX_ASTERISK.'|(?:0[1-9])|(?:1[0-2])']; |
||
89 | /** |
||
90 | * Day route token |
||
91 | * |
||
92 | * @var array |
||
93 | */ |
||
94 | protected static $TOKEN_MINUTE = ['minute' => self::REGEX_ASTERISK.'|(?:0[1-9])|(?:[1-4]\d)|(?:5[0-9])']; |
||
95 | /** |
||
96 | * Second route token |
||
97 | * |
||
98 | * @var array |
||
99 | */ |
||
100 | protected static $TOKEN_SECOND = ['second' => self::REGEX_ASTERISK.'|(?:0[1-9])|(?:[1-4]\d)|(?:5[0-9])']; |
||
101 | /** |
||
102 | * Asterisk regular expression |
||
103 | * |
||
104 | * @var string |
||
105 | */ |
||
106 | const REGEX_ASTERISK = '(?:\%2A)'; |
||
107 | |||
108 | /** |
||
109 | * Register a route |
||
110 | * |
||
111 | * @param RouteInterface $route |
||
112 | */ |
||
113 | 2 | public static function registerRoute(RouteInterface $route) |
|
117 | |||
118 | /** |
||
119 | * Register the default routes for a particular repository |
||
120 | * |
||
121 | * @param string $repositoryPath Repository path |
||
122 | * @param bool $enable Enable / disable default routes |
||
123 | */ |
||
124 | 1 | public static function registerRepositoryDefaultRoutes($repositoryPath = '', $enable = true) |
|
141 | |||
142 | /** |
||
143 | * Dispatch a request |
||
144 | * |
||
145 | * @param ServerRequestInterface $request |
||
146 | * @return ResponseInterface $response |
||
147 | */ |
||
148 | 2 | public static function dispatchRequest(ServerRequestInterface $request) |
|
152 | |||
153 | /** |
||
154 | * Create and return the server instance |
||
155 | * |
||
156 | * @return \Apparat\Server\Domain\Model\Server Server instance |
||
157 | */ |
||
158 | 2 | protected static function getServer() |
|
165 | |||
166 | /** |
||
167 | * Build and return the default date routes |
||
168 | * |
||
169 | * @param string $prefix Repository route prefix |
||
170 | * @param int $precision Date precision |
||
171 | * @return array Default date routes |
||
172 | */ |
||
173 | 1 | protected static function buildDefaultDateRoutes($prefix, $precision) |
|
226 | |||
227 | /** |
||
228 | * Build and return the default object routes |
||
229 | * |
||
230 | * @param string $prefix Repository route prefix |
||
231 | * @param array $baseDateRoute Base date route |
||
232 | * @param int $numDefaultRoutes Total number of date routes |
||
233 | * @return array Default object routes |
||
234 | */ |
||
235 | 1 | protected static function buildDefaultObjectRoutes($prefix, $baseDateRoute, $numDefaultRoutes) |
|
255 | } |
||
256 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.