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...
18
{
19
/**
20
* @var \DateTimeInterface
21
*/
22
private $start;
23
24
/**
25
* @var \DateTimeInterface
26
*/
27
private $end;
28
29
/**
30
* @var int
31
*/
32
private $count;
33
34
/**
35
* @param \DateTimeInterface $start
36
* @param \DateTimeInterface $end
37
* @param int $count
38
*/
39
private function __construct(\DateTimeInterface $start, \DateTimeInterface $end, int $count)
40
{
41
$this->start = $start;
42
$this->end = $end;
43
$this->count = $count;
44
}
45
46
/**
47
* @param array $data
48
*
49
* @return Total
50
*/
51
public static function createFromArray(array $data): Total
52
{
53
return new self(new \DateTimeImmutable($data['start']), new \DateTimeImmutable($data['end']), $data['count']);
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.