Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
StatisticsViewsResult | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
getTotalCount | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getDayCount | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTimestamp | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Drupal\visitors; |
4 | |
5 | /** |
6 | * Value object for passing statistic results. |
7 | */ |
8 | class StatisticsViewsResult { |
9 | |
10 | /** |
11 | * Total number of times the entity has been viewed. |
12 | * |
13 | * @var int |
14 | */ |
15 | protected $total; |
16 | |
17 | /** |
18 | * Total number of times the entity has been viewed "today". |
19 | * |
20 | * @var int |
21 | */ |
22 | protected $today; |
23 | |
24 | /** |
25 | * Timestamp of when the entity was last viewed. |
26 | * |
27 | * @var int |
28 | */ |
29 | protected $timestamp; |
30 | |
31 | /** |
32 | * StatisticsViewsResult constructor. |
33 | * |
34 | * @param int $total_count |
35 | * Total number of times the entity has been viewed. |
36 | * @param int $day_count |
37 | * Total number of times the entity has been viewed "today". |
38 | * @param int $timestamp |
39 | * Timestamp of when the entity was last viewed. |
40 | */ |
41 | public function __construct($total_count, $day_count, $timestamp) { |
42 | $this->total = (int) $total_count; |
43 | $this->today = (int) $day_count; |
44 | $this->timestamp = (int) $timestamp; |
45 | } |
46 | |
47 | /** |
48 | * Total number of times the entity has been viewed. |
49 | * |
50 | * @return int |
51 | * The total number of times the entity has been viewed. |
52 | */ |
53 | public function getTotalCount() { |
54 | return $this->total; |
55 | } |
56 | |
57 | /** |
58 | * Total number of times the entity has been viewed "today". |
59 | * |
60 | * @return int |
61 | * The total number of times the entity has been viewed "today". |
62 | */ |
63 | public function getDayCount() { |
64 | return $this->today; |
65 | } |
66 | |
67 | /** |
68 | * Timestamp of when the entity was last viewed. |
69 | * |
70 | * @return int |
71 | * The timestamp of when the entity was last viewed. |
72 | */ |
73 | public function getTimestamp() { |
74 | return $this->timestamp; |
75 | } |
76 | |
77 | } |