| 1 | <?php |
||
| 5 | trait ServiceTrait |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Full namespace of exception. |
||
| 9 | * |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | protected $exception; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Full namespace of model. |
||
| 16 | * |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | protected $model; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Create a new instance of the model. |
||
| 23 | * |
||
| 24 | * @param array $data |
||
| 25 | * |
||
| 26 | * @return mixed |
||
| 27 | */ |
||
| 28 | 4 | public function createModel(array $data = []) |
|
| 34 | |||
| 35 | /** |
||
| 36 | * Returns the model. |
||
| 37 | * |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | 10 | public function getModel() |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Runtime override of the model. |
||
| 47 | * |
||
| 48 | * @param string $model |
||
| 49 | * |
||
| 50 | * @return $this |
||
| 51 | */ |
||
| 52 | 10 | public function setModel($model) |
|
| 58 | |||
| 59 | /** |
||
| 60 | * Returns the exception. |
||
| 61 | * |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | 2 | public function getException() |
|
| 68 | |||
| 69 | /** |
||
| 70 | * Runtime override of the exception. |
||
| 71 | * |
||
| 72 | * @param string $exception |
||
| 73 | * |
||
| 74 | * @return $this |
||
| 75 | */ |
||
| 76 | 2 | public function setException($exception) |
|
| 82 | |||
| 83 | /** |
||
| 84 | * Throw model exception. |
||
| 85 | * |
||
| 86 | * @param string $message |
||
| 87 | */ |
||
| 88 | 2 | public function throwException($message) |
|
| 94 | } |
||
| 95 |