Task/Collect/PluginTypesCollector.php
protected function getClassComponentNamespace($class_name) {
    $pieces = explode('\\', $class_name);

    if (!isset($pieces[1])) {
      // We don't know about something that is in the global namespace.
      return '';
    }

    if ($pieces[1] == 'Core' || $pieces[1] == 'Component') {
      return implode('\\', array_slice($pieces, 0, 3));
    }
    else {
      return implode('\\', array_slice($pieces, 0, 2));
    }
  }
protected function getClassComponentNamespace($class_name) {
    $pieces = explode('\\', $class_name);

    if (!isset($pieces[1])) {
      // We don't know about something that is in the global namespace.
      return '';
    }

    if ($pieces[1] == 'Core' || $pieces[1] == 'Component') {
      return implode('\\', array_slice($pieces, 0, 3));
    }
    else {
      return implode('\\', array_slice($pieces, 0, 2));
    }
  }
protected function getClassComponentNamespace ( $ class_name ) { $ pieces = explode ( '\\' , $ class_name ) ; if ( ! isset ( $ pieces [ 1 ] ) ) { // We don't know about something that is in the global namespace. return '' ; } if ( $ pieces [ 1 ] == 'Core' || $ pieces [ 1 ] == 'Component' ) { return implode ( '\\' , array_slice ( $ pieces , 0 , 3 ) ) ; } else { return implode ( '\\' , array_slice ( $ pieces , 0 , 2 ) ) ; } }
Gets the namespace for the component a class is in.

This is either a module namespace, or a core component namespace, e.g.:
- 'Drupal\foo'
- 'Drupal\Core\Foo'
- 'Drupal\Component\Foo'

@param string $class_name
The class name.

@return string
The namespace, or an empty string if nothing found.
Gets the namespace for the component a class is in .