JobTimingManager   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 86.67%

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 50
ccs 13
cts 15
cp 0.8667
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A recordTiming() 0 6 2
A getJobTimingClass() 0 3 1
A pruneJobTimings() 0 3 1
A performRecording() 0 2 1
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
Unused Code introduced by
The parameter $olderThan is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

26
    public function pruneJobTimings(/** @scrutinizer ignore-unused */ \DateTime $olderThan)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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)
0 ignored issues
show
Unused Code introduced by
The parameter $status is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
    protected function performRecording(/** @scrutinizer ignore-unused */ $status, \DateTime $dateTime = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $dateTime is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
    protected function performRecording($status, /** @scrutinizer ignore-unused */ \DateTime $dateTime = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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