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.

MapErrors::to()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Marcosh\PhpValidationDSL\Combinator;
6
7
use Marcosh\PhpValidationDSL\Result\ValidationResult;
8
use Marcosh\PhpValidationDSL\Validation;
9
10
final class MapErrors implements Validation
11
{
12
    /**
13
     * @var Validation
14
     */
15
    private $validation;
16
17
    /**
18
     * @var callable with signature $messages -> $messages
19
     */
20
    private $function;
21
22
    private function __construct(
23
        Validation $validation,
24
        callable $function
25
    ) {
26
        $this->validation = $validation;
27
        $this->function = $function;
28
    }
29
30
    public static function to(
31
        Validation $validation,
32
        callable $function
33
    ): self {
34
        return new self($validation, $function);
35
    }
36
37
    public function validate($data, array $context = []): ValidationResult
38
    {
39
        return $this->validation->validate($data, $context)->mapErrors($this->function);
40
    }
41
}
42