Skip to content
Permalink
Browse files

Get 100% code coverage

  • Loading branch information...
LeSuisse committed Sep 13, 2019
1 parent f980734 commit 7ec8f14853076caf04725ce2a8fdb23587e0381b
Showing with 2 additions and 18 deletions.
  1. +1 −9 src/Storage/APCUStore.php
  2. +1 −9 src/Storage/InMemoryStore.php
@@ -11,7 +11,6 @@
use Enalean\Prometheus\Value\LabelNames;
use Enalean\Prometheus\Value\MetricLabelNames;
use Enalean\Prometheus\Value\MetricName;
use RuntimeException;
use const JSON_THROW_ON_ERROR;
use function apcu_add;
use function apcu_cas;
@@ -381,16 +380,9 @@ private function encodeLabelValues(array $values) : string
/**
* @return string[]
*
* @throws RuntimeException
*/
private function decodeLabelValues(string $values) : array
{
$json = base64_decode($values, true);
if ($json === false) {
throw new RuntimeException('Cannot base64 decode label values');
}
return json_decode($json, true, JSON_THROW_ON_ERROR);
return json_decode((string) base64_decode($values, true), true, JSON_THROW_ON_ERROR);
}
}
@@ -10,7 +10,6 @@
use Enalean\Prometheus\Value\LabelNames;
use Enalean\Prometheus\Value\MetricLabelNames;
use Enalean\Prometheus\Value\MetricName;
use RuntimeException;
use const JSON_THROW_ON_ERROR;
use function array_key_exists;
use function array_keys;
@@ -331,16 +330,9 @@ private function encodeLabelValues(array $values) : string
/**
* @return string[]
*
* @throws RuntimeException
*/
private function decodeLabelValues(string $values) : array
{
$json = base64_decode($values, true);
if ($json === false) {
throw new RuntimeException('Cannot base64 decode label values');
}
return json_decode($json, true, 512, JSON_THROW_ON_ERROR);
return json_decode((string) base64_decode($values, true), true, 512, JSON_THROW_ON_ERROR);
}
}

0 comments on commit 7ec8f14

Please sign in to comment.
You can’t perform that action at this time.