@@ -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 | /** |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | $ph = sprintf("\{%s(?:%s)?\}", self::MATCH_GROUP_NAME, self::MATCH_GROUP_TYPE); |
121 | 121 | // count placeholders |
122 | 122 | $map = $m = []; |
123 | - if (preg_match_all('~' . $ph . '~x', $pattern, $m)) { |
|
123 | + if (preg_match_all('~'.$ph.'~x', $pattern, $m)) { |
|
124 | 124 | $map = $m[1]; |
125 | 125 | } |
126 | 126 | $result = preg_replace( |
127 | 127 | [ |
128 | - '~' . $ph . '(*SKIP)(*FAIL) | \[~x', '~' . $ph . '(*SKIP)(*FAIL) | \]~x', |
|
129 | - '~\{' . self::MATCH_GROUP_NAME . '\}~x', '~' . $ph . '~x', |
|
128 | + '~'.$ph.'(*SKIP)(*FAIL) | \[~x', '~'.$ph.'(*SKIP)(*FAIL) | \]~x', |
|
129 | + '~\{'.self::MATCH_GROUP_NAME.'\}~x', '~'.$ph.'~x', |
|
130 | 130 | ], |
131 | - ['(?:', ')?', '{\\1:' . self::MATCH_SEGMENT . '}', '(\\2)'], |
|
132 | - strtr('/' . trim($pattern, '/'), $this->shortcuts) |
|
131 | + ['(?:', ')?', '{\\1:'.self::MATCH_SEGMENT.'}', '(\\2)'], |
|
132 | + strtr('/'.trim($pattern, '/'), $this->shortcuts) |
|
133 | 133 | ); |
134 | 134 | return [$result, $map]; |
135 | 135 | } |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $map = $this->getMapData($arr, $this->maps); |
166 | 166 | $str = '~^(?|'; |
167 | 167 | foreach ($arr as $k => $reg) { |
168 | - $str .= $reg . str_repeat('()', $map[$k] - count($this->maps[$k])) . '|'; |
|
168 | + $str .= $reg.str_repeat('()', $map[$k] - count($this->maps[$k])).'|'; |
|
169 | 169 | } |
170 | - $this->data[$i] = substr($str, 0, -1) . ')$~x'; |
|
170 | + $this->data[$i] = substr($str, 0, -1).')$~x'; |
|
171 | 171 | $this->xmap[$i] = $map; |
172 | 172 | } |
173 | 173 | $this->modified = FALSE; |
@@ -105,8 +105,7 @@ |
||
105 | 105 | public function setMethods($method, $handler, array $defaults) |
106 | 106 | { |
107 | 107 | $methods = is_string($method) ? |
108 | - preg_split('~[^A-Z]+~', strtoupper($method), -1, PREG_SPLIT_NO_EMPTY) : |
|
109 | - array_map('strtoupper', $method); |
|
108 | + preg_split('~[^A-Z]+~', strtoupper($method), -1, PREG_SPLIT_NO_EMPTY) : array_map('strtoupper', $method); |
|
110 | 109 | foreach ($methods as $mth) { |
111 | 110 | $this->methods[$mth] = [$handler, $defaults]; |
112 | 111 | } |
@@ -90,8 +90,8 @@ |
||
90 | 90 | */ |
91 | 91 | protected function appendSuffix(array $notCallable): callable |
92 | 92 | { |
93 | - $controller = $this->namespace . '\\' . $notCallable[0] . $this->controllerSuffix; |
|
94 | - $action = $notCallable[1] . $this->actionSuffix; |
|
93 | + $controller = $this->namespace.'\\'.$notCallable[0].$this->controllerSuffix; |
|
94 | + $action = $notCallable[1].$this->actionSuffix; |
|
95 | 95 | return [new $controller(), $action]; |
96 | 96 | } |
97 | 97 |