Test Setup Failed
Push — master ( 21f1bb...1dec6d )
by Php Easy Api
04:35
created

JobAbstract   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 12
dl 0
loc 44
rs 10
c 1
b 1
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A jobProcessor() 0 12 4
1
<?php
2
3
namespace Resta\Worker;
4
5
use Resta\Support\Process;
6
use Resta\Foundation\ApplicationProvider;
7
use Resta\Contracts\ApplicationContracts;
8
use Resta\Contracts\WorkerManagerContracts;
9
10
class JobAbstract extends ApplicationProvider
11
{
12
    /**
13
     * @var null|object
14
     */
15
    protected $worker;
16
17
    /**
18
     * @var Process
19
     */
20
    protected $process;
21
22
    /**
23
     * DefaultJob constructor.
24
     *
25
     * @param ApplicationContracts $app
26
     * @param WorkerManagerContracts $worker
27
     */
28
    public function __construct(ApplicationContracts $app,WorkerManagerContracts $worker)
29
    {
30
        parent::__construct($app);
31
32
        $this->worker = $worker;
33
34
        $this->process = new Process();
35
    }
36
37
    /**
38
     * job processor
39
     *
40
     * @return mixed|void
41
     */
42
    public function jobProcessor()
43
    {
44
        if($this->app->get('WORKER_START')===true){
45
            return 'start';
46
        }
47
48
        if($this->app->get('WORKER_STOP')===true){
49
            return 'stop';
50
        }
51
52
        if($this->app->get('WORKER_STATUS')===true){
53
            return 'status';
54
        }
55
    }
56
57
}