InvoiceTypeEnum.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace common\enums;
  3. use yii\helpers\Html;
  4. /**
  5. * Class InvoiceTypeEnum
  6. * @package common\enums
  7. * @author jianyan74 <751393839@qq.com>
  8. */
  9. class InvoiceTypeEnum extends BaseEnum
  10. {
  11. const COMPANY = 1;
  12. const PERSONAGE = 2;
  13. /**
  14. * @return array
  15. */
  16. public static function getMap(): array
  17. {
  18. return [
  19. self::COMPANY => '公司',
  20. self::PERSONAGE => '个人',
  21. ];
  22. }
  23. /**
  24. * @param $key
  25. * @return mixed|string
  26. */
  27. public static function html($key)
  28. {
  29. $html = [
  30. self::COMPANY => Html::tag('span', self::getValue(self::COMPANY), array_merge(
  31. [
  32. 'class' => "label label-outline-primary",
  33. ]
  34. )),
  35. self::PERSONAGE => Html::tag('span', self::getValue(self::PERSONAGE), array_merge(
  36. [
  37. 'class' => "label label-outline-success",
  38. ]
  39. )),
  40. ];
  41. return $html[$key] ?? '';
  42. }
  43. }
粤ICP备19079148号