diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2021-11-01 21:01:11 +0000 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2021-11-01 21:01:11 +0000 |
| commit | 647395dd6a9152ddb9d298daff21c6a3ada6d80b (patch) | |
| tree | 24131bf22297e3048e6a7c65041c3b73abc51171 /src | |
| parent | 6c5c68c597ca8c1a8c945050912cef7ed91cf98d (diff) | |
Return false if saving fails
Diffstat (limited to 'src')
| -rw-r--r-- | src/DTS/BookmarkRepository.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/DTS/BookmarkRepository.php b/src/DTS/BookmarkRepository.php index 675cb8b..a2d80cd 100644 --- a/src/DTS/BookmarkRepository.php +++ b/src/DTS/BookmarkRepository.php @@ -148,18 +148,20 @@ class BookmarkRepository implements \Iterator throw new \Exception("Unable to open repository {$this->pathToRepository}"); } + $success = true; + foreach ($this->repository as $bookmark) { - fputcsv($fp, [ + $success = $success && fputcsv($fp, [ $bookmark->id, $bookmark->url, $bookmark->title, $bookmark->tag, $bookmark->addedAt, - ]); + ]) !== false; } fclose($fp); - return true; + return $success; } } |
