GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( d245d8...82e8c7 )
by Leonardo
10:28
created

getCustomPostID()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 14
ccs 0
cts 4
cp 0
crap 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\SchemaConfiguratorExecuters;
6
7
abstract class AbstractLoadingCPTSchemaConfiguratorExecuter extends AbstractSchemaConfiguratorExecuter
8
{
9
    /**
10
     * Initialize the configuration if visiting the corresponding CPT
11
     */
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
    }
27
28
    abstract protected function getPostType(): string;
29
}
30