From 1e947870a613dfc2903eebbbcca94c04a51a40a0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 30 Jan 2017 16:46:30 +0100 Subject: [PATCH] Remove all constructors. --- .../Account/AccountRepository.php | 10 ------- app/Repositories/Account/AccountTasker.php | 10 ------- .../Attachment/AttachmentRepository.php | 26 +++++++------------ .../AttachmentRepositoryInterface.php | 10 +++---- app/Repositories/Bill/BillRepository.php | 24 ++++++----------- .../Bill/BillRepositoryInterface.php | 10 +++---- app/Repositories/Budget/BudgetRepository.php | 24 ++++++----------- .../Budget/BudgetRepositoryInterface.php | 10 +++---- .../Category/CategoryRepository.php | 24 ++++++----------- .../Category/CategoryRepositoryInterface.php | 10 +++---- .../Currency/CurrencyRepository.php | 10 +------ .../Currency/CurrencyRepositoryInterface.php | 10 +++---- .../ExportJob/ExportJobRepository.php | 24 ++++++----------- .../ExportJobRepositoryInterface.php | 10 +++---- .../ImportJob/ImportJobRepository.php | 24 ++++++----------- .../ImportJobRepositoryInterface.php | 10 +++---- .../Journal/JournalRepository.php | 10 +------ .../Journal/JournalRepositoryInterface.php | 18 ++++++------- app/Repositories/Journal/JournalTasker.php | 9 ------- .../Journal/JournalTaskerInterface.php | 10 +++---- .../PiggyBank/PiggyBankRepository.php | 24 ++++++----------- app/Repositories/Rule/RuleRepository.php | 24 ++++++----------- .../Rule/RuleRepositoryInterface.php | 9 ++++--- .../RuleGroup/RuleGroupRepository.php | 10 +------ app/Repositories/Tag/TagRepository.php | 10 +------ .../Tag/TagRepositoryInterface.php | 10 +++---- 26 files changed, 128 insertions(+), 252 deletions(-) diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 631157d62c..26ba26b6ea 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -43,16 +43,6 @@ class AccountRepository implements AccountRepositoryInterface /** @var array */ private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC']; - /** - * AttachmentRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * Moved here from account CRUD * diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index 874ceb7a30..d43902e094 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -31,16 +31,6 @@ class AccountTasker implements AccountTaskerInterface /** @var User */ private $user; - /** - * AttachmentRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @see self::amountInPeriod * diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 4ee2b458c6..79a481e4ab 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -14,12 +14,12 @@ declare(strict_types = 1); namespace FireflyIII\Repositories\Attachment; use Carbon\Carbon; +use Crypt; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Models\Attachment; use FireflyIII\User; use Illuminate\Support\Collection; use Storage; -use Crypt; /** * Class AttachmentRepository @@ -30,22 +30,6 @@ class AttachmentRepository implements AttachmentRepositoryInterface { /** @var User */ private $user; - /** - * @param User $user - */ - public function setUser(User $user) - { - $this->user = $user; - } - /** - * AttachmentRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } /** * @param Attachment $attachment @@ -123,6 +107,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface return ''; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param Attachment $attachment * @param array $data diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.php index 25dc72ff38..cc7cb887f8 100644 --- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php +++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php @@ -26,11 +26,6 @@ use Illuminate\Support\Collection; interface AttachmentRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * @param Attachment $attachment * @@ -65,6 +60,11 @@ interface AttachmentRepositoryInterface */ public function getContent(Attachment $attachment): string; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param Attachment $attachment * @param array $attachmentData diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 4955145877..545a29fb96 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -36,22 +36,6 @@ class BillRepository implements BillRepositoryInterface /** @var User */ private $user; - /** - * @param User $user - */ - public function setUser(User $user) - { - $this->user = $user; - } - /** - * BillRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } /** * @param Bill $bill @@ -526,6 +510,14 @@ class BillRepository implements BillRepositoryInterface } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param array $data * diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.php index af6dd36dab..2e07d12d93 100644 --- a/app/Repositories/Bill/BillRepositoryInterface.php +++ b/app/Repositories/Bill/BillRepositoryInterface.php @@ -26,11 +26,6 @@ use Illuminate\Support\Collection; */ interface BillRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * @param Bill $bill * @@ -164,6 +159,11 @@ interface BillRepositoryInterface */ public function scan(Bill $bill, TransactionJournal $journal): bool; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $data * diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 8d6cde13a8..8f0588dc1a 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -38,22 +38,6 @@ class BudgetRepository implements BudgetRepositoryInterface /** @var User */ private $user; - /** - * BudgetRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** - * @param User $user - */ - public function setUser(User $user) - { - $this->user = $user; - } /** * @return bool */ @@ -439,6 +423,14 @@ class BudgetRepository implements BudgetRepositoryInterface return true; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param Collection $budgets * @param Collection $accounts diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index 3eefa19b01..906a4827ae 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -27,11 +27,6 @@ use Illuminate\Support\Collection; */ interface BudgetRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * @return bool */ @@ -154,6 +149,11 @@ interface BudgetRepositoryInterface */ public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): bool; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param Collection $budgets * @param Collection $accounts diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 7d88329dbe..fb366c0812 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -34,22 +34,6 @@ class CategoryRepository implements CategoryRepositoryInterface /** @var User */ private $user; - /** - * CategoryRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** - * @param User $user - */ - public function setUser(User $user) - { - $this->user = $user; - } /** * @param Category $category * @@ -390,6 +374,14 @@ class CategoryRepository implements CategoryRepositoryInterface return $result; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param Collection $categories * @param Collection $accounts diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index 80b42d6852..9e89a78f50 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -25,11 +25,6 @@ use Illuminate\Support\Collection; */ interface CategoryRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * @param Category $category * @@ -127,6 +122,11 @@ interface CategoryRepositoryInterface */ public function periodIncomeNoCategory(Collection $accounts, Carbon $start, Carbon $end): array; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param Collection $categories * @param Collection $accounts diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index d299bbf4f2..bb1444d73c 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -30,15 +30,6 @@ class CurrencyRepository implements CurrencyRepositoryInterface /** @var User */ private $user; - /** - * CategoryRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } /** * @param User $user */ @@ -46,6 +37,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface { $this->user = $user; } + /** * @param TransactionCurrency $currency * diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index 9c63c1fbfc..63eb9bf0b5 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -26,11 +26,6 @@ use Illuminate\Support\Collection; */ interface CurrencyRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * @param TransactionCurrency $currency * @@ -100,6 +95,11 @@ interface CurrencyRepositoryInterface */ public function getCurrencyByPreference(Preference $preference): TransactionCurrency; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $data * diff --git a/app/Repositories/ExportJob/ExportJobRepository.php b/app/Repositories/ExportJob/ExportJobRepository.php index afbdab9248..aa956f901e 100644 --- a/app/Repositories/ExportJob/ExportJobRepository.php +++ b/app/Repositories/ExportJob/ExportJobRepository.php @@ -29,22 +29,6 @@ class ExportJobRepository implements ExportJobRepositoryInterface /** @var User */ private $user; - /** - * ExportJobRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** - * @param User $user - */ - public function setUser(User $user) - { - $this->user = $user; - } /** * @param ExportJob $job * @param string $status @@ -155,4 +139,12 @@ class ExportJobRepository implements ExportJobRepositoryInterface return $content; } + + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } } diff --git a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php b/app/Repositories/ExportJob/ExportJobRepositoryInterface.php index 484e8496b5..7e93663ea5 100644 --- a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php +++ b/app/Repositories/ExportJob/ExportJobRepositoryInterface.php @@ -23,11 +23,6 @@ use FireflyIII\User; */ interface ExportJobRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * @param ExportJob $job * @param string $status @@ -67,4 +62,9 @@ interface ExportJobRepositoryInterface */ public function getContent(ExportJob $job): string; + /** + * @param User $user + */ + public function setUser(User $user); + } diff --git a/app/Repositories/ImportJob/ImportJobRepository.php b/app/Repositories/ImportJob/ImportJobRepository.php index 88d54f4a81..0eec759e5b 100644 --- a/app/Repositories/ImportJob/ImportJobRepository.php +++ b/app/Repositories/ImportJob/ImportJobRepository.php @@ -28,22 +28,6 @@ class ImportJobRepository implements ImportJobRepositoryInterface /** @var User */ private $user; - /** - * ExportJobRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** - * @param User $user - */ - public function setUser(User $user) - { - $this->user = $user; - } /** * @param string $fileType * @@ -101,4 +85,12 @@ class ImportJobRepository implements ImportJobRepositoryInterface return $result; } + + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } } diff --git a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php index b58468f1af..5bb2149fbe 100644 --- a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php +++ b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php @@ -23,11 +23,6 @@ use FireflyIII\User; */ interface ImportJobRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * @param string $fileType * @@ -41,4 +36,9 @@ interface ImportJobRepositoryInterface * @return ImportJob */ public function findByKey(string $key): ImportJob; + + /** + * @param User $user + */ + public function setUser(User $user); } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index aa28551d4c..12ce898ff1 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -43,15 +43,6 @@ class JournalRepository implements JournalRepositoryInterface /** @var array */ private $validMetaFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'notes']; - /** - * JournalRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } /** * @param User $user */ @@ -59,6 +50,7 @@ class JournalRepository implements JournalRepositoryInterface { $this->user = $user; } + /** * @param TransactionJournal $journal * @param TransactionType $type diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index 446d21c184..f1f5438ad4 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -27,10 +27,6 @@ use Illuminate\Support\MessageBag; */ interface JournalRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); /** * @param TransactionJournal $journal * @param TransactionType $type @@ -41,11 +37,6 @@ interface JournalRepositoryInterface */ public function convert(TransactionJournal $journal, TransactionType $type, Account $source, Account $destination): MessageBag; - /** - * @return Collection - */ - public function getTransactionTypes(): Collection; - /** * Deletes a journal. * @@ -71,6 +62,15 @@ interface JournalRepositoryInterface */ public function first(): TransactionJournal; + /** + * @return Collection + */ + public function getTransactionTypes(): Collection; + + /** + * @param User $user + */ + public function setUser(User $user); /** * @param array $data diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php index 5f9f610ca1..c0424242c8 100644 --- a/app/Repositories/Journal/JournalTasker.php +++ b/app/Repositories/Journal/JournalTasker.php @@ -35,15 +35,6 @@ class JournalTasker implements JournalTaskerInterface /** @var User */ private $user; - /** - * JournalRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } /** * @param TransactionJournal $journal diff --git a/app/Repositories/Journal/JournalTaskerInterface.php b/app/Repositories/Journal/JournalTaskerInterface.php index e5c007c1e7..1273f69c3a 100644 --- a/app/Repositories/Journal/JournalTaskerInterface.php +++ b/app/Repositories/Journal/JournalTaskerInterface.php @@ -25,11 +25,6 @@ use Illuminate\Support\Collection; */ interface JournalTaskerInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * @param TransactionJournal $journal * @@ -46,4 +41,9 @@ interface JournalTaskerInterface * @return array */ public function getTransactionsOverview(TransactionJournal $journal): array; + + /** + * @param User $user + */ + public function setUser(User $user); } diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index fad4b0f4fa..1f14467a5b 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -32,22 +32,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface /** @var User */ private $user; - /** - * PiggyBankRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** - * @param User $user - */ - public function setUser(User $user) - { - $this->user = $user; - } /** * @param PiggyBank $piggyBank * @param string $amount @@ -173,6 +157,14 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface return true; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param array $data * diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 05849acd5d..7e0487be63 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -30,22 +30,6 @@ class RuleRepository implements RuleRepositoryInterface /** @var User */ private $user; - /** - * BillRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** - * @param User $user - */ - public function setUser(User $user) - { - $this->user = $user; - } /** * @return int */ @@ -224,6 +208,14 @@ class RuleRepository implements RuleRepositoryInterface } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param array $data * diff --git a/app/Repositories/Rule/RuleRepositoryInterface.php b/app/Repositories/Rule/RuleRepositoryInterface.php index 887bb20d79..6ca1456214 100644 --- a/app/Repositories/Rule/RuleRepositoryInterface.php +++ b/app/Repositories/Rule/RuleRepositoryInterface.php @@ -26,10 +26,6 @@ use FireflyIII\User; */ interface RuleRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); /** * @return int */ @@ -98,6 +94,11 @@ interface RuleRepositoryInterface */ public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $data * diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index 7a6afa6f0e..e413987334 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -30,15 +30,6 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface /** @var User */ private $user; - /** - * BillRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } /** * @param User $user */ @@ -46,6 +37,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface { $this->user = $user; } + /** * @return int */ diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index a344da412a..1b0950467f 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -34,15 +34,6 @@ class TagRepository implements TagRepositoryInterface /** @var User */ private $user; - /** - * TagRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } /** * @param User $user */ @@ -50,6 +41,7 @@ class TagRepository implements TagRepositoryInterface { $this->user = $user; } + /** * * @param TransactionJournal $journal diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php index c813a238da..b360e7d436 100644 --- a/app/Repositories/Tag/TagRepositoryInterface.php +++ b/app/Repositories/Tag/TagRepositoryInterface.php @@ -27,11 +27,6 @@ use Illuminate\Support\Collection; */ interface TagRepositoryInterface { - /** - * @param User $user - */ - public function setUser(User $user); - /** * This method will connect a journal with a tag. * @@ -95,6 +90,11 @@ interface TagRepositoryInterface */ public function lastUseDate(Tag $tag): Carbon; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param Tag $tag * @param Carbon $start