WebOrbiton
v1.0.0.1

StocketBase

44 lines · 1.2 KB
  1. <?php
  2. ​
  3. declare(strict_types=1);
  4. ​
  5. final class StatusLabel
  6. {
  7. private const LABELS = [
  8. 'draft' => 'Draft',
  9. 'pending_review' => 'Waiting for approval',
  10. 'scheduled' => 'Scheduled',
  11. 'published' => 'Live',
  12. 'rejected' => 'Sent back',
  13. 'archived' => 'Archived',
  14. 'pending' => 'Waiting for payment',
  15. 'paid' => 'Paid',
  16. 'processing' => 'Being prepared',
  17. 'fulfilled' => 'Ready',
  18. 'shipped' => 'Shipped',
  19. 'completed' => 'Completed',
  20. 'canceled' => 'Canceled',
  21. 'cancelled' => 'Canceled',
  22. 'refunded' => 'Refunded',
  23. 'failed' => 'Payment failed',
  24. 'approved' => 'Approved',
  25. 'active' => 'Active',
  26. 'suspended' => 'Blocked',
  27. 'trialing' => 'Free trial',
  28. 'past_due' => 'Payment overdue',
  29. 'unpaid' => 'Unpaid',
  30. 'expired' => 'Expired',
  31. 'inactive' => 'Inactive',
  32. ];
  33. ​
  34. public static function get(string $status): string
  35. {
  36. $key = strtolower(trim($status));
  37. if (isset(self::LABELS[$key])) {
  38. return self::LABELS[$key];
  39. }
  40. ​
  41. return ucfirst(str_replace('_', ' ', $key));
  42. }
  43. }
  44. ​