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

JobsManager::create()   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\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