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.
Passed
Push — master ( d5a27a...1e0f3a )
by Leonardo
13:55
created

CustomEndpointClientTrait::isClientDisabled()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 0
cts 1
cp 0
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\Clients;
6
7
use GraphQLAPI\GraphQLAPI\General\RequestParams;
8
use GraphQLAPI\GraphQLAPI\PostTypes\GraphQLEndpointPostType;
9
use PoP\ComponentModel\Misc\RequestUtils;
10
11
trait CustomEndpointClientTrait
12
{
13
    /**
14
     * Enable only when executing a single CPT
15
     */
16
    protected function isClientDisabled(): bool
17
    {
18
        if (!\is_singular(GraphQLEndpointPostType::POST_TYPE)) {
19
            return true;
20
        }
21
        return parent::isClientDisabled();
22
    }
23
24
    /**
25
     * Endpoint URL
26
     *
27
     * @return string
28
     */
29
    protected function getEndpointURL(): string
30
    {
31
        /**
32
         * If accessing from Nginx, the server_name might point to localhost
33
         * instead of the actual server domain. So use the user-requested host
34
         */
35
        $fullURL = RequestUtils::getRequestedFullURL(true);
36
        // Remove the ?view=...
37
        $endpointURL = \remove_query_arg(RequestParams::VIEW, $fullURL);
38
        // // Maybe add ?use_namespace=true
39
        // if (ComponentModelComponentConfiguration::namespaceTypesAndInterfaces()) {
40
        //     $endpointURL = \add_query_arg(APIRequest::URLPARAM_USE_NAMESPACE, true, $endpointURL);
41
        // }
42
        return $endpointURL;
43
    }
44
}
45