From a9654f00c8fbc9934289d761843ddd071025013f Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 28 Aug 2026 17:20:28 +0000
Subject: [PATCH] =PHPStorm Code Inspection: fixed class reference errors (from getting rid of JVB() and replacing with direct class::getInstance; as well as general code sniffing, etc

---
 inc/integrations/services/PostMarkOld.php |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/inc/integrations/services/PostMarkOld.php b/inc/integrations/services/PostMarkOld.php
index 9f7c7fd..b2dcca8 100644
--- a/inc/integrations/services/PostMarkOld.php
+++ b/inc/integrations/services/PostMarkOld.php
@@ -1,7 +1,10 @@
 <?php
 
 namespace JVBase\integrations\services;
+use Exception;
 use JVBase\integrations\Integrations;
+use WP_Error;
+
 if (!defined('ABSPATH')) {
 	exit;
 }
@@ -158,8 +161,8 @@
 
 		// Determine content type
 		$is_html = $parsed_headers['content-type'] === 'text/html' ||
-			strpos($message, '<html') !== false ||
-			strpos($message, '<body') !== false;
+			str_contains($message, '<html') ||
+			str_contains($message, '<body');
 
 		// Build PostMark payload
 		$payload = $this->buildEmailPayload(
@@ -293,7 +296,7 @@
 
 			return true;
 
-		} catch (\Exception $e) {
+		} catch (Exception $e) {
 			$this->logError('[POSTMARK]', ['method' => 'sendEmail', 'error' => $e->getMessage()]);
 			return new WP_Error(
 				'postmark_send_failed',
@@ -357,7 +360,7 @@
 
 		switch ($name) {
 			case 'content-type':
-				if (strpos($value, 'text/html') !== false) {
+				if (str_contains($value, 'text/html')) {
 					$parsed['content-type'] = 'text/html';
 				}
 				break;
@@ -386,7 +389,7 @@
 
 			default:
 				// Store custom headers
-				if (strpos($name, 'x-') === 0) {
+				if (str_starts_with($name, 'x-')) {
 					$parsed['x-headers'][] = [
 						'Name' => $parts[0], // Original case
 						'Value' => $value
@@ -513,7 +516,7 @@
 				$this->cache->set($cache_key, $stats, 3600); // Cache for 1 hour
 				return $stats;
 			}
-		} catch (\Exception $e) {
+		} catch (Exception $e) {
 			$this->logError('stats/outbound', ['error' => $e->getMessage()]);
 		}
 
@@ -530,7 +533,7 @@
 				'count' => $count,
 				'offset' => $offset
 			]);
-		} catch (\Exception $e) {
+		} catch (Exception $e) {
 			$this->logError('[POSTMARK]', ['method' => 'getBounces', 'error' => $e->getMessage()]);
 			return [];
 		}

--
Gitblit v1.10.0