Skip to content

Firefly III: a personal finances manager

More cleanup and php doc stuff.

James Cole80c1184eacfb
diff --git a/app/database/migrations/2014_06_27_163032_create_users_table.php b/app/database/migrations/2014_06_27_163032_create_users_table.php
index 4356800182..c4d20b537e 100644
--- a/app/database/migrations/2014_06_27_163032_create_users_table.php
+++ b/app/database/migrations/2014_06_27_163032_create_users_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateUsersTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateUsersTable extends Migration {
/**
diff --git a/app/database/migrations/2014_06_27_163145_create_account_types_table.php b/app/database/migrations/2014_06_27_163145_create_account_types_table.php
index da12408702..68816c33ec 100644
--- a/app/database/migrations/2014_06_27_163145_create_account_types_table.php
+++ b/app/database/migrations/2014_06_27_163145_create_account_types_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
+/**
+ * Class CreateAccountTypesTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateAccountTypesTable extends Migration
{
diff --git a/app/database/migrations/2014_06_27_163259_create_accounts_table.php b/app/database/migrations/2014_06_27_163259_create_accounts_table.php
index 6c5330e31a..2653b4fc65 100644
--- a/app/database/migrations/2014_06_27_163259_create_accounts_table.php
+++ b/app/database/migrations/2014_06_27_163259_create_accounts_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateAccountsTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateAccountsTable extends Migration {
/**
diff --git a/app/database/migrations/2014_06_27_163817_create_components_table.php b/app/database/migrations/2014_06_27_163817_create_components_table.php
index ca7b9da162..94dd180c59 100644
--- a/app/database/migrations/2014_06_27_163817_create_components_table.php
+++ b/app/database/migrations/2014_06_27_163817_create_components_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateComponentsTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateComponentsTable extends Migration {
/**
diff --git a/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php b/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php
index eb3fef17c6..1a6de1bce2 100644
--- a/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php
+++ b/app/database/migrations/2014_06_27_164042_create_transaction_currencies_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateTransactionCurrenciesTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateTransactionCurrenciesTable extends Migration {
/**
diff --git a/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php b/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php
index af12f27009..e54ab93e89 100644
--- a/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php
+++ b/app/database/migrations/2014_06_27_164512_create_transaction_types_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateTransactionTypesTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateTransactionTypesTable extends Migration {
/**
diff --git a/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php b/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php
index 794cb32764..71a559c18d 100644
--- a/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php
+++ b/app/database/migrations/2014_06_27_164620_create_transaction_journals_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateTransactionJournalsTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateTransactionJournalsTable extends Migration {
/**
diff --git a/app/database/migrations/2014_06_27_164836_create_transactions_table.php b/app/database/migrations/2014_06_27_164836_create_transactions_table.php
index 14a4858f76..1b9ab96301 100644
--- a/app/database/migrations/2014_06_27_164836_create_transactions_table.php
+++ b/app/database/migrations/2014_06_27_164836_create_transactions_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
+/**
+ * Class CreateTransactionsTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateTransactionsTable extends Migration
{
diff --git a/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php b/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php
index cc90d4bfa2..291aa6dcf4 100644
--- a/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php
+++ b/app/database/migrations/2014_06_27_165344_create_component_transaction_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateComponentTransactionTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateComponentTransactionTable extends Migration {
/**
diff --git a/app/database/migrations/2014_07_05_100651_create_piggybanks_table.php b/app/database/migrations/2014_07_05_100651_create_piggybanks_table.php
index 8845ca6b1a..6bed480a93 100644
--- a/app/database/migrations/2014_07_05_100651_create_piggybanks_table.php
+++ b/app/database/migrations/2014_07_05_100651_create_piggybanks_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
+/**
+ * Class CreatePiggybanksTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreatePiggybanksTable extends Migration
{
diff --git a/app/database/migrations/2014_07_05_143244_create_recurring_transactions_table.php b/app/database/migrations/2014_07_05_143244_create_recurring_transactions_table.php
index 931c60b43c..d9be3d7106 100644
--- a/app/database/migrations/2014_07_05_143244_create_recurring_transactions_table.php
+++ b/app/database/migrations/2014_07_05_143244_create_recurring_transactions_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateRecurringTransactionsTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateRecurringTransactionsTable extends Migration {
/**
diff --git a/app/database/migrations/2014_07_05_171326_create_component_transaction_journal_table.php b/app/database/migrations/2014_07_05_171326_create_component_transaction_journal_table.php
index df9b0ff525..a98d4fef02 100644
--- a/app/database/migrations/2014_07_05_171326_create_component_transaction_journal_table.php
+++ b/app/database/migrations/2014_07_05_171326_create_component_transaction_journal_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateComponentTransactionJournalTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateComponentTransactionJournalTable extends Migration {
/**
diff --git a/app/database/migrations/2014_07_06_123842_create_preferences_table.php b/app/database/migrations/2014_07_06_123842_create_preferences_table.php
index 3448062757..9aabb3bbcd 100644
--- a/app/database/migrations/2014_07_06_123842_create_preferences_table.php
+++ b/app/database/migrations/2014_07_06_123842_create_preferences_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
+/**
+ * Class CreatePreferencesTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreatePreferencesTable extends Migration
{
diff --git a/app/database/migrations/2014_07_09_204843_create_session_table.php b/app/database/migrations/2014_07_09_204843_create_session_table.php
index 2aac4339c2..d5f9867866 100644
--- a/app/database/migrations/2014_07_09_204843_create_session_table.php
+++ b/app/database/migrations/2014_07_09_204843_create_session_table.php
@@ -2,6 +2,11 @@
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateSessionTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateSessionTable extends Migration {
/**
diff --git a/app/database/migrations/2014_07_17_183717_create_limits_table.php b/app/database/migrations/2014_07_17_183717_create_limits_table.php
index ce330aecc3..356e146924 100644
--- a/app/database/migrations/2014_07_17_183717_create_limits_table.php
+++ b/app/database/migrations/2014_07_17_183717_create_limits_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateLimitsTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateLimitsTable extends Migration {
/**
diff --git a/app/database/migrations/2014_07_19_055011_create_limit_repeat_table.php b/app/database/migrations/2014_07_19_055011_create_limit_repeat_table.php
index 2fde86bfce..7a636d919f 100644
--- a/app/database/migrations/2014_07_19_055011_create_limit_repeat_table.php
+++ b/app/database/migrations/2014_07_19_055011_create_limit_repeat_table.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class CreateLimitRepeatTable
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class CreateLimitRepeatTable extends Migration {
/**
diff --git a/app/database/migrations/2014_08_06_044416_recurring_transactions_to_components.php b/app/database/migrations/2014_08_06_044416_recurring_transactions_to_components.php
index e5781b6f6d..819041d176 100644
--- a/app/database/migrations/2014_08_06_044416_recurring_transactions_to_components.php
+++ b/app/database/migrations/2014_08_06_044416_recurring_transactions_to_components.php
@@ -3,6 +3,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+/**
+ * Class RecurringTransactionsToComponents
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ */
class RecurringTransactionsToComponents extends Migration {
/**
diff --git a/app/database/seeds/AccountTypeSeeder.php b/app/database/seeds/AccountTypeSeeder.php
index f0f95532ce..8813320dde 100644
--- a/app/database/seeds/AccountTypeSeeder.php
+++ b/app/database/seeds/AccountTypeSeeder.php
@@ -1,6 +1,9 @@
<?php
+/**
+ * Class AccountTypeSeeder
+ */
class AccountTypeSeeder extends Seeder
{
public function run()
diff --git a/app/database/seeds/DatabaseSeeder.php b/app/database/seeds/DatabaseSeeder.php
index bc31d0998e..dd35eb592a 100644
--- a/app/database/seeds/DatabaseSeeder.php
+++ b/app/database/seeds/DatabaseSeeder.php
@@ -1,5 +1,8 @@
<?php
+/**
+ * Class DatabaseSeeder
+ */
class DatabaseSeeder extends Seeder
{
diff --git a/app/database/seeds/DefaultUserSeeder.php b/app/database/seeds/DefaultUserSeeder.php
index a2fae3ac7a..7ff50fb7d9 100644
--- a/app/database/seeds/DefaultUserSeeder.php
+++ b/app/database/seeds/DefaultUserSeeder.php
@@ -1,5 +1,8 @@
<?php
+/**
+ * Class DefaultUserSeeder
+ */
class DefaultUserSeeder extends Seeder
{
public function run()
diff --git a/app/database/seeds/TransactionCurrencySeeder.php b/app/database/seeds/TransactionCurrencySeeder.php
index ff04c2784e..46a08f74fb 100644
--- a/app/database/seeds/TransactionCurrencySeeder.php
+++ b/app/database/seeds/TransactionCurrencySeeder.php
@@ -1,6 +1,9 @@
<?php
+/**
+ * Class TransactionCurrencySeeder
+ */
class TransactionCurrencySeeder extends Seeder
{
public function run()
diff --git a/app/database/seeds/TransactionTypeSeeder.php b/app/database/seeds/TransactionTypeSeeder.php
index cb4071b36f..a500ce6c00 100644
--- a/app/database/seeds/TransactionTypeSeeder.php
+++ b/app/database/seeds/TransactionTypeSeeder.php
@@ -1,6 +1,9 @@
<?php
+/**
+ * Class TransactionTypeSeeder
+ */
class TransactionTypeSeeder extends Seeder
{
public function run()
diff --git a/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php b/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php
index 1d86b7d1b2..4d42ef9cbf 100644
--- a/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php
+++ b/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php
@@ -276,6 +276,7 @@ class EloquentAccountRepository implements AccountRepositoryInterface
* @param Carbon $date
*
* @return bool
+ * @SuppressWarnings(PHPMD.CamelCaseMethodName)
*/
protected function _createInitialBalance(\Account $account, $amount = 0, Carbon $date)
{
diff --git a/app/models/Account.php b/app/models/Account.php
index 93b7dbaaa9..291f836d0f 100644
--- a/app/models/Account.php
+++ b/app/models/Account.php
@@ -92,6 +92,11 @@ class Account extends Ardent
);
}
+ /**
+ * @param \Carbon\Carbon $date
+ *
+ * @return null
+ */
public function predict(\Carbon\Carbon $date)
{
return null;
diff --git a/app/models/AccountType.php b/app/models/AccountType.php
index 1f0607bcbc..b1206e714b 100644
--- a/app/models/AccountType.php
+++ b/app/models/AccountType.php
@@ -22,6 +22,9 @@ class AccountType extends Eloquent
'description' => 'string'
];
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function accounts()
{
return $this->hasMany('Account');
diff --git a/app/models/Budget.php b/app/models/Budget.php
index d93b88d909..488b3547f9 100644
--- a/app/models/Budget.php
+++ b/app/models/Budget.php
@@ -30,11 +30,17 @@ class Budget extends Component
];
protected $isSubclass = true;
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function limits()
{
return $this->hasMany('Limit', 'component_id');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function transactionjournals()
{
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
diff --git a/app/models/Category.php b/app/models/Category.php
index 067f795bc0..e08108bd18 100644
--- a/app/models/Category.php
+++ b/app/models/Category.php
@@ -30,6 +30,9 @@ class Category extends Component
];
protected $isSubclass = true;
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function transactionjournals()
{
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
diff --git a/app/models/Component.php b/app/models/Component.php
index bdc2b487a2..0a5830a00f 100644
--- a/app/models/Component.php
+++ b/app/models/Component.php
@@ -38,21 +38,33 @@ class Component extends Firefly\Database\SingleTableInheritanceEntity
protected $table = 'components';
protected $subclassField = 'class';
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function limits()
{
return $this->hasMany('Limit');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function transactionjournals()
{
return $this->belongsToMany('TransactionJournal');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function transactions()
{
return $this->belongsToMany('Transaction');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function user()
{
return $this->belongsTo('User');
diff --git a/app/models/Limit.php b/app/models/Limit.php
index 82c12bf87c..6c6de35acf 100644
--- a/app/models/Limit.php
+++ b/app/models/Limit.php
@@ -40,6 +40,9 @@ class Limit extends Ardent
];
+ /**
+ * @return array
+ */
public static function factory()
{
$start = new Carbon;
@@ -54,16 +57,25 @@ class Limit extends Ardent
];
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function budget()
{
return $this->belongsTo('Budget', 'component_id');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function component()
{
return $this->belongsTo('Component', 'component_id');
}
+ /**
+ * @param Carbon $start
+ */
public function createRepetition(Carbon $start)
{
@@ -116,12 +128,18 @@ class Limit extends Ardent
}
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function limitrepetitions()
{
return $this->hasMany('LimitRepetition');
}
+ /**
+ * @return array
+ */
public function getDates()
{
return ['created_at', 'updated_at', 'startdate', 'enddate'];
diff --git a/app/models/LimitRepetition.php b/app/models/LimitRepetition.php
index 558941b91c..d8b44d4c61 100644
--- a/app/models/LimitRepetition.php
+++ b/app/models/LimitRepetition.php
@@ -31,6 +31,9 @@ class LimitRepetition extends Ardent
'amount' => 'numeric|required|min:0.01',
];
+ /**
+ * @return array
+ */
public static function factory()
{
$start = new \Carbon\Carbon;
@@ -46,6 +49,9 @@ class LimitRepetition extends Ardent
];
}
+ /**
+ * @return array
+ */
public function getDates()
{
return ['created_at', 'updated_at', 'startdate', 'enddate'];
@@ -76,6 +82,9 @@ class LimitRepetition extends Ardent
return $left;
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function limit()
{
return $this->belongsTo('Limit');
diff --git a/app/models/Piggybank.php b/app/models/Piggybank.php
index f9e3c08f17..454c781e93 100644
--- a/app/models/Piggybank.php
+++ b/app/models/Piggybank.php
@@ -37,6 +37,9 @@ class Piggybank extends Ardent
'order' => 'required:min:1',
];
+ /**
+ * @return array
+ */
public static function factory()
{
$start = new Carbon;
@@ -52,14 +55,20 @@ class Piggybank extends Ardent
];
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function account()
{
return $this->belongsTo('Account');
}
+ /**
+ * @return array
+ */
public function getDates()
{
- return array('created_at', 'updated_at', 'targetdate');
+ return ['created_at', 'updated_at', 'targetdate'];
}
}
\ No newline at end of file
diff --git a/app/models/Preference.php b/app/models/Preference.php
index 7baffdd543..1ac1119cd2 100644
--- a/app/models/Preference.php
+++ b/app/models/Preference.php
@@ -36,17 +36,27 @@ class Preference extends Ardent
'data' => 'string'
];
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function user()
{
return $this->belongsTo('User');
}
+ /**
+ * @param $value
+ */
public function setDataAttribute($value)
{
$this->attributes['data'] = json_encode($value);
}
- //
+ /**
+ * @param $value
+ *
+ * @return mixed
+ */
public function getDataAttribute($value)
{
return json_decode($value);
diff --git a/app/models/RecurringTransaction.php b/app/models/RecurringTransaction.php
index 024b664aea..7b0ccde6ed 100644
--- a/app/models/RecurringTransaction.php
+++ b/app/models/RecurringTransaction.php
@@ -50,6 +50,9 @@ class RecurringTransaction extends Ardent
'skip' => 'required|between:0,31',
];
+ /**
+ * @return array
+ */
public static function factory()
{
$date = new Carbon;
@@ -68,11 +71,17 @@ class RecurringTransaction extends Ardent
];
}
+ /**
+ * @return array
+ */
public function getDates()
{
return ['created_at', 'updated_at', 'date'];
}
+ /**
+ * @return Carbon
+ */
public function next()
{
$start = clone $this->date;
@@ -105,6 +114,9 @@ class RecurringTransaction extends Ardent
return $start;
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function user()
{
return $this->belongsTo('User');
diff --git a/app/models/Transaction.php b/app/models/Transaction.php
index f7a892ede0..8cfb9bf43a 100644
--- a/app/models/Transaction.php
+++ b/app/models/Transaction.php
@@ -44,26 +44,41 @@ class Transaction extends Ardent
'amount' => 'integer:5'
];
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function account()
{
return $this->belongsTo('Account');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function transactionJournal()
{
return $this->belongsTo('TransactionJournal');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function components()
{
return $this->belongsToMany('Component');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function budgets()
{
return $this->belongsToMany('Budget', 'component_transaction', 'transaction_id', 'component_id');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function categories()
{
return $this->belongsToMany('Category', 'component_transaction', 'transaction_id', 'component_id');
diff --git a/app/models/TransactionCurrency.php b/app/models/TransactionCurrency.php
index 826517d009..165773c36f 100644
--- a/app/models/TransactionCurrency.php
+++ b/app/models/TransactionCurrency.php
@@ -22,7 +22,10 @@ class TransactionCurrency extends Eloquent
'code' => 'string'
];
- public function transactionJournals()
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ public function transactionjournals()
{
return $this->hasMany('TransactionJournal');
}
diff --git a/app/models/TransactionJournal.php b/app/models/TransactionJournal.php
index 472557fd50..3a2f0e73c5 100644
--- a/app/models/TransactionJournal.php
+++ b/app/models/TransactionJournal.php
@@ -84,6 +84,9 @@ class TransactionJournal extends Ardent
'completed' => 'required|between:0,1'
];
+ /**
+ * @return array
+ */
public static function factory()
{
$date = new \Carbon\Carbon;
@@ -98,6 +101,9 @@ class TransactionJournal extends Ardent
];
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function transactionType()
{
return $this->belongsTo('TransactionType');
@@ -114,21 +120,33 @@ class TransactionJournal extends Ardent
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ */
public function transactionCurrency()
{
return $this->belongsTo('TransactionCurrency');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function transactions()
{
return $this->hasMany('Transaction');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function components()
{
return $this->belongsToMany('Component');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function budgets()
{
return $this->belongsToMany(
@@ -136,6 +154,9 @@ class TransactionJournal extends Ardent
);
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
+ */
public function categories()
{
return $this->belongsToMany(
@@ -143,16 +164,31 @@ class TransactionJournal extends Ardent
);
}
+ /**
+ * @return array
+ */
public function getDates()
{
- return array('created_at', 'updated_at', 'date');
+ return ['created_at', 'updated_at', 'date'];
}
+ /**
+ * @param $query
+ * @param \Carbon\Carbon $date
+ *
+ * @return mixed
+ */
public function scopeAfter($query, \Carbon\Carbon $date)
{
return $query->where('date', '>=', $date->format('Y-m-d'));
}
+ /**
+ * @param $query
+ * @param \Carbon\Carbon $date
+ *
+ * @return mixed
+ */
public function scopeBefore($query, \Carbon\Carbon $date)
{
return $query->where('date', '<=', $date->format('Y-m-d'));
diff --git a/app/models/TransactionType.php b/app/models/TransactionType.php
index f6e3e2f881..652589c782 100644
--- a/app/models/TransactionType.php
+++ b/app/models/TransactionType.php
@@ -22,6 +22,9 @@ class TransactionType extends Ardent
'type' => 'string'
];
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function transactionJournals()
{
return $this->hasMany('TransactionJournal');
diff --git a/app/models/User.php b/app/models/User.php
index 07b8b6b1e8..487bba5295 100644
--- a/app/models/User.php
+++ b/app/models/User.php
@@ -61,6 +61,9 @@ class User extends Ardent implements UserInterface, RemindableInterface
*/
protected $hidden = ['remember_token'];
+ /**
+ * @return array
+ */
public static function factory()
{
return [
@@ -71,41 +74,65 @@ class User extends Ardent implements UserInterface, RemindableInterface
];
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function accounts()
{
return $this->hasMany('Account');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function budgets()
{
return $this->hasMany('Budget');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function categories()
{
return $this->hasMany('Category');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function components()
{
return $this->hasMany('Component');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function preferences()
{
return $this->hasMany('Preference');
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function recurringtransactions()
{
return $this->hasMany('RecurringTransaction');
}
+ /**
+ * @param $value
+ */
public function setPasswordAttribute($value)
{
$this->attributes['password'] = Hash::make($value);
}
+ /**
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
public function transactionjournals()
{
return $this->hasMany('TransactionJournal');
diff --git a/app/tests/TestCase.php b/app/tests/TestCase.php
index 58a560c9cd..4431c97948 100644
--- a/app/tests/TestCase.php
+++ b/app/tests/TestCase.php
@@ -1,5 +1,8 @@
<?php
+/**
+ * Class TestCase
+ */
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
@@ -7,6 +10,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
* Creates the application.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
public function createApplication()
{
@@ -17,6 +21,11 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
return require __DIR__ . '/../../bootstrap/start.php';
}
+ /**
+ * @param $class
+ *
+ * @return \Mockery\MockInterface
+ */
public function mock($class)
{
$mock = Mockery::mock($class);
diff --git a/app/tests/controllers/AccountControllerTest.php b/app/tests/controllers/AccountControllerTest.php
index 3028f5b93a..dfe9578f61 100644
--- a/app/tests/controllers/AccountControllerTest.php
+++ b/app/tests/controllers/AccountControllerTest.php
@@ -7,6 +7,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class AccountControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class AccountControllerTest extends TestCase
{
diff --git a/app/tests/controllers/BudgetControllerTest.php b/app/tests/controllers/BudgetControllerTest.php
index b6fb29507b..5434e651e9 100644
--- a/app/tests/controllers/BudgetControllerTest.php
+++ b/app/tests/controllers/BudgetControllerTest.php
@@ -5,6 +5,12 @@ use Illuminate\Database\Eloquent\Collection;
use Mockery as m;
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
+/**
+ * Class BudgetControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
+ */
class BudgetControllerTest extends TestCase
{
protected $_repository;
diff --git a/app/tests/controllers/CategoryControllerTest.php b/app/tests/controllers/CategoryControllerTest.php
index ba65f938bb..7d87683cf3 100644
--- a/app/tests/controllers/CategoryControllerTest.php
+++ b/app/tests/controllers/CategoryControllerTest.php
@@ -7,6 +7,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class CategoryControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class CategoryControllerTest extends TestCase
{
@@ -100,6 +103,7 @@ class CategoryControllerTest extends TestCase
{
$category = f::create('Category');
$collection = new Collection();
+ $collection->add($category);
$this->_repository->shouldReceive('get')->with()->once()->andReturn($collection);
$this->action('GET', 'CategoryController@index');
diff --git a/app/tests/controllers/ChartControllerTest.php b/app/tests/controllers/ChartControllerTest.php
index 0e0d8d802c..0b86bf7f57 100644
--- a/app/tests/controllers/ChartControllerTest.php
+++ b/app/tests/controllers/ChartControllerTest.php
@@ -8,6 +8,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class ChartControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class ChartControllerTest extends TestCase
{
diff --git a/app/tests/controllers/HomeControllerTest.php b/app/tests/controllers/HomeControllerTest.php
index ec44dc3280..16c9798f88 100644
--- a/app/tests/controllers/HomeControllerTest.php
+++ b/app/tests/controllers/HomeControllerTest.php
@@ -5,6 +5,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class HomeControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class HomeControllerTest extends TestCase
{
diff --git a/app/tests/controllers/JsonControllerTest.php b/app/tests/controllers/JsonControllerTest.php
index 5dfca4b3eb..66b437848d 100644
--- a/app/tests/controllers/JsonControllerTest.php
+++ b/app/tests/controllers/JsonControllerTest.php
@@ -3,6 +3,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class JsonControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class JsonControllerTest extends TestCase
{
diff --git a/app/tests/controllers/LimitControllerTest.php b/app/tests/controllers/LimitControllerTest.php
index e863c5a5c1..93cdb5b239 100644
--- a/app/tests/controllers/LimitControllerTest.php
+++ b/app/tests/controllers/LimitControllerTest.php
@@ -4,6 +4,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class LimitControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class LimitControllerTest extends TestCase
{
diff --git a/app/tests/controllers/PiggybankControllerTest.php b/app/tests/controllers/PiggybankControllerTest.php
index 40f0a1ad90..3c3bcebb3c 100644
--- a/app/tests/controllers/PiggybankControllerTest.php
+++ b/app/tests/controllers/PiggybankControllerTest.php
@@ -6,6 +6,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class PiggybankControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class PiggybankControllerTest extends TestCase
{
diff --git a/app/tests/controllers/PreferencesControllerTest.php b/app/tests/controllers/PreferencesControllerTest.php
index ddff2d0702..50eb036056 100644
--- a/app/tests/controllers/PreferencesControllerTest.php
+++ b/app/tests/controllers/PreferencesControllerTest.php
@@ -5,6 +5,9 @@ use Mockery as m;
/**
* Class PreferencesControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class PreferencesControllerTest extends TestCase
{
diff --git a/app/tests/controllers/ProfileControllerTest.php b/app/tests/controllers/ProfileControllerTest.php
index 37018484ef..b0e9e9f379 100644
--- a/app/tests/controllers/ProfileControllerTest.php
+++ b/app/tests/controllers/ProfileControllerTest.php
@@ -4,6 +4,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class ProfileControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class ProfileControllerTest extends TestCase
{
diff --git a/app/tests/controllers/RecurringControllerTest.php b/app/tests/controllers/RecurringControllerTest.php
index 3cdcf80c27..a520bf61e3 100644
--- a/app/tests/controllers/RecurringControllerTest.php
+++ b/app/tests/controllers/RecurringControllerTest.php
@@ -4,6 +4,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class RecurringControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class RecurringControllerTest extends TestCase
{
diff --git a/app/tests/controllers/ReportControllerTest.php b/app/tests/controllers/ReportControllerTest.php
index e548e8e88e..c83a18e91c 100644
--- a/app/tests/controllers/ReportControllerTest.php
+++ b/app/tests/controllers/ReportControllerTest.php
@@ -3,6 +3,9 @@ use Mockery as m;
/**
* Class ReportControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class ReportControllerTest extends TestCase
{
diff --git a/app/tests/controllers/SearchControllerTest.php b/app/tests/controllers/SearchControllerTest.php
index f7e639a618..36556bde42 100644
--- a/app/tests/controllers/SearchControllerTest.php
+++ b/app/tests/controllers/SearchControllerTest.php
@@ -3,6 +3,9 @@ use Mockery as m;
/**
* Class SearchControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class SearchControllerTest extends TestCase
{
diff --git a/app/tests/controllers/TransactionControllerTest.php b/app/tests/controllers/TransactionControllerTest.php
index 49f0be001c..6159565ac6 100644
--- a/app/tests/controllers/TransactionControllerTest.php
+++ b/app/tests/controllers/TransactionControllerTest.php
@@ -5,6 +5,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class TransactionControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class TransactionControllerTest extends TestCase
{
diff --git a/app/tests/controllers/UserControllerTest.php b/app/tests/controllers/UserControllerTest.php
index 9501d03b97..963ba018c1 100644
--- a/app/tests/controllers/UserControllerTest.php
+++ b/app/tests/controllers/UserControllerTest.php
@@ -6,6 +6,9 @@ use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
/**
* Class UserControllerTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class UserControllerTest extends TestCase
{
@@ -57,11 +60,7 @@ class UserControllerTest extends TestCase
public function testPostLoginFails()
{
- $input = [
- 'username' => 'bla@bla',
- 'password' => 'something',
- 'remindme' => 0
- ];
+
$this->action('POST', 'UserController@postLogin');
$this->assertResponseOk();
}
diff --git a/app/tests/models/ModelTest.php b/app/tests/models/ModelTest.php
index 41f2fb9f19..d5824be583 100644
--- a/app/tests/models/ModelTest.php
+++ b/app/tests/models/ModelTest.php
@@ -2,6 +2,11 @@
use Carbon\Carbon;
use Zizaco\FactoryMuff\Facade\FactoryMuff as f;
+/**
+ * Class ModelTest
+ *
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ */
class ModelTest extends TestCase
{
@@ -179,7 +184,7 @@ class ModelTest extends TestCase
// repeat frequency (present) for periodOrder
$list = ['yearly', 'half-year', 'quarterly', 'monthly', 'weekly', 'daily'];
- foreach ($list as $index => $entry) {
+ foreach ($list as $entry) {
$rep->repeat_freq = $entry;
$this->assertGreaterThan(0, strlen($rep->periodShow()));
}
@@ -216,7 +221,7 @@ class ModelTest extends TestCase
$this->assertEquals($rec->user_id, $user->id);
$list = ['yearly', 'half-year', 'quarterly', 'monthly', 'weekly', 'daily'];
- foreach ($list as $index => $entry) {
+ foreach ($list as $entry) {
$start = clone $rec->date;
$rec->repeat_freq = $entry;
$end = $rec->next();