MatcherDictionary   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 24
rs 10
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A count() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of expect package.
5
 *
6
 * (c) Noritaka Horio <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
namespace expect;
12
13
/**
14
 * Immutable container of matcher.
15
 *
16
 * @author Noritaka Horio <[email protected]>
17
 * @copyright Noritaka Horio <[email protected]>
18
 */
19
final class MatcherDictionary implements MatcherContainer
20
{
21
    use MatcherLookupTable;
22
23
    /**
24
     * Create matcher dictionary.
25
     *
26
     * @param array matcher classes
27
     */
28
    public function __construct(array $matchers)
29
    {
30
        $this->matchers = Dictionary::fromArray($matchers);
31
    }
32
33
    /**
34
     * Count elements of an matcher class.
35
     *
36
     * @return int
37
     */
38
    public function count()
39
    {
40
        return count($this->matchers);
41
    }
42
}
43