• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RonasIT / laravel-swagger / 3929037431

pending completion
3929037431

push

github

dpankratov
tests: fix test fixtures;

236 of 464 relevant lines covered (50.86%)

2.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.33
/src/Http/Controllers/AutoDocController.php
1
<?php
2

3
namespace RonasIT\Support\AutoDoc\Http\Controllers;
4

5
use Illuminate\Http\Request;
6
use Illuminate\Routing\Controller as BaseController;
7
use RonasIT\Support\AutoDoc\Services\SwaggerService;
8
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9

10
class AutoDocController extends BaseController
11
{
12
    protected $service;
13

14
    public function __construct()
15
    {
16
        $this->service = app(SwaggerService::class);
5✔
17
    }
18

19
    public function documentation()
20
    {
21
        $documentation = $this->service->getDocFileContent();
2✔
22

23
        return response()->json($documentation);
2✔
24
    }
25

26
    public function index()
27
    {
28
        $currentEnvironment = config('app.env');
3✔
29

30
        if (in_array($currentEnvironment, config('auto-doc.display_environments'))) {
3✔
31
            return view('auto-doc::documentation');
2✔
32
        }
33

34
        return response('Forbidden.', 403);
1✔
35
    }
36

37
    public function getFile(Request $request, $file)
38
    {
39
        $filePath = base_path("vendor/ronasit/laravel-swagger/src/Views/swagger/{$file}");
×
40

41
        if (!file_exists($filePath)) {
×
42
            throw new NotFoundHttpException();
×
43
        }
44

45
        $content = file_get_contents($filePath);
×
46

47
        return response($content)->header('Content-Type', $request->getAcceptableContentTypes());
×
48
    }
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc