| Total Complexity | 5 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | trait ClassBasedTrait |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var string|null |
||
| 23 | */ |
||
| 24 | protected $class = null; |
||
| 25 | |||
| 26 | public function getClass(): string |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Set class for DTO and check if class exists |
||
| 33 | * |
||
| 34 | * @param string $class |
||
| 35 | * @param string|null $exceptionMsg |
||
| 36 | * |
||
| 37 | * @return static |
||
| 38 | * |
||
| 39 | * @throws StorageException |
||
| 40 | */ |
||
| 41 | public function setClass(string $class, ?string $exceptionMsg = null): self |
||
| 42 | { |
||
| 43 | $this->checkClass($class, $exceptionMsg ?: ''); |
||
| 44 | |||
| 45 | $this->class = $class; |
||
| 46 | |||
| 47 | return $this; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Check if class exists |
||
| 52 | * |
||
| 53 | * @param string $class |
||
| 54 | * @param string $errorPostfix |
||
| 55 | * |
||
| 56 | * @throws StorageException |
||
| 57 | */ |
||
| 58 | protected function checkClass(string $class, string $errorPostfix): void |
||
| 63 | ); |
||
| 64 | } |
||
| 67 |