Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreLebedel authored and github-actions[bot] committed Nov 3, 2024
1 parent 2e270e0 commit 61de5a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/Models/AbstractVCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/VCardBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
18 changes: 9 additions & 9 deletions src/VCardsCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -64,28 +64,28 @@ 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);
}
}

fwrite($fp, $this->toString());
fclose($fp);

} catch(Throwable $e){
} catch (Throwable $e) {
throw VCardExportException::unableToWrite($filePath);
}
}
Expand Down

0 comments on commit 61de5a5

Please sign in to comment.