Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | trait UsersService |
||
10 | { |
||
11 | /** @var Users|null */ |
||
12 | private $users; |
||
13 | |||
14 | /** |
||
15 | * Get the resource API Provider instance. |
||
16 | * |
||
17 | * @return ApiProvider |
||
18 | */ |
||
19 | abstract public function getApiProvider(); |
||
20 | |||
21 | /** |
||
22 | * Get the users service instance. |
||
23 | * |
||
24 | * @param bool $reload = false Reload instance flag. |
||
25 | * |
||
26 | * @return Users |
||
27 | */ |
||
28 | public function getUsersService(bool $reload = false) |
||
29 | { |
||
30 | if (is_null($this->users) || $reload) { |
||
31 | return $this->users = new Users($this->getApiProvider()); |
||
32 | } |
||
33 | |||
34 | return $this->users; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Get user by the given ID. |
||
39 | * This is a proxy method for Users::getUser(). |
||
40 | * |
||
41 | * @param integer $id User ID. |
||
42 | * |
||
43 | * @see Users::getUser() |
||
44 | * |
||
45 | * @return User|null |
||
46 | */ |
||
47 | public function getUser($id) |
||
50 | } |
||
51 | } |
||
52 |