Skip to content

Commit c089591

Browse files
mpociotStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent a0aaef8 commit c089591

19 files changed

+119
-116
lines changed

src/ApiDocGeneratorServiceProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ class ApiDocGeneratorServiceProvider extends ServiceProvider
1717
*/
1818
public function boot()
1919
{
20-
$this->loadViewsFrom(__DIR__.'/../resources/views/', 'apidoc');
20+
$this->loadViewsFrom(__DIR__ . '/../resources/views/', 'apidoc');
2121

2222
$this->publishes([
23-
__DIR__.'/../resources/views' => $this->app->basePath('resources/views/vendor/apidoc'),
23+
__DIR__ . '/../resources/views' => $this->app->basePath('resources/views/vendor/apidoc'),
2424
], 'apidoc-views');
2525

2626
$this->publishes([
27-
__DIR__.'/../config/apidoc.php' => $this->app->configPath('apidoc.php'),
27+
__DIR__ . '/../config/apidoc.php' => $this->app->configPath('apidoc.php'),
2828
], 'apidoc-config');
2929

30-
$this->mergeConfigFrom(__DIR__.'/../config/apidoc.php', 'apidoc');
30+
$this->mergeConfigFrom(__DIR__ . '/../config/apidoc.php', 'apidoc');
3131

3232
$this->bootRoutes();
3333

@@ -52,7 +52,7 @@ protected function bootRoutes()
5252
config('apidoc.laravel.autoload', false)
5353
) {
5454
$this->loadRoutesFrom(
55-
__DIR__.'/../routes/laravel.php'
55+
__DIR__ . '/../routes/laravel.php'
5656
);
5757
}
5858
}

src/Commands/GenerateDocumentation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private function processRoutes(Generator $generator, array $routes)
101101
$routePath = $generator->getUri($route);
102102

103103
if ($this->isClosureRoute($route->getAction())) {
104-
$this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).': Closure routes are not supported.');
104+
$this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . ': Closure routes are not supported.');
105105
continue;
106106
}
107107

@@ -112,20 +112,20 @@ private function processRoutes(Generator $generator, array $routes)
112112
}
113113

114114
if (! $this->doesControllerMethodExist($routeControllerAndMethod)) {
115-
$this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).': Controller method does not exist.');
115+
$this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . ': Controller method does not exist.');
116116
continue;
117117
}
118118

119119
if (! $this->isRouteVisibleForDocumentation($routeControllerAndMethod)) {
120-
$this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).': @hideFromAPIDocumentation was specified.');
120+
$this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . ': @hideFromAPIDocumentation was specified.');
121121
continue;
122122
}
123123

124124
try {
125125
$parsedRoutes[] = $generator->processRoute($route, $routeItem->getRules());
126126
$this->info(sprintf($messageFormat, 'Processed', $routeMethods, $routePath));
127127
} catch (\Exception $exception) {
128-
$this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).'- Exception '.get_class($exception).' encountered : '.$exception->getMessage());
128+
$this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . '- Exception ' . get_class($exception) . ' encountered : ' . $exception->getMessage());
129129
}
130130
}
131131

src/Commands/RebuildDocumentation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public function handle()
1616
{
1717
$sourceOutputPath = 'resources/docs/source';
1818
if (! is_dir($sourceOutputPath)) {
19-
$this->error('There is no existing documentation available at '.$sourceOutputPath.'.');
19+
$this->error('There is no existing documentation available at ' . $sourceOutputPath . '.');
2020

2121
return false;
2222
}
2323

24-
$this->info('Rebuilding API documentation from '.$sourceOutputPath.'/index.md');
24+
$this->info('Rebuilding API documentation from ' . $sourceOutputPath . '/index.md');
2525

2626
$writer = new Writer($this, new DocumentationConfig(config('apidoc')));
2727
$writer->writeHtmlDocs();

src/Extracting/Generator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function processRoute(Route $route, array $routeRules = [])
5858
$method = $controller->getMethod($methodName);
5959

6060
$parsedRoute = [
61-
'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
61+
'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
6262
'methods' => $this->getMethods($route),
6363
'uri' => $this->getUri($route),
6464
];
@@ -213,7 +213,9 @@ protected function cleanParams(array $params)
213213

214214
foreach ($params as $paramName => $details) {
215215
$this->generateConcreteSampleForArrayKeys(
216-
$paramName, $details['value'], $values
216+
$paramName,
217+
$details['value'],
218+
$values
217219
);
218220
}
219221

src/Extracting/ParamHelpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function generateDummyValue(string $type)
3333
return [];
3434
},
3535
'object' => function () {
36-
return new stdClass;
36+
return new stdClass();
3737
},
3838
];
3939

