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.

NonePredicate   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 19
loc 19
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 10 10 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 none of the predicates return true.
15
 * If the array of predicates is empty, then this predicate returns true.
16
 *
17
 * @package Dutek\Predicate
18
 * @author Dušan Vejin <[email protected]>
19
 */
20 View Code Duplication
class NonePredicate extends AbstractQuantifierPredicate
21
{
22
    /**
23
     * Evaluates the predicate returning false if any stored predicate returns false.
24
     *
25
     * @param mixed $value The input value.
26
     * @return bool true if none of decorated predicates return true.
27
     */
28 6
    public function __invoke($value) : bool
29
    {
30 6
        foreach ($this->predicates as $predicate) {
31 5
            if ($predicate($value)) {
32 5
                return false;
33
            }
34
        }
35
36 3
        return true;
37
    }
38
}
39