Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Drupal\visitors; |
| 4 | |
| 5 | /** |
| 6 | * Interface VisitorsViewInterface. |
| 7 | * |
| 8 | * @package Drupal\visitors |
| 9 | */ |
| 10 | interface VisitorsCounterInterface { |
| 11 | |
| 12 | /** |
| 13 | * Counts an entity view. |
| 14 | * |
| 15 | * @param string $type |
| 16 | * The type of the entity to count. |
| 17 | * @param int $id |
| 18 | * The ID of the entity to count. |
| 19 | * |
| 20 | * @return bool |
| 21 | * TRUE if the entity view has been counted. |
| 22 | */ |
| 23 | public function recordView(string $type, int $id); |
| 24 | |
| 25 | /** |
| 26 | * Fetches the number of views for an entity. |
| 27 | * |
| 28 | * @param string $type |
| 29 | * The type of the entity to count. |
| 30 | * @param int $id |
| 31 | * The ID of the entity to count. |
| 32 | * |
| 33 | * @return \Drupal\visitors\StatisticsViewsResult |
| 34 | * The number of views for the entity. |
| 35 | */ |
| 36 | public function fetchView(string $type, int $id); |
| 37 | |
| 38 | /** |
| 39 | * Returns the number of times entities have been viewed. |
| 40 | * |
| 41 | * @param string $type |
| 42 | * The type of the entity to count. |
| 43 | * @param array $ids |
| 44 | * An array of IDs of entities to fetch the views for. |
| 45 | * |
| 46 | * @return \Drupal\visitors\StatisticsViewsResult[] |
| 47 | * An array of value objects representing the number of times each entity |
| 48 | * has been viewed. The array is keyed by entity ID. If an ID does not |
| 49 | * exist, it will not be present in the array. |
| 50 | */ |
| 51 | public function fetchViews(string $type, array $ids); |
| 52 | |
| 53 | /** |
| 54 | * Fetches the number of views for a list of entities. |
| 55 | * |
| 56 | * @param string $type |
| 57 | * The type of the entity to count. |
| 58 | * @param string $order |
| 59 | * The type of the entity to count. |
| 60 | * @param int $limit |
| 61 | * The IDs of the entities to count. |
| 62 | * |
| 63 | * @return array |
| 64 | * The number of views for the entities. |
| 65 | */ |
| 66 | public function fetchAll(string $type, string $order, int $limit); |
| 67 | |
| 68 | /** |
| 69 | * Delete counts for a specific entity. |
| 70 | * |
| 71 | * @param string $type |
| 72 | * The type of the entity to count. |
| 73 | * @param int $id |
| 74 | * The ID of the entity which views to delete. |
| 75 | * |
| 76 | * @return bool |
| 77 | * TRUE if the entity views have been deleted. |
| 78 | */ |
| 79 | public function deleteViews(string $type, int $id); |
| 80 | |
| 81 | /** |
| 82 | * Reset the day counter for all entities once every day. |
| 83 | */ |
| 84 | public function resetDayCount(); |
| 85 | |
| 86 | /** |
| 87 | * Returns the highest 'total' value. |
| 88 | * |
| 89 | * @return int |
| 90 | * The highest 'total' value. |
| 91 | */ |
| 92 | public function maxTotalCount(string $type); |
| 93 | |
| 94 | } |