ZendAclLumenServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 52
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A register() 0 16 2
A provides() 0 4 1
1
<?php
2
namespace Spekkionu\ZendAcl;
3
4
use Illuminate\Support\ServiceProvider;
5
use Laminas\Permissions\Acl\Acl;
6
use Illuminate\Contracts\Foundation\Application;
7
8
class ZendAclLumenServiceProvider extends ServiceProvider
9
{
10
11
    /**
12
     * Indicates if loading of the provider is deferred.
13
     *
14
     * @var bool
15
     */
16
    protected $defer = false;
17
18
    /**
19
     * Bootstrap the application events.
20
     *
21
     * @return void
22
     */
23
    public function boot()
24
    {
25
        $this->loadViewsFrom(dirname(dirname(__DIR__)).'/views', 'zendacl');
26
    }
27
28
    /**
29
     * Register the service provider.
30
     *
31
     * @return void
32
     */
33
    public function register()
34
    {
35
        $this->app->configure('zendacl');
0 ignored issues
show
Bug introduced by
The method configure() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean registerConfiguredProviders()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
36
37
        $this->app->singleton(function (Application $app) {
0 ignored issues
show
Documentation introduced by
function (\Illuminate\Co... } return $acl; } is of type object<Closure>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
            $acl = new Acl;
39
            if (file_exists(base_path('app/Http/acl.php'))) {
40
                include base_path('app/Http/acl.php');
41
            }
42
            return $acl;
43
        });
44
45
        $this->app->singleton('Laminas\Permissions\Acl\Acl', function (Application $app) {
46
            return $app->make('acl');
47
        });
48
    }
49
50
    /**
51
     * Get the services provided by the provider.
52
     *
53
     * @return array
54
     */
55
    public function provides()
56
    {
57
        return array('acl', 'Laminas\Permissions\Acl\Acl');
58
    }
59
}
60