| Conditions | 7 |
| Paths | 5 |
| Total Lines | 27 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 | } |
||
| 83 | } |