Various code cleanup

This commit is contained in:
James Cole 2016-12-27 20:52:00 +01:00
parent 02695d852c
commit 1aee3d8e2c
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
9 changed files with 22 additions and 9 deletions

View File

@ -18,6 +18,7 @@ use Illuminate\Queue\SerializesModels;
/** /**
* Class BlockedBadLogin * Class BlockedBadLogin
* *
* @deprecated
* @package FireflyIII\Events * @package FireflyIII\Events
*/ */
class BlockedBadLogin extends Event class BlockedBadLogin extends Event

View File

@ -19,6 +19,7 @@ use Illuminate\Queue\SerializesModels;
/** /**
* Class BlockedUseOfEmail * Class BlockedUseOfEmail
* *
* @deprecated
* @package FireflyIII\Events * @package FireflyIII\Events
*/ */
class BlockedUseOfEmail extends Event class BlockedUseOfEmail extends Event

View File

@ -19,6 +19,7 @@ use Illuminate\Queue\SerializesModels;
/** /**
* Class BlockedUserLogin * Class BlockedUserLogin
* *
* @deprecated
* @package FireflyIII\Events * @package FireflyIII\Events
*/ */
class BlockedUserLogin extends Event class BlockedUserLogin extends Event

View File

@ -18,6 +18,7 @@ use Illuminate\Queue\SerializesModels;
/** /**
* Class DeletedUser * Class DeletedUser
* *
* @deprecated
* @package FireflyIII\Events * @package FireflyIII\Events
*/ */
class DeletedUser extends Event class DeletedUser extends Event

View File

@ -18,6 +18,7 @@ use Illuminate\Queue\SerializesModels;
/** /**
* Class LockedOutUser * Class LockedOutUser
* *
* @deprecated
* @package FireflyIII\Events * @package FireflyIII\Events
*/ */
class LockedOutUser extends Event class LockedOutUser extends Event

View File

@ -125,6 +125,7 @@ class StoredJournalEventHandler
} }
/** /**
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's 6 but I can live with it.
* @param TransactionJournal $journal * @param TransactionJournal $journal
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* @param PiggyBankRepetition $repetition * @param PiggyBankRepetition $repetition
@ -153,7 +154,8 @@ class StoredJournalEventHandler
Log::debug(sprintf('Room in piggy bank for extra money is %f', $room)); Log::debug(sprintf('Room in piggy bank for extra money is %f', $room));
Log::debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name)); Log::debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
Log::debug(sprintf('New amount is %f', $room)); Log::debug(sprintf('New amount is %f', $room));
$amount = $room;
return $room;
} }
// amount is negative and $currentamount is smaller than $amount // amount is negative and $currentamount is smaller than $amount
@ -161,7 +163,8 @@ class StoredJournalEventHandler
Log::debug(sprintf('Max amount to remove is %f', $repetition->currentamount)); Log::debug(sprintf('Max amount to remove is %f', $repetition->currentamount));
Log::debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name)); Log::debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
Log::debug(sprintf('New amount is %f', $compare)); Log::debug(sprintf('New amount is %f', $compare));
$amount = $compare;
return $compare;
} }
return $amount; return $amount;

View File

@ -85,6 +85,7 @@ class UserEventHandler
/** /**
* @param BlockedBadLogin $event * @param BlockedBadLogin $event
* *
* @deprecated
* @return bool * @return bool
*/ */
public function reportBadLogin(BlockedBadLogin $event) public function reportBadLogin(BlockedBadLogin $event)
@ -118,6 +119,7 @@ class UserEventHandler
/** /**
* @param BlockedUserLogin $event * @param BlockedUserLogin $event
* *
* @deprecated
* @return bool * @return bool
*/ */
public function reportBlockedUser(BlockedUserLogin $event): bool public function reportBlockedUser(BlockedUserLogin $event): bool
@ -157,6 +159,7 @@ class UserEventHandler
/** /**
* @param LockedOutUser $event * @param LockedOutUser $event
* *
* @deprecated
* @return bool * @return bool
*/ */
public function reportLockout(LockedOutUser $event): bool public function reportLockout(LockedOutUser $event): bool
@ -189,6 +192,7 @@ class UserEventHandler
/** /**
* @param BlockedUseOfDomain $event * @param BlockedUseOfDomain $event
* *
* @deprecated
* @return bool * @return bool
*/ */
public function reportUseBlockedDomain(BlockedUseOfDomain $event): bool public function reportUseBlockedDomain(BlockedUseOfDomain $event): bool
@ -227,6 +231,7 @@ class UserEventHandler
/** /**
* @param BlockedUseOfEmail $event * @param BlockedUseOfEmail $event
* *
* @deprecated
* @return bool * @return bool
*/ */
public function reportUseOfBlockedEmail(BlockedUseOfEmail $event): bool public function reportUseOfBlockedEmail(BlockedUseOfEmail $event): bool
@ -263,6 +268,7 @@ class UserEventHandler
/** /**
* @param DeletedUser $event * @param DeletedUser $event
* *
* @deprecated
* @return bool * @return bool
*/ */
public function saveEmailAddress(DeletedUser $event): bool public function saveEmailAddress(DeletedUser $event): bool
@ -379,6 +385,7 @@ class UserEventHandler
* from the user yet stored conveniently. * from the user yet stored conveniently.
* *
* @param ConfirmedUser $event * @param ConfirmedUser $event
* @deprecated
* *
* @return bool * @return bool
*/ */
@ -394,6 +401,7 @@ class UserEventHandler
* fashion as the previous method. * fashion as the previous method.
* *
* @param RegisteredUser $event * @param RegisteredUser $event
* @deprecated
* *
* @return bool * @return bool
*/ */

View File

@ -139,6 +139,7 @@ class BalanceLine
} }
/** /**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @return string * @return string
*/ */
public function getTitle(): string public function getTitle(): string
@ -147,13 +148,13 @@ class BalanceLine
return $this->getBudget()->name; return $this->getBudget()->name;
} }
if ($this->getRole() == self::ROLE_DEFAULTROLE) { if ($this->getRole() == self::ROLE_DEFAULTROLE) {
return trans('firefly.no_budget'); return strval(trans('firefly.no_budget'));
} }
if ($this->getRole() == self::ROLE_TAGROLE) { if ($this->getRole() == self::ROLE_TAGROLE) {
return trans('firefly.coveredWithTags'); return strval(trans('firefly.coveredWithTags'));
} }
if ($this->getRole() == self::ROLE_DIFFROLE) { if ($this->getRole() == self::ROLE_DIFFROLE) {
return trans('firefly.leftUnbalanced'); return strval(trans('firefly.leftUnbalanced'));
} }
return ''; return '';

View File

@ -74,12 +74,8 @@ class Help implements HelpInterface
$converter = new CommonMarkConverter(); $converter = new CommonMarkConverter();
$content = $converter->convertToHtml($content); $content = $converter->convertToHtml($content);
} }
if (strlen($content) === 0) {
Log::warning('Raw content length is zero.');
}
return $content; return $content;
} }
/** /**