Skip to content

Commit

Permalink
style: correct code style.
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Lapkovsky committed Dec 13, 2023
1 parent ec7b5de commit ecafd32
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 167 deletions.
2 changes: 1 addition & 1 deletion src/AutoDocServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class AutoDocServiceProvider extends ServiceProvider
{
public function boot()
public function boot(): void
{
$this->mergeConfigFrom(__DIR__ . '/../config/auto-doc.php', 'auto-doc');

Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/BaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

abstract class BaseDriver implements SwaggerDriverInterface
{
protected $tempFilePath;
protected string $tempFilePath;

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/LocalDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class LocalDriver extends BaseDriver
{
protected $prodFilePath;
protected string $prodFilePath;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Drivers/RemoteDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

class RemoteDriver extends BaseDriver
{
protected $key;
protected $remoteUrl;
protected string $key;
protected string $remoteUrl;

public function __construct()
{
Expand Down
5 changes: 3 additions & 2 deletions src/Drivers/StorageDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
namespace RonasIT\Support\AutoDoc\Drivers;

use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Support\Facades\Storage;
use RonasIT\Support\AutoDoc\Exceptions\MissedProductionFilePathException;

class StorageDriver extends BaseDriver
{
protected $disk;
protected $prodFilePath;
protected Filesystem $disk;
protected string $prodFilePath;

public function __construct()
{
Expand Down
13 changes: 8 additions & 5 deletions src/Http/Controllers/AutoDocController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,33 @@

namespace RonasIT\Support\AutoDoc\Http\Controllers;

use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller as BaseController;
use RonasIT\Support\AutoDoc\Services\SwaggerService;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class AutoDocController extends BaseController
{
protected $service;
protected $documentationViewer;
protected SwaggerService $service;
protected string $documentationViewer;

public function __construct()
{
$this->service = app(SwaggerService::class);
$this->documentationViewer = config('auto-doc.documentation_viewer');
}

public function documentation()
public function documentation(): JsonResponse
{
$documentation = $this->service->getDocFileContent();

return response()->json($documentation);
}

public function index()
public function index(): View|Response
{
$currentEnvironment = config('app.env');

Expand All @@ -36,7 +39,7 @@ public function index()
return response('Forbidden.', 403);
}

public function getFile(Request $request, $file)
public function getFile(Request $request, $file): Response
{
$filePath = __DIR__ . "/../../../resources/assets/{$this->documentationViewer}/" . $file;

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/AutoDocMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function handle($request, Closure $next)
{
$response = $next($request);

if ((config('app.env') == 'testing') && !self::$skipped && !empty($request->route())) {
if ((config('app.env') === 'testing') && !self::$skipped && !empty($request->route())) {
app(SwaggerService::class)->addData($request, $response);
}

Expand Down
8 changes: 3 additions & 5 deletions src/Interfaces/SwaggerDriverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@ interface SwaggerDriverInterface
{
/**
* Save temporary data
*
* @param array $data
*/
public function saveTmpData($data);
public function saveTmpData(array $data): void;

/**
* Get temporary data
*/
public function getTmpData();
public function getTmpData(): void;

/**
* Save production data
*/
public function saveData();
public function saveData(): void;

/**
* Get production documentation
Expand Down
Loading

0 comments on commit ecafd32

Please sign in to comment.