adminerevo/docs/phpdoc-template/method.md.twig
Gerry Demaret 762a8948b9 docs: WiP - phpdocumentor templates
This is mainly to not lose what I have so far. The idea is to run
phpdocumentor on a select number of source code files, with the goal
of rendering something like https://www.adminer.org/en/extension/

The output should be in Markdown, ideally injected into a file in the
docs/ folder, and auto-deployed to the docs website.
2023-08-14 14:42:09 +02:00

53 lines
1.6 KiB
Twig

### {{ class.name }}::{{ method.name }}
{{ method.summary|raw }}
{# Method signature #}
```php
{{ class.name }}::{{ method.name }}( {% for argument in method.arguments %}
{{- argument.types ? argument.types|join('|')~' ' }}
{{- argument.byReference ? '&' }}
{{- argument.name }}{{ argument.default ? (' = '~argument.default)|raw }}
{%- if not loop.last %}, {% endif %}
{%- endfor %} )
{{- method.response.types ? ': '~method.response.types|join('|') }}
```
{{ method.description|raw }}
{% if method.static %}* This method is **static**.{% endif %}
{% if method.deprecated %}* **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version.
{% endif %}
{% if method.arguments is not empty %}
**Parameters:**
| Parameter | Type | Description |
|-----------|------|-------------|
{% for argument in method.arguments %}
| `{{ argument.name }}` | **{{ argument.types ? argument.types|join('\\|')|raw|replace({'|': '\\|'}) }}** | {{ argument.description|raw|replace({'|': '\\|'}) }} |
{% endfor %}
{% endif %}{# method.arguments is not empty #}
{% if method.response.description %}
**Return Value:**
{{ method.response.description|raw }}
{% endif %}
{% if method.tags.see is not empty or method.tags.link is not empty %}
**See Also:**
{% for see in method.tags.see %}
* {{ see.reference }} {% if see.description %}- {{ see.description|raw }}{% endif %}
{% endfor %}
{% for link in method.tags.link %}
* {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description|raw }}{% endif %}
{% endfor %}
{% endif %}{# method.tags.see || method.tags.link #}
---