| Total Complexity | 11 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 5 | trait WhereTrait |
||
| 6 | { |
||
| 7 | use Helper; |
||
| 8 | |||
| 9 | public static function where(array $wheres): Router |
||
| 10 | { |
||
| 11 | $route = self::getInstance()->inSabe(); |
||
|
|
|||
| 12 | $route['where'] = (is_array($route['where'])) ? array_merge($route['where'],$wheres) : $wheres; |
||
| 13 | self::getInstance()->updateRoute($route,array_key_last(self::getInstance()->routes)); |
||
| 14 | return self::getInstance(); |
||
| 15 | } |
||
| 16 | |||
| 17 | protected function checkData(string $routePath, string $uriPath): void |
||
| 18 | { |
||
| 19 | $routePath = explode('/',urldecode($routePath)); |
||
| 20 | unset($routePath[0]); |
||
| 21 | $uriPath = explode('/',urldecode($uriPath)); |
||
| 22 | unset($uriPath[0]); |
||
| 23 | |||
| 24 | $this->checkCount($routePath, $uriPath); |
||
| 25 | |||
| 26 | $corretRoute = true; |
||
| 27 | foreach($routePath as $r => $routeFrag){ |
||
| 28 | $routeFrag = $this->replaceParam($routeFrag, $uriPath[$r]); |
||
| 29 | |||
| 30 | if($routeFrag !== $uriPath[$r]){ |
||
| 31 | $corretRoute = false; |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | if(!$corretRoute){ |
||
| 36 | throw new \Exception('continue'); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | private function replaceParam(string $ref, string $value): string |
||
| 41 | { |
||
| 42 | if(((substr($ref,0,1) === '{') && (substr($ref,strlen($ref)-1) === '}'))) { |
||
| 43 | return $value; |
||
| 44 | } |
||
| 45 | return $ref; |
||
| 46 | } |
||
| 47 | |||
| 48 | private function checkCount(array $routePath, array $uriPath): void |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | } |
||
| 56 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.