src/Extracting/RouteDocBlocker.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ protected static function cacheDocBlocks(Route $route, string $className, string
6363
private static function getRouteCacheId(Route $route, string $className, string $methodName): string
6464
{
6565
return $route->uri()
66-
.':'
67-
.implode(array_diff($route->methods(), ['HEAD']))
68-
.$className
69-
.$methodName;
66+
. ':'
67+
. implode(array_diff($route->methods(), ['HEAD']))
68+
. $className
69+
. $methodName;
7070
}
7171
}

src/Extracting/Strategies/Responses/ResponseCalls.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __invoke(Route $route, \ReflectionClass $controller, \Reflection
5252
],
5353
];
5454
} catch (\Exception $e) {
55-
echo 'Exception thrown during response call for ['.implode(',', $route->methods)."] {$route->uri}.\n";
55+
echo 'Exception thrown during response call for [' . implode(',', $route->methods) . "] {$route->uri}.\n";
5656
if (Flags::$shouldBeVerbose) {
5757
Utils::dumpException($e);
5858
} else {
@@ -366,7 +366,7 @@ protected function transformHeadersToServerVars(array $headers)
366366
foreach ($headers as $name => $value) {
367367
$name = strtr(strtoupper($name), '-', '_');
368368
if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
369-
$name = $prefix.$name;
369+
$name = $prefix . $name;
370370
}
371371
$server[$name] = $value;
372372
}

src/Extracting/Strategies/Responses/UseApiResourceTags.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function getApiResourceResponse(array $tags, Route $route)
9090
],
9191
];
9292
} catch (\Exception $e) {
93-
echo 'Exception thrown when fetching Eloquent API resource response for ['.implode(',', $route->methods)."] {$route->uri}.\n";
93+
echo 'Exception thrown when fetching Eloquent API resource response for [' . implode(',', $route->methods) . "] {$route->uri}.\n";
9494
if (Flags::$shouldBeVerbose) {
9595
Utils::dumpException($e);
9696
} else {
@@ -156,7 +156,7 @@ protected function instantiateApiResourceModel(string $type)
156156
echo "Eloquent model factory failed to instantiate {$type}; trying to fetch from database.\n";
157157
}
158158

159-
$instance = new $type;
159+
$instance = new $type();
160160
if ($instance instanceof \Illuminate\Database\Eloquent\Model) {
161161
try {
162162
// we can't use a factory but can try to get one from the database

src/Extracting/Strategies/Responses/UseResponseFileTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function getFileResponses(array $tags)
5858
$relativeFilePath = trim($result[2]);
5959
$filePath = storage_path($relativeFilePath);
6060
if (! file_exists($filePath)) {
61-
throw new \Exception('@responseFile '.$relativeFilePath.' does not exist');
61+
throw new \Exception('@responseFile ' . $relativeFilePath . ' does not exist');
6262
}
6363
$status = $result[1] ?: 200;
6464
$content = $result[2] ? file_get_contents($filePath, true) : '{}';

src/Extracting/Strategies/Responses/UseTransformerTags.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ protected function getTransformerResponse(array $tags, Route $route)
7272
$resource = (strtolower($transformerTag->getName()) == 'transformercollection')
7373
? new Collection(
7474
[$modelInstance, $this->instantiateTransformerModel($model)],
75-
new $transformer)
76-
: new Item($modelInstance, new $transformer);
75+
new $transformer()
76+
)
77+
: new Item($modelInstance, new $transformer());
7778

7879
$response = response($fractal->createData($resource)->toJson());
7980

@@ -84,7 +85,7 @@ protected function getTransformerResponse(array $tags, Route $route)
8485
],
8586
];
8687
} catch (Exception $e) {
87-
echo 'Exception thrown when fetching transformer response for ['.implode(',', $route->methods)."] {$route->uri}.\n";
88+
echo 'Exception thrown when fetching transformer response for [' . implode(',', $route->methods) . "] {$route->uri}.\n";
8889
if (Flags::$shouldBeVerbose) {
8990
Utils::dumpException($e);
9091
} else {
@@ -162,7 +163,7 @@ protected function instantiateTransformerModel(string $type)
162163
echo "Eloquent model factory failed to instantiate {$type}; trying to fetch from database.\n";
163164
}
164165

165-
$instance = new $type;
166+
$instance = new $type();
166167
if ($instance instanceof IlluminateModel) {
167168
try {
168169
// we can't use a factory but can try to get one from the database

0 commit comments

Comments
 (0)