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.

isDynamicBlock()   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 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 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\Blocks;
6
7
/**
8
 * Query Execution (endpoint and persisted query) Options block
9
 */
10
abstract class AbstractQueryExecutionOptionsBlock extends AbstractOptionsBlock
11
{
12
    public const ATTRIBUTE_NAME_IS_ENABLED = 'isEnabled';
13
14
    protected function isDynamicBlock(): bool
15
    {
16
        return true;
17
    }
18
19
    /**
20
     * @param array<string, mixed> $attributes
21
     */
22
    public function renderBlock(array $attributes, string $content): string
23
    {
24
        // Append "-front" because this style must be used only on the client, not on the admin
25
        $className = $this->getBlockClassName() . '-front';
26
        $blockContentPlaceholder = <<<EOT
27
        <div class="%s">
28
            <h3 class="%s">%s</h3>
29
            %s
30
        </div>
31
EOT;
32
        return sprintf(
33
            $blockContentPlaceholder,
34
            $className . ' ' . $this->getAlignClass(),
35
            $className . '__title',
36
            \__('Options', 'graphql-api'),
37
            $this->getBlockContent($attributes, $content)
38
        );
39
    }
40
41
    /**
42
     * @param array<string, mixed> $attributes
43
     */
44
    protected function getBlockContent(array $attributes, string $content): string
45
    {
46
        $blockContentPlaceholder = '<p><strong>%s</strong> %s</p>';
47
        return sprintf(
48
            $blockContentPlaceholder,
49
            \__('Enabled:', 'graphql-api'),
50
            $this->getBooleanLabel($attributes[self::ATTRIBUTE_NAME_IS_ENABLED] ?? true)
51
        );
52
    }
53
}
54