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.

BasePresenter::apiProblem()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 8/03/16
5
 * Time: 23:30.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace NilPortugues\Api\Problem\Presenter;
12
13
use NilPortugues\Api\Problem\ApiProblem;
14
15
/**
16
 * Class BasePresenter.
17
 */
18
abstract class BasePresenter implements Presenter
19
{
20
    /**
21
     * @var ApiProblem
22
     */
23
    protected $apiProblem;
24
25
    /**
26
     * PresenterInterface constructor.
27
     *
28
     * @param ApiProblem $apiProblem
29
     */
30
    public function __construct(ApiProblem $apiProblem)
31
    {
32
        $this->apiProblem = $apiProblem;
33
    }
34
35
    /**
36
     * Returns value for `apiProblem`.
37
     *
38
     * @return ApiProblem
39
     */
40
    public function apiProblem()
41
    {
42
        return $this->apiProblem;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function __toString()
49
    {
50
        return $this->contents();
51
    }
52
53
    /**
54
     * @return array
55
     */
56
    protected function buildContent()
57
    {
58
        return array_reverse(
59
            array_filter(
60
                array_merge(
61
                    array_filter($this->apiProblem->additionalDetails()),
62
                    array_filter([
63
                        'type' => $this->apiProblem->type(),
64
                        'detail' => $this->apiProblem->detail(),
65
                        'status' => $this->apiProblem->status(),
66
                        'title' => $this->apiProblem->title(),
67
                    ])
68
                )
69
            ),
70
            true
71
        );
72
    }
73
}
74