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

RonasIT / laravel-swagger / 3950499686

pending completion
3950499686

Pull #64

github

GitHub
Merge 3ceb03e20 into cf7bb3d1f
Pull Request #64: #20 :- limit response data

21 of 21 new or added lines in 2 files covered. (100.0%)

255 of 482 relevant lines covered (52.9%)

3.31 hits per line

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

91.67
/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
    protected $documentation;
15

16
    public function __construct()
17
    {
18
        $this->service = app(SwaggerService::class);
7✔
19
    }
20

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

25
        return response()->json($this->documentation);
2✔
26
    }
27

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

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

36
        return response('Forbidden.', 403);
1✔
37
    }
38

39
    public function getFile(Request $request, $file)
40
    {
41
        $filePath = __DIR__ . '/../../../resources/assets/swagger/' . $file;
2✔
42

43
        if (!file_exists($filePath)) {
2✔
44
            throw new NotFoundHttpException();
×
45
        }
46

47
        $content = file_get_contents($filePath);
2✔
48

49
        return response($content)->header('Content-Type', $request->getAcceptableContentTypes());
2✔
50
    }
51
}
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