CompletedSample::getFinishedAt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Created by IntelliJ IDEA.
4
 * User: gerk
5
 * Date: 26.01.17
6
 * Time: 12:25
7
 */
8
9
namespace PeekAndPoke\Component\Slumber\FrameworkIntegration\StorageProfiler;
10
11
/**
12
 * @author Karsten J. Gerber <[email protected]>
13
 */
14 View Code Duplication
class CompletedSample
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /** @var string */
17
    private $name;
18
    /** @var float */
19
    private $startedAt;
20
    /** @var float */
21
    private $finishedAt;
22
    /** @var array */
23
    private $data;
24
25
    /**
26
     * CompletedSample constructor.
27
     *
28
     * @param RunningSample $sample
29
     * @param float|null    $finishedAt
30
     */
31
    public function __construct(RunningSample $sample, $finishedAt = null)
32
    {
33
        $this->name       = $sample->getName();
34
        $this->startedAt  = $sample->getStartedAt();
35
        $this->finishedAt = $finishedAt ?: microtime(true);
36
        $this->data       = $sample->getData();
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getName()
43
    {
44
        return $this->name;
45
    }
46
47
    /**
48
     * @return float
49
     */
50
    public function getStartedAt()
51
    {
52
        return $this->startedAt;
53
    }
54
55
    /**
56
     * @return float
57
     */
58
    public function getFinishedAt()
59
    {
60
        return $this->finishedAt;
61
    }
62
63
    /**
64
     * @return array
65
     */
66
    public function getData()
67
    {
68
        return $this->data;
69
    }
70
}
71