MissingConfigException::provider()   A
last analyzed

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 Authenticatable $model
22
     * @param string $driver
23
     * @return MissingConfigException
24
     */
25 1
    public static function guard(Authenticatable $model, $driver = 'passport')
26
    {
27 1
        $message = 'Any guard with driver "'.$driver.'" found to '.get_class($model);
28
29 1
        return new static($message);
30
    }
31
32
    /**
33
     * @param Authenticatable $model
34
     * @return MissingConfigException
35
     */
36 3
    public static function provider(Authenticatable $model)
37
    {
38 3
        $message = 'Any provider found to '.get_class($model);
39
40 3
        return new static($message);
41
    }
42
}
43