Passed
Push — fix-same-id-model-one-token-4.... ( ffd135 )
by Samuel
04:54
created

MissingConfigException::providerGuard()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
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 1
    public static function providerGuard($provider)
25
    {
26 1
        $msg = 'Any guard found for provider '.$provider.' and driver passport';
27
28 1
        return new static($msg);
29
    }
30
31
    /**
32
     * @param Authenticatable $model
33
     * @return MissingConfigException
34
     */
35 3
    public static function provider(Authenticatable $model)
36
    {
37 3
        $message = 'Any provider found to '.get_class($model);
38
39 3
        return new static($message);
40
    }
41
}
42