|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Leonidas\Library\System\Model\PostType; |
|
4
|
|
|
|
|
5
|
|
|
use Leonidas\Contracts\System\Model\PostType\PostTypeInterface; |
|
6
|
|
|
use WP_Post_Type; |
|
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
class AdaptedPostType implements PostTypeInterface |
|
9
|
|
|
{ |
|
10
|
|
|
protected WP_Post_Type $postType; |
|
11
|
|
|
|
|
12
|
|
|
public function __construct(WP_Post_Type $postType) |
|
13
|
|
|
{ |
|
14
|
|
|
$this->postType = $postType; |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
public function getName(): string |
|
18
|
|
|
{ |
|
19
|
|
|
return $this->postType->name; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function getLabel(): string |
|
23
|
|
|
{ |
|
24
|
|
|
return $this->postType->label; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function getDescription(): string |
|
28
|
|
|
{ |
|
29
|
|
|
return $this->postType->description; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function isPublic(): bool |
|
33
|
|
|
{ |
|
34
|
|
|
return $this->postType->public; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function getPubliclyQueryable(): bool |
|
38
|
|
|
{ |
|
39
|
|
|
return $this->postType->publicly_queryable; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function getShowUi(): bool |
|
43
|
|
|
{ |
|
44
|
|
|
return $this->postType->show_ui; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function getShowInMenu(): bool |
|
48
|
|
|
{ |
|
49
|
|
|
return $this->postType->show_in_menu; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function getMenuPosition(): ?int |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->postType->menu_position; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getMenuIcon(): ?string |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->postType->menu_icon; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function getCapabilityType(): string |
|
63
|
|
|
{ |
|
64
|
|
|
return $this->postType->capability_type; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function getSupports(): array |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->postType->supports; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function getTaxonomies(): array |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->postType->taxonomies; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function getArchive(): ?string |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->postType->has_archive; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function canBeExported(): bool |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->postType->can_export; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function isDeletedWithUser(): ?bool |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->postType->delete_with_user; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function getTemplate(): array |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->postType->template; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function getTemplateLock(): ?string |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->postType->template_lock; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public function isExcludedFromSearch(): bool |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->postType->exclude_from_search; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function isAllowedInAdminBar(): bool |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->postType->show_in_admin_bar; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
public function allowsMetaCapMapping(): bool |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->postType->map_meta_cap; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
public function getRegisterMetaBoxCb(): ?callable |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->postType->register_meta_box_cb; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
public function getRewrite(): array |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->postType->rewrite; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
public function getQueryVar(): string |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->postType->query_var; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
public function isAllowedInNavMenus(): bool |
|
133
|
|
|
{ |
|
134
|
|
|
return $this->postType->show_in_nav_menus; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
public function getRestBase(): string |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->postType->rest_base; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
public function getRestControllerClass(): string |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->postType->rest_controller_class; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
public function isAllowedInRest(): bool |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->postType->show_in_rest; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
public function isAllowedInUi(): bool |
|
153
|
|
|
{ |
|
154
|
|
|
return $this->postType->show_ui; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
public function getLabels(): array |
|
158
|
|
|
{ |
|
159
|
|
|
return (array) $this->postType->labels; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
public function getSingularLabel(): string |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->postType->labels->singular_name; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
public function getPluralLabel(): string |
|
168
|
|
|
{ |
|
169
|
|
|
return $this->postType->labels->name; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
public function getRestNamespace(): string |
|
173
|
|
|
{ |
|
174
|
|
|
return $this->postType->rest_namespace; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
public function getCapabilities(): array |
|
178
|
|
|
{ |
|
179
|
|
|
return (array) $this->postType->cap; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
public function getDisplayedInMenu() |
|
183
|
|
|
{ |
|
184
|
|
|
return $this->postType->show_in_menu; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
public function getOptions(): array |
|
188
|
|
|
{ |
|
189
|
|
|
return $this->postType->options ?? []; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
public function isHierarchical(): bool |
|
193
|
|
|
{ |
|
194
|
|
|
return $this->postType->hierarchical; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
public function isPubliclyQueryable(): bool |
|
198
|
|
|
{ |
|
199
|
|
|
return $this->postType->publicly_queryable; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
public static function fromName(string $name): PostTypeInterface |
|
203
|
|
|
{ |
|
204
|
|
|
return new self(get_post_type_object($name)); |
|
|
|
|
|
|
205
|
|
|
} |
|
206
|
|
|
} |
|
207
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths