v1.0.0.1
StocketBase
- <?php
-
- declare(strict_types=1);
-
- final class StatusLabel
- {
- private const LABELS = [
- 'draft' => 'Draft',
- 'pending_review' => 'Waiting for approval',
- 'scheduled' => 'Scheduled',
- 'published' => 'Live',
- 'rejected' => 'Sent back',
- 'archived' => 'Archived',
- 'pending' => 'Waiting for payment',
- 'paid' => 'Paid',
- 'processing' => 'Being prepared',
- 'fulfilled' => 'Ready',
- 'shipped' => 'Shipped',
- 'completed' => 'Completed',
- 'canceled' => 'Canceled',
- 'cancelled' => 'Canceled',
- 'refunded' => 'Refunded',
- 'failed' => 'Payment failed',
- 'approved' => 'Approved',
- 'active' => 'Active',
- 'suspended' => 'Blocked',
- 'trialing' => 'Free trial',
- 'past_due' => 'Payment overdue',
- 'unpaid' => 'Unpaid',
- 'expired' => 'Expired',
- 'inactive' => 'Inactive',
- ];
-
- public static function get(string $status): string
- {
- $key = strtolower(trim($status));
- if (isset(self::LABELS[$key])) {
- return self::LABELS[$key];
- }
-
- return ucfirst(str_replace('_', ' ', $key));
- }
- }
-