StatisticsViewsResult.php 940 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Drupal\statistics;
  3. /**
  4. * Value object for passing statistic results.
  5. */
  6. class StatisticsViewsResult {
  7. /**
  8. * @var int
  9. */
  10. protected $totalCount;
  11. /**
  12. * @var int
  13. */
  14. protected $dayCount;
  15. /**
  16. * @var int
  17. */
  18. protected $timestamp;
  19. public function __construct($total_count, $day_count, $timestamp) {
  20. $this->totalCount = $total_count;
  21. $this->dayCount = $day_count;
  22. $this->timestamp = $timestamp;
  23. }
  24. /**
  25. * Total number of times the entity has been viewed.
  26. *
  27. * @return int
  28. */
  29. public function getTotalCount() {
  30. return $this->totalCount;
  31. }
  32. /**
  33. * Total number of times the entity has been viewed "today".
  34. *
  35. * @return int
  36. */
  37. public function getDayCount() {
  38. return $this->dayCount;
  39. }
  40. /**
  41. * Timestamp of when the entity was last viewed.
  42. *
  43. * @return int
  44. */
  45. public function getTimestamp() {
  46. return $this->timestamp;
  47. }
  48. }