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.

AbstractItemListAccessControlRuleBlock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 35
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

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