| Total Complexity | 7 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | trait HaveValidationService |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Undocumented variable |
||
| 18 | * |
||
| 19 | * @var ValidateService |
||
| 20 | */ |
||
| 21 | private static $service; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Undocumented function |
||
| 25 | * |
||
| 26 | * @return ValidateService |
||
| 27 | */ |
||
| 28 | 735 | protected static function getServiceInstance(): ValidateService |
|
| 29 | { |
||
| 30 | 735 | if (static::$service === null) { |
|
|
|
|||
| 31 | 3 | static::$service = static::createServiceInstance(); |
|
| 32 | } |
||
| 33 | |||
| 34 | 735 | return static::$service; |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Undocumented function |
||
| 39 | * |
||
| 40 | * @param string $method |
||
| 41 | * @param mixed ...$args |
||
| 42 | * |
||
| 43 | * @return mixed |
||
| 44 | */ |
||
| 45 | 735 | protected static function proxyService(string $method, ...$args) |
|
| 46 | { |
||
| 47 | 735 | $service = static::getServiceInstance(); |
|
| 48 | |||
| 49 | 735 | return \call_user_func([$service, $method], ...$args); |
|
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Undocumented function |
||
| 54 | * |
||
| 55 | * @param string $method |
||
| 56 | * @param mixed ...$args |
||
| 57 | * |
||
| 58 | * @return void |
||
| 59 | */ |
||
| 60 | 720 | protected static function askService(string $method, ...$args): void |
|
| 67 | } |
||
| 68 | 276 | } |
|
| 69 | |||
| 70 | /** |
||
| 71 | * Undocumented function |
||
| 72 | * |
||
| 73 | * @param string $message |
||
| 74 | * |
||
| 75 | * @return void |
||
| 76 | * @throws \PHPUnit\Framework\AssertionFailedError |
||
| 77 | */ |
||
| 78 | 276 | protected static function succeed(string $message = ''): void |
|
| 79 | { |
||
| 80 | 276 | PHPUnit::assertTrue(true, $message); |
|
| 81 | 276 | } |
|
| 82 | |||
| 83 | /** |
||
| 84 | * Undocumented function |
||
| 85 | * |
||
| 86 | * @return ValidateService |
||
| 87 | */ |
||
| 88 | 3 | private static function createServiceInstance(): ValidateService |
|
| 91 | } |
||
| 92 | } |
||
| 93 |