Config::modify()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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\Acl;
21
22
use Aura\Di\Container;
23
use Aura\Di\ContainerConfig;
24
25
use Zend\Permissions\Acl\Acl;
26
27
/**
28
 * Config
29
 *
30
 * @category Config
31
 * @package  Jnjxp\Cheka
32
 * @author   Jake Johns <[email protected]>
33
 * @license  http://jnj.mit-license.org/2016 MIT License
34
 * @link     https://github.com/jnjxp/jnjxp.cheka
35
 *
36
 * @see ContainerConfig
37
 */
38
class Config extends ContainerConfig
39
{
40
41
    /**
42
     * Modify container
43
     *
44
     * @param Container $di DESCRIPTION
45
     *
46
     * @return mixed
47
     *
48
     * @access public
49
     *
50
     * @SuppressWarnings(PHPMD.ShortVariable)
51
     */
52 4
    public function modify(Container $di)
53
    {
54 4
        $this->init($di->get('jnjxp/cheka:acl'));
0 ignored issues
show
Unused Code introduced by
The call to the method Jnjxp\Cheka\Acl\Config::init() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
55 4
    }
56
57
    /**
58
     * Init
59
     *
60
     * @param Acl $acl DESCRIPTION
61
     *
62
     * @return mixed
63
     *
64
     * @access protected
65
     */
66 4
    protected function init(Acl $acl)
67
    {
68
        $acl;
69 4
    }
70
}
71