| Total Complexity | 10 |
| Total Lines | 75 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | trait RouteAccessiblePropertyTrait |
||
| 8 | {
|
||
| 9 | /** |
||
| 10 | * get route mappers |
||
| 11 | * |
||
| 12 | * @return array |
||
| 13 | */ |
||
| 14 | public static function getMappers() : array |
||
| 15 | {
|
||
| 16 | // this feature will give you a map |
||
| 17 | // to see all your route methods. |
||
| 18 | return static::$mappers; |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * get static path |
||
| 23 | * |
||
| 24 | * @return array |
||
| 25 | */ |
||
| 26 | protected static function getPath() : array |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * get routes |
||
| 35 | * |
||
| 36 | * @param null|string $method |
||
| 37 | * @return array |
||
| 38 | */ |
||
| 39 | public static function getRoutes($method=null) : array |
||
| 40 | {
|
||
| 41 | // it collects and |
||
| 42 | // executes route data in an array. |
||
| 43 | if(is_null($method)){
|
||
| 44 | return static::$routes; |
||
| 45 | } |
||
| 46 | |||
| 47 | $httpRouteList = []; |
||
| 48 | |||
| 49 | $routes = self::getRoutes(); |
||
| 50 | |||
| 51 | if(isset($routes['data'])){
|
||
| 52 | foreach ($routes['data'] as $key=>$item){
|
||
| 53 | if($item['http']==httpMethod()){
|
||
| 54 | $httpRouteList['data'][$key] = $item; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | if(isset($routes['pattern'],$httpRouteList['data'])){
|
||
| 60 | foreach ($httpRouteList['data'] as $key=>$item){
|
||
| 61 | $httpRouteList['pattern'][$key] = $routes['pattern'][$key]; |
||
| 62 | } |
||
| 63 | } |
||
| 64 | |||
| 65 | return $httpRouteList; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * get static trace path |
||
| 70 | * |
||
| 71 | * @return mixed|null |
||
| 72 | */ |
||
| 73 | protected static function getTracePath() |
||
| 82 | } |
||
| 83 | } |