HandleAction.php
1 month ago
HandleActionLabels.php
1 month ago
HandleActionManifest.php
1 month ago
HandleActionSend.php
1 month ago
HandleActionStrategy.php
1 month ago
HandleActionStrategyInterface.php
1 month ago
HandleActionStrategy.php
41 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class HandleActionStrategy |
| 4 | */ |
| 5 | |
| 6 | namespace WPDesk\FS\Shipment\BulkAction; |
| 7 | |
| 8 | use Exception; |
| 9 | use FSVendor\WPDesk\Session\SessionFactory; |
| 10 | |
| 11 | /** |
| 12 | * . |
| 13 | */ |
| 14 | class HandleActionStrategy { |
| 15 | |
| 16 | /** |
| 17 | * @var SessionFactory |
| 18 | */ |
| 19 | private $session_factory; |
| 20 | |
| 21 | /** |
| 22 | * @param SessionFactory $session_factory . |
| 23 | */ |
| 24 | public function __construct( SessionFactory $session_factory ) { |
| 25 | $this->session_factory = $session_factory; |
| 26 | } |
| 27 | |
| 28 | public function get( string $action ) { |
| 29 | switch ( $action ) { |
| 30 | case 'flexible_shipping_send': |
| 31 | return new HandleActionSend( $this->session_factory ); |
| 32 | case 'flexible_shipping_labels': |
| 33 | return new HandleActionLabels( $this->session_factory ); |
| 34 | case 'flexible_shipping_manifest': |
| 35 | return new HandleActionManifest( $this->session_factory ); |
| 36 | default: |
| 37 | throw new Exception( __( 'Bulk Handle action not found', 'flexible-shipping' ) ); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 |