DelayedDispatcher   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 3
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 2 1
1
<?php
2
3
namespace PHPKitchen\CodeSpecsCore\Expectation\Dispatcher;
4
5
/**
6
 * Extends base dispatcher to delay asserts.
7
 *
8
 * Asserts won;t be executed once they are called and only would be started when
9
 * matcher object would ca called as a function.
10
 *
11
 * For example:
12
 * <code>
13
 *  $delayedMatcher = $dispatcher->isArray()->isNotEmpty()->hasKey('name');
14
 *  $delayedMatcher($myArray);
15
 * </code>
16
 *
17
 * @package PHPKitchen\CodeSpecsCore\Expectation\Dispatchers
18
 * @author Dmitry Kolodko <[email protected]>
19
 */
20
class DelayedDispatcher extends Dispatcher {
21
    protected function init(): void {
22
        $this->useDelayedAsserts = true;
23
    }
24
}