| Total Complexity | 6 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | trait ModelEvent |
||
| 23 | { |
||
| 24 | |||
| 25 | /** |
||
| 26 | * 是否需要事件响应 |
||
| 27 | * @var bool |
||
| 28 | */ |
||
| 29 | protected $withEvent = true; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * 当前操作的事件响应 |
||
| 33 | * @access protected |
||
| 34 | * @param bool $event 是否需要事件响应 |
||
| 35 | * @return $this |
||
| 36 | */ |
||
| 37 | public function withEvent(bool $event) |
||
| 38 | { |
||
| 39 | $this->withEvent = $event; |
||
| 40 | return $this; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * 触发事件 |
||
| 45 | * @access protected |
||
| 46 | * @param string $event 事件名 |
||
| 47 | * @return bool |
||
| 48 | */ |
||
| 49 | protected function trigger(string $event): bool |
||
| 67 | } |
||
| 68 | } |
||
| 70 |