DefaultConfigurator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A configure() 0 12 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\configurator;
12
13
use expect\Configurator;
14
use expect\context\DefaultContextFactory;
15
use expect\factory\DefaultMatcherFactory;
16
use expect\package\DefaultPackageRegistrar;
17
use expect\registry\DefaultMatcherRegistry;
18
use expect\reporter\ExceptionReporter;
19
20
/**
21
 * Default configurator
22
 *
23
 * Configure by the default
24
 *
25
 * @author Noritaka Horio <[email protected]>
26
 * @copyright Noritaka Horio <[email protected]>
27
 */
28
final class DefaultConfigurator implements Configurator
29
{
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function configure()
34
    {
35
        $registry = new DefaultMatcherRegistry();
36
37
        $packageRegistrar = new DefaultPackageRegistrar();
38
        $packageRegistrar->registerTo($registry);
39
40
        $dictionary = $registry->toDictionary();
41
        $matcherFactory = new DefaultMatcherFactory($dictionary);
42
43
        return new DefaultContextFactory($matcherFactory, new ExceptionReporter());
44
    }
45
}
46