diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 07e2bb7ece..6f8232dbc0 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -26,6 +26,8 @@ class Kernel extends ConsoleKernel * * @param \Illuminate\Console\Scheduling\Schedule $schedule * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @return void */ protected function schedule(Schedule $schedule) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 5bf9d44d91..08c263fb3a 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -27,6 +27,7 @@ class Handler extends ExceptionHandler * * @param \Illuminate\Http\Request $request * @param \Exception $e + * @SuppressWarnings(PHPMD.ShortVariable) * * @return \Illuminate\Http\Response */ diff --git a/app/Handlers/Events/JournalDeletedHandler.php b/app/Handlers/Events/JournalDeletedHandler.php deleted file mode 100644 index 757738ba62..0000000000 --- a/app/Handlers/Events/JournalDeletedHandler.php +++ /dev/null @@ -1,36 +0,0 @@ -piggyBank()->first(); - $bars = new Collection; - $currentStart = clone $repetition->startdate; - - if (is_null($piggyBank->reminder)) { - $entry = ['repetition' => $repetition, 'amountPerBar' => floatval($piggyBank->targetamount), - 'currentAmount' => floatval($repetition->currentamount), 'cumulativeAmount' => floatval($piggyBank->targetamount), - 'startDate' => clone $repetition->startdate, 'targetDate' => clone $repetition->targetdate]; - $bars->push($this->createPiggyBankPart($entry)); - - return $bars; - } - - while ($currentStart < $repetition->targetdate) { - $currentTarget = Navigation::endOfX($currentStart, $piggyBank->reminder, $repetition->targetdate); - $entry = ['repetition' => $repetition, 'amountPerBar' => null, 'currentAmount' => floatval($repetition->currentamount), - 'cumulativeAmount' => null, 'startDate' => $currentStart, 'targetDate' => $currentTarget]; - $bars->push($this->createPiggyBankPart($entry)); - $currentStart = clone $currentTarget; - $currentStart->addDay(); - - } - $amountPerBar = floatval($piggyBank->targetamount) / $bars->count(); - $cumulative = $amountPerBar; - /** @var PiggyBankPart $bar */ - foreach ($bars as $index => $bar) { - $bar->setAmountPerBar($amountPerBar); - $bar->setCumulativeAmount($cumulative); - if ($bars->count() - 1 == $index) { - $bar->setCumulativeAmount($piggyBank->targetamount); - } - $cumulative += $amountPerBar; - } - - return $bars; - } - /** * @param PiggyBank $piggyBank * @param $amount @@ -83,24 +32,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface return true; } - /** - * @param array $data - * - * @return PiggyBankPart - */ - public function createPiggyBankPart(array $data) - { - $part = new PiggyBankPart; - $part->setRepetition($data['repetition']); - $part->setAmountPerBar($data['amountPerBar']); - $part->setCurrentamount($data['currentAmount']); - $part->setCumulativeAmount($data['cumulativeAmount']); - $part->setStartdate($data['startDate']); - $part->setTargetdate($data['targetDate']); - - return $part; - } - /** * @param PiggyBank $piggyBank * diff --git a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php index ce67a6b6b0..7724a294a8 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php +++ b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php @@ -14,18 +14,6 @@ use Illuminate\Support\Collection; interface PiggyBankRepositoryInterface { - /** - * - * Based on the piggy bank, the reminder-setting and - * other variables this method tries to divide the piggy bank into equal parts. Each is - * accommodated by a reminder (if everything goes to plan). - * - * @param PiggyBankRepetition $repetition - * - * @return Collection - */ - public function calculateParts(PiggyBankRepetition $repetition); - /** * @return Collection */ @@ -38,13 +26,6 @@ interface PiggyBankRepositoryInterface */ public function getEvents(PiggyBank $piggyBank); - /** - * @param array $data - * - * @return PiggyBankPart - */ - public function createPiggyBankPart(array $data); - /** * @param PiggyBank $piggyBank * @param $amount diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 188853939b..c8e172e68d 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -18,6 +18,8 @@ class TagRepository implements TagRepositoryInterface { /** + * @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five. + * * @param TransactionJournal $journal * @param Tag $tag * diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index c28c7ea5b8..9263fd13d4 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -29,10 +29,11 @@ class FireflyValidator extends Validator * @param array $rules * @param array $messages * @param array $customAttributes + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = []) { - parent::__construct($translator, $data, $rules, $messages); + parent::__construct($translator, $data, $rules, $messages, $customAttributes); } /**