Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
Job | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
create | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
command | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
exec | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@nolainteractive.com> |
7 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Queue\Process; |
15 | |
16 | /** |
17 | * Job class |
18 | * |
19 | * @category Pop |
20 | * @package Pop\Queue |
21 | * @author Nick Sagona, III <dev@nolainteractive.com> |
22 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
23 | * @license http://www.popphp.org/license New BSD License |
24 | * @version 2.0.0 |
25 | */ |
26 | class Job extends AbstractJob |
27 | { |
28 | |
29 | /** |
30 | * Create job |
31 | * |
32 | * @param mixed $callable |
33 | * @param mixed $params |
34 | * @param ?string $id |
35 | * @return Job |
36 | */ |
37 | public static function create(mixed $callable = null, mixed $params = null, ?string $id = null): Job |
38 | { |
39 | return new self($callable, $params, $id); |
40 | } |
41 | |
42 | /** |
43 | * Create a job object with an application command |
44 | * |
45 | * @param string $command |
46 | * @param ?string $id |
47 | * @return static |
48 | */ |
49 | public static function command(string $command, ?string $id = null): static |
50 | { |
51 | return (new static(null, null, $id))->setCommand($command); |
52 | } |
53 | |
54 | /** |
55 | * Create a job object with a CLI executable command |
56 | * |
57 | * @param string $command |
58 | * @param ?string $id |
59 | * @return static |
60 | */ |
61 | public static function exec(string $command, ?string $id = null): static |
62 | { |
63 | return (new static(null, null, $id))->setExec($command); |
64 | } |
65 | |
66 | } |