1. 8.5.x core/lib/Drupal/Core/AppRootFactory.php AppRootFactory
  2. 8.0.x core/lib/Drupal/Core/AppRootFactory.php AppRootFactory
  3. 8.1.x core/lib/Drupal/Core/AppRootFactory.php AppRootFactory
  4. 8.2.x core/lib/Drupal/Core/AppRootFactory.php AppRootFactory
  5. 8.3.x core/lib/Drupal/Core/AppRootFactory.php AppRootFactory
  6. 8.4.x core/lib/Drupal/Core/AppRootFactory.php AppRootFactory
  7. 8.6.x core/lib/Drupal/Core/AppRootFactory.php AppRootFactory

Gets the app root from the kernel.

Hierarchy

Expanded class hierarchy of AppRootFactory

1 string reference to 'AppRootFactory'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses AppRootFactory

File

core/lib/Drupal/Core/AppRootFactory.php, line 8

Namespace

Drupal\Core
View source
class AppRootFactory {

  /**
   * The Drupal kernel.
   *
   * @var \Drupal\Core\DrupalKernelInterface
   */
  protected $drupalKernel;

  /**
   * Constructs an AppRootFactory instance.
   *
   * @param \Drupal\Core\DrupalKernelInterface $drupal_kernel
   *   The Drupal kernel.
   */
  public function __construct(DrupalKernelInterface $drupal_kernel) {
    $this->drupalKernel = $drupal_kernel;
  }

  /**
   * Gets the app root.
   *
   * @return string
   */
  public function get() {
    return $this->drupalKernel
      ->getAppRoot();
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
AppRootFactory::$drupalKernel protected property The Drupal kernel.
AppRootFactory::get public function Gets the app root.
AppRootFactory::__construct public function Constructs an AppRootFactory instance.