This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/vendor/chi-teck/drupal-code-generator/templates/lib/di.twig
2018-11-23 12:29:20 +00:00

47 lines
1.3 KiB
Twig

{% macro arguments(services) %}
{% for service_id, service in services %}'@{{ service_id }}'{{ loop.last ? '' : ', ' }}{% endfor %}
{% endmacro %}
{% macro use(services) %}
{% sort %}
{% for service in services %}
use {{ service.type }};
{% endfor %}
{% endsort %}
{% endmacro %}
{% macro properties(services) %}
{% for service in services %}
/**
* {{ service.description }}
*
* @var \{{ service.type }}
*/
protected ${{ service.name|camelize(false) }};{{ loop.last ? '' : "\n\n" }}
{%- endfor %}
{% endmacro %}
{% macro annotation(services) %}
{% for service in services %}
* @param \{{ service.type }} ${{ service.name }}
* {{ service.description }}{{ loop.last ? '' : "\n" }}
{%- endfor %}
{% endmacro %}
{% macro signature(services) %}
{% for service in services %}{{ service.short_type }} ${{ service.name }}{{ loop.last ? '' : ', ' }}{% endfor %}
{% endmacro %}
{% macro assignment(services) %}
{% for service in services %}
$this->{{ service.name|camelize(false) }} = ${{ service.name }};{{ loop.last ? '' : "\n" }}
{%- endfor %}
{% endmacro %}
{% macro container(services) %}
{% for service_id, service in services %}
$container->get('{{ service_id }}'){{ loop.last ? '' : ",\n" }}
{%- endfor %}
{% endmacro %}