DispatchingRule::getPriority()   A
last analyzed

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 0
1
<?php
2
namespace Workana\AsyncJobs\Dispatcher;
3
4
use Workana\AsyncJobs\Job;
5
6
/**
7
 * @author Carlos Frutos <[email protected]>
8
 */
9
abstract class DispatchingRule
10
{
11
    const PRIORITY_VERY_LOW = -10;
12
    const PRIORITY_LOW = -5;
13
    const PRIORITY_NORMAL = 0;
14
    const PRIORITY_MEDIUM = 5;
15
    const PRIORITY_HIGH = 10;
16
17
    /**
18
     * @var int
19
     */
20
    protected $priority = self::PRIORITY_NORMAL;
21
22
    /**
23
     * Decides in what queue a job should be dispatched
24
     *
25
     * @param Job $job
26
     *
27
     * @return string Queue name, or null if It doesn't decide
28
     */
29
    public abstract function __invoke(Job $job);
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
30
31
    /**
32
     * @return int
33
     */
34
    public function getPriority()
35
    {
36
        return $this->priority;
37
    }
38
}