1 | <?php |
||
23 | trait MutualQueryTrait |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * Get the opposite relation. |
||
28 | * @param BaseUserModel|string $user initiator |
||
29 | * @param BaseUserModel|string $other recipient. |
||
30 | * @param Connection $database |
||
31 | * @return |
||
32 | */ |
||
33 | 1 | public function opposite($user, $other, $database = null) |
|
38 | |||
39 | /** |
||
40 | * Get all the opposites. |
||
41 | * @param string $user initator. |
||
42 | * @param array $others all recipients. |
||
43 | * @param Connection $database |
||
44 | * @return array instances. |
||
45 | */ |
||
46 | 1 | public function opposites($user, $others = [], $database = null) |
|
58 | |||
59 | /** |
||
60 | * Specify initiators. |
||
61 | * @param string|array $users the guid of initiator if string, or guid array |
||
62 | * of initiators if array. |
||
63 | * @return \static $this |
||
64 | */ |
||
65 | 19 | public function initiators($users = []) |
|
73 | |||
74 | /** |
||
75 | * Specify recipients. |
||
76 | * @param string|array $users the guid of recipient if string, or guid array |
||
77 | * of recipients if array. |
||
78 | * @return \static $this |
||
79 | */ |
||
80 | 19 | public function recipients($users = []) |
|
88 | } |
||
89 |
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: