| Total Complexity | 2 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | trait RouteTypes |
||
| 10 | { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Supported types of URL parameters |
||
| 14 | * |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | private $types = []; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Init types |
||
| 21 | */ |
||
| 22 | private function initDefaultTypes(): void |
||
| 23 | { |
||
| 24 | $this->types['i'] = '\Mezon\Router\Types\IntegerRouterType'; |
||
| 25 | $this->types['a'] = '\Mezon\Router\Types\CommandRouterType'; |
||
| 26 | $this->types['il'] = '\Mezon\Router\Types\IntegerListRouterType'; |
||
| 27 | $this->types['s'] = '\Mezon\Router\Types\StringRouterType'; |
||
| 28 | $this->types['fp'] = '\Mezon\Router\Types\FixPointNumberRouterType'; |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Method adds custom type |
||
| 33 | * |
||
| 34 | * @param string $typeName |
||
| 35 | * type name |
||
| 36 | * @param string $className |
||
| 37 | * name of the class wich represents custom type |
||
| 38 | */ |
||
| 39 | public function addType(string $typeName, string $className): void |
||
| 44 | } |
||
| 45 | } |
||
| 46 |