Completed
Push — master ( 5309e4...b64411 )
by Frederick
12s
created

DownloadStatistics::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Vanbrabantf\NpmStatFetcher\ValueObjects;
4
5
use DateTimeImmutable;
6
7
class DownloadStatistics extends Statistics
8
{
9
    /**
10
     * @var int
11
     */
12
    private $downloads;
13
14
    /**
15
     * @var DateTimeImmutable
16
     */
17
    private $startDate;
18
19
    /**
20
     * @var DateTimeImmutable
21
     */
22
    private $endDate;
23
24
    /**
25
     * @param Package $package
26
     * @param int $downloads
27
     * @param DateTimeImmutable $startDate
28
     * @param DateTimeImmutable $endDate
29
30
     */
31
    public function __construct(
32
        Package $package,
33
        int $downloads,
34
        DateTimeImmutable $startDate,
35
        DateTimeImmutable $endDate
36
    ) {
37
        parent::__construct($package);
38
        $this->downloads = $downloads;
39
        $this->startDate = $startDate;
40
        $this->endDate = $endDate;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function __toString()
47
    {
48
        return (string)$this->downloads;
49
    }
50
51
    /**
52
     * @return int
53
     */
54
    public function getDownloads(): int
55
    {
56
        return $this->downloads;
57
    }
58
59
    /**
60
     * @return DateTimeImmutable
61
     */
62
    public function getStartDate()
63
    {
64
        return $this->startDate;
65
    }
66
67
    /**
68
     * @return DateTimeImmutable
69
     */
70
    public function getEndDate()
71
    {
72
        return $this->endDate;
73
    }
74
}