| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class WpdbAdapterFactory |
| 4 |
* |
| 5 |
* @package Packetery |
| 6 |
*/ |
| 7 |
|
| 8 |
declare( strict_types=1 ); |
| 9 |
|
| 10 |
namespace Packetery\Module; |
| 11 |
|
| 12 |
/** |
| 13 |
* Class WpdbAdapterFactory |
| 14 |
* |
| 15 |
* @package Packetery |
| 16 |
*/ |
| 17 |
class WpdbAdapterFactory { |
| 18 |
/** |
| 19 |
* Creates WpdbAdapter instance |
| 20 |
* |
| 21 |
* @return WpdbAdapter |
| 22 |
*/ |
| 23 |
public function create(): WpdbAdapter { |
| 24 |
global $wpdb; |
| 25 |
|
| 26 |
$instance = new WpdbAdapter( $wpdb ); |
| 27 |
$instance->packeteryCarrier = sprintf( '%scarrier', $instance->getPacketeryPrefix() ); |
| 28 |
$instance->packeteryOrder = sprintf( '%sorder', $instance->getPacketeryPrefix() ); |
| 29 |
$instance->packeteryLog = sprintf( '%slog', $instance->getPacketeryPrefix() ); |
| 30 |
$instance->packeteryCustomsDeclaration = sprintf( '%scustoms_declaration', $instance->getPacketeryPrefix() ); |
| 31 |
$instance->packeteryCustomsDeclarationItem = sprintf( '%scustoms_declaration_item', $instance->getPacketeryPrefix() ); |
| 32 |
$instance->wcOrders = sprintf( '%swc_orders', $wpdb->prefix ); |
| 33 |
$instance->posts = $wpdb->posts; |
| 34 |
$instance->options = $wpdb->options; |
| 35 |
$instance->postmeta = $wpdb->postmeta; |
| 36 |
|
| 37 |
return $instance; |
| 38 |
} |
| 39 |
} |
| 40 |
|