GetPreference   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 32
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 1
1
<?php namespace Anomaly\PreferencesModule\Preference\Command;
2
3
use Anomaly\PreferencesModule\Preference\Contract\PreferenceRepositoryInterface;
4
5
6
/**
7
 * Class GetPreference
8
 *
9
 * @link          http://pyrocms.com/
10
 * @author        PyroCMS, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 */
13
class GetPreference
14
{
15
16
    /**
17
     * The preference key.
18
     *
19
     * @var string
20
     */
21
    protected $key;
22
23
    /**
24
     * Create a new GetPreference instance.
25
     *
26
     * @param      $key
27
     * @param null $default
0 ignored issues
show
Bug introduced by
There is no parameter named $default. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
28
     */
29
    public function __construct($key)
30
    {
31
        $this->key = $key;
32
    }
33
34
    /**
35
     * Handle the command.
36
     *
37
     * @param  PreferenceRepositoryInterface $preferences
38
     * @return mixed
39
     */
40
    public function handle(PreferenceRepositoryInterface $preferences)
41
    {
42
        return $preferences->get($this->key);
43
    }
44
}
45