ProjectDetector.php 975 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Services\History\Detector;
  3. use App\Services\History\Converter\ConverterContact;
  4. use App\Services\History\Converter\ModelEnumConverter;
  5. use App\Services\History\Converter\WhitelistConverter;
  6. class ProjectDetector implements DetectorContact
  7. {
  8. public static function fields(): array
  9. {
  10. return [
  11. 'name',
  12. 'code',
  13. 'const',
  14. 'status',
  15. 'begin',
  16. 'end',
  17. 'latitude',
  18. 'type',
  19. 'acl',
  20. 'whitelist',
  21. 'description',
  22. ];
  23. }
  24. public static function diffFields(): array
  25. {
  26. return [
  27. 'description',
  28. ];
  29. }
  30. public static function converter(string $field): ConverterContact
  31. {
  32. return match ($field) {
  33. "whitelist" => new WhitelistConverter(),
  34. "status" => new ModelEnumConverter("project.status"),
  35. default => null
  36. };
  37. }
  38. }