From 61de5a5699002b0d2e49b2d27f576cb1ef276aed Mon Sep 17 00:00:00 2001 From: PierreLebedel Date: Sun, 3 Nov 2024 15:23:25 +0000 Subject: [PATCH] Fix styling --- src/Models/AbstractVCard.php | 8 ++++---- src/VCardBuilder.php | 5 ++--- src/VCardsCollection.php | 18 +++++++++--------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Models/AbstractVCard.php b/src/Models/AbstractVCard.php index 5705c7f..b99ec3b 100644 --- a/src/Models/AbstractVCard.php +++ b/src/Models/AbstractVCard.php @@ -433,18 +433,18 @@ public function toString(): string return $vCardString; } - public function __toString() :string + public function __toString(): string { return $this->toString(); } - public function export(string $filePath) :void + public function export(string $filePath): void { - try{ + try { $fp = fopen($filePath, 'w'); fwrite($fp, $this->toString()); fclose($fp); - } catch(Throwable $e){ + } catch (Throwable $e) { throw VCardExportException::unableToWrite($filePath); } } diff --git a/src/VCardBuilder.php b/src/VCardBuilder.php index b48c162..edc77aa 100644 --- a/src/VCardBuilder.php +++ b/src/VCardBuilder.php @@ -630,13 +630,12 @@ public function get(): AbstractVCard /** * Shortcuts to use builder as vCard object */ - - public function __toString() :string + public function __toString(): string { return (string) $this->get(); } - public function export(string $filePath) :void + public function export(string $filePath): void { $this->get()->export($filePath); } diff --git a/src/VCardsCollection.php b/src/VCardsCollection.php index ae16ad8..21b6cad 100644 --- a/src/VCardsCollection.php +++ b/src/VCardsCollection.php @@ -4,10 +4,10 @@ namespace Pleb\VCardIO; -use Throwable; -use Pleb\VCardIO\Models\AbstractVCard; -use Pleb\VCardIO\Exceptions\VCardExportException; use Pleb\VCardIO\Exceptions\VCardCollectionException; +use Pleb\VCardIO\Exceptions\VCardExportException; +use Pleb\VCardIO\Models\AbstractVCard; +use Throwable; class VCardsCollection implements \ArrayAccess, \Countable, \Iterator { @@ -64,20 +64,20 @@ public function toString(): string return $collectionString; } - public function __toString() :string + public function __toString(): string { return $this->toString(); } - public function export(string $filePath, bool $append = false) :void + public function export(string $filePath, bool $append = false): void { - try{ + try { $mode = ($append) ? 'a' : 'w'; $fp = fopen($filePath, $mode); - if($mode=='a'){ - if(filesize($filePath)>0){ + if ($mode == 'a') { + if (filesize($filePath) > 0) { fwrite($fp, PHP_EOL); } } @@ -85,7 +85,7 @@ public function export(string $filePath, bool $append = false) :void fwrite($fp, $this->toString()); fclose($fp); - } catch(Throwable $e){ + } catch (Throwable $e) { throw VCardExportException::unableToWrite($filePath); } }