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

GetPreference   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
lcom 1
cbo 1
dl 0
loc 32
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
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