Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( a00617...81d717 )
by Henrique
02:56
created

ContainsAny::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of Respect/Validation.
5
 *
6
 * (c) Alexandre Gomes Gaigalas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the "LICENSE.md"
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Respect\Validation\Rules;
15
16
use function array_map;
17
18
/**
19
 * Validates if the input contains at least one of defined values
20
 *
21
 * @author Henrique Moody <[email protected]>
22
 * @author Kirill Dlussky <[email protected]>
23
 */
24
final class ContainsAny extends AbstractEnvelope
25
{
26
    /**
27
     * Initializes the rule.
28
     *
29
     * @param array $needles At least one of the values provided must be found in input string or array
30
     * @param bool $identical Defines whether the value should be compared strictly, when validating array
31
     */
32 1
    public function __construct(array $needles, bool $identical = false)
33
    {
34 1
        parent::__construct(
35 1
            new AnyOf(...$this->getRules($needles, $identical)),
36 1
            ['needles' => $needles]
37
        );
38 1
    }
39
40 1
    private function getRules(array $needles, bool $identical): array
41
    {
42 1
        return array_map(
43
            function ($needle) use ($identical): Contains {
44 1
                return new Contains($needle, $identical);
45 1
            },
46 1
            $needles
47
        );
48
    }
49
}
50