1 | <?php |
||
19 | trait TestingUserTrait |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * the Logged in user (client). |
||
24 | * |
||
25 | * @var User |
||
26 | */ |
||
27 | public $loggedInTestingUser; |
||
28 | |||
29 | /** |
||
30 | * the Logged in admin user. |
||
31 | * |
||
32 | * @var User |
||
33 | */ |
||
34 | public $loggedInTestingAdmin; |
||
35 | |||
36 | |||
37 | /** |
||
38 | * get teh current logged in user OR create new one if no one exist |
||
39 | * |
||
40 | * @param null $access |
||
41 | * |
||
42 | * @return \App\Containers\User\Models\User|mixed |
||
43 | */ |
||
44 | public function getTestingUser($access = null) |
||
52 | |||
53 | /** |
||
54 | * @return \App\Containers\User\Models\User|mixed |
||
55 | */ |
||
56 | public function getTestingUserWithoutPermissions() |
||
64 | |||
65 | /** |
||
66 | * @param null $permissions |
||
67 | * |
||
68 | * @return \App\Containers\User\Models\User|mixed |
||
69 | */ |
||
70 | public function getTestingAdmin($permissions = null) |
||
81 | |||
82 | /** |
||
83 | * get teh current logged in user token. |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function getLoggedInTestingUserToken() |
||
91 | |||
92 | /** |
||
93 | * @param null $access |
||
94 | * @param null $userDetails |
||
95 | * |
||
96 | * @return mixed |
||
97 | */ |
||
98 | public function createTestingUser($access = null, $userDetails = null) |
||
122 | |||
123 | /** |
||
124 | * @param $user |
||
125 | * @param $access |
||
126 | * |
||
127 | * @return mixed |
||
128 | */ |
||
129 | private function setupTestingUserAccess($user, $access) |
||
142 | |||
143 | } |
||
144 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: