You are here

SitePathFactory.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/lib/Drupal/Core/SitePathFactory.php

Namespace

Drupal\Core

File

core/lib/Drupal/Core/SitePathFactory.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Core\SitePathFactory.
 */
namespace Drupal\Core;


/**
 * Gets the site path from the kernel.
 */
class SitePathFactory {

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

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

  /**
   * Gets the site path.
   *
   * @return string
   *   The site path.
   */
  public function get() {
    return $this->drupalKernel
      ->getSitePath();
  }

}

Classes

Namesort descending Description
SitePathFactory Gets the site path from the kernel.