1{% macro class_item(class, short = false, indent = "") -%}
2{{ indent }}{{ _self.class_name(class, short) }}{% if class.shortdesc %} -- {{ class.shortdesc }}{% endif %}
3{%- endmacro -%}
4
5{% macro class_name(class, short = false, suffix = "") -%}
6{% spaceless -%}
7{% if class.projectclass or class.phpclass %}
8{% if class.projectclass %}
9<<{{_self.replace_backslash( (short ? class.shortname : class)~suffix) }},{{ class }}>>
10{% else %}
11http://php.net/class.{{ class }}[{{ short ? class.shortname : class }}{{ suffix }}]
12{% endif %})
13{% else %}
14`{{ class }}`
15{% endif %}
16{%- endspaceless %}
17{%- endmacro -%}
18
19{% macro class_type(class, sentence = false) -%}
20{% spaceless %}
21{% if class.interface %}
22{% if sentence %}an {% endif %}
23interface
24{%- else -%}
25{% if sentence %}{% if class.abstract %}an{% else %}a{% endif %} {% endif %}
26{% if class.abstract %}abstract {% endif %}
27class
28{%- endif -%}
29{% endspaceless %}
30{%- endmacro -%}
31
32{% macro hint(hint) -%}
33{% spaceless %}
34{% if hint.class -%}
35{{ _self.class_name(hint.name) }}
36{%- elseif hint.name -%}
37{{ hint.name }}
38{%- endif %}
39{% endspaceless %}
40{%- endmacro -%}
41
42{% macro markdown_path(path) -%}
43{% spaceless %}
44{{- path|replace({".html": ".md"}) -}}
45{% endspaceless %}
46{%- endmacro -%}
47
48{% macro replace_backslash(path) -%}
49    {% spaceless %}
50        {{- path|replace({"\\": "_"}) -}}
51    {% endspaceless %}
52{%- endmacro -%}
53
54{% macro back_to_forward(path) -%}
55    {% spaceless %}
56        {{- path|replace({"\\": "/"}) -}}
57    {% endspaceless %}
58{%- endmacro -%}
59
60{% macro sanitize(path) -%}
61    {% spaceless %}
62        {{- path|replace({"$": "", "::": "", "__": "-"}) -}}
63    {% endspaceless %}
64{%- endmacro -%}
65
66{% macro get_namespace(class) -%}
67    {% spaceless %}
68        {% if class.shortname == 'Client' %}
69            $client
70        {% else %}
71            $client->{{ class.shortname|lower|replace({"namespace": ""}) }}()
72        {% endif %}
73    {% endspaceless %}
74{%- endmacro -%}
75
76
77
78{% macro param_list(member) -%}
79    {% spaceless %}
80        {% for parameter in member.parameters %}${{ parameter.name }},{% endfor %}
81    {% endspaceless %}
82{%- endmacro -%}
83
84{% macro member_signature(type, member) -%}
85* It is a **{{ _self.member_visibility(member) }}{% if member.abstract is defined and member.abstract %} abstract{% endif %}** {{ type }}.
86{% if member.final %}
87* It is a **finalized** {{ type }}.
88{% endif %}
89{% if "property" == type %}
90{% if member.hint|length > 1 %}
91* It can be one of the following types:
92{%- for hint in member.hint %}
93
94    * {{ _self.hint(hint) }}
95{%- endfor -%}
96{%- elseif member.hint|length > 0 %}
97* It is a(n) {{ _self.hint(member.hint[0]) }} value.
98{%- else %}
99* Its type is not specified.
100{% endif %}
101{% elseif "method" == type %}
102{% if member.parameters %}
103* It accepts the following parameter(s):
104{% for parameter in member.parameters %}
105    * `${{ parameter.name }}`{% if parameter.hint %} ({% for hint in parameter.hint %}{{ _self.hint(hint) }}{% if not loop.last %}|{% endif %}{% endfor %}){% endif %}{% if parameter.shortdesc %} -- {{ parameter.shortdesc }}{% endif %}
106
107{% endfor %}
108{% endif %}
109{% if (member.hint|length > 1) or member.hintDesc %}
110{% if member.hintDesc %}
111* _Returns:_ {{ member.hintDesc }}
112{% else %}
113* It can return one of the following values:
114{% endif %}
115{% for hint in member.hint %}
116    * {{ _self.hint(hint) }}
117{% endfor -%}
118{% elseif member.hint|length > 0 %}
119* It returns a(n) {{ _self.hint(member.hint[0]) }} value.
120{% else %}
121* It does not return anything.
122{% endif %}
123{% if member.exceptions %}
124* It throws one of the following exceptions:
125{% for exception in member.exceptions %}
126    * {{ _self.class_name(exception[0]) }}{% if exception[1] is defined and exception[1] is not empty %} -- {{ exception[1] }}{% endif %}
127
128{% endfor %}
129{% endif %}
130{% endif %}
131{%- endmacro -%}
132
133{% macro member_visibility(member) -%}
134{% spaceless %}
135{% if member.private %}private{% elseif member.protected %}protected{% else %}public{% endif %}
136{% if member.static %} static{% endif %}
137{% endspaceless %}
138{%- endmacro -%}
139