mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Clean up code, remove unused methods.
This commit is contained in:
@@ -51,6 +51,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property bool $automatch
|
||||
* @property User $user
|
||||
* @property string $match
|
||||
* @property bool match_encrypted
|
||||
* @property bool name_encrypted
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*/
|
||||
class Bill extends Model
|
||||
{
|
||||
@@ -93,7 +97,10 @@ class Bill extends Model
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$billId = (int)$value;
|
||||
$bill = auth()->user()->bills()->find($billId);
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var Bill $bill */
|
||||
$bill = $user->bills()->find($billId);
|
||||
if (null !== $bill) {
|
||||
return $bill;
|
||||
}
|
||||
@@ -105,7 +112,7 @@ class Bill extends Model
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
*/
|
||||
public function attachments()
|
||||
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
@@ -118,7 +125,7 @@ class Bill extends Model
|
||||
* @return string
|
||||
* @throws \Illuminate\Contracts\Encryption\DecryptException
|
||||
*/
|
||||
public function getMatchAttribute($value)
|
||||
public function getMatchAttribute($value): string
|
||||
{
|
||||
if (1 === (int)$this->match_encrypted) {
|
||||
return Crypt::decrypt($value);
|
||||
@@ -135,7 +142,7 @@ class Bill extends Model
|
||||
* @return string
|
||||
* @throws \Illuminate\Contracts\Encryption\DecryptException
|
||||
*/
|
||||
public function getNameAttribute($value)
|
||||
public function getNameAttribute($value): string
|
||||
{
|
||||
if (1 === (int)$this->name_encrypted) {
|
||||
return Crypt::decrypt($value);
|
||||
@@ -158,7 +165,7 @@ class Bill extends Model
|
||||
*
|
||||
* @param $value
|
||||
*/
|
||||
public function setAmountMaxAttribute($value)
|
||||
public function setAmountMaxAttribute($value): void
|
||||
{
|
||||
$this->attributes['amount_max'] = (string)$value;
|
||||
}
|
||||
@@ -168,7 +175,7 @@ class Bill extends Model
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setAmountMinAttribute($value)
|
||||
public function setAmountMinAttribute($value): void
|
||||
{
|
||||
$this->attributes['amount_min'] = (string)$value;
|
||||
}
|
||||
@@ -179,7 +186,7 @@ class Bill extends Model
|
||||
* @codeCoverageIgnore
|
||||
* @throws \Illuminate\Contracts\Encryption\EncryptException
|
||||
*/
|
||||
public function setMatchAttribute($value)
|
||||
public function setMatchAttribute($value): void
|
||||
{
|
||||
$encrypt = config('firefly.encryption');
|
||||
$this->attributes['match'] = $encrypt ? Crypt::encrypt($value) : $value;
|
||||
@@ -192,7 +199,7 @@ class Bill extends Model
|
||||
* @codeCoverageIgnore
|
||||
* @throws \Illuminate\Contracts\Encryption\EncryptException
|
||||
*/
|
||||
public function setNameAttribute($value)
|
||||
public function setNameAttribute($value): void
|
||||
{
|
||||
$encrypt = config('firefly.encryption');
|
||||
$this->attributes['name'] = $encrypt ? Crypt::encrypt($value) : $value;
|
||||
|
Reference in New Issue
Block a user