Test Failed
Push — master ( d0ec41...3b9ce6 )
by Maximo
02:08
created

AclProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 28
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 23 1
1
<?php
0 ignored issues
show
Coding Style introduced by
End of line character is invalid; expected "\n" but found "\r\n"
Loading history...
2
3
namespace Gewaer\Providers;
4
5
use Phalcon\Di\ServiceProviderInterface;
6
use Phalcon\DiInterface;
7
use Gewaer\Acl\Manager as AclManager;
8
use Phalcon\Acl;
9
10
class AclProvider implements ServiceProviderInterface
11
{
12
    /**
13
     * @param DiInterface $container
14
     */
15 11
    public function register(DiInterface $container)
16
    {
17 11
        $config = $container->getShared('config');
0 ignored issues
show
Unused Code introduced by
The assignment to $config is dead and can be removed.
Loading history...
18 11
        $db = $container->getShared('db');
19
20 11
        $container->setShared(
21 11
            'acl',
22
            function () use ($db) {
23 7
                $acl = new AclManager(
24
                    [
25 7
                        'db' => $db,
26 7
                        'roles' => 'roles',
27 7
                        'rolesInherits' => 'roles_inherits',
28 7
                        'resources' => 'resources',
29 7
                        'resourcesAccesses' => 'resources_accesses',
30 7
                        'accessList' => 'access_list'
31
                    ]
32
                );
33
34
                //default behavior
35 7
                $acl->setDefaultAction(Acl::ALLOW);
36
37 7
                return $acl;
38 11
            }
39
        );
40 11
    }
41
}
42