| Total Complexity | 5 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class Utilities |
||
| 15 | { |
||
| 16 | public static function ObtainFrameworkInstance( |
||
| 17 | TestCase $testCase, |
||
| 18 | string $implementation, |
||
| 19 | ...$implementationArgs |
||
| 20 | ) : Framework { |
||
| 21 | $testCase->assertTrue( |
||
| 22 | is_a($implementation, Framework::class, true), |
||
| 23 | sprintf( |
||
| 24 | 'Argument %u passed to %s must be an implementation of %s', |
||
| 25 | 1, |
||
| 26 | __METHOD__, |
||
| 27 | Framework::class |
||
| 28 | ) |
||
| 29 | ); |
||
| 30 | |||
| 31 | return new $implementation(...$implementationArgs); |
||
| 32 | } |
||
| 33 | |||
| 34 | public static function ObtainHttpHandlerInstance( |
||
| 35 | TestCase $testCase, |
||
| 36 | string $implementation, |
||
| 37 | ...$implementationArgs |
||
| 38 | ) : HttpHandler { |
||
| 39 | $testCase->assertTrue( |
||
| 40 | is_a($implementation, HttpHandler::class, true), |
||
| 41 | sprintf( |
||
| 42 | 'Argument %u passed to %s must be an implementation of %s', |
||
| 43 | 1, |
||
| 44 | __METHOD__, |
||
| 45 | HttpHandler::class |
||
| 46 | ) |
||
| 47 | ); |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @var HttpHandler $instance |
||
| 51 | */ |
||
| 52 | $instance = static::ObtainFrameworkInstance( |
||
| 53 | $testCase, |
||
| 54 | $implementation, |
||
| 55 | ...$implementationArgs |
||
| 56 | ); |
||
| 57 | |||
| 58 | return $instance; |
||
| 59 | } |
||
| 60 | |||
| 61 | public static function ConfigureFrameworkInstance( |
||
| 78 | } |
||
| 79 | } |
||
| 80 | } |
||
| 82 |