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 | use Drupal\Core\Session\AccountInterface; |
6 | |
7 | /** |
8 | * Interface for checking visitors visibility. |
9 | */ |
10 | interface VisitorsVisibilityInterface { |
11 | |
12 | /** |
13 | * Path must not match to be tracked. |
14 | */ |
15 | const PATH_EXCLUDE = 0; |
16 | |
17 | /** |
18 | * Path must math to be tracked. |
19 | */ |
20 | const PATH_INCLUDE = 1; |
21 | |
22 | /** |
23 | * No customization allowed to the users. |
24 | */ |
25 | const USER_NO_PERSONALIZATION = 0; |
26 | |
27 | /** |
28 | * Customization allowed, tracking enabled by default. |
29 | */ |
30 | const USER_OPT_OUT = 1; |
31 | |
32 | /** |
33 | * Customization allowed, tracking disabled by default. |
34 | */ |
35 | const USER_OPT_IN = 2; |
36 | |
37 | /** |
38 | * Tracking visibility check for an user object. |
39 | * |
40 | * @param \Drupal\Core\Session\AccountInterface $account |
41 | * A user object containing an array of roles to check. |
42 | * |
43 | * @return bool |
44 | * TRUE if the current user is being tracked by Visitors, otherwise FALSE. |
45 | */ |
46 | public function user(AccountInterface $account): bool; |
47 | |
48 | /** |
49 | * Tracking visibility check for pages. |
50 | * |
51 | * @return bool |
52 | * TRUE if JS code should be added to the current page and otherwise FALSE. |
53 | */ |
54 | public function page(): bool; |
55 | |
56 | /** |
57 | * Tracking visibility check for user roles. |
58 | * |
59 | * @return bool |
60 | * TRUE if JS code should be added for the current role and otherwise FALSE. |
61 | */ |
62 | public function isVisible(): bool; |
63 | |
64 | /** |
65 | * Tracking visibility check for user roles. |
66 | * |
67 | * Based on visibility setting this function returns TRUE if Visitors code |
68 | * should be added for the current role and otherwise FALSE. |
69 | * |
70 | * @param \Drupal\Core\Session\AccountInterface $account |
71 | * A user object containing an array of roles to check. |
72 | * |
73 | * @return bool |
74 | * TRUE if JS code should be added for the current role and otherwise FALSE. |
75 | */ |
76 | public function roles(AccountInterface $account): bool; |
77 | |
78 | } |