1: <?php
2:
3: /**
4: * This file is part of expect package.
5: *
6: * (c) Noritaka Horio <holy.shared.design@gmail.com>
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 <holy.shared.design@gmail.com>
17: * @copyright Noritaka Horio <holy.shared.design@gmail.com>
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: