class ExampleService in Coder 8.2
Same name and namespace in other branches
- 8.3 tests/DrupalPractice/Objects/drupal8/ExampleService.php \Drupal\testmodule\ExampleService
- 8.3.x tests/DrupalPractice/Objects/drupal8/ExampleService.php \Drupal\testmodule\ExampleService
Some service.
Hierarchy
- class \Drupal\testmodule\ExampleService
Expanded class hierarchy of ExampleService
1 string reference to 'ExampleService'
- testmodule.services.yml in coder_sniffer/
DrupalPractice/ Test/ Objects/ testmodule.services.yml - coder_sniffer/DrupalPractice/Test/Objects/testmodule.services.yml
1 service uses ExampleService
- testmodule.example in coder_sniffer/
DrupalPractice/ Test/ Objects/ testmodule.services.yml - Drupal\testmodule\ExampleService
File
- coder_sniffer/
DrupalPractice/ Test/ Objects/ src/ ExampleService.php, line 10
Namespace
Drupal\testmoduleView source
class ExampleService {
/**
* Using \Drupal here but it should be injected instead.
*/
public function test() {
return \Drupal::configFactory();
}
/**
* Loading nodes should be done from an injected service.
*/
public function test2() {
return Node::load(1);
}
/**
* t() should not be used, translation service should be injected.
*/
public function test3() {
return t('Test');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExampleService:: |
public | function | Using \Drupal here but it should be injected instead. | |
ExampleService:: |
public | function | Loading nodes should be done from an injected service. | |
ExampleService:: |
public | function | t() should not be used, translation service should be injected. |