You are here

class Service in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/new_dependency_test/src/Service.php \Drupal\new_dependency_test\Service

A service that can decorated itself.

Hierarchy

  • class \Drupal\new_dependency_test\Service

Expanded class hierarchy of Service

See also

new_dependency_test.services.yml

1 string reference to 'Service'
new_dependency_test.services.yml in core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml
core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml
4 services use Service
new_dependency_test.another_service in core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml
Drupal\new_dependency_test\Service
new_dependency_test.another_service.decorated in core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml
Drupal\new_dependency_test\Service
new_dependency_test.another_service_two in core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml
Drupal\new_dependency_test\Service
new_dependency_test.another_service_two.decorated in core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml
Drupal\new_dependency_test\Service

File

core/modules/system/tests/modules/new_dependency_test/src/Service.php, line 10

Namespace

Drupal\new_dependency_test
View source
class Service {

  /**
   * The decorated service.
   *
   * @var \Drupal\new_dependency_test\Service
   */
  protected $inner;

  /**
   * Service constructor.
   *
   * @param \Drupal\new_dependency_test\Service|null $inner
   *   The service to decorate.
   */
  public function __construct(Service $inner = NULL) {
    $this->inner = $inner;
  }

  /**
   * Determines if the service is decorated.
   *
   * @return bool
   *   TRUE if the services is decorated, FALSE if not.
   */
  public function isDecorated() {
    return isset($this->inner);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Service::$inner protected property The decorated service.
Service::isDecorated public function Determines if the service is decorated.
Service::__construct public function Service constructor.