1 | <?php |
||
29 | trait CountTrait |
||
30 | { |
||
31 | /** |
||
32 | * Count number of private projects. |
||
33 | * |
||
34 | * @return int |
||
35 | */ |
||
36 | public function countPrivateProjects() |
||
42 | |||
43 | /** |
||
44 | * Count number of open projects. |
||
45 | * |
||
46 | * @return int |
||
47 | */ |
||
48 | 2 | public function countOpenProjects() |
|
52 | |||
53 | /** |
||
54 | * Count number of archived projects. |
||
55 | * |
||
56 | * @return int |
||
57 | */ |
||
58 | 2 | public function countArchivedProjects() |
|
62 | |||
63 | /** |
||
64 | * Count number of open issue in the project. |
||
65 | * |
||
66 | * @return int |
||
67 | */ |
||
68 | 2 | public function countOpenIssues() |
|
75 | |||
76 | /** |
||
77 | * Count number of closed issue in the project. |
||
78 | * |
||
79 | * @return int |
||
80 | */ |
||
81 | 2 | public function countClosedIssues() |
|
91 | |||
92 | /** |
||
93 | * For eager loading: count number of issues. |
||
94 | * |
||
95 | * @return Eloquent\Relations\HasOne |
||
96 | */ |
||
97 | public function issuesCount() |
||
103 | |||
104 | /** |
||
105 | * For eager loading: include number of closed issues. |
||
106 | * |
||
107 | * @return Eloquent\Relations\HasOne |
||
108 | */ |
||
109 | 36 | public function closedIssuesCount() |
|
120 | |||
121 | /** |
||
122 | * For eager loading: include number of open issues. |
||
123 | * |
||
124 | * @return Eloquent\Relations\HasOne |
||
125 | */ |
||
126 | 37 | public function openIssuesCount() |
|
137 | |||
138 | /** |
||
139 | * Return projects with count of open & closed issues. |
||
140 | * |
||
141 | * @param array $projectIds |
||
142 | * |
||
143 | * @return Eloquent\Collection |
||
144 | */ |
||
145 | 1 | public function projectsWithCountIssues(array $projectIds) |
|
152 | |||
153 | /** |
||
154 | * Returns projects with open issue count. |
||
155 | * |
||
156 | * @param int $status |
||
157 | * @param int $private |
||
158 | * |
||
159 | * @return mixed |
||
160 | */ |
||
161 | 5 | public function projectsWithOpenIssuesCount($status = Project::STATUS_OPEN, $private = Project::PRIVATE_YES) |
|
172 | } |
||
173 |
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.