Completed
Push — master ( 94f126...440cd2 )
by Saurabh
02:17 queued 45s
created

Signere   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 35
ccs 5
cts 5
cp 1
rs 10
wmc 3
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A check() 0 6 2
A auth() 0 6 1
1
<?php
2
3
namespace Sausin\Signere;
4
5
use Closure;
6
7
class Signere
8
{
9
    /**
10
     * The callback that should be used to authenticate the package users.
11
     *
12
     * @var \Closure
13
     */
14
    public static $authUsing;
15
16
    /**
17
     * Determine if the given request can access the paths.
18
     *
19
     * @param  \Illuminate\Http\Request  $request
20
     * @return bool
21
     */
22
    public static function check($request)
23
    {
24 44
        return (static::$authUsing ?: function () {
25
            return app()->environment('local');
26 44
        })($request);
27
    }
28
29
    /**
30
     * Set the callback that should be used to authenticate package users.
31
     *
32
     * @param  \Closure  $callback
33
     * @return static
34
     */
35 44
    public static function auth(Closure $callback)
36
    {
37 44
        static::$authUsing = $callback;
38
39 44
        return new static;
40
    }
41
}
42