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

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