Total Complexity | 4 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class PathMatchExpectation |
||
10 | { |
||
11 | 109 | public static function from(Expectation $expectation): callable |
|
12 | { |
||
13 | 109 | return function ($request) use ($expectation) { |
|
14 | /** @var RequestInterface $request */ |
||
15 | 107 | if (!is_null($expectation->getPathRegex()) && !self::matches($expectation, $request)) { |
|
16 | 1 | return new RejectedPromise('path does not match expectation'); |
|
17 | } |
||
18 | |||
19 | 106 | return $request; |
|
20 | }; |
||
21 | } |
||
22 | |||
23 | 2 | private static function matches($expectation, $request): bool |
|
26 | } |
||
27 | } |
||
28 |