1 | <?php |
||
29 | trait UserOrganizationTrait |
||
30 | { |
||
31 | public $organizationClass = Organization::class; |
||
32 | public $memberClass = Member::class; |
||
33 | private $noInitOrganization; |
||
34 | private $noInitMember; |
||
35 | public $lastSetUpOrganization; |
||
36 | /** |
||
37 | * @return Organization |
||
38 | */ |
||
39 | protected function getNoInitOrganization() |
||
47 | /** |
||
48 | * @return Member |
||
49 | */ |
||
50 | 6 | protected function getNoInitMember() |
|
58 | |||
59 | /** |
||
60 | * |
||
61 | * @return MemberQuery |
||
62 | */ |
||
63 | 6 | public function getOfMembers() |
|
67 | |||
68 | /** |
||
69 | * |
||
70 | * @return OrganizationQuery |
||
71 | */ |
||
72 | 6 | public function getAtOrganizations() |
|
76 | |||
77 | /** |
||
78 | * Set up organization. |
||
79 | * @param string $name |
||
80 | * @param Organization $parent |
||
81 | * @param string $nickname |
||
82 | * @param integer $gravatar_type |
||
83 | * @param string $gravatar |
||
84 | * @param string $timezone |
||
85 | * @param string $description |
||
86 | * @return boolean Whether indicate the setting-up succeeded or not. |
||
87 | */ |
||
88 | 11 | public function setUpOrganization($name, $parent = null, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
|
118 | |||
119 | /** |
||
120 | * Set up organization. |
||
121 | * @param string $name |
||
122 | * @param Organization $parent |
||
123 | * @param string $nickname |
||
124 | * @param integer $gravatar_type |
||
125 | * @param string $gravatar |
||
126 | * @param string $timezone |
||
127 | * @param string $description |
||
128 | * @return boolean Whether indicate the setting-up succeeded or not. |
||
129 | */ |
||
130 | 1 | public function setUpDepartment($name, $parent = null, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
|
163 | |||
164 | /** |
||
165 | * Create organization. |
||
166 | * @param string $name |
||
167 | * @param string $nickname |
||
168 | * @param string $gravatar_type |
||
169 | * @param string $gravatar |
||
170 | * @param string $timezone |
||
171 | * @param string $description |
||
172 | * @return Organization |
||
173 | */ |
||
174 | 10 | public function createOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
|
178 | |||
179 | /** |
||
180 | * Create department. |
||
181 | * @param string $name |
||
182 | * @param string $nickname |
||
183 | * @param string $gravatar_type |
||
184 | * @param string $gravatar |
||
185 | * @param string $timezone |
||
186 | * @param string $description |
||
187 | * @return Organization |
||
188 | */ |
||
189 | 1 | public function createDepartment($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
|
193 | |||
194 | /** |
||
195 | * Create Base Organization. |
||
196 | * @param string $name |
||
197 | * @param string $nickname |
||
198 | * @param integer $gravatar_type |
||
199 | * @param string $gravatar |
||
200 | * @param string $timezone |
||
201 | * @param string $description |
||
202 | * @param integer $type |
||
203 | * @return array This array contains two elements, the first is `Organization` or `Department` depends on `$type`. |
||
204 | * The other is `associatedModels` array, contains two elements `Profile`(profile) and `Creator`(creator). |
||
205 | */ |
||
206 | 10 | protected function createBaseOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '', $type = Organization::TYPE_ORGANIZATION) |
|
223 | } |
||
224 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.