GetPreference::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 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 Ryan Thompson
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