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 — master ( 4d5462...b04125 )
by Marco
01:20
created

ComposingAssertion::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Marcosh\PhpValidationDSL\Basic;
6
7
use Marcosh\PhpValidationDSL\Result\ValidationResult;
8
use Marcosh\PhpValidationDSL\Translator\Translator;
9
10
abstract class ComposingAssertion
11
{
12
    /**
13
     * @var IsAsAsserted
14
     */
15
    protected $isAsAsserted;
16
17
    abstract public function __construct(?callable $errorFormatter = null);
18
19
    public static function withFormatter(callable $errorFormatter): self
20
    {
21
        return new static($errorFormatter);
22
    }
23
24
    public function validate($data, array $context = []): ValidationResult
25
    {
26
        return $this->isAsAsserted->validate($data, $context);
27
    }
28
29
    protected static function withTranslatorAndMessage(Translator $translator, string $message)
30
    {
31
        return new static(function ($data) use ($translator, $message) {
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

31
        return new static(function (/** @scrutinizer ignore-unused */ $data) use ($translator, $message) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
            return [$translator->translate($message)];
33
        });
34
    }
35
}
36