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.

Shortcode   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 33
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 5
A withContent() 0 4 1
1
<?php
2
namespace Thunder\Shortcode\Shortcode;
3
4
/**
5
 * @author Tomasz Kowalczyk <[email protected]>
6
 */
7
final class Shortcode extends AbstractShortcode implements ShortcodeInterface
8
{
9
    /**
10
     * @param string $name
11
     * @param array $parameters
12
     * @psalm-param array<string,string|null> $parameters
13
     * @param string|null $content
14
     * @param string|null $bbCode
15
     */
16 227
    public function __construct($name, array $parameters, $content, $bbCode = null)
17
    {
18
        /** @psalm-suppress RedundantConditionGivenDocblockType, DocblockTypeContradiction */
19 227
        if(false === is_string($name) || '' === $name) {
20 1
            throw new \InvalidArgumentException('Shortcode name must be a non-empty string!');
21
        }
22
23
        /** @psalm-suppress MissingClosureParamType, MissingClosureReturnType */
24
        $isStringOrNull = function($value) { return is_string($value) || null === $value; };
25 226
        if(count(array_filter($parameters, $isStringOrNull)) !== count($parameters)) {
26 1
            throw new \InvalidArgumentException('Parameter values must be either string or empty (null)!');
27
        }
28
29 225
        $this->name = $name;
30 225
        $this->parameters = $parameters;
31 225
        $this->content = $content;
32 225
        $this->bbCode = $bbCode;
33 225
    }
34
35 1
    public function withContent($content)
36
    {
37 1
        return new self($this->name, $this->parameters, $content, $this->bbCode);
38
    }
39
}
40