summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/SitePathFactory.php
blob: 7a01ff17a4a6fd8058ea6cb546c704597c9cecc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

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();
  }

}