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

Breadcrumb

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

function AnnotatedClassDiscovery::getProviderFromNamespace

Extracts the provider name from a Drupal namespace.

Parameters

string $namespace: The namespace to extract the provider from.

Return value

string|null The matching provider name, or NULL otherwise.

2 calls to AnnotatedClassDiscovery::getProviderFromNamespace()
AnnotatedClassDiscovery::prepareAnnotationDefinition in core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
Prepares the annotation definition.
AnnotatedClassDiscoveryAutomatedProviders::prepareAnnotationDefinition in core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php
Prepares the annotation definition.

File

core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php, line 105

Class

AnnotatedClassDiscovery
Defines a discovery mechanism to find annotated plugins in PSR-4 namespaces.

Namespace

Drupal\Core\Plugin\Discovery

Code

protected function getProviderFromNamespace($namespace) {
    preg_match('|^Drupal\\\\(?<provider>[\\w]+)\\\\|', $namespace, $matches);
    if (isset($matches['provider'])) {
        return mb_strtolower($matches['provider']);
    }
    return NULL;
}

API Navigation

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