StatisticsViewsResult.php 956 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 = (int) $total_count;
  21. $this->dayCount = (int) $day_count;
  22. $this->timestamp = (int) $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. }