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.

renderBlock()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 20
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 17
nc 1
nop 2
dl 0
loc 20
ccs 0
cts 4
cp 0
crap 6
rs 9.7
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\Blocks\AccessControlRuleBlocks;
6
7
use GraphQLAPI\GraphQLAPI\Blocks\AccessControlRuleBlocks\AbstractAccessControlRuleBlock;
8
9
/**
10
 * Access Control User Capabilities block
11
 */
12
abstract class AbstractItemListAccessControlRuleBlock extends AbstractAccessControlRuleBlock
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
        $blockContentPlaceholder = <<<EOF
25
        <div class="%s">
26
            %s
27
        </div>
28
EOF;
29
        $values = $attributes[self::ATTRIBUTE_NAME_VALUE] ?? [];
30
        return sprintf(
31
            $blockContentPlaceholder,
32
            $this->getBlockClassName(),
33
            $values ?
34
                sprintf(
35
                    '<p><strong>%s</strong></p><ul><li><code>%s</code></li></ul>',
36
                    $this->getHeader(),
37
                    implode('</code></li><li><code>', $values)
38
                ) :
39
                sprintf(
40
                    '<em>%s</em>',
41
                    \__('(not set)', 'graphql-api')
42
                )
43
        );
44
    }
45
46
    abstract protected function getHeader(): string;
47
}
48