Code Duplication    Length = 40-40 lines in 2 locations

src/Setting/Command/GetSetting.php 1 location

@@ 13-52 (lines=40) @@
10
 * @author        PyroCMS, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 */
13
class GetSetting
14
{
15
16
    /**
17
     * The setting key.
18
     *
19
     * @var string
20
     */
21
    protected $key;
22
23
    /**
24
     * The default value.
25
     *
26
     * @var mixed
27
     */
28
    protected $default;
29
30
    /**
31
     * Create a new GetSetting instance.
32
     *
33
     * @param      $key
34
     * @param null $default
35
     */
36
    public function __construct($key, $default = null)
37
    {
38
        $this->key     = $key;
39
        $this->default = $default;
40
    }
41
42
    /**
43
     * Handle the command.
44
     *
45
     * @param  SettingRepositoryInterface $settings
46
     * @return mixed
47
     */
48
    public function handle(SettingRepositoryInterface $settings)
49
    {
50
        return $settings->get($this->key, $this->default);
51
    }
52
}
53

src/Setting/Command/GetSettingValue.php 1 location

@@ 13-52 (lines=40) @@
10
 * @author        PyroCMS, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 */
13
class GetSettingValue
14
{
15
16
    /**
17
     * The setting key.
18
     *
19
     * @var string
20
     */
21
    protected $key;
22
23
    /**
24
     * The default value.
25
     *
26
     * @var mixed
27
     */
28
    protected $default;
29
30
    /**
31
     * Create a new GetSettingValue instance.
32
     *
33
     * @param      $key
34
     * @param null $default
35
     */
36
    public function __construct($key, $default = null)
37
    {
38
        $this->key     = $key;
39
        $this->default = $default;
40
    }
41
42
    /**
43
     * Handle the command.
44
     *
45
     * @param  SettingRepositoryInterface $settings
46
     * @return mixed
47
     */
48
    public function handle(SettingRepositoryInterface $settings)
49
    {
50
        return $settings->value($this->key, $this->default);
51
    }
52
}
53