PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.16
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.16
1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 1.9.13 All 162 releases
woocommerce-pos / includes / Services / Receipt_Output_Adapter_Factory.php

Receipt_Output_Adapter_Factory.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.16, at includes/Services/Receipt_Output_Adapter_Factory.php

51 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Receipt output adapter factory.
4 *
5 * @package WCPOS\WooCommercePOS\Services
6 */
7
8 namespace WCPOS\WooCommercePOS\Services;
9
10 use InvalidArgumentException;
11 use WCPOS\WooCommercePOS\Interfaces\Receipt_Output_Adapter_Interface;
12 use WCPOS\WooCommercePOS\Templates\Adapters\Cpcl_Output_Adapter;
13 use WCPOS\WooCommercePOS\Templates\Adapters\Epos_Xml_Output_Adapter;
14 use WCPOS\WooCommercePOS\Templates\Adapters\Escpos_Output_Adapter;
15 use WCPOS\WooCommercePOS\Templates\Adapters\Html_Output_Adapter;
16 use WCPOS\WooCommercePOS\Templates\Adapters\Tspl_Output_Adapter;
17 use WCPOS\WooCommercePOS\Templates\Adapters\Zpl_Output_Adapter;
18
19 /**
20 * Receipt_Output_Adapter_Factory class.
21 */
22 class Receipt_Output_Adapter_Factory {
23 /**
24 * Create output adapter by type.
25 *
26 * @param string $output_type Output type.
27 *
28 * @throws InvalidArgumentException If output type is unsupported.
29 *
30 * @return Receipt_Output_Adapter_Interface
31 */
32 public function create( string $output_type ): Receipt_Output_Adapter_Interface {
33 switch ( $output_type ) {
34 case 'html':
35 return new Html_Output_Adapter();
36 case 'escpos':
37 return new Escpos_Output_Adapter();
38 case 'epos-xml':
39 return new Epos_Xml_Output_Adapter();
40 case 'zpl':
41 return new Zpl_Output_Adapter();
42 case 'cpcl':
43 return new Cpcl_Output_Adapter();
44 case 'tspl':
45 return new Tspl_Output_Adapter();
46 default:
47 throw new InvalidArgumentException( 'Unsupported receipt output type: ' . esc_html( $output_type ) );
48 }
49 }
50 }
51