@@ -11,19 +11,19 @@ |
||
| 11 | 11 | public function boot() |
| 12 | 12 | { |
| 13 | 13 | $this->publishes([ |
| 14 | - __DIR__ . '/../config/apidocs.php' => config_path('yaro.apidocs.php'), |
|
| 14 | + __DIR__.'/../config/apidocs.php' => config_path('yaro.apidocs.php'), |
|
| 15 | 15 | ], 'config'); |
| 16 | 16 | |
| 17 | 17 | $this->publishes([ |
| 18 | - __DIR__ . '/../public' => public_path('vendor/yaro/apidocs'), |
|
| 18 | + __DIR__.'/../public' => public_path('vendor/yaro/apidocs'), |
|
| 19 | 19 | ], 'public'); |
| 20 | 20 | |
| 21 | - $this->app['view']->addNamespace('apidocs', __DIR__ . '/../resources/views'); |
|
| 21 | + $this->app['view']->addNamespace('apidocs', __DIR__.'/../resources/views'); |
|
| 22 | 22 | } // end boot |
| 23 | 23 | |
| 24 | 24 | public function register() |
| 25 | 25 | { |
| 26 | - $configPath = __DIR__ . '/../config/apidocs.php'; |
|
| 26 | + $configPath = __DIR__.'/../config/apidocs.php'; |
|
| 27 | 27 | $this->mergeConfigFrom($configPath, 'yaro.apidocs'); |
| 28 | 28 | |
| 29 | 29 | $this->app->singleton('yaro.apidocs', function($app) { |
@@ -179,6 +179,9 @@ discard block |
||
| 179 | 179 | return isset($matches[1]) ? $matches[1] : []; |
| 180 | 180 | } // end getUriParams |
| 181 | 181 | |
| 182 | + /** |
|
| 183 | + * @param string $key |
|
| 184 | + */ |
|
| 182 | 185 | private function generateHashForUrl($key, $route, $method) |
| 183 | 186 | { |
| 184 | 187 | $path = preg_replace('~\s+~', '-', $key); |
@@ -203,6 +206,9 @@ discard block |
||
| 203 | 206 | return preg_split($splitCamelCaseRegexp, $chunk); |
| 204 | 207 | } // end splitCamelCaseToWords |
| 205 | 208 | |
| 209 | + /** |
|
| 210 | + * @param string $param |
|
| 211 | + */ |
|
| 206 | 212 | private function getRouteParam($route, $param) |
| 207 | 213 | { |
| 208 | 214 | $route = (array) $route; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | private function isPrefixedRoute($route) |
| 69 | 69 | { |
| 70 | 70 | $prefix = config('yaro.apidocs.prefix', 'api'); |
| 71 | - $regexp = '~^'. preg_quote($prefix) .'~'; |
|
| 71 | + $regexp = '~^'.preg_quote($prefix).'~'; |
|
| 72 | 72 | |
| 73 | 73 | return preg_match($regexp, $this->getRouteParam($route, 'uri')); |
| 74 | 74 | } // end isPrefixedRoute |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $checkForLongDescription = true; |
| 98 | 98 | foreach ($docs as $line) { |
| 99 | 99 | if ($checkForLongDescription && !preg_match('~^@\w+~', $line)) { |
| 100 | - $description .= trim($line) .' '; |
|
| 100 | + $description .= trim($line).' '; |
|
| 101 | 101 | } elseif (preg_match('~^@\w+~', $line)) { |
| 102 | 102 | $checkForLongDescription = false; |
| 103 | 103 | if (preg_match('~^@param~', $line)) { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ksort($endpoints); |
| 166 | 166 | |
| 167 | 167 | $sorted = array(); |
| 168 | - foreach($endpoints as $key => $val) { |
|
| 168 | + foreach ($endpoints as $key => $val) { |
|
| 169 | 169 | $this->ins($sorted, explode('.', $key), $val); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $httpMethod = $this->getRouteParam($route, 'methods.0'); |
| 186 | 186 | $classMethod = implode('-', $this->splitCamelCaseToWords($method)); |
| 187 | 187 | |
| 188 | - $hash = $path .'::'. $httpMethod .'::'. $classMethod; |
|
| 188 | + $hash = $path.'::'.$httpMethod.'::'.$classMethod; |
|
| 189 | 189 | |
| 190 | 190 | return strtolower($hash); |
| 191 | 191 | } // end generateHashForUrl |
@@ -218,8 +218,7 @@ discard block |
||
| 218 | 218 | private function ins(&$ary, $keys, $val) |
| 219 | 219 | { |
| 220 | 220 | $keys ? |
| 221 | - $this->ins($ary[array_shift($keys)], $keys, $val) : |
|
| 222 | - $ary = $val; |
|
| 221 | + $this->ins($ary[array_shift($keys)], $keys, $val) : $ary = $val; |
|
| 223 | 222 | } // end ins |
| 224 | 223 | |
| 225 | 224 | } |