Skip to content

Commit b7cdd1d

Browse files
committed
🔥 Remove exclusion of private members
Members visibility should be configured in the project :new: :memo: Note in README about `visibility`
1 parent 67f9ace commit b7cdd1d

File tree

5 files changed

+32
-14
lines changed

5 files changed

+32
-14
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Add a file called `phpdoc.xml` with the following content to the root of your pr
4848
<title>My Project Documentation</title>
4949
<parser>
5050
<target>output/doc</target>
51+
<visibility>public,protected</visibility>
5152
</parser>
5253
<transformer>
5354
<target>docs/api</target>
@@ -61,8 +62,31 @@ Add a file called `phpdoc.xml` with the following content to the root of your pr
6162
</phpdoc>
6263
```
6364

64-
More information about [configuring phpDocumentor](http://www.phpdoc.org/docs/latest/references/configuration.html).
65+
**Default visibility**
66+
By default, all members are parsed. If you want to ignore the private members, you should config the `visibility` option of `phpdoc`:
67+
68+
```xml
69+
<parser>
70+
<!-- Only Public and Protected members are parsed -->
71+
<visibility>public,protected</visibility>
72+
</parser>
73+
```
6574

75+
```xml
76+
<parser>
77+
<!-- Only Public members are parsed -->
78+
<visibility>public</visibility>
79+
</parser>
80+
```
81+
82+
```xml
83+
<parser>
84+
<!-- Only private members are parsed -->
85+
<visibility>private</visibility>
86+
</parser>
87+
```
88+
89+
More information about [configuring phpDocumentor](http://www.phpdoc.org/docs/latest/references/configuration.html).
6690

6791
### Configure routes in VuePress
6892

data/templates/vuepress/class.md.twig

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@
9797
{# Lista de métodos públicos y protegidos #}
9898
{% for method in class.methods|sort_asc %}
9999
{% set methodsList = methodsList|merge([method.name]) %}
100-
{% if method.visibility != 'private' %}
101100
{% include 'method.md.twig' %}
102-
{% endif %}
103101
{% else %}
104102
> This class has not methods.
105103
{% endfor %}
@@ -115,21 +113,19 @@
115113
{%- set parent_location = 'traits' %}
116114
{%- endif %}
117115

118-
{%- if method.visibility != 'private' %}
119116
- [{{ method.parent.namespace|trim('\\') -}}\\<span style="font-weight: bold;">{{ method.parent.name }}</span>](/api/{{ parent_location }}.html#
120117
{{- method.parent|trim('\\')|lower|replace('\\', '-') -}}
121118
)::
122119
{{- include('method-anchor-link.md.twig', { text: method.name ~ '()' }) -}}
123120
{{ include('badges.md.twig', { elem: method }) }}
124-
{% endif %}
125121
{% else %}
126122
> This class has not inherited methods.
127123
{% endfor %}
128124

129125
{% set propertiesList = [] %}
130126
### <span style="display: none;">{{ class }}</span> Properties
131127
{# Lista de propiedades públicas y protegidas #}
132-
{% for property in class.properties|merge(class.magicProperties|default([]))|sort_asc if property.visibility != 'private' %}
128+
{% for property in class.properties|merge(class.magicProperties|default([]))|sort_asc %}
133129
{% set propertiesList = propertiesList|merge([property.name]) %}
134130
{% include 'property.md.twig' %}
135131
{% else %}
@@ -138,7 +134,7 @@
138134

139135
#### <span style="display: none;">{{ class }}</span> Inherited properties
140136
{# Lista de métodos públicos y protegidos #}
141-
{% for property in class.inheritedProperties if property.name not in propertiesList and property.visibility != 'private'-%}
137+
{% for property in class.inheritedProperties if property.name not in propertiesList -%}
142138
{%- if property.parent in project.indexes.classes %}
143139
{%- set parent_location = 'classes' %}
144140
{%- elseif property.parent in project.indexes.interfaces %}

data/templates/vuepress/index.md.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ This represents a `public` member.
2121
This represents a `protected` member.
2222
:::
2323

24+
::: danger Private member
25+
This represents a `protected` member.
26+
:::
27+
2428
### Badges
2529

2630
- Applied to any `abstract` class or method: <Badge text="abstract" />

data/templates/vuepress/interface.md.twig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@
5858
### <span style="display: none;">{{ interface }}</span> Methods
5959
{# Lista de métodos públicos y protegidos #}
6060
{% for method in interface.methods|sort_asc %}
61-
{% if method.visibility != 'private' %}
6261
{% include 'method.md.twig' %}
63-
{% endif %}
6462
{% else %}
6563
> This interface has not methods.
6664
{% endfor %}

data/templates/vuepress/trait.md.twig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,26 @@
6060
### <span style="display: none;">{{ trait }}</span> Methods
6161
{# Lista de métodos públicos y protegidos #}
6262
{% for method in trait.methods|sort_asc %}
63-
{% if method.visibility != 'private' %}
6463
{% include 'method.md.twig' %}
65-
{% endif %}
6664
{% else %}
6765
> This trait has not methods.
6866
{% endfor %}
6967

7068
#### <span style="display: none;">{{ trait }}</span> Inherited methods
7169
{# Lista de métodos públicos y protegidos #}
7270
{% for method in trait.inheritedMethods -%}
73-
{%- if method.visibility != 'private' %}
7471
- [{{ method.parent.namespace|trim('\\') -}}\\<span style="font-weight: bold;">{{ method.parent.name }}</span>](/api/traits.html#
7572
{{- method.parent|trim('\\')|lower|replace('\\', '-') -}}
7673
)::
7774
{{- include('method-anchor-link.md.twig', { text: method.name ~ '()' }) }} {{ include('badges.md.twig', { elem: method }) }}
78-
{% endif %}
7975
{% else %}
8076
> This trait has not inherited methods.
8177
{% endfor %}
8278

8379
{% set propertiesList = [] %}
8480
### <span style="display: none;">{{ trait }}</span> Properties
8581
{# Lista de propiedades públicas y protegidas #}
86-
{% for property in trait.properties|merge(trait.magicProperties)|sort_asc if property.visibility != 'private' %}
82+
{% for property in trait.properties|merge(trait.magicProperties)|sort_asc %}
8783
{% set propertiesList = propertiesList|merge([property.name]) %}
8884
{% include 'property.md.twig' %}
8985
{% else %}

0 commit comments

Comments
 (0)