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.

AbstractQueryExecutionOptionsBlock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 41
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A renderBlock() 0 16 1
A getBlockContent() 0 7 1
A isDynamicBlock() 0 3 1
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