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

W3CMarkupValidatorMessage   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 15
lcom 1
cbo 1
dl 0
loc 91
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
B initializeType() 0 18 6
A initializeSummary() 0 6 2
A initializeFirstLineNumber() 0 6 2
A initializeLastLineNumber() 0 6 2
A initializeMarkup() 0 6 2
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