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

AbstractLoadingCPTSchemaConfiguratorExecuter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 22
ccs 0
cts 4
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCustomPostID() 0 14 2
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