StringTranslationTrait allow to get t() and formatPlural() methods
Example: use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
class MyClass {
The structure of the examples are like: namespace Drupal\mymodule\Tools;
class MyTools extends MyToolsBase {
...
}
...
class MyToolsBase {
public function showClass() {
$class_name = ....
Different between self:: and static (Late Static Bindings)
Static references to the current class like self:: or __CLASS__ are resolved using the class in which the function belongs, as in where it was defined.