Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / statistics / src / StatisticsStorageInterface.php
1 <?php
2
3 namespace Drupal\statistics;
4
5 /**
6  * Provides an interface defining Statistics Storage.
7  *
8  * Stores the views per day, total views and timestamp of last view
9  * for entities.
10  */
11 interface StatisticsStorageInterface {
12
13   /**
14    * Count a entity view.
15    *
16    * @param int $id
17    *   The ID of the entity to count.
18    *
19    * @return bool
20    *   TRUE if the entity view has been counted.
21    */
22   public function recordView($id);
23
24   /**
25    * Returns the number of times entities have been viewed.
26    *
27    * @param array $ids
28    *   An array of IDs of entities to fetch the views for.
29    *
30    * @return \Drupal\statistics\StatisticsViewsResult[]
31    *   An array of value objects representing the number of times each entity
32    *   has been viewed. The array is keyed by entity ID. If an ID does not
33    *   exist, it will not be present in the array.
34    */
35   public function fetchViews($ids);
36
37   /**
38    * Returns the number of times a single entity has been viewed.
39    *
40    * @param int $id
41    *   The ID of the entity to fetch the views for.
42    *
43    * @return \Drupal\statistics\StatisticsViewsResult|false
44    *   If the entity exists, a value object representing the number of times if
45    *   has been viewed. If it does not exist, FALSE is returned.
46    */
47   public function fetchView($id);
48
49   /**
50    * Returns the number of times a entity has been viewed.
51    *
52    * @param string $order
53    *   The counter name to order by:
54    *   - 'totalcount' The total number of views.
55    *   - 'daycount' The number of views today.
56    *   - 'timestamp' The unix timestamp of the last view.
57    *
58    * @param int $limit
59    *   The number of entity IDs to return.
60    *
61    * @return array
62    *   An ordered array of entity IDs.
63    */
64   public function fetchAll($order = 'totalcount', $limit = 5);
65
66   /**
67    * Delete counts for a specific entity.
68    *
69    * @param int $id
70    *   The ID of the entity which views to delete.
71    *
72    * @return bool
73    *   TRUE if the entity views have been deleted.
74    */
75   public function deleteViews($id);
76
77   /**
78    * Reset the day counter for all entities once every day.
79    */
80   public function resetDayCount();
81
82   /**
83    * Returns the highest 'totalcount' value.
84    *
85    * @return int
86    *   The highest 'totalcount' value.
87    */
88   public function maxTotalCount();
89
90 }