Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CriteriaViewRegistry.php

class CriteriaViewRegistry

Hierarchy

  • class \OpenTelemetry\SDK\Metrics\View\CriteriaViewRegistry implements \OpenTelemetry\SDK\Metrics\ViewRegistryInterface

Expanded class hierarchy of CriteriaViewRegistry

1 file declares its use of CriteriaViewRegistry
MeterProviderBuilder.php in vendor/open-telemetry/sdk/Metrics/MeterProviderBuilder.php

File

vendor/open-telemetry/sdk/Metrics/View/CriteriaViewRegistry.php, line 12

Namespace

OpenTelemetry\SDK\Metrics\View
View source
final class CriteriaViewRegistry implements ViewRegistryInterface {
    
    /** @var list<SelectionCriteriaInterface> */
    private array $criteria = [];
    
    /** @var list<ViewTemplate> */
    private array $views = [];
    public function register(SelectionCriteriaInterface $criteria, ViewTemplate $view) : void {
        $this->criteria[] = $criteria;
        $this->views[] = $view;
    }
    
    /**
     * @todo is null the best return type here? what about empty array or exception?
     */
    public function find(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope) : ?iterable {
        $views = $this->generateViews($instrument, $instrumentationScope);
        return $views->valid() ? $views : null;
    }
    private function generateViews(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope) : Generator {
        foreach ($this->criteria as $i => $criteria) {
            if ($criteria->accepts($instrument, $instrumentationScope)) {
                (yield $this->views[$i]
                    ->project($instrument));
            }
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
CriteriaViewRegistry::$criteria private property @var list&lt;SelectionCriteriaInterface&gt;
CriteriaViewRegistry::$views private property @var list&lt;ViewTemplate&gt;
CriteriaViewRegistry::find public function @todo is null the best return type here? what about empty array or exception? Overrides ViewRegistryInterface::find
CriteriaViewRegistry::generateViews private function
CriteriaViewRegistry::register public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal