You are here

protected function DrupalKernel::classLoaderAddMultiplePsr4 in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::classLoaderAddMultiplePsr4()

Registers a list of namespaces with PSR-4 directories for class loading.

Parameters

array $namespaces: Array where each key is a namespace like 'Drupal\system', and each value is either a PSR-4 base directory, or an array of PSR-4 base directories associated with this namespace.

2 calls to DrupalKernel::classLoaderAddMultiplePsr4()
DrupalKernel::attachSynthetic in core/lib/Drupal/Core/DrupalKernel.php
Attach synthetic values on to kernel.
DrupalKernel::discoverServiceProviders in core/lib/Drupal/Core/DrupalKernel.php
Discovers available serviceProviders.

File

core/lib/Drupal/Core/DrupalKernel.php, line 1349
Contains \Drupal\Core\DrupalKernel.

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function classLoaderAddMultiplePsr4(array $namespaces = array()) {
  foreach ($namespaces as $prefix => $paths) {
    if (is_array($paths)) {
      foreach ($paths as $key => $value) {
        $paths[$key] = $this->root . '/' . $value;
      }
    }
    elseif (is_string($paths)) {
      $paths = $this->root . '/' . $paths;
    }
    $this->classLoader
      ->addPsr4($prefix . '\\', $paths);
  }
}