Completed
Push — master ( b4c13e...3cc9b0 )
by Timur
03:04
created

JobsManager   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 schedule() 0 4 1
A create() 0 4 1
A list() 0 4 1
A get() 0 4 1
1
<?php
2
3
namespace Laravel\Forge\Jobs;
4
5
use Laravel\Forge\Jobs\Commands\GetJobCommand;
6
use Laravel\Forge\Jobs\Commands\ListJobsCommand;
7
use Laravel\Forge\Jobs\Commands\CreateJobCommand;
8
9
class JobsManager
10
{
11
    /**
12
     * Initialize new create job command.
13
     *
14
     * @param string $command
15
     *
16
     * @return \Laravel\Forge\Jobs\Commands\CreateJobCommand
17
     */
18
    public function schedule(string $command)
19
    {
20
        return (new CreateJobCommand())->schedule($command);
21
    }
22
23
    /**
24
     * Alias for "schedule" method.
25
     *
26
     * @param string $command
27
     *
28
     * @return \Laravel\Forge\Jobs\Commands\CreateJobCommand
29
     */
30
    public function create(string $command)
31
    {
32
        return $this->schedule($command);
33
    }
34
35
    /**
36
     * Initialize new list jobs command.
37
     *
38
     * @return \Laravel\Forge\Jobs\Commands\ListJobsCommand
39
     */
40
    public function list()
41
    {
42
        return new ListJobsCommand();
43
    }
44
45
    /**
46
     * Initialize new get job command.
47
     *
48
     * @param int $jobId
49
     *
50
     * @return \Laravel\Forge\Jobs\Commands\GetJobCommand
51
     */
52
    public function get(int $jobId)
53
    {
54
        return (new GetJobCommand())->setResourceId($jobId);
55
    }
56
}
57