Completed
Push — master ( 365164...87d4f7 )
by Saurabh
08:29 queued 30s
created

Signere::check()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2.1481

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
ccs 2
cts 3
cp 0.6667
crap 2.1481
rs 9.4285
c 1
b 0
f 0
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