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 — 44-add-message-line-numbers ( e501d6...07824a )
by Nikolay
02:06
created

initializeLastLineNumber()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace Kolyunya\Codeception\Lib\MarkupValidator;
4
5
use Kolyunya\Codeception\Lib\MarkupValidator\MarkupValidatorMessage;
6
use Kolyunya\Codeception\Lib\MarkupValidator\MarkupValidatorMessageInterface;
7
8
/**
9
 * A message of a W3C markup validator.
10
 */
11
class W3CMarkupValidatorMessage extends MarkupValidatorMessage implements MarkupValidatorMessageInterface
12
{
13
    /**
14
     * Constructs a W3C markup validator message from the message data received
15
     * from a W3C Markup Validation Service.
16
     *
17
     * @param array $data Message data.
18
     */
19
    public function __construct(array $data)
20
    {
21
        parent::__construct();
22
23
        $this->initializeType($data);
24
        $this->initializeSummary($data);
25
        $this->initializeFirstLineNumber($data);
26
        $this->initializeLastLineNumber($data);
27
        $this->initializeMarkup($data);
28
    }
29
30
    /**
31
     * Initializes message type.
32
     *
33
     * @param array $data Message data.
34
     */
35
    private function initializeType(array $data)
36
    {
37
        if (isset($data['type']) === false) {
38
            return;
39
        }
40
41
        if ($data['type'] === 'error') {
42
            $this->type = self::TYPE_ERROR;
43
        } elseif ($data['type'] === 'info') {
44
            if (isset($data['subType']) === true &&
45
                $data['subType'] === 'warning'
46
            ) {
47
                $this->type = self::TYPE_WARNING;
48
            } else {
49
                $this->type = self::TYPE_INFO;
50
            }
51
        }
52
    }
53
54
    /**
55
     * Initializes message summary.
56
     *
57
     * @param array $data Message data.
58
     */
59
    private function initializeSummary(array $data)
60
    {
61
        if (isset($data['message']) === true) {
62
            $this->setSummary($data['message']);
63
        }
64
    }
65
66
    /**
67
     * Initializes first line number.
68
     *
69
     * @param array $data Message data.
70
     */
71
    private function initializeFirstLineNumber(array $data)
72
    {
73
        if (isset($data['firstLine']) === true) {
74
            $this->setFirstLineNumber($data['firstLine']);
75
        }
76
    }
77
78
    /**
79
     * Initializes last line number.
80
     *
81
     * @param array $data Message data.
82
     */
83
    private function initializeLastLineNumber(array $data)
84
    {
85
        if (isset($data['lastLine']) === true) {
86
            $this->setLastLineNumber($data['lastLine']);
87
        }
88
    }
89
90
    /**
91
     * Initializes message markup.
92
     *
93
     * @param array $data Message data.
94
     */
95
    private function initializeMarkup(array $data)
96
    {
97
        if (isset($data['extract']) === true) {
98
            $this->setMarkup($data['extract']);
99
        }
100
    }
101
}
102