Completed
Branch EDTR/master (da238f)
by
unknown
09:58 queued 01:23
created

MatchAllRouteSpecifications   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 19
loc 19
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A isMatchingRoute() 9 9 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
namespace EventEspresso\core\domain\entities\routing\specifications;
4
5
/**
6
 * Class MatchAllRouteSpecifications
7
 * Returns true if ALL of the supplied Route Match Specifications also return true
8
 * ie: supplied Route Match Specifications joined using AND logic
9
 *
10
 * @package EventEspresso\core\domain\entities\routing
11
 * @author  Brent Christensen
12
 * @since   4.9.71.p
13
 */
14 View Code Duplication
class MatchAllRouteSpecifications extends MultiRouteSpecification
15
{
16
17
    /**
18
     * returns true if current request matches specification
19
     *
20
     * @since 4.9.71.p
21
     * @return boolean
22
     */
23
    public function isMatchingRoute()
24
    {
25
        foreach ($this->specifications as $specification) {
26
            if (! $specification->isMatchingRoute()) {
27
                return false;
28
            }
29
        }
30
        return true;
31
    }
32
}
33