Test Failed
Push — master ( 4cf4fc...5851fa )
by Maximo
02:07
created

AclProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 1
dl 0
loc 23
ccs 14
cts 14
cp 1
crap 1
rs 9.7998
c 0
b 0
f 0
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