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

WorkersManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 48
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A start() 0 4 1
A create() 0 4 1
A get() 0 4 1
A list() 0 4 1
1
<?php
2
3
namespace Laravel\Forge\Sites;
4
5
use Laravel\Forge\Sites\Commands\Workers\GetWorkerCommand;
6
use Laravel\Forge\Sites\Commands\Workers\ListWorkersCommand;
7
use Laravel\Forge\Sites\Commands\Workers\CreateWorkerCommand;
8
9
class WorkersManager
10
{
11
    /**
12
     * Initialize new create worker command.
13
     *
14
     * @param string $connection
15
     *
16
     * @return \Laravel\Forge\Sites\Commands\Workers\CreateWorkerCommand
17
     */
18
    public function start(string $connection)
19
    {
20
        return (new CreateWorkerCommand())->usingConnection($connection);
21
    }
22
23
    /**
24
     * Alias for "start" method.
25
     *
26
     * @param string $connection
27
     *
28
     * @return \Laravel\Forge\Sites\Commands\Workers\CreateWorkerCommand
29
     */
30
    public function create(string $connection)
31
    {
32
        return $this->start($connection);
33
    }
34
35
    /**
36
     * Initialize new get worker command.
37
     *
38
     * @param int $workerId
39
     *
40
     * @return \Laravel\Forge\Sites\Commands\Workers\GetWorkerCommand
41
     */
42
    public function get(int $workerId)
43
    {
44
        return (new GetWorkerCommand())->setSiteResourceId($workerId);
45
    }
46
47
    /**
48
     * Initialize new list workers command.
49
     *
50
     * @return \Laravel\Forge\Sites\Commands\Workers\ListWorkersCommand
51
     */
52
    public function list()
53
    {
54
        return new ListWorkersCommand();
55
    }
56
}
57