Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | protected function getCustomPostID(): ?int |
||
13 | { |
||
14 | if (\is_singular($this->getPostType())) { |
||
15 | // Watch out! If accessing $vars it triggers setting ComponentConfiguration vars, |
||
16 | // but we have not set the hooks yet! |
||
17 | // For instance for `namespaceTypesAndInterfaces()`, |
||
18 | // to be set in `executeSchemaConfigurationOptionsNamespacing()` |
||
19 | // Hence, code below was commented, and access the $post from the global variable |
||
20 | // $vars = ApplicationState::getVars(); |
||
21 | // $postID = $vars['routing-state']['queried-object-id']; |
||
22 | global $post; |
||
23 | return $post->ID; |
||
24 | } |
||
25 | return null; |
||
26 | } |
||
30 |