PluginProbe
Packeta / 2.3.2
Packeta v2.3.2
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Module / WpdbAdapterFactory.php

WpdbAdapterFactory.php in Packeta 2.3.2, at src/Packetery/Module/WpdbAdapterFactory.php

37 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare( strict_types=1 );
4
5 namespace Packetery\Module;
6
7 use Packetery\Module\Framework\WcAdapter;
8
9 class WpdbAdapterFactory {
10
11 /**
12 * @var WcAdapter
13 */
14 private $wcAdapter;
15
16 public function __construct( WcAdapter $wcAdapter ) {
17 $this->wcAdapter = $wcAdapter;
18 }
19
20 public function create(): WpdbAdapter {
21 global $wpdb;
22
23 $instance = new WpdbAdapter( $wpdb, $this->wcAdapter );
24 $instance->packeteryCarrier = sprintf( '%scarrier', $instance->getPacketeryPrefix() );
25 $instance->packeteryOrder = sprintf( '%sorder', $instance->getPacketeryPrefix() );
26 $instance->packeteryLog = sprintf( '%slog', $instance->getPacketeryPrefix() );
27 $instance->packeteryCustomsDeclaration = sprintf( '%scustoms_declaration', $instance->getPacketeryPrefix() );
28 $instance->packeteryCustomsDeclarationItem = sprintf( '%scustoms_declaration_item', $instance->getPacketeryPrefix() );
29 $instance->wcOrders = sprintf( '%swc_orders', $wpdb->prefix );
30 $instance->posts = $wpdb->posts;
31 $instance->options = $wpdb->options;
32 $instance->postmeta = $wpdb->postmeta;
33
34 return $instance;
35 }
36 }
37