AdaptedTaxonomy::getShowInNavMenus()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Leonidas\Library\System\Model\Taxonomy;
4
5
use Leonidas\Contracts\System\Model\Taxonomy\TaxonomyInterface;
6
use WP_Taxonomy;
0 ignored issues
show
Bug introduced by
The type WP_Taxonomy was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class AdaptedTaxonomy implements TaxonomyInterface
9
{
10
    protected WP_Taxonomy $taxonomy;
11
12
    public function __construct(WP_Taxonomy $taxonomy)
13
    {
14
        $this->taxonomy = $taxonomy;
15
    }
16
17
    public function getName(): string
18
    {
19
        return $this->taxonomy->name;
20
    }
21
22
    public function getObjectTypes(): array
23
    {
24
        return $this->taxonomy->object_type;
25
    }
26
27
    public function getLabels(): array
28
    {
29
        return (array) $this->taxonomy->labels;
30
    }
31
32
    public function getPluralLabel(): string
33
    {
34
        return $this->taxonomy->labels->name;
35
    }
36
37
    public function getSingularLabel(): string
38
    {
39
        return $this->taxonomy->labels->singular_name;
40
    }
41
42
    public function getDescription(): string
43
    {
44
        return $this->taxonomy->description;
45
    }
46
47
    public function isHierarchical(): bool
48
    {
49
        return $this->taxonomy->hierarchical;
50
    }
51
52
    public function getRewrite(): array
53
    {
54
        return (array) $this->taxonomy->rewrite;
55
    }
56
57
    public function getQueryVar(): string
58
    {
59
        return $this->taxonomy->query_var;
60
    }
61
62
    public function getObjectType(): array
63
    {
64
        return (array) $this->taxonomy->object_type;
65
    }
66
67
    public function getShowUi(): bool
68
    {
69
        return $this->taxonomy->show_ui;
70
    }
71
72
    public function getShowInMenu(): bool
73
    {
74
        return $this->taxonomy->show_in_menu;
75
    }
76
77
    public function getShowInNavMenus(): bool
78
    {
79
        return $this->taxonomy->show_in_nav_menus;
80
    }
81
82
    public function getShowTagCloud(): bool
83
    {
84
        return $this->taxonomy->show_tagcloud;
85
    }
86
87
    public function getShowInQuickEdit(): bool
88
    {
89
        return $this->taxonomy->show_in_quick_edit;
90
    }
91
92
    public function getShowAdminColumn(): bool
93
    {
94
        return $this->taxonomy->show_admin_column;
95
    }
96
97
    public function getMetaBoxCallback(): ?callable
98
    {
99
        return $this->taxonomy->meta_box_cb;
100
    }
101
102
    public function getCapabilities(): array
103
    {
104
        return (array) $this->taxonomy->cap;
105
    }
106
107
    public function getRestBase(): string
108
    {
109
        return $this->taxonomy->rest_base;
110
    }
111
112
    public function getRestControllerClass(): string
113
    {
114
        return $this->taxonomy->rest_controller_class;
115
    }
116
117
    public function isAllowedInRest(): bool
118
    {
119
        return $this->taxonomy->show_in_rest;
120
    }
121
122
    public function isAllowedInNavMenus(): bool
123
    {
124
        return $this->taxonomy->show_in_nav_menus;
125
    }
126
127
    public function isAllowedInTagCloud(): bool
128
    {
129
        return $this->taxonomy->show_tagcloud;
130
    }
131
132
    public function isAllowedInQuickEdit(): bool
133
    {
134
        return $this->taxonomy->show_in_quick_edit;
135
    }
136
137
    public function canHaveAdminColumn(): bool
138
    {
139
        return $this->taxonomy->show_admin_column;
140
    }
141
142
    public function getMetaBoxCb(): ?callable
143
    {
144
        return $this->taxonomy->meta_box_cb;
145
    }
146
147
    public function getMetaBoxSanitizeCb(): ?callable
148
    {
149
        return $this->taxonomy->meta_box_sanitize_cb;
150
    }
151
152
    public function getUpdateCountCallback(): ?callable
153
    {
154
        return $this->taxonomy->update_count_callback;
155
    }
156
157
    public function getDefaultTerm(): ?string
158
    {
159
        return $this->taxonomy->default_term;
160
    }
161
162
    public function shouldBeSorted(): ?bool
163
    {
164
        return $this->taxonomy->sort;
165
    }
166
167
    public function getArgs(): ?array
168
    {
169
        return $this->taxonomy->args;
170
    }
171
172
    public function isAllowedInUi(): bool
173
    {
174
        return $this->taxonomy->show_ui;
175
    }
176
177
    public function isAllowedInAdmin(): bool
178
    {
179
        return $this->taxonomy->show_admin_column;
180
    }
181
182
    public function isAllowedInAdminMenu(): bool
183
    {
184
        return $this->taxonomy->show_in_menu;
185
    }
186
187
    public function isAllowedInAdminNavMenu(): bool
188
    {
189
        return $this->taxonomy->show_in_nav_menus;
190
    }
191
192
    public function isAllowedInAdminTagCloud(): bool
193
    {
194
        return $this->taxonomy->show_tagcloud;
195
    }
196
197
    public function isAllowedInAdminQuickEdit(): bool
198
    {
199
        return $this->taxonomy->show_in_quick_edit;
200
    }
201
202
    public function isAllowedInAdminUi(): bool
203
    {
204
        return $this->taxonomy->show_ui;
205
    }
206
207
    public function getDisplayedInMenu()
208
    {
209
        return $this->taxonomy->show_in_menu;
210
    }
211
212
    public function isPublic(): bool
213
    {
214
        return $this->taxonomy->public;
215
    }
216
217
    public function isPubliclyQueryable(): bool
218
    {
219
        return $this->taxonomy->publicly_queryable;
220
    }
221
222
    public function getRestNamespace()
223
    {
224
        return $this->taxonomy->rest_namespace;
225
    }
226
227
    public function getOptions(): array
228
    {
229
        return (array) $this->taxonomy->options ?? [];
230
    }
231
232
    public static function fromName(string $name): self
233
    {
234
        return new static(get_taxonomy($name));
0 ignored issues
show
Bug introduced by
The function get_taxonomy was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

234
        return new static(/** @scrutinizer ignore-call */ get_taxonomy($name));
Loading history...
235
    }
236
}
237