| Total Complexity | 7 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 4 | enum CompanyApplyStatusEnum: int |
||
| 5 | { |
||
| 6 | /** |
||
| 7 | * 待提交 |
||
| 8 | */ |
||
| 9 | case Pending = 0; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * 审核中 |
||
| 13 | */ |
||
| 14 | case Reviewing = 1; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * 审核通过 |
||
| 18 | */ |
||
| 19 | case Pass = 2; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * 审核拒绝 |
||
| 23 | */ |
||
| 24 | case Reject = 3; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * 关闭 |
||
| 28 | */ |
||
| 29 | case Close = 4; |
||
| 30 | |||
| 31 | public static function fromValue(int $type): self |
||
| 32 | { |
||
| 33 | return match ($type) { |
||
| 34 | 1 => self::Reviewing, |
||
| 35 | 2 => self::Pass, |
||
| 36 | 3 => self::Reject, |
||
| 37 | 4 => self::Close, |
||
| 38 | default => self::Pending |
||
| 39 | }; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function canClose(): bool |
||
| 43 | { |
||
| 44 | return match ($this) { |
||
| 45 | self::Reviewing => true, |
||
| 46 | self::Pending => true, |
||
| 47 | default => false |
||
| 48 | }; |
||
| 49 | } |
||
| 50 | public function canDelete(): bool |
||
| 51 | { |
||
| 52 | return match ($this) { |
||
| 53 | self::Reject => true, |
||
| 54 | self::Close => true, |
||
| 55 | self::Pending => true, |
||
| 56 | default => false |
||
| 57 | }; |
||
| 58 | } |
||
| 59 | |||
| 60 | public function canSubmit(): bool |
||
| 65 | }; |
||
| 66 | } |
||
| 67 | |||
| 68 | public function isPass(): bool |
||
| 69 | { |
||
| 70 | return $this === self::Pass; |
||
| 71 | } |
||
| 72 | |||
| 73 | public function isReject(): bool |
||
| 76 | } |
||
| 77 | |||
| 78 | public function isReviewing(): bool |
||
| 81 | } |
||
| 82 | } |