1 | <?php |
||
29 | trait CountTrait |
||
30 | { |
||
31 | /** |
||
32 | * Count number of private projects. |
||
33 | * |
||
34 | * @return int |
||
35 | */ |
||
36 | public function countPrivateProjects() |
||
40 | |||
41 | /** |
||
42 | * Count number of open projects. |
||
43 | * |
||
44 | * @return int |
||
45 | */ |
||
46 | 2 | public function countOpenProjects() |
|
50 | |||
51 | /** |
||
52 | * Count number of archived projects. |
||
53 | * |
||
54 | * @return int |
||
55 | */ |
||
56 | 2 | public function countArchivedProjects() |
|
60 | |||
61 | /** |
||
62 | * Count number of open issue in the project. |
||
63 | * |
||
64 | * @return int |
||
65 | */ |
||
66 | 2 | public function countOpenIssues() |
|
73 | |||
74 | /** |
||
75 | * Count number of closed issue in the project. |
||
76 | * |
||
77 | * @return int |
||
78 | */ |
||
79 | 2 | public function countClosedIssues() |
|
89 | |||
90 | /** |
||
91 | * For eager loading: count number of issues. |
||
92 | * |
||
93 | * @return Eloquent\Relations\HasOne |
||
94 | */ |
||
95 | public function issuesCount() |
||
101 | |||
102 | /** |
||
103 | * For eager loading: include number of closed issues. |
||
104 | * |
||
105 | * @return Eloquent\Relations\HasOne |
||
106 | */ |
||
107 | 36 | public function closedIssuesCount() |
|
118 | |||
119 | /** |
||
120 | * For eager loading: include number of open issues. |
||
121 | * |
||
122 | * @return Eloquent\Relations\HasOne |
||
123 | */ |
||
124 | 37 | public function openIssuesCount() |
|
135 | |||
136 | /** |
||
137 | * Return projects with count of open & closed issues. |
||
138 | * |
||
139 | * @param array $projectIds |
||
140 | * |
||
141 | * @return Eloquent\Collection |
||
142 | */ |
||
143 | 1 | public function projectsWithCountIssues(array $projectIds) |
|
150 | |||
151 | /** |
||
152 | * Returns projects with open issue count. |
||
153 | * |
||
154 | * @param int $status |
||
155 | * @param int $private |
||
156 | * |
||
157 | * @return mixed |
||
158 | */ |
||
159 | 5 | public function projectsWithOpenIssuesCount($status = Project::STATUS_OPEN, $private = Project::PRIVATE_YES) |
|
170 | } |
||
171 |
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.