PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.17
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.17
1.10.25 1.10.24 1.10.23 1.10.22 1.10.21 1.10.20 1.10.19 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 All 169 releases
← All changes | includes/Services/Provider.php +0 -56 1.10.21 → 1.10.17 View file →
@@ -11,9 +11,8 @@
11 11
12 12 namespace WCPOS\WooCommercePOS\Services;
13 13
14 14 use WCPOS\WooCommercePOS\Interfaces\Provider_Adapter_Interface;
15 -use WCPOS\WooCommercePOS\Interfaces\Poll_Provider_Adapter_Interface;
16 15 use WCPOS\WooCommercePOS\Services\Providers\Epson_Sdp_Adapter;
17 16 use WCPOS\WooCommercePOS\Services\Providers\Printnode_Adapter;
18 17 use WCPOS\WooCommercePOS\Services\Providers\Star_Cloudprnt_Adapter;
19 18 use WCPOS\WooCommercePOS\Services\Providers\Star_Online_Adapter;
@@ -133,63 +132,8 @@
133 132 return new Star_Online_Adapter();
134 133 default:
135 134 return null;
136 135 }
137 - }
138 -
139 - /**
140 - * Resolve the wire format and HTTP content type for a print job.
141 - *
142 - * @param array $printer Printer configuration.
143 - * @param array $template Template configuration.
144 - *
145 - * @return array{kind:string, content_type:string}
146 - */
147 - public static function format( array $printer, array $template ): array {
148 - // Printer rows saved before the provider field existed have none; they must behave as the default provider.
149 - $provider = self::normalize( \is_string( $printer['provider'] ?? null ) ? $printer['provider'] : null );
150 - $adapter = self::adapter( $provider );
151 - if ( null === $adapter ) {
152 - return array(
153 - 'kind' => '',
154 - 'content_type' => '',
155 - );
156 - }
157 -
158 - return $adapter->format( $printer, $template );
159 - }
160 -
161 - /**
162 - * Resolve the HTTP content type for a printer when no template is in hand.
163 - *
164 - * The reprint path uses this only when the template cannot be rendered and
165 - * the job carries no `pn_kind`; otherwise it keeps the stored content type
166 - * so the two halves cannot drift apart.
167 - *
168 - * PrintNode reports its PDF default even for a printer in raw mode. The
169 - * reprint path's `pn_kind` condition keeps raw jobs away from this answer.
170 - * Prefer format() when a template is in hand to resolve both halves together.
171 - *
172 - * @param array $printer Printer configuration.
173 - *
174 - * @return string
175 - */
176 - public static function printer_content_type( array $printer ): string {
177 - $provider = self::normalize( \is_string( $printer['provider'] ?? null ) ? $printer['provider'] : null );
178 - $adapter = self::adapter( $provider );
179 -
180 - return null === $adapter ? 'application/octet-stream' : $adapter->content_type();
181 - }
182 -
183 - /**
184 - * Resolve only polling adapters without widening the base provider contract.
185 - *
186 - * @param string $key Provider key.
187 - * @return Poll_Provider_Adapter_Interface|null
188 - */
189 - public static function poll_adapter( string $key ): ?Poll_Provider_Adapter_Interface {
190 - $adapter = self::adapter( $key );
191 - return $adapter instanceof Poll_Provider_Adapter_Interface ? $adapter : null;
192 136 }
193 137
194 138 /**
195 139 * Whether the provider polls the server for jobs.