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.

AndPredicate::getPredicates()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of the predicates package.
4
 *
5
 * Copyright (c) dutekvejin
6
 *
7
 * For full copyright and license information, please refer to the LICENSE file,
8
 * located at the package root folder.
9
 */
10
11
namespace Dutek\Predicate;
12
13
/**
14
 * Predicate implementation that returns true if both predicates return true.
15
 *
16
 * @package Dutek\Predicate
17
 * @author Dušan Vejin <[email protected]>
18
 */
19 View Code Duplication
final class AndPredicate implements PredicateDecorator
20
{
21
    protected $predicate1;
22
    protected $predicate2;
23
24
    /**
25
     * AndPredicate constructor.
26
     *
27
     * @param Predicate $predicate1 The first predicate to check.
28
     * @param Predicate $predicate2 The second predicate to check.
29
     */
30 5
    public function __construct(Predicate $predicate1, Predicate $predicate2)
31
    {
32 5
        $this->predicate1 = $predicate1;
33 5
        $this->predicate2 = $predicate2;
34 5
    }
35
36
    /**
37
     * Gets the two predicates being decorated as an array.
38
     *
39
     * @return array The predicates.
40
     */
41 1
    public function getPredicates() : array
42
    {
43 1
        return [$this->predicate1, $this->predicate2];
44
    }
45
46
    /**
47
     * Evaluates the predicate returning true if both predicates return true.
48
     *
49
     * @param mixed $value The input value.
50
     * @return bool true if both decorated predicates return true
51
     */
52 4
    public function __invoke($value) : bool
53
    {
54 4
        return ($this->predicate1)($value) && ($this->predicate2)($value);
55
    }
56
}
57