Completed
Push — master ( 874c42...3f0650 )
by Ryan
02:09
created

GetLogoutPath   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 2
1
<?php namespace Anomaly\UsersModule\User\Command;
2
3
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
4
use Illuminate\Contracts\Bus\SelfHandling;
5
6
/**
7
 * Class GetLogoutPath
8
 *
9
 * @link          http://anomaly.is/streams-platform
10
 * @author        AnomalyLabs, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 * @package       Anomaly\UsersModule\User\Command
13
 */
14
class GetLogoutPath implements SelfHandling
15
{
16
17
    /**
18
     * The redirect URL/path.
19
     *
20
     * @var null|string
21
     */
22
    protected $redirect;
23
24
    /**
25
     * Create a new GetLogoutPath instance.
26
     *
27
     * @param null $redirect
28
     */
29
    public function __construct($redirect = null)
30
    {
31
        $this->redirect = $redirect;
32
    }
33
34
    /**
35
     * Handle the command.
36
     *
37
     * @param SettingRepositoryInterface $settings
38
     * @return string
39
     */
40
    public function handle(SettingRepositoryInterface $settings)
41
    {
42
        return $this->redirect ?: $settings->value('anomaly.module.users::logout_path', '/');
43
    }
44
}
45