function ServiceWithDependency::greet
Same name in other branches
- 9 core/modules/system/tests/modules/new_dependency_test/src/ServiceWithDependency.php \Drupal\new_dependency_test\ServiceWithDependency::greet()
- 8.9.x core/modules/system/tests/modules/new_dependency_test/src/ServiceWithDependency.php \Drupal\new_dependency_test\ServiceWithDependency::greet()
- 10 core/modules/system/tests/modules/new_dependency_test/src/ServiceWithDependency.php \Drupal\new_dependency_test\ServiceWithDependency::greet()
Gets a greeting from the injected service and adds to it.
Return value
string The greeting.
File
-
core/
modules/ system/ tests/ modules/ new_dependency_test/ src/ ServiceWithDependency.php, line 37
Class
- ServiceWithDependency
- Service that gets the other service of the same module injected.
Namespace
Drupal\new_dependency_testCode
public function greet() {
if (isset($this->service)) {
return $this->service
->greet() . ' World';
}
return 'Sorry, no service.';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.