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.
Completed
Push — master ( b02eb6...eeb8ae )
by Akpé Aurelle Emmanuel Moïse
17s queued 11s
created

PrepareStrip::getPrepared()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EZAMA;
4
5
class PrepareStrip
6
{
7
    protected $state;
8
    protected $preprocessed;
9
10
    public function __construct(beforeStrip $prepocessed)
11
    {
12
        if ($prepocessed->mustLoadMulti()) {
13
            $this->state = 'multi';
14
        } else {
15
            $this->state = 'single';
16
        }
17
        $this->prepocessed = $prepocessed;
0 ignored issues
show
Bug Best Practice introduced by
The property prepocessed does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
18
    }
19
20
    public function getPrepared()
21
    {
22
        if ($this->state === 'single') {
23
            return $this->prepocessed->getContent();
24
        }
25
        $prepared = $this->preparePhp() + $this->prepareHtml();
26
        ksort($prepared);
27
28
        return join('', $prepared);
29
    }
30
31
    public function prepareHtml()
32
    {
33
        return  array_map(function ($v) {
34
            return is_array($v) ? $v[1] : $v;
35
        }, $this->prepocessed->getHTML());
36
    }
37
38
    public function preparePhp()
39
    {
40
        return array_map(function ($v) {
41
            return is_array($v) && ($v[0] === T_OPEN_TAG || $v[0] === T_CLOSE_TAG) ? ($v[0] === T_OPEN_TAG ? '<php>' : '</php>') : (is_array($v) ? $v[1] : $v);
42
        }, $this->prepocessed->getPHP());
43
    }
44
}
45