GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SwaggerProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 2
1
<?php
2
namespace PhpBoot\Docgen\Swagger;
3
4
use PhpBoot\Application;
5
use Symfony\Component\HttpFoundation\Response;
6
7
class SwaggerProvider
8
{
9
    /**
10
     * How to use
11
     *
12
     * SwaggerProvider::register($app, function(Swagger $swagger){
13
     *          $swagger->host = 'api.example.com',
14
     *          $swagger->info->description = '...';
15
     *          ...
16
     *      },
17
     *      '/docs')
18
     *
19
     * @param Application $app
20
     * @param string $prefix
21
     * @param callable $callback
22
     * @return void
23
     */
24
    static public function register(Application $app,
25
                                    callable $callback = null,
26
                                    $prefix='/docs')
27
    {
28
        $app->addRoute('GET', $prefix.'/swagger.json', function (Application $app)use($callback){
29
            $swagger = new Swagger();
30
            $swagger->appendControllers($app, $app->getControllers());
31
            if($callback){
32
                $callback($swagger);
33
            }
34
            return new Response($swagger->toJson());
35
        });
36
    }
37
}