protected function AnnotatedClassDiscovery::getProviderFromNamespace in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getProviderFromNamespace()
- 9 core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\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.
1 call to AnnotatedClassDiscovery::getProviderFromNamespace()
- AnnotatedClassDiscovery::prepareAnnotationDefinition in core/lib/ Drupal/ Core/ Plugin/ Discovery/ AnnotatedClassDiscovery.php 
File
- core/lib/ Drupal/ Core/ Plugin/ Discovery/ AnnotatedClassDiscovery.php, line 101 
Class
- AnnotatedClassDiscovery
- Defines a discovery mechanism to find annotated plugins in PSR-4 namespaces.
Namespace
Drupal\Core\Plugin\DiscoveryCode
protected function getProviderFromNamespace($namespace) {
  preg_match('|^Drupal\\\\(?<provider>[\\w]+)\\\\|', $namespace, $matches);
  if (isset($matches['provider'])) {
    return mb_strtolower($matches['provider']);
  }
  return NULL;
}