summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/sdk/Metrics/View/SelectionCriteria/AllCriteria.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/open-telemetry/sdk/Metrics/View/SelectionCriteria/AllCriteria.php')
-rw-r--r--vendor/open-telemetry/sdk/Metrics/View/SelectionCriteria/AllCriteria.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/open-telemetry/sdk/Metrics/View/SelectionCriteria/AllCriteria.php b/vendor/open-telemetry/sdk/Metrics/View/SelectionCriteria/AllCriteria.php
new file mode 100644
index 000000000..438297324
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/View/SelectionCriteria/AllCriteria.php
@@ -0,0 +1,33 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\View\SelectionCriteria;
+
+use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeInterface;
+use OpenTelemetry\SDK\Metrics\Instrument;
+use OpenTelemetry\SDK\Metrics\View\SelectionCriteriaInterface;
+
+final class AllCriteria implements SelectionCriteriaInterface
+{
+ private iterable $criteria;
+
+ /**
+ * @param iterable<SelectionCriteriaInterface> $criteria
+ */
+ public function __construct(iterable $criteria)
+ {
+ $this->criteria = $criteria;
+ }
+
+ public function accepts(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope): bool
+ {
+ foreach ($this->criteria as $criterion) {
+ if (!$criterion->accepts($instrument, $instrumentationScope)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}