1 | <?php |
||
2 | |||
3 | namespace Dtc\QueueBundle\Manager; |
||
4 | |||
5 | use Dtc\QueueBundle\Exception\UnsupportedException; |
||
6 | |||
7 | class JobTimingManager |
||
8 | { |
||
9 | /** @var string */ |
||
10 | protected $jobTimingClass; |
||
11 | |||
12 | /** @var bool */ |
||
13 | protected $recordTimings; |
||
14 | |||
15 | 38 | public function __construct($jobTimingClass, $recordTimings) |
|
16 | { |
||
17 | 38 | $this->jobTimingClass = $jobTimingClass; |
|
18 | 38 | $this->recordTimings = $recordTimings; |
|
19 | 38 | } |
|
20 | |||
21 | /** |
||
22 | * @throws UnsupportedException |
||
23 | * |
||
24 | * @return int Number of archived runs pruned |
||
25 | */ |
||
26 | 1 | public function pruneJobTimings(\DateTime $olderThan) |
|
0 ignored issues
–
show
|
|||
27 | { |
||
28 | 1 | throw new UnsupportedException('not supported'); |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * Subclasses should overrride this function instead of recordTiming. |
||
33 | * |
||
34 | * @param $status |
||
35 | */ |
||
36 | protected function performRecording($status, \DateTime $dateTime = null) |
||
37 | { |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param $status |
||
42 | */ |
||
43 | 97 | public function recordTiming($status, \DateTime $dateTime = null) |
|
44 | { |
||
45 | 97 | if (!$this->recordTimings) { |
|
46 | 53 | return; |
|
47 | } |
||
48 | 44 | $this->performRecording($status, $dateTime); |
|
49 | 44 | } |
|
50 | |||
51 | /** |
||
52 | * @return string |
||
53 | */ |
||
54 | 1 | public function getJobTimingClass() |
|
55 | { |
||
56 | 1 | return $this->jobTimingClass; |
|
57 | } |
||
58 | } |
||
59 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.