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.

AbstractShortcode   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 11
lcom 2
cbo 0
dl 0
loc 80
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A hasContent() 0 4 1
A getParameters() 0 4 1
A hasParameter() 0 4 1
A getName() 0 4 1
A hasParameters() 0 4 1
A getParameter() 0 4 2
A getParameterAt() 0 6 2
A getContent() 0 4 1
A getBbCode() 0 4 1
1
<?php
2
namespace Thunder\Shortcode\Shortcode;
3
4
/**
5
 * @author Tomasz Kowalczyk <[email protected]>
6
 */
7
abstract class AbstractShortcode
8
{
9
    /** @var string */
10
    protected $name;
11
    /** @psalm-var array<string,string|null> */
12
    protected $parameters = array();
13
    /** @var string|null */
14
    protected $content;
15
    /** @var string|null */
16
    protected $bbCode;
17
18
    /** @return bool */
19 1
    public function hasContent()
20
    {
21 1
        return $this->content !== null;
22
    }
23
24
    /** @return string */
25 223
    public function getName()
26
    {
27 223
        return $this->name;
28
    }
29
30
    /** @psalm-return array<string,string|null> */
31 223
    public function getParameters()
32
    {
33 223
        return $this->parameters;
34
    }
35
36
    /**
37
     * @param string $name
38
     *
39
     * @return bool
40
     */
41 3
    public function hasParameter($name)
42
    {
43 3
        return array_key_exists($name, $this->parameters);
44
    }
45
46
    /** @return bool */
47 4
    public function hasParameters()
48
    {
49 4
        return (bool)$this->parameters;
50
    }
51
52
    /**
53
     * @param string $name
54
     * @param string|null $default
55
     *
56
     * @psalm-return string|null
57
     */
58 3
    public function getParameter($name, $default = null)
59
    {
60 3
        return $this->hasParameter($name) ? $this->parameters[$name] : $default;
61
    }
62
63
    /**
64
     * @param int $index
65
     *
66
     * @return string|null
67
     */
68 5
    public function getParameterAt($index)
69
    {
70 5
        $keys = array_keys($this->parameters);
71
72 5
        return array_key_exists($index, $keys) ? $keys[$index] : null;
73
    }
74
75
    /** @return string|null */
76 223
    public function getContent()
77
    {
78 223
        return $this->content;
79
    }
80
81
    /** @return string|null */
82 223
    public function getBbCode()
83
    {
84 223
        return $this->bbCode;
85
    }
86
}
87