BaseStepFactory.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/12/14
  6. * Time: 17:01
  7. */
  8. namespace app\common\services\steps;
  9. use app\common\services\steps\interfaces\ElementSteps;
  10. abstract class BaseStepFactory implements ElementSteps
  11. {
  12. protected $model;
  13. public function __construct($model)
  14. {
  15. $this->model = $model;
  16. }
  17. /**
  18. * 标题
  19. * @return string
  20. */
  21. public function getTitle()
  22. {
  23. return '';
  24. }
  25. /**
  26. * 描述性文字
  27. * @return string
  28. */
  29. public function getDescription()
  30. {
  31. return '';
  32. }
  33. /**
  34. * 图标
  35. * @return string
  36. */
  37. public function getIcon()
  38. {
  39. return '';
  40. }
  41. /**
  42. * 指定返回 wait|process|finish|error|success
  43. * @return string
  44. */
  45. public function getStatus()
  46. {
  47. if ($this->finishStatus()) {
  48. return 'finish';
  49. } elseif ($this->processStatus()) {
  50. return 'process';
  51. } elseif ($this->waitStatus()) {
  52. return 'wait';
  53. }
  54. return 'error';
  55. }
  56. /**
  57. * 是否显示
  58. * @return bool
  59. */
  60. public function isShow()
  61. {
  62. return true;
  63. }
  64. /**
  65. * 排序
  66. * @return int
  67. */
  68. public function sort()
  69. {
  70. return 0;
  71. }
  72. /**
  73. * 值、标识
  74. * @return int
  75. */
  76. public function getValue()
  77. {
  78. return $this->sort();
  79. }
  80. /**
  81. * 等待状态
  82. * @return boolean
  83. */
  84. abstract function waitStatus();
  85. /**
  86. * 处理中状态
  87. * @return boolean
  88. */
  89. abstract function processStatus();
  90. /**
  91. * 完成状态
  92. * @return boolean
  93. */
  94. abstract function finishStatus();
  95. }