Completed
Push — master ( c49cbc...039121 )
by Timur
02:32
created

CreateWorkerCommand::asDaemon()   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\Workers\Commands;
4
5
class CreateWorkerCommand extends WorkerCommand
6
{
7
    /**
8
     * Set connection name.
9
     *
10
     * @param string $connection
11
     *
12
     * @return static
13
     */
14
    public function usingConnection(string $connection)
15
    {
16
        return $this->attachPayload('connection', $connection);
17
    }
18
19
    /**
20
     * Set queue name.
21
     *
22
     * @param string $queue
23
     *
24
     * @return static
25
     */
26
    public function onQueue(string $queue)
27
    {
28
        return $this->attachPayload('queue', $queue);
29
    }
30
31
    /**
32
     * Set timeout.
33
     *
34
     * @param int $seconds
35
     *
36
     * @return static
37
     */
38
    public function withTimeout(int $seconds)
39
    {
40
        return $this->attachPayload('timeout', $seconds);
41
    }
42
43
    /**
44
     * Set sleep seconds.
45
     *
46
     * @param int $seconds
47
     *
48
     * @return static
49
     */
50
    public function sleepFor(int $seconds)
51
    {
52
        return $this->attachPayload('sleep', $seconds);
53
    }
54
55
    /**
56
     * Set max tries count.
57
     *
58
     * @param int $tries
59
     *
60
     * @return static
61
     */
62
    public function maxTries(int $tries)
63
    {
64
        return $this->attachPayload('tries', $tries);
65
    }
66
67
    /**
68
     * Indicates that worker should start as daemon.
69
     *
70
     * @return static
71
     */
72
    public function asDaemon()
73
    {
74
        return $this->attachPayload('daemon', true);
75
    }
76
}
77