Errors   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 6 1
1
<?php namespace HSkrasek\JsonSchema\Validator;
2
3
use League\JsonGuard\ValidationError;
4
5
class Errors
6
{
7
    /**
8
     * @var array|ValidationError[]
9
     */
10
    private $errors;
11
12
    public function __construct(array $errors)
13
    {
14
        $this->errors = $errors;
15
    }
16
17
    public function __toString(): string
18
    {
19
        return array_reduce($this->errors, function (string $carry, ValidationError $error) {
20
            return $carry .= $error->getMessage() . " ({$error->getDataPath()})" . PHP_EOL;
21
        }, '');
22
    }
23
}
24