From 169ce93c019e6fe79a66db126ccf8ae57e43c389 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Wed, 7 Aug 2019 14:17:48 +0200 Subject: [PATCH] Replace foreach with in_array in_array give more readability to the code. --- src/Prometheus/Histogram.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Prometheus/Histogram.php b/src/Prometheus/Histogram.php index 9dbfda4..9041a3a 100644 --- a/src/Prometheus/Histogram.php +++ b/src/Prometheus/Histogram.php @@ -39,10 +39,8 @@ public function __construct(Adapter $adapter, $namespace, $name, $help, $labels ); } } - foreach ($labels as $label) { - if ($label === 'le') { - throw new \InvalidArgumentException("Histogram cannot have a label named 'le'."); - } + if (in_array('le', $labels, true)) { + throw new \InvalidArgumentException("Histogram cannot have a label named 'le'."); } $this->buckets = $buckets; }