devel_wizard-2.x-dev/templates/php/devel_wizard.php.class.body.php.twig

templates/php/devel_wizard.php.class.body.php.twig
{#
  type string class|interface|trait

  body.*.phpdoc           string
  body.*.type             string property|method
  body.*.modifier         string abstract|final
  body.*.visibility       string public|protected|private
  body.*.isStatic         bool
  body.*.name             string custom name
  body.*.params           array @todo
  body.*.isReturnNullable bool
  body.*.returnTypes      array @todo
  body.*.body             string
#}
{%- import "@devel_wizard/devel_wizard.utils.twig" as utils -%}
{%- autoescape false -%}
{%- for item in body -%}
{%- include '@devel_wizard/php/devel_wizard.php.phpdoc.php.twig' with {'phpdoc': item.phpdoc} %}
{%- if item.type == 'constant' ~%}

  const {{ item.name }} = {{ item.body|raw }};
{%- elseif item.type == 'property' ~%}

  {{ item.visibility|default('protected') }}
  {{- item.isStatic ? ' static' : '' }}{{ utils.typehint(item.returnTypes, item.isReturnNullable, ' ') }} ${{ item.name }}
  {{- item.body ? ' = ' ~ item.body|raw : '' }};
{%- elseif item.type == 'method' ~%}

  {% set hasBody = type != 'interface' and type.modifier != 'abstract' %}
{% if item.modifier %}{{ item.modifier }} {% endif %}
  {{- item.visibility|default('public') }}
{%- if item.isStatic %} static{% endif %} function {{ item.name }}(
{%- for param in item.params -%}
  {{- loop.first ? '' : ', ' -}}
  {{- utils.typehint(param.types, param.isNullable, '') -}}
  {{- '$' ~ param.name -}}
  {{- param.body ? ' = ' ~ param.body : '' -}}
{%- endfor -%})
    {{- utils.typehint(item.returnTypes, item.isReturnNullable, ': ') }}
    {%- if hasBody %} {
      {{ item.body|raw }}
    }
    {%- else -%}
      ;
    {%- endif %}
  {% endif %}
{% endfor -%}
{% endautoescape -%}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc