Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | 82 | protected function labeled(Metric $metric, array $labels): Collection |
|
20 | { |
||
21 | 82 | $expected = $metric->labels()->count(); |
|
22 | 82 | $actual = count($labels); |
|
23 | |||
24 | 82 | if ($expected !== $actual) { |
|
25 | 5 | throw new LabelException("Expected {$expected} label values but {$actual} were given."); |
|
26 | } |
||
27 | |||
28 | // FIXME: Only return the value. |
||
29 | 77 | return new Collection([ |
|
30 | 77 | 'labels' => $metric->labels()->combine($labels), |
|
31 | ]); |
||
34 |