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.

Model   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 37.5%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 27
rs 10
ccs 3
cts 8
cp 0.375
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 3
1
<?php
2
3
namespace NStack\Models;
4
5
use NStack\Exceptions\FailedToParseException;
6
7
abstract class Model
8
{
9
    /**
10
     * Model constructor.
11
     *
12
     * @param array $data
13
     * @throws \NStack\Exceptions\FailedToParseException
14
     * @author Casper Rasmussen <[email protected]>
15
     */
16 26
    public function __construct(array $data)
17
    {
18
        try {
19 26
            $this->parse($data);
20
        } catch (\Throwable $e) {
21
            $message = sprintf('Failed to parse %s: %s', get_called_class(), $e->getMessage());
22
23
            if (!empty($data['id'])) {
24
                $message .= ' ID: ' . $data['id'];
25
            }
26
27
            throw new FailedToParseException($message);
28
        }
29 26
    }
30
31
    public abstract function parse(array $data);
32
33
    public abstract function toArray(): array;
34
}