1 | <?php |
||
17 | trait ManageTrait |
||
18 | { |
||
19 | use CheckAccessTrait; |
||
20 | |||
21 | /** |
||
22 | * HTTP success response code |
||
23 | * |
||
24 | * @var int|null |
||
25 | */ |
||
26 | public $statusCodeSuccess; |
||
27 | |||
28 | /** |
||
29 | * HTTP fail response code |
||
30 | * |
||
31 | * @var int|null |
||
32 | */ |
||
33 | public $statusCodeFail; |
||
34 | |||
35 | /** |
||
36 | * @param mixed $data |
||
37 | * @return bool |
||
38 | */ |
||
39 | abstract protected function performAction($data): bool; |
||
40 | |||
41 | /** |
||
42 | * @param $data |
||
43 | * @return mixed |
||
44 | * @throws \yii\web\HttpException |
||
45 | */ |
||
46 | protected function runInternal($data) |
||
59 | |||
60 | /** |
||
61 | * HTTP success response code |
||
62 | * |
||
63 | * @return int |
||
64 | */ |
||
65 | protected function statusCodeSuccess(): int |
||
69 | |||
70 | /** |
||
71 | * HTTP fail response code |
||
72 | * |
||
73 | * @return int |
||
74 | */ |
||
75 | protected function statusCodeFail(): int |
||
79 | |||
80 | /** |
||
81 | * @param $data |
||
82 | * @return mixed |
||
83 | */ |
||
84 | protected function handleSuccessResponse($data) |
||
90 | |||
91 | /** |
||
92 | * @param $data |
||
93 | * @return mixed |
||
94 | */ |
||
95 | protected function handleFailResponse($data) |
||
100 | } |
||
101 |