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

Worker::daemon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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