Completed
Push — master ( e97c13...1021f1 )
by Timur
02:50
created

Worker   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 62
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A resourceType() 0 4 1
A resourcePath() 0 4 1
A connection() 0 4 1
A timeout() 0 4 1
A maxTries() 0 4 1
A daemon() 0 4 1
1
<?php
2
3
namespace Laravel\Forge\Sites;
4
5
class Worker extends SiteResource
6
{
7
    /**
8
     * Resource type.
9
     *
10
     * @return string
11
     */
12
    public static function resourceType()
13
    {
14
        return 'worker';
15
    }
16
17
    /**
18
     * Resource path (relative to Server URL).
19
     *
20
     * @return string
21
     */
22
    public function resourcePath()
23
    {
24
        return 'sites/'.$this->getSite()->id().'/workers';
25
    }
26
27
    /**
28
     * Queue connection.
29
     *
30
     * @return string|null
31
     */
32
    public function connection()
33
    {
34
        return $this->getData('connection');
35
    }
36
37
    /**
38
     * Worker timeout.
39
     *
40
     * @return int
41
     */
42
    public function timeout(): int
43
    {
44
        return intval($this->getData('timeout'));
45
    }
46
47
    /**
48
     * Max tries count.
49
     *
50
     * @return int
51
     */
52
    public function maxTries(): int
53
    {
54
        return intval($this->getData('tries'));
55
    }
56
57
    /**
58
     * Determines if worker is daemon.
59
     *
60
     * @return bool
61
     */
62
    public function daemon(): bool
63
    {
64
        return intval($this->getData('daemon')) === 1;
65
    }
66
}
67