| Conditions | 3 |
| Paths | 3 |
| Total Lines | 27 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function build($project_id) |
||
| 30 | { |
||
| 31 | $rows = $this->db->table(TaskModel::TABLE) |
||
|
|
|||
| 32 | ->columns('SUM(time_estimated) AS time_estimated', 'SUM(time_spent) AS time_spent', 'is_active') |
||
| 33 | ->eq('project_id', $project_id) |
||
| 34 | ->groupBy('is_active') |
||
| 35 | ->findAll(); |
||
| 36 | |||
| 37 | $metrics = [ |
||
| 38 | 'open' => [ |
||
| 39 | 'time_spent' => 0, |
||
| 40 | 'time_estimated' => 0, |
||
| 41 | ], |
||
| 42 | 'closed' => [ |
||
| 43 | 'time_spent' => 0, |
||
| 44 | 'time_estimated' => 0, |
||
| 45 | ], |
||
| 46 | ]; |
||
| 47 | |||
| 48 | foreach ($rows as $row) { |
||
| 49 | $key = $row['is_active'] == TaskModel::STATUS_OPEN ? 'open' : 'closed'; |
||
| 50 | $metrics[$key]['time_spent'] = (float) $row['time_spent']; |
||
| 51 | $metrics[$key]['time_estimated'] = (float) $row['time_estimated']; |
||
| 52 | } |
||
| 53 | |||
| 54 | return $metrics; |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.