| 1 |
<?php |
| 2 |
|
| 3 |
namespace StoreEngine\Classes\OrderStatus; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
use StoreEngine\Classes\Exceptions\StoreEngineInvalidArgumentException; |
| 10 |
use StoreEngine\Classes\OrderContext; |
| 11 |
use StoreEngine\Interfaces\OrderStatus; |
| 12 |
|
| 13 |
class Completed implements OrderStatus { |
| 14 |
const STATUS = 'completed'; |
| 15 |
|
| 16 |
public function proceed_to_next_status( OrderContext $context, string $trigger = '' ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed |
| 17 |
throw new StoreEngineInvalidArgumentException( |
| 18 |
sprintf( |
| 19 |
/* translators: %1$s. Current status, %2$s. Requested status transition. */ |
| 20 |
esc_html__( 'Invalid transition from %1$s to %2$s', 'storeengine' ), |
| 21 |
esc_html( self::STATUS ), |
| 22 |
esc_html( $trigger ) |
| 23 |
), |
| 24 |
'invalid-status-transition' |
| 25 |
); |
| 26 |
} |
| 27 |
|
| 28 |
public function get_status(): string { |
| 29 |
return self::STATUS; |
| 30 |
} |
| 31 |
|
| 32 |
public function get_status_title(): string { |
| 33 |
return __( 'Completed', 'storeengine' ); |
| 34 |
} |
| 35 |
|
| 36 |
public function get_possible_next_statuses(): array { |
| 37 |
return []; |
| 38 |
} |
| 39 |
|
| 40 |
public function get_possible_triggers(): array { |
| 41 |
// TODO: Implement get_possible_triggers() method. |
| 42 |
return []; |
| 43 |
} |
| 44 |
} |
| 45 |
|