mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Improve code quality for Export directory.
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AttachmentCollector.php
|
* AttachmentCollector.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -29,6 +28,7 @@ use Crypt;
|
|||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
|
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Storage;
|
use Storage;
|
||||||
@@ -38,15 +38,15 @@ use Storage;
|
|||||||
*/
|
*/
|
||||||
class AttachmentCollector extends BasicCollector implements CollectorInterface
|
class AttachmentCollector extends BasicCollector implements CollectorInterface
|
||||||
{
|
{
|
||||||
/** @var Carbon */
|
/** @var Carbon The end date of the range. */
|
||||||
private $end;
|
private $end;
|
||||||
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
|
/** @var \Illuminate\Contracts\Filesystem\Filesystem File system */
|
||||||
private $exportDisk;
|
private $exportDisk;
|
||||||
/** @var AttachmentRepositoryInterface */
|
/** @var AttachmentRepositoryInterface Attachment repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
/** @var Carbon */
|
/** @var Carbon Start date of range */
|
||||||
private $start;
|
private $start;
|
||||||
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
|
/** @var \Illuminate\Contracts\Filesystem\Filesystem Disk with uploads on it */
|
||||||
private $uploadDisk;
|
private $uploadDisk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,6 +64,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Run the routine.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function run(): bool
|
public function run(): bool
|
||||||
@@ -80,6 +82,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the start and end date.
|
||||||
|
*
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*/
|
*/
|
||||||
@@ -89,7 +93,10 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
$this->end = $end;
|
$this->end = $end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @noinspection MultipleReturnStatementsInspection */
|
||||||
/**
|
/**
|
||||||
|
* Export attachments.
|
||||||
|
*
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
@@ -101,13 +108,13 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
if ($this->uploadDisk->exists($file)) {
|
if ($this->uploadDisk->exists($file)) {
|
||||||
try {
|
try {
|
||||||
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
|
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
|
||||||
} catch (DecryptException $e) {
|
} catch (FileNotFoundException|DecryptException $e) {
|
||||||
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
|
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($decrypted === false) {
|
if (false === $decrypted) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$exportFile = $this->exportFileName($attachment);
|
$exportFile = $this->exportFileName($attachment);
|
||||||
@@ -130,6 +137,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the attachments.
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
private function getAttachments(): Collection
|
private function getAttachments(): Collection
|
||||||
|
@@ -33,11 +33,11 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
class BasicCollector
|
class BasicCollector
|
||||||
{
|
{
|
||||||
/** @var ExportJob */
|
/** @var ExportJob The job to export. */
|
||||||
protected $job;
|
protected $job;
|
||||||
/** @var User */
|
/** @var User The user */
|
||||||
protected $user;
|
protected $user;
|
||||||
/** @var Collection */
|
/** @var Collection All the entries. */
|
||||||
private $entries;
|
private $entries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,6 +49,8 @@ class BasicCollector
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all entries.
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getEntries(): Collection
|
public function getEntries(): Collection
|
||||||
@@ -57,26 +59,32 @@ class BasicCollector
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set entries.
|
||||||
|
*
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*/
|
*/
|
||||||
public function setEntries(Collection $entries)
|
public function setEntries(Collection $entries): void
|
||||||
{
|
{
|
||||||
$this->entries = $entries;
|
$this->entries = $entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set export job.
|
||||||
|
*
|
||||||
* @param ExportJob $job
|
* @param ExportJob $job
|
||||||
*/
|
*/
|
||||||
public function setJob(ExportJob $job)
|
public function setJob(ExportJob $job): void
|
||||||
{
|
{
|
||||||
$this->job = $job;
|
$this->job = $job;
|
||||||
$this->user = $job->user;
|
$this->user = $job->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set user.
|
||||||
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
public function setUser(User $user)
|
public function setUser(User $user): void
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
@@ -33,21 +33,29 @@ use Illuminate\Support\Collection;
|
|||||||
interface CollectorInterface
|
interface CollectorInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Get entries.
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getEntries(): Collection;
|
public function getEntries(): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Run the collector.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function run(): bool;
|
public function run(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set entries.
|
||||||
|
*
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*/
|
*/
|
||||||
public function setEntries(Collection $entries);
|
public function setEntries(Collection $entries);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set export job.
|
||||||
|
*
|
||||||
* @param ExportJob $job
|
* @param ExportJob $job
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UploadCollector.php
|
* UploadCollector.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -84,7 +83,10 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @noinspection MultipleReturnStatementsInspection */
|
||||||
/**
|
/**
|
||||||
|
* Process new file uploads.
|
||||||
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@@ -46,137 +46,65 @@ use FireflyIII\Models\Transaction;
|
|||||||
*/
|
*/
|
||||||
final class Entry
|
final class Entry
|
||||||
{
|
{
|
||||||
// @formatter:off
|
/** @var int ID of the journal */
|
||||||
/**
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $journal_id;
|
public $journal_id;
|
||||||
/**
|
/** @var int ID of the transaction */
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $transaction_id = 0;
|
public $transaction_id = 0;
|
||||||
|
/** @var string The date. */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $date;
|
public $date;
|
||||||
/**
|
/** @var string The description */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $description;
|
public $description;
|
||||||
|
/** @var string The currency code. */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $currency_code;
|
public $currency_code;
|
||||||
/**
|
/** @var string The amount. */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $amount;
|
public $amount;
|
||||||
/**
|
/** @var string The foreign currency code */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $foreign_currency_code = '';
|
public $foreign_currency_code = '';
|
||||||
/**
|
/** @var string Foreign amount */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $foreign_amount = '0';
|
public $foreign_amount = '0';
|
||||||
|
/** @var string Transaction type */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $transaction_type;
|
public $transaction_type;
|
||||||
|
/** @var string Asset account ID */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $asset_account_id;
|
public $asset_account_id;
|
||||||
/**
|
/** @var string Asset account name */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $asset_account_name;
|
public $asset_account_name;
|
||||||
/**
|
/** @var string Asset account IBAN */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $asset_account_iban;
|
public $asset_account_iban;
|
||||||
/**
|
/** @var string Asset account BIC */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $asset_account_bic;
|
public $asset_account_bic;
|
||||||
/**
|
/** @var string Asset account number */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $asset_account_number;
|
public $asset_account_number;
|
||||||
/**
|
/** @var string Asset account currency code */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $asset_currency_code;
|
public $asset_currency_code;
|
||||||
|
/** @var string Opposing account ID */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $opposing_account_id;
|
public $opposing_account_id;
|
||||||
/**
|
/** @var string Opposing account name */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $opposing_account_name;
|
public $opposing_account_name;
|
||||||
/**
|
/** @var string Opposing account IBAN */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $opposing_account_iban;
|
public $opposing_account_iban;
|
||||||
/**
|
/** @var string Opposing account BIC */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $opposing_account_bic;
|
public $opposing_account_bic;
|
||||||
/**
|
/** @var string Opposing account number */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $opposing_account_number;
|
public $opposing_account_number;
|
||||||
/**
|
/** @var string Opposing account code */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $opposing_currency_code;
|
public $opposing_currency_code;
|
||||||
|
/** @var string Budget ID */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $budget_id;
|
public $budget_id;
|
||||||
/**
|
/** @var string Budget name */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $budget_name;
|
public $budget_name;
|
||||||
|
/** @var string Category ID */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $category_id;
|
public $category_id;
|
||||||
/**
|
/** @var string Category name */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $category_name;
|
public $category_name;
|
||||||
|
/** @var string Bill ID */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $bill_id;
|
public $bill_id;
|
||||||
/**
|
/** @var string Bill name */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $bill_name;
|
public $bill_name;
|
||||||
|
/** @var string Notes */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $notes;
|
public $notes;
|
||||||
|
/** @var string Tags */
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $tags;
|
public $tags;
|
||||||
|
|
||||||
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry constructor.
|
* Entry constructor.
|
||||||
*/
|
*/
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ExpandedProcessor.php
|
* ExpandedProcessor.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -20,6 +19,8 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Export;
|
namespace FireflyIII\Export;
|
||||||
@@ -50,23 +51,23 @@ use ZipArchive;
|
|||||||
*/
|
*/
|
||||||
class ExpandedProcessor implements ProcessorInterface
|
class ExpandedProcessor implements ProcessorInterface
|
||||||
{
|
{
|
||||||
/** @var Collection */
|
/** @var Collection All accounts */
|
||||||
public $accounts;
|
public $accounts;
|
||||||
/** @var string */
|
/** @var string The export format*/
|
||||||
public $exportFormat;
|
public $exportFormat;
|
||||||
/** @var bool */
|
/** @var bool Should include attachments */
|
||||||
public $includeAttachments;
|
public $includeAttachments;
|
||||||
/** @var bool */
|
/** @var bool Should include old uploads */
|
||||||
public $includeOldUploads;
|
public $includeOldUploads;
|
||||||
/** @var ExportJob */
|
/** @var ExportJob The export job itself */
|
||||||
public $job;
|
public $job;
|
||||||
/** @var array */
|
/** @var array The settings*/
|
||||||
public $settings;
|
public $settings;
|
||||||
/** @var Collection */
|
/** @var Collection The entries to export. */
|
||||||
private $exportEntries;
|
private $exportEntries;
|
||||||
/** @var Collection */
|
/** @var Collection The files to export */
|
||||||
private $files;
|
private $files;
|
||||||
/** @var Collection */
|
/** @var Collection The journals. */
|
||||||
private $journals;
|
private $journals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,6 +81,8 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Collect all attachments
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function collectAttachments(): bool
|
public function collectAttachments(): bool
|
||||||
@@ -143,6 +146,8 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get old oploads.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function collectOldUploads(): bool
|
public function collectOldUploads(): bool
|
||||||
@@ -158,6 +163,8 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Convert journals to export objects.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function convertJournals(): bool
|
public function convertJournals(): bool
|
||||||
@@ -173,6 +180,8 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a ZIP file.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -204,6 +213,8 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Export the journals.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function exportJournals(): bool
|
public function exportJournals(): bool
|
||||||
@@ -219,6 +230,8 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get files.
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getFiles(): Collection
|
public function getFiles(): Collection
|
||||||
@@ -231,7 +244,7 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
*
|
*
|
||||||
* @param array $settings
|
* @param array $settings
|
||||||
*/
|
*/
|
||||||
public function setSettings(array $settings)
|
public function setSettings(array $settings): void
|
||||||
{
|
{
|
||||||
// save settings
|
// save settings
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
@@ -243,9 +256,9 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Delete files.
|
||||||
*/
|
*/
|
||||||
private function deleteFiles()
|
private function deleteFiles():void
|
||||||
{
|
{
|
||||||
$disk = Storage::disk('export');
|
$disk = Storage::disk('export');
|
||||||
foreach ($this->getFiles() as $file) {
|
foreach ($this->getFiles() as $file) {
|
||||||
@@ -254,6 +267,8 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get currencies.
|
||||||
|
*
|
||||||
* @param array $array
|
* @param array $array
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
@@ -32,9 +32,9 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
class BasicExporter
|
class BasicExporter
|
||||||
{
|
{
|
||||||
/** @var ExportJob */
|
/** @var ExportJob The export job */
|
||||||
protected $job;
|
protected $job;
|
||||||
/** @var Collection */
|
/** @var Collection The entries */
|
||||||
private $entries;
|
private $entries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,6 +46,8 @@ class BasicExporter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all entries.
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getEntries(): Collection
|
public function getEntries(): Collection
|
||||||
@@ -54,17 +56,21 @@ class BasicExporter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set all entries.
|
||||||
|
*
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*/
|
*/
|
||||||
public function setEntries(Collection $entries)
|
public function setEntries(Collection $entries): void
|
||||||
{
|
{
|
||||||
$this->entries = $entries;
|
$this->entries = $entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the job.
|
||||||
|
*
|
||||||
* @param ExportJob $job
|
* @param ExportJob $job
|
||||||
*/
|
*/
|
||||||
public function setJob(ExportJob $job)
|
public function setJob(ExportJob $job): void
|
||||||
{
|
{
|
||||||
$this->job = $job;
|
$this->job = $job;
|
||||||
}
|
}
|
||||||
|
@@ -33,10 +33,12 @@ use Storage;
|
|||||||
*/
|
*/
|
||||||
class CsvExporter extends BasicExporter implements ExporterInterface
|
class CsvExporter extends BasicExporter implements ExporterInterface
|
||||||
{
|
{
|
||||||
/** @var string */
|
/** @var string Filename */
|
||||||
private $fileName;
|
private $fileName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get file name.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFileName(): string
|
public function getFileName(): string
|
||||||
@@ -45,6 +47,8 @@ class CsvExporter extends BasicExporter implements ExporterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Run collector.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -83,6 +87,9 @@ class CsvExporter extends BasicExporter implements ExporterInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a temp file.
|
||||||
|
*/
|
||||||
private function tempFile()
|
private function tempFile()
|
||||||
{
|
{
|
||||||
$this->fileName = $this->job->key . '-records.csv';
|
$this->fileName = $this->job->key . '-records.csv';
|
||||||
|
@@ -33,26 +33,36 @@ use Illuminate\Support\Collection;
|
|||||||
interface ExporterInterface
|
interface ExporterInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Get entries.
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getEntries(): Collection;
|
public function getEntries(): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get file name.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFileName(): string;
|
public function getFileName(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Run exporter.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function run(): bool;
|
public function run(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set entries.
|
||||||
|
*
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*/
|
*/
|
||||||
public function setEntries(Collection $entries);
|
public function setEntries(Collection $entries);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set job.
|
||||||
|
*
|
||||||
* @param ExportJob $job
|
* @param ExportJob $job
|
||||||
*/
|
*/
|
||||||
public function setJob(ExportJob $job);
|
public function setJob(ExportJob $job);
|
||||||
|
@@ -37,41 +37,57 @@ interface ProcessorInterface
|
|||||||
public function __construct();
|
public function __construct();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Collect all attachments.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function collectAttachments(): bool;
|
public function collectAttachments(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Collect all journals.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function collectJournals(): bool;
|
public function collectJournals(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Collect old uploads.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function collectOldUploads(): bool;
|
public function collectOldUploads(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Convert all journals.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function convertJournals(): bool;
|
public function convertJournals(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a zip file.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function createZipFile(): bool;
|
public function createZipFile(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Export journals.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function exportJournals(): bool;
|
public function exportJournals(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all files.
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getFiles(): Collection;
|
public function getFiles(): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the settings.
|
||||||
|
*
|
||||||
* @param array $settings
|
* @param array $settings
|
||||||
*/
|
*/
|
||||||
public function setSettings(array $settings);
|
public function setSettings(array $settings);
|
||||||
|
Reference in New Issue
Block a user