Skip to content

Commit 7dc1de6

Browse files
committed
Fix admin PHP warning output
1 parent 26b8775 commit 7dc1de6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

includes/class-brevwoo-admin.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
use Brevo\Client\Model\CreateContact;
11-
use BrevWoo_ApiClient;
1211

1312
/**
1413
* The admin-specific functionality of the plugin.
@@ -58,13 +57,15 @@ public function __construct( $plugin_name, $version ) {
5857
/**
5958
* Initialize the API client.
6059
*
60+
* @SuppressWarnings(MissingImport)
61+
*
6162
* @return void
6263
*/
6364
private function initialize_api_client() {
6465
$brevo_api_key = get_option( 'brevwoo_brevo_api_key', '' );
6566
if ( ! empty( $brevo_api_key ) ) {
6667
require_once plugin_dir_path( __FILE__ ) . 'class-brevwoo-apiclient.php';
67-
$this->api_client = new BrevWoo_ApiClient( $brevo_api_key );
68+
$this->api_client = new \BrevWoo_ApiClient( $brevo_api_key );
6869
}
6970
}
7071

@@ -857,6 +858,10 @@ private function create_brevo_contact( $order, $list_ids ) {
857858
* @return void
858859
*/
859860
private function render_brevo_status_notice() {
861+
if ( ! $this->api_client ) {
862+
return;
863+
}
864+
860865
try {
861866
$this->api_client->get_account();
862867
$message =

0 commit comments

Comments
 (0)