Version 1
[yaffs-website] / vendor / drupal / console / templates / module / src / TwigExtension / twig-extension.php.twig
diff --git a/vendor/drupal/console/templates/module/src/TwigExtension/twig-extension.php.twig b/vendor/drupal/console/templates/module/src/TwigExtension/twig-extension.php.twig
new file mode 100644 (file)
index 0000000..5b6f547
--- /dev/null
@@ -0,0 +1,98 @@
+{% extends "base/class.php.twig" %}
+
+{% block file_path %}
+\Drupal\{{module}}\TwigExtension\{{ class }}.
+{% endblock %}
+
+{% block namespace_class %}
+namespace Drupal\{{module}}\TwigExtension;
+{% endblock %}
+
+{% block use_class %}
+{% endblock %}
+
+{% block class_declaration %}
+/**
+ * Class {{ class }}.
+ *
+ * @package Drupal\{{module}}
+ */
+class {{ class }} extends \Twig_Extension {% endblock %}
+
+{% set properties = services[1:] %}
+{% block class_properties %}
+    {% for service in properties %}
+
+   /**
+    * {{ service.class }} definition.
+    *
+    * @var \{{ service.class }}
+    */
+    protected ${{service.camel_case_name}};
+    {% endfor %}
+{% endblock %}
+
+{% block class_construct %}
+    {% if services|length > 1 %}
+
+   /**
+    * Constructor.
+    */
+    public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
+        parent::__construct($renderer);
+    {{ serviceClassInitialization(properties) }}
+    }
+    {% endif %}
+{% endblock %}
+
+{% block class_methods %}
+
+   /**
+    * {@inheritdoc}
+    */
+    public function getTokenParsers() {
+      return [];
+    }
+
+   /**
+    * {@inheritdoc}
+    */
+    public function getNodeVisitors() {
+      return [];
+    }
+
+   /**
+    * {@inheritdoc}
+    */
+    public function getFilters() {
+      return [];
+    }
+
+   /**
+    * {@inheritdoc}
+    */
+    public function getTests() {
+      return [];
+    }
+
+   /**
+    * {@inheritdoc}
+    */
+    public function getFunctions() {
+      return [];
+    }
+
+   /**
+    * {@inheritdoc}
+    */
+    public function getOperators() {
+      return [];
+    }
+
+   /**
+    * {@inheritdoc}
+    */
+    public function getName() {
+      return '{{ name }}';
+    }
+{% endblock %}