| 1 | <?php |
||
| 11 | class Dispatcher |
||
| 12 | { |
||
| 13 | |||
| 14 | 6 | public function __construct(\FastRoute\Dispatcher $dispatcher) |
|
| 18 | |||
| 19 | /** |
||
| 20 | * Dispatches against the provided HTTP method verb and URI. |
||
| 21 | * |
||
| 22 | * Returns array with one of the following formats: |
||
| 23 | * |
||
| 24 | * [self::NOT_FOUND] |
||
| 25 | * [self::METHOD_NOT_ALLOWED, ['GET', 'OTHER_ALLOWED_METHODS']] |
||
| 26 | * [self::FOUND, $handler, ['varName' => 'value', ...]] |
||
| 27 | * |
||
| 28 | * @param string $command |
||
| 29 | * |
||
| 30 | * @return array |
||
| 31 | */ |
||
| 32 | 3 | public function dispatch($command) |
|
| 36 | |||
| 37 | /** |
||
| 38 | * Get a new instance of dispatcher |
||
| 39 | * @param callable $routeDefinitionCallback |
||
| 40 | * @param array $options |
||
| 41 | * @return static |
||
| 42 | */ |
||
| 43 | public static function simpleDispatcher(callable $routeDefinitionCallback, array $options = []) |
||
| 49 | } |
||
| 50 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: