@@ -41,13 +41,13 @@  | 
                                                    ||
| 41 | 41 | public function resolve($notCallable): callable  | 
                                                        
| 42 | 42 |      { | 
                                                        
| 43 | 43 |          try { | 
                                                        
| 44 | - $controllerName = $this->namespace . '\\' . $notCallable[0];  | 
                                                        |
| 44 | + $controllerName = $this->namespace.'\\'.$notCallable[0];  | 
                                                        |
| 45 | 45 | $methodName = $notCallable[1];  | 
                                                        
| 46 | 46 | $result = [new $controllerName(), $methodName];  | 
                                                        
| 47 | 47 |              if (is_callable($result)) { | 
                                                        
| 48 | 48 | return $result;  | 
                                                        
| 49 | 49 | }  | 
                                                        
| 50 | -            throw new \Exception("unable to resolve " . $notCallable[0]); | 
                                                        |
| 50 | +            throw new \Exception("unable to resolve ".$notCallable[0]); | 
                                                        |
| 51 | 51 |          } catch (\Throwable $e) { | 
                                                        
| 52 | 52 | throw new \InvalidArgumentException($e->getMessage());  | 
                                                        
| 53 | 53 | }  | 
                                                        
@@ -32,7 +32,7 @@  | 
                                                    ||
| 32 | 32 |  { | 
                                                        
| 33 | 33 | use RouteAwareTrait;  | 
                                                        
| 34 | 34 | |
| 35 | - const URI_PARAMETERS = '_parsedParams';  | 
                                                        |
| 35 | + const URI_PARAMETERS = '_parsedParams';  | 
                                                        |
| 36 | 36 | |
| 37 | 37 | /**  | 
                                                        
| 38 | 38 | * @var ResolverInterface  | 
                                                        
@@ -73,13 +73,13 @@ discard block  | 
                                                    ||
| 73 | 73 | * @var string[]  | 
                                                        
| 74 | 74 | */  | 
                                                        
| 75 | 75 | protected $shortcuts = [  | 
                                                        
| 76 | - ':d}' => ':[0-9]++}', // digit only  | 
                                                        |
| 77 | - ':l}' => ':[a-z]++}', // lower case  | 
                                                        |
| 78 | - ':u}' => ':[A-Z]++}', // upper case  | 
                                                        |
| 79 | - ':a}' => ':[0-9a-zA-Z]++}', // alphanumeric  | 
                                                        |
| 76 | + ':d}' => ':[0-9]++}', // digit only  | 
                                                        |
| 77 | + ':l}' => ':[a-z]++}', // lower case  | 
                                                        |
| 78 | + ':u}' => ':[A-Z]++}', // upper case  | 
                                                        |
| 79 | + ':a}' => ':[0-9a-zA-Z]++}', // alphanumeric  | 
                                                        |
| 80 | 80 | ':c}' => ':[0-9a-zA-Z+_\-\.]++}', // common chars  | 
                                                        
| 81 | - ':nd}' => ':[^0-9/]++}', // not digits  | 
                                                        |
| 82 | - ':xd}' => ':[^0-9/][^/]*+}', // no leading digits  | 
                                                        |
| 81 | + ':nd}' => ':[^0-9/]++}', // not digits  | 
                                                        |
| 82 | + ':xd}' => ':[^0-9/][^/]*+}', // no leading digits  | 
                                                        |
| 83 | 83 | ];  | 
                                                        
| 84 | 84 | |
| 85 | 85 | /**  | 
                                                        
@@ -121,17 +121,17 @@ discard block  | 
                                                    ||
| 121 | 121 | |
| 122 | 122 | // count placeholders  | 
                                                        
| 123 | 123 | $map = $m = [];  | 
                                                        
| 124 | -        if (preg_match_all('~' . $ph . '~x', $pattern, $m)) { | 
                                                        |
| 124 | +        if (preg_match_all('~'.$ph.'~x', $pattern, $m)) { | 
                                                        |
| 125 | 125 | $map = $m[1];  | 
                                                        
| 126 | 126 | }  | 
                                                        
| 127 | 127 | |
| 128 | 128 | $result = preg_replace(  | 
                                                        
| 129 | 129 | [  | 
                                                        
| 130 | - '~' . $ph . '(*SKIP)(*FAIL) | \[~x', '~' . $ph . '(*SKIP)(*FAIL) | \]~x',  | 
                                                        |
| 131 | -            '~\{' . self::MATCH_GROUP_NAME . '\}~x', '~' . $ph . '~x', | 
                                                        |
| 130 | + '~'.$ph.'(*SKIP)(*FAIL) | \[~x', '~'.$ph.'(*SKIP)(*FAIL) | \]~x',  | 
                                                        |
| 131 | +            '~\{'.self::MATCH_GROUP_NAME.'\}~x', '~'.$ph.'~x', | 
                                                        |
| 132 | 132 | ],  | 
                                                        
| 133 | -            ['(?:', ')?', '{\\1:' . self::MATCH_SEGMENT . '}', '(\\2)'], | 
                                                        |
| 134 | -            strtr('/' . trim($pattern, '/'), $this->shortcuts) | 
                                                        |
| 133 | +            ['(?:', ')?', '{\\1:'.self::MATCH_SEGMENT.'}', '(\\2)'], | 
                                                        |
| 134 | +            strtr('/'.trim($pattern, '/'), $this->shortcuts) | 
                                                        |
| 135 | 135 | );  | 
                                                        
| 136 | 136 | |
| 137 | 137 | return [$result, $map];  | 
                                                        
@@ -155,9 +155,9 @@ discard block  | 
                                                    ||
| 155 | 155 | $map = $this->getMapData($arr, $this->maps);  | 
                                                        
| 156 | 156 | $str = '~^(?|';  | 
                                                        
| 157 | 157 |              foreach ($arr as $k => $reg) { | 
                                                        
| 158 | -                $str .= $reg . str_repeat('()', $map[$k] - count($this->maps[$k])) . '|'; | 
                                                        |
| 158 | +                $str .= $reg.str_repeat('()', $map[$k] - count($this->maps[$k])).'|'; | 
                                                        |
| 159 | 159 | }  | 
                                                        
| 160 | - $this->data[$i] = substr($str, 0, -1) . ')$~x';  | 
                                                        |
| 160 | + $this->data[$i] = substr($str, 0, -1).')$~x';  | 
                                                        |
| 161 | 161 | $this->xmap[$i] = $map;  | 
                                                        
| 162 | 162 | }  | 
                                                        
| 163 | 163 | $this->modified = false;  | 
                                                        
@@ -85,8 +85,7 @@  | 
                                                    ||
| 85 | 85 | public function setMethods($method, $handler, array $defaults): Route  | 
                                                        
| 86 | 86 |      { | 
                                                        
| 87 | 87 | $methods = is_string($method) ?  | 
                                                        
| 88 | -            preg_split('~[^A-Z]+~', strtoupper($method), -1, PREG_SPLIT_NO_EMPTY) : | 
                                                        |
| 89 | -            array_map('strtoupper', $method); | 
                                                        |
| 88 | +            preg_split('~[^A-Z]+~', strtoupper($method), -1, PREG_SPLIT_NO_EMPTY) : array_map('strtoupper', $method); | 
                                                        |
| 90 | 89 | |
| 91 | 90 |          foreach ($methods as $mth) { | 
                                                        
| 92 | 91 | $this->methods[$mth] = [$handler, $defaults];  |