Completed
Push — master ( 80f23e...86e96b )
by Ryan
02:23
created

GetSetting::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php namespace Anomaly\SettingsModule\Setting\Command;
2
3
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
4
use Illuminate\Contracts\Bus\SelfHandling;
5
6
/**
7
 * Class GetSetting
8
 *
9
 * @link          http://anomaly.is/streams-platform
10
 * @author        AnomalyLabs, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 * @package       Anomaly\SettingsModule\Setting\Plugin\Command
13
 */
14
class GetSetting implements SelfHandling
15
{
16
17
    /**
18
     * The setting key.
19
     *
20
     * @var string
21
     */
22
    protected $key;
23
24
    /**
25
     * Create a new GetSetting instance.
26
     *
27
     * @param      $key
28
     */
29
    public function __construct($key)
30
    {
31
        $this->key = $key;
32
    }
33
34
    /**
35
     * Handle the command.
36
     *
37
     * @param SettingRepositoryInterface $settings
38
     * @return \Anomaly\SettingsModule\Setting\Contract\SettingInterface|null
39
     */
40
    public function handle(SettingRepositoryInterface $settings)
41
    {
42
        return $settings->get($this->key);
43
    }
44
}
45