diff --git a/composer.json b/composer.json index cff16de..4e2d0c7 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,6 @@ ], "require": { "ext-simplexml": "*", - "ext-http": "*", "ext-mbstring": "*", "ext-libxml": "*" }, diff --git a/src/OFX.php b/src/OFX.php index e9de367..8023394 100644 --- a/src/OFX.php +++ b/src/OFX.php @@ -201,7 +201,7 @@ private static function parseStatement(SimpleXMLElement $xml): Statement $sic, $checkNumber, ); - }; + } return new Statement($currency, $transactions, $startDate, $endDate); } diff --git a/src/OFXUtils.php b/src/OFXUtils.php index 806eef2..aded4e9 100644 --- a/src/OFXUtils.php +++ b/src/OFXUtils.php @@ -2,9 +2,12 @@ namespace Endeken\OFX; +use RuntimeException; +use SimpleXMLElement; + class OFXUtils { - public static function normalizeOfx(string $ofxContent): string|false|\SimpleXMLElement + public static function normalizeOfx(string $ofxContent): string|false|SimpleXMLElement { $ofxContent = str_replace(['\r\n'], '\n', $ofxContent); $ofxContent = mb_convert_encoding($ofxContent, 'UTF-8', 'ISO-8859-1'); @@ -25,7 +28,7 @@ public static function normalizeOfx(string $ofxContent): string|false|\SimpleXML $xml = simplexml_load_string($ofxXml); if ($errors = libxml_get_errors()) { - throw new \RuntimeException('Failed to parse OFX: ' . var_export($errors, true)); + throw new RuntimeException('Failed to parse OFX: ' . var_export($errors, true)); } return $xml; @@ -110,9 +113,9 @@ private static function closeUnclosedXmlTags($line): string $line, $matches )) { - return "<{$matches[1]}>{$matches[2]}"; + return "<$matches[1]>$matches[2]"; } return $line; } -} \ No newline at end of file +} diff --git a/src/SignOn.php b/src/SignOn.php index 4bd960a..d54db1c 100644 --- a/src/SignOn.php +++ b/src/SignOn.php @@ -2,7 +2,7 @@ namespace Endeken\OFX; -use DateTimeInterface; +use DateTime; class SignOn { @@ -12,9 +12,9 @@ class SignOn public Status $status; /** - * @var DateTimeInterface + * @var DateTime */ - public DateTimeInterface $date; + public DateTime $date; /** * @var string @@ -26,11 +26,11 @@ class SignOn */ public Institute $institute; - public function __construct(Status $status, DateTimeInterface $date, string $language, Institute $institute) + public function __construct(Status $status, DateTime $date, string $language, Institute $institute) { $this->status = $status; $this->date = $date; $this->language = $language; $this->institute = $institute; } -} \ No newline at end of file +} diff --git a/src/Transaction.php b/src/Transaction.php index 8a86b47..ece315a 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -115,8 +115,7 @@ public function __construct( */ public function typeDescription(): string { - // Cast SimpleXMLObject to string - $type = (string)$this->type; + $type = $this->type; return array_key_exists($type, self::$types) ? self::$types[$type] : ''; } }