Strict comparisons.

This commit is contained in:
James Cole
2017-07-15 16:41:07 +02:00
parent c03ab269f0
commit 22144b78ea
59 changed files with 110 additions and 107 deletions

View File

@@ -95,7 +95,7 @@ class Account extends Model
/** @var Account $account */
foreach ($set as $account) {
if ($account->name == $fields['name']) {
if ($account->name === $fields['name']) {
return $account;
}
}
@@ -116,7 +116,7 @@ class Account extends Model
{
if (auth()->check()) {
if ($value->user_id == auth()->user()->id) {
if ($value->user_id === auth()->user()->id) {
return $value;
}
}
@@ -187,7 +187,7 @@ class Account extends Model
public function getMeta(string $fieldName): string
{
foreach ($this->accountMeta as $meta) {
if ($meta->name == $fieldName) {
if ($meta->name === $fieldName) {
return strval($meta->data);
}
}

View File

@@ -55,7 +55,7 @@ class Attachment extends Model
{
if (auth()->check()) {
if ($value->user_id == auth()->user()->id) {
if ($value->user_id === auth()->user()->id) {
return $value;
}
}

View File

@@ -62,7 +62,7 @@ class Bill extends Model
public static function routeBinder(Bill $value)
{
if (auth()->check()) {
if ($value->user_id == auth()->user()->id) {
if ($value->user_id === auth()->user()->id) {
return $value;
}
}
@@ -77,7 +77,7 @@ class Bill extends Model
public function getMatchAttribute($value)
{
if (intval($this->match_encrypted) == 1) {
if (intval($this->match_encrypted) === 1) {
return Crypt::decrypt($value);
}
@@ -92,7 +92,7 @@ class Bill extends Model
public function getNameAttribute($value)
{
if (intval($this->name_encrypted) == 1) {
if (intval($this->name_encrypted) === 1) {
return Crypt::decrypt($value);
}

View File

@@ -66,7 +66,7 @@ class Budget extends Model
$set = $query->get(['budgets.*']);
/** @var Budget $budget */
foreach ($set as $budget) {
if ($budget->name == $fields['name']) {
if ($budget->name === $fields['name']) {
return $budget;
}
}
@@ -85,7 +85,7 @@ class Budget extends Model
public static function routeBinder(Budget $value)
{
if (auth()->check()) {
if ($value->user_id == auth()->user()->id) {
if ($value->user_id === auth()->user()->id) {
return $value;
}
}

View File

@@ -67,7 +67,7 @@ class Category extends Model
$set = $query->get(['categories.*']);
/** @var Category $category */
foreach ($set as $category) {
if ($category->name == $fields['name']) {
if ($category->name === $fields['name']) {
return $category;
}
}
@@ -86,7 +86,7 @@ class Category extends Model
public static function routeBinder(Category $value)
{
if (auth()->check()) {
if ($value->user_id == auth()->user()->id) {
if ($value->user_id === auth()->user()->id) {
return $value;
}
}

View File

@@ -124,7 +124,7 @@ class ImportJob extends Model
if (is_null($value)) {
return [];
}
if (strlen($value) == 0) {
if (strlen($value) === 0) {
return [];
}
@@ -138,7 +138,7 @@ class ImportJob extends Model
*/
public function getExtendedStatusAttribute($value)
{
if (strlen($value) == 0) {
if (strlen($value) === 0) {
return [];
}

View File

@@ -58,7 +58,7 @@ class PiggyBank extends Model
public static function routeBinder(PiggyBank $value)
{
if (auth()->check()) {
if ($value->account->user_id == auth()->user()->id) {
if ($value->account->user_id === auth()->user()->id) {
return $value;
}
}

View File

@@ -51,7 +51,7 @@ class Rule extends Model
public static function routeBinder(Rule $value)
{
if (auth()->check()) {
if ($value->user_id == auth()->user()->id) {
if ($value->user_id === auth()->user()->id) {
return $value;
}
}

View File

@@ -52,7 +52,7 @@ class RuleGroup extends Model
public static function routeBinder(RuleGroup $value)
{
if (auth()->check()) {
if ($value->user_id == auth()->user()->id) {
if ($value->user_id === auth()->user()->id) {
return $value;
}
}

View File

@@ -66,7 +66,7 @@ class Tag extends Model
$set = $query->get(['tags.*']);
/** @var Tag $tag */
foreach ($set as $tag) {
if ($tag->tag == $fields['tag']) {
if ($tag->tag === $fields['tag']) {
return $tag;
}
}
@@ -87,7 +87,7 @@ class Tag extends Model
public static function routeBinder(Tag $value)
{
if (auth()->check()) {
if ($value->user_id == auth()->user()->id) {
if ($value->user_id === auth()->user()->id) {
return $value;
}
}

View File

@@ -207,7 +207,7 @@ class TransactionJournal extends Model
public function isDeposit(): bool
{
if (!is_null($this->transaction_type_type)) {
return $this->transaction_type_type == TransactionType::DEPOSIT;
return $this->transaction_type_type === TransactionType::DEPOSIT;
}
return $this->transactionType->isDeposit();
@@ -220,7 +220,7 @@ class TransactionJournal extends Model
public function isOpeningBalance(): bool
{
if (!is_null($this->transaction_type_type)) {
return $this->transaction_type_type == TransactionType::OPENING_BALANCE;
return $this->transaction_type_type === TransactionType::OPENING_BALANCE;
}
return $this->transactionType->isOpeningBalance();
@@ -233,7 +233,7 @@ class TransactionJournal extends Model
public function isTransfer(): bool
{
if (!is_null($this->transaction_type_type)) {
return $this->transaction_type_type == TransactionType::TRANSFER;
return $this->transaction_type_type === TransactionType::TRANSFER;
}
return $this->transactionType->isTransfer();
@@ -246,7 +246,7 @@ class TransactionJournal extends Model
public function isWithdrawal(): bool
{
if (!is_null($this->transaction_type_type)) {
return $this->transaction_type_type == TransactionType::WITHDRAWAL;
return $this->transaction_type_type === TransactionType::WITHDRAWAL;
}
return $this->transactionType->isWithdrawal();