Extension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 30
c 1
b 0
f 0
dl 0
loc 48
ccs 26
cts 26
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 43 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\phpspectime;
6
7
use loophp\nanobench\BenchmarkFactory;
8
use loophp\nanobench\Time\TimeUnit;
9
use loophp\phpspectime\Matcher\TakeInBetweenMatcher;
10
use loophp\phpspectime\Matcher\TakeLessThanMatcher;
11
use loophp\phpspectime\Matcher\TakeMoreThanMatcher;
12
use PhpSpec\Extension as ExtensionInterface;
13
use PhpSpec\ServiceContainer;
14
use PhpSpec\ServiceContainer\IndexedServiceContainer;
15
16
final class Extension implements ExtensionInterface
17
{
18
    /**
19
     * @return void
20
     */
21 1
    public function load(ServiceContainer $container, array $params)
22
    {
23
        $params += [
24 1
            'timeunit' => TimeUnit::SECOND,
25
        ];
26
27 1
        $container->define(
28 1
            'matchers.takeMoreThan',
29
            static function (IndexedServiceContainer $c) use ($params) {
30 1
                return new TakeMoreThanMatcher(
31 1
                    $c->get('unwrapper'),
32 1
                    $c->get('formatter.presenter'),
33 1
                    new BenchmarkFactory(),
34
                    $params
35
                );
36 1
            },
37 1
            ['matchers']
38
        );
39
40 1
        $container->define(
41 1
            'matchers.takeLessThan',
42
            static function (IndexedServiceContainer $c) use ($params) {
43 1
                return new TakeLessThanMatcher(
44 1
                    $c->get('unwrapper'),
45 1
                    $c->get('formatter.presenter'),
46 1
                    new BenchmarkFactory(),
47
                    $params
48
                );
49 1
            },
50 1
            ['matchers']
51
        );
52
53 1
        $container->define(
54 1
            'matchers.takeInBetween',
55
            static function (IndexedServiceContainer $c) use ($params) {
56 1
                return new TakeInBetweenMatcher(
57 1
                    $c->get('unwrapper'),
58 1
                    $c->get('formatter.presenter'),
59 1
                    new BenchmarkFactory(),
60
                    $params
61
                );
62 1
            },
63 1
            ['matchers']
64
        );
65 1
    }
66
}
67