| Total Complexity | 4 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class TextRenderer implements Renderable |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * {@inheritdoc} |
||
| 14 | */ |
||
| 15 | 32 | public function render(Collection $metrics): string |
|
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param Collection $labels |
||
| 26 | * |
||
| 27 | * @return string |
||
| 28 | */ |
||
| 29 | 32 | protected function serialize(Collection $labels): string |
|
| 30 | { |
||
| 31 | $quoted = $labels->map(function (string $value) { |
||
| 32 | 31 | return "\"{$value}\""; |
|
| 33 | 32 | }); |
|
| 34 | |||
| 35 | 32 | $serialized = urldecode( |
|
| 36 | 32 | http_build_query($quoted->toArray(), '', ',') |
|
| 37 | ); |
||
| 38 | |||
| 39 | 32 | return !$serialized |
|
| 40 | 1 | ? $serialized |
|
| 41 | 32 | : "{{$serialized}}"; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param MetricFamilySamples $family |
||
| 46 | * |
||
| 47 | * @return Collection |
||
| 48 | */ |
||
| 49 | 32 | protected function transform(MetricFamilySamples $family): Collection |
|
| 63 | } |
||
| 64 | } |
||
| 65 |