Completed
Pull Request — 4.0 (#72)
by Samuel
07:40 queued 04:55
created

MissingConfigException::providerGuard()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SMartins\PassportMultiauth\Exceptions;
4
5
use Exception;
6
use Illuminate\Contracts\Auth\Authenticatable;
7
8
class MissingConfigException extends Exception
9
{
10
    /**
11
     * @param string $message
12
     */
13 4
    public function __construct($message)
14
    {
15 4
        $message .= '. Please, check your config/auth.php file.';
16
17 4
        parent::__construct($message, 0, null);
18 4
    }
19
20
    /**
21
     * @param $provider
22
     * @return MissingConfigException
23
     */
24
    public static function providerGuard($provider)
25 1
    {
26
        $msg = 'Any guard found for provider '.$provider.' and driver passport';
27 1
28
        return new static($msg);
29 1
    }
30
31
    /**
32
     * @param Authenticatable $model
33
     * @return MissingConfigException
34
     */
35
    public static function provider(Authenticatable $model)
36 3
    {
37
        $message = 'Any provider found to '.get_class($model);
38 3
39
        return new static($message);
40 3
    }
41
}
42