Completed
Push — master ( d58cf2...34418d )
by Ryan
03:13
created

GetPreference::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
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
use Illuminate\Contracts\Bus\SelfHandling;
5
6
/**
7
 * Class GetPreference
8
 *
9
 * @link          http://pyrocms.com/
10
 * @author        PyroCMS, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 * @package       Anomaly\PreferencesModule\Preference\Command
13
 */
14
class GetPreference implements SelfHandling
15
{
16
17
    /**
18
     * The preference key.
19
     *
20
     * @var string
21
     */
22
    protected $key;
23
24
    /**
25
     * Create a new GetPreference instance.
26
     *
27
     * @param      $key
28
     * @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...
29
     */
30
    public function __construct($key)
31
    {
32
        $this->key = $key;
33
    }
34
35
    /**
36
     * Handle the command.
37
     *
38
     * @param PreferenceRepositoryInterface $preferences
39
     * @return mixed
40
     */
41
    public function handle(PreferenceRepositoryInterface $preferences)
42
    {
43
        return $preferences->get($this->key);
44
    }
45
}
46