Dripper   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 7
Bugs 0 Features 0
Metric Value
wmc 5
eloc 20
c 7
b 0
f 0
dl 0
loc 42
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getAgeCheckIntervalAttribute() 0 5 1
A getAgeThresholdAttribute() 0 3 1
A getIntervalAttribute() 0 5 1
A getHtmlAttribute() 0 8 1
A getUrlAttribute() 0 8 1
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
        return (string) view('genealabs-laravel-caffeine::script')
10
            ->with([
11
                'ageCheckInterval' => $this->ageCheckInterval,
12
                'ageThreshold' => $this->ageThreshold,
13
                'interval' => $this->interval,
14
                'url' => $this->url,
15
            ]);
16
    }
17
18
    public function getAgeCheckIntervalAttribute() : int
19
    {
20
        return config(
21
            'genealabs-laravel-caffeine.outdated-drip-check-interval',
22
            2000
23
        );
24
    }
25
26
    public function getAgeThresholdAttribute() : int
27
    {
28
        return (config('session.lifetime', 32) - 2) * 60000;
29
    }
30
31
    public function getIntervalAttribute() : string
32
    {
33
        return config(
34
            'genealabs-laravel-caffeine.drip-interval',
35
            300000
36
        );
37
    }
38
39
    public function getUrlAttribute() : string
40
    {
41
        return trim(config('genealabs-laravel-caffeine.domain', url('/')), '/')
42
            . '/'
43
            . trim(config(
44
                'genealabs-laravel-caffeine.route',
45
                'genealabs/laravel-caffeine/drip'
46
            ), '/');
47
    }
48
}
49