Config   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 42
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A define() 0 10 1
A modify() 0 6 1
1
<?php
2
/**
3
 * Cheka - Authorization
4
 *
5
 * PHP version 5
6
 *
7
 * Copyright (C) 2016 Jake Johns
8
 *
9
 * This software may be modified and distributed under the terms
10
 * of the MIT license.  See the LICENSE file for details.
11
 *
12
 * @category  Config
13
 * @package   Jnjxp\Cheka
14
 * @author    Jake Johns <[email protected]>
15
 * @copyright 2016 Jake Johns
16
 * @license   http://jnj.mit-license.org/2016 MIT License
17
 * @link      https://github.com/jnjxp/jnjxp.cheka
18
 */
19
20
namespace Jnjxp\Cheka;
21
22
use Aura\Di\Container;
23
use Aura\Di\ContainerConfig;
24
25
use Aura\Router\RouterContainer;
26
27
use Zend\Permissions\Acl\Acl;
28
29
/**
30
 * Config
31
 *
32
 * @category Config
33
 * @package  Jnjxp\Cheka
34
 * @author   Jake Johns <[email protected]>
35
 * @license  http://jnj.mit-license.org/2016 MIT License
36
 * @link     https://github.com/jnjxp/jnjxp.cheka
37
 *
38
 * @see ContainerConfig
39
 */
40
class Config extends ContainerConfig
41
{
42
    /**
43
     * Define
44
     *
45
     * @param Container $di Aura\Di Container
46
     *
47
     * @return void
48
     *
49
     * @access public
50
     *
51
     * @SuppressWarnings(PHPMD.ShortVariable)
52
     */
53 4
    public function define(Container $di)
54
    {
55 4
        $di->setters[RouterContainer::class]['setRouteFactory'] = $di->newFactory(
56
            Route\RadarRoute::class
57 4
        );
58
59 4
        $di->set('jnjxp/cheka:acl', $di->lazyNew(Acl::class));
60
61 4
        $di->params[AuthorizedRule::class]['acl'] = $di->lazyGet('jnjxp/cheka:acl');
62 4
    }
63
64
    /**
65
     * Modify container
66
     *
67
     * @param Container $di DESCRIPTION
68
     *
69
     * @return mixed
70
     *
71
     * @access public
72
     *
73
     * @SuppressWarnings(PHPMD.ShortVariable)
74
     */
75 4
    public function modify(Container $di)
76
    {
77 4
        $di->get('radar/adr:adr')
78 4
            ->rules()
79 4
            ->append($di->newInstance(AuthorizedRule::class));
80 4
    }
81
}
82