1 | <?php |
||
28 | trait UserOrganizationTrait |
||
29 | { |
||
30 | public $organizationClass = Organization::class; |
||
31 | public $departmentClass = Department::class; |
||
32 | public $memberClass = Member::class; |
||
33 | private $noInitOrganization; |
||
34 | private $noInitMember; |
||
35 | public $lastSetUpOrganization; |
||
36 | public $lastSetUpDepartment; |
||
37 | /** |
||
38 | * @return Organization |
||
39 | */ |
||
40 | protected function getNoInitOrganization() |
||
48 | /** |
||
49 | * @return Member |
||
50 | */ |
||
51 | 6 | protected function getNoInitMember() |
|
59 | |||
60 | /** |
||
61 | * |
||
62 | * @return MemberQuery |
||
63 | */ |
||
64 | 6 | public function getOfMembers() |
|
68 | |||
69 | /** |
||
70 | * |
||
71 | * @return OrganizationQuery |
||
72 | */ |
||
73 | 6 | public function getAtOrganizations() |
|
77 | |||
78 | /** |
||
79 | * Set up organization. |
||
80 | * @param string $name |
||
81 | * @param string $nickname |
||
82 | * @param integer $gravatar_type |
||
83 | * @param string $gravatar |
||
84 | * @param string $timezone |
||
85 | * @param string $description |
||
86 | * @param BaseOrganization $parent |
||
87 | * @return boolean Whether indicate the setting-up succeeded or not. |
||
88 | */ |
||
89 | 6 | public function setUpOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '', $parent = null) |
|
119 | |||
120 | /** |
||
121 | * |
||
122 | * @param BaseOrganization $parent |
||
123 | * @param string $name |
||
124 | * @param string $nickname |
||
125 | * @param integer $gravatar_type |
||
126 | * @param string $gravatar |
||
127 | * @param string $timezone |
||
128 | * @param string $description |
||
129 | * @return boolean Whether indicate the setting-up succeeded or not. |
||
130 | */ |
||
131 | public function setUpDepartment($parent, $name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
||
161 | |||
162 | /** |
||
163 | * Create organization. |
||
164 | * @param string $name |
||
165 | * @param string $nickname |
||
166 | * @param string $gravatar_type |
||
167 | * @param string $gravatar |
||
168 | * @param string $timezone |
||
169 | * @param string $description |
||
170 | * @return Organization |
||
171 | */ |
||
172 | 6 | public function createOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
|
176 | |||
177 | /** |
||
178 | * Create department. |
||
179 | * @param string $name |
||
180 | * @param string $nickname |
||
181 | * @param integer $gravatar_type |
||
182 | * @param string $gravatar |
||
183 | * @param string $timezone |
||
184 | * @param string $description |
||
185 | * @return Department |
||
186 | */ |
||
187 | public function createDepartment($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
||
191 | |||
192 | /** |
||
193 | * Create Base Organization. |
||
194 | * @param string $name |
||
195 | * @param string $nickname |
||
196 | * @param integer $gravatar_type |
||
197 | * @param string $gravatar |
||
198 | * @param string $timezone |
||
199 | * @param string $description |
||
200 | * @param integer $type |
||
201 | * @return array This array contains two elements, the first is `Organization` or `Department` depends on `$type`. |
||
202 | * The other is `associatedModels` array, contains two elements `Profile`(profile) and `Creator`(creator). |
||
203 | */ |
||
204 | 6 | protected function createBaseOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '', $type = BaseOrganization::TYPE_ORGANIZATION) |
|
224 | } |
||
225 |
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.