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

MultiRouteSpecification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 3
1
<?php
2
3
namespace EventEspresso\core\domain\entities\routing\specifications;
4
5
use EventEspresso\core\exceptions\InvalidEntityException;
6
use EventEspresso\core\services\request\RequestInterface;
7
8
/**
9
 * Class MultiRouteSpecification
10
 * Used for combining multiple Route Match Specifications into a single specification
11
 *
12
 * @package EventEspresso\core\domain\entities\routing
13
 * @author  Brent Christensen
14
 * @since   4.9.71.p
15
 */
16
abstract class MultiRouteSpecification extends RouteMatchSpecification
17
{
18
19
    /**
20
     * @var RouteMatchSpecificationInterface[] $specifications
21
     */
22
    protected $specifications;
23
24
    /**
25
     * MultiRouteSpecification constructor.
26
     *
27
     * @param RouteMatchSpecificationInterface[] $specifications
28
     * @param RequestInterface                   $request
29
     * @throws InvalidEntityException
30
     */
31
    public function __construct(array $specifications, RequestInterface $request)
32
    {
33
        foreach ($specifications as $specification) {
34
            if (! $specification instanceof RouteMatchSpecificationInterface) {
35
                throw new InvalidEntityException(
36
                    $specification,
37
                    'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface'
38
                );
39
            }
40
        }
41
        $this->specifications = $specifications;
42
        parent::__construct($request);
43
    }
44
}
45