1 | <?php |
||
30 | trait UserOrganizationTrait |
||
31 | { |
||
32 | public $organizationClass = Organization::class; |
||
33 | public $departmentClass = Department::class; |
||
34 | public $memberClass = Member::class; |
||
35 | private $noInitOrganization; |
||
36 | private $noInitMember; |
||
37 | public $lastSetUpOrganization; |
||
38 | public $lastSetUpDepartment; |
||
39 | /** |
||
40 | * @return Organization |
||
41 | */ |
||
42 | protected function getNoInitOrganization() |
||
50 | /** |
||
51 | * @return Member |
||
52 | */ |
||
53 | 6 | protected function getNoInitMember() |
|
61 | |||
62 | /** |
||
63 | * |
||
64 | * @return MemberQuery |
||
65 | */ |
||
66 | 6 | public function getOfMembers() |
|
70 | |||
71 | /** |
||
72 | * |
||
73 | * @return OrganizationQuery |
||
74 | */ |
||
75 | 6 | public function getAtOrganizations() |
|
79 | |||
80 | /** |
||
81 | * |
||
82 | * @return DepartmentQuery |
||
83 | */ |
||
84 | public function getAtDepartments() |
||
88 | |||
89 | /** |
||
90 | * Set up organization. |
||
91 | * @param string $name |
||
92 | * @param string $nickname |
||
93 | * @param integer $gravatar_type |
||
94 | * @param string $gravatar |
||
95 | * @param string $timezone |
||
96 | * @param string $description |
||
97 | * @param BaseOrganization $parent |
||
98 | * @return boolean Whether indicate the setting-up succeeded or not. |
||
99 | */ |
||
100 | 7 | public function setUpOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '', $parent = null) |
|
130 | |||
131 | /** |
||
132 | * |
||
133 | * @param BaseOrganization $parent |
||
134 | * @param string $name |
||
135 | * @param string $nickname |
||
136 | * @param integer $gravatar_type |
||
137 | * @param string $gravatar |
||
138 | * @param string $timezone |
||
139 | * @param string $description |
||
140 | * @return boolean Whether indicate the setting-up succeeded or not. |
||
141 | */ |
||
142 | 1 | public function setUpDepartment($parent, $name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
|
174 | |||
175 | /** |
||
176 | * Create organization. |
||
177 | * @param string $name |
||
178 | * @param string $nickname |
||
179 | * @param string $gravatar_type |
||
180 | * @param string $gravatar |
||
181 | * @param string $timezone |
||
182 | * @param string $description |
||
183 | * @return Organization |
||
184 | */ |
||
185 | 7 | public function createOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
|
189 | |||
190 | /** |
||
191 | * Create department. |
||
192 | * @param string $name |
||
193 | * @param string $nickname |
||
194 | * @param integer $gravatar_type |
||
195 | * @param string $gravatar |
||
196 | * @param string $timezone |
||
197 | * @param string $description |
||
198 | * @return Department |
||
199 | */ |
||
200 | 1 | public function createDepartment($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '') |
|
204 | |||
205 | /** |
||
206 | * Create Base Organization. |
||
207 | * @param string $name |
||
208 | * @param string $nickname |
||
209 | * @param integer $gravatar_type |
||
210 | * @param string $gravatar |
||
211 | * @param string $timezone |
||
212 | * @param string $description |
||
213 | * @param integer $type |
||
214 | * @return array This array contains two elements, the first is `Organization` or `Department` depends on `$type`. |
||
215 | * The other is `associatedModels` array, contains two elements `Profile`(profile) and `Creator`(creator). |
||
216 | */ |
||
217 | 7 | protected function createBaseOrganization($name, $nickname = '', $gravatar_type = 0, $gravatar = '', $timezone = 'UTC', $description = '', $type = BaseOrganization::TYPE_ORGANIZATION) |
|
237 | } |
||
238 |
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.