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

GetLogoutPath::__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\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