Completed
Push — master ( 39d5b7...3411ce )
by Mike
14s
created

Dripper::getCheckIntervalAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php namespace GeneaLabs\LaravelCaffeine;
2
3
use Jenssegers\Model\Model;
4
5
class Dripper extends Model
6
{
7
    public function getHtmlAttribute() : string
8
    {
9
        $html = (string) view('genealabs-laravel-caffeine::script')
10
            ->with([
11
                'ageCheckInterval' => $this->ageCheckInterval,
1 ignored issue
show
Bug Best Practice introduced by
The property ageCheckInterval does not exist on GeneaLabs\LaravelCaffeine\Dripper. Since you implemented __get, consider adding a @property annotation.
Loading history...
12
                'ageThreshold' => $this->ageThreshold,
1 ignored issue
show
Bug Best Practice introduced by
The property ageThreshold does not exist on GeneaLabs\LaravelCaffeine\Dripper. Since you implemented __get, consider adding a @property annotation.
Loading history...
13
                'interval' => $this->interval,
1 ignored issue
show
Bug Best Practice introduced by
The property interval does not exist on GeneaLabs\LaravelCaffeine\Dripper. Since you implemented __get, consider adding a @property annotation.
Loading history...
14
                'url' => $this->url,
1 ignored issue
show
Bug Best Practice introduced by
The property url does not exist on GeneaLabs\LaravelCaffeine\Dripper. Since you implemented __get, consider adding a @property annotation.
Loading history...
15
            ]);
16
        return $html;
17
    }
18
19
    public function getAgeCheckIntervalAttribute() : int
20
    {
21
        return config(
22
            'genealabs-laravel-caffeine.outdatedDripCheckInterval',
23
            2000
24
        );
25
    }
26
27
    public function getAgeThresholdAttribute() : int
28
    {
29
        return (config('session.lifetime', 32) - 2) * 60000;
30
    }
31
32
    public function getIntervalAttribute() : string
33
    {
34
        return config(
35
            'genealabs-laravel-caffeine.dripInterval',
36
            300000
37
        );
38
    }
39
40
    public function getUrlAttribute() : string
41
    {
42
        return trim(config('genealabs-laravel-caffeine.domain', url('/')), '/')
43
            . '/'
44
            . trim(config(
45
                'genealabs-laravel-caffeine.route',
46
                'genealabs/laravel-caffeine/drip'
47
            ), '/');
48
    }
49
}
50