1 | <?php |
||
20 | trait MutualQueryTrait |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Get the opposite relation. |
||
25 | * @param BaseUserModel|string $user initiator |
||
26 | * @param BaseUserModel|string $other recipient. |
||
27 | * @param Connection $database |
||
28 | * @return |
||
29 | */ |
||
30 | 8 | public function opposite($user, $other, $database = null) |
|
35 | |||
36 | /** |
||
37 | * Get all the opposites. |
||
38 | * @param string $user initator. |
||
39 | * @param array $others all recipients. |
||
40 | * @param Connection $database |
||
41 | * @return array instances. |
||
42 | */ |
||
43 | 7 | public function opposites($user, $others = [], $database = null) |
|
52 | |||
53 | /** |
||
54 | * Specify initiators. |
||
55 | * @param string|array $users the guid of initiator if string, or guid array |
||
56 | * of initiators if array. |
||
57 | * @return \static $this |
||
58 | */ |
||
59 | 8 | public function initiators($users = []) |
|
67 | |||
68 | /** |
||
69 | * Specify recipients. |
||
70 | * @param string|array $users the guid of recipient if string, or guid array |
||
71 | * of recipients if array. |
||
72 | * @return \static $this |
||
73 | */ |
||
74 | 10 | public function recipients($users = []) |
|
82 | } |
||
83 |
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: