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.
Completed
Push — master ( 57c6bc...e6f823 )
by Jason
02:08
created

ResourcefulServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 27
rs 10
c 1
b 0
f 0
ccs 10
cts 12
cp 0.8333

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 12 1
A register() 0 9 1
1
<?php
2
3
namespace JDesrosiers\Resourceful\ResourcefulServiceProvider;
4
5
use Pimple\Container;
6
use Pimple\ServiceProviderInterface;
7
use Silex\Api\BootableProviderInterface;
8
use Silex\Application;
9
use Twig_Loader_Filesystem;
10
11
class ResourcefulServiceProvider implements ServiceProviderInterface, BootableProviderInterface
12
{
13
    const ERROR_HANDLER_PRIORITY = 0;
14
15 8
    public function boot(Application $app)
16
    {
17
        // Error Handling
18 8
        $schema = $app["url_generator"]->generate("schema", array("type" => "error"));
19
20 8
        $app["twig.loader"]->addLoader(new Twig_Loader_Filesystem(__DIR__ . "/templates"));
21 8
        $app->before(new AddSchema($schema, "error"));
22
23
        $app->error(function (\Exception $e, $code) use ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $e is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $code is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24 2
            $app["json-schema.describedBy"] = $app["url_generator"]->generate("schema", array("type" => "error"));
25 8
        }, self::ERROR_HANDLER_PRIORITY);
26 8
    }
27
28 8
    public function register(Container $app)
29
    {
30 8
        $app["resources_factory"] = $app->protect(new ResourcesFactory($app));
0 ignored issues
show
Compatibility introduced by
$app of type object<Pimple\Container> is not a sub-type of object<Silex\Application>. It seems like you assume a child class of the class Pimple\Container to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
31
32
        // CreateResourceController
33
        $app["uniqid"] = function () {
34
            return uniqid();
35
        };
36 8
    }
37
}
38