From 41562f8f6de415b0ab4a58f9539268a2ccfdfa83 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 10 Aug 2014 19:02:24 +0200 Subject: [PATCH] Even more code cleanup. --- .../2014_06_27_163032_create_users_table.php | 62 ++++++------- ...014_06_27_163259_create_accounts_table.php | 76 ++++++++-------- ...4_06_27_163817_create_components_table.php | 66 +++++++------- ...42_create_transaction_currencies_table.php | 52 +++++------ ..._164512_create_transaction_types_table.php | 52 +++++------ ...4620_create_transaction_journals_table.php | 86 ++++++++++--------- ...344_create_component_transaction_table.php | 68 ++++++++------- ...4_07_05_100651_create_piggybanks_table.php | 2 +- ...44_create_recurring_transactions_table.php | 72 ++++++++-------- ...te_component_transaction_journal_table.php | 68 ++++++++------- ...2014_07_09_204843_create_session_table.php | 50 +++++------ .../2014_07_17_183717_create_limits_table.php | 70 +++++++-------- ...07_19_055011_create_limit_repeat_table.php | 68 ++++++++------- ...6_recurring_transactions_to_components.php | 70 +++++++-------- app/lib/Firefly/Helper/Controllers/Chart.php | 6 -- app/lib/Firefly/Helper/Form/FormTrigger.php | 1 + .../Helper/Migration/MigrationHelper.php | 1 + .../Account/EloquentAccountRepository.php | 2 + .../EloquentTransactionJournalRepository.php | 3 +- app/models/Account.php | 42 ++++----- app/tests/TestCase.php | 2 + 21 files changed, 474 insertions(+), 445 deletions(-) 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 c4d20b537e..25cc4349a3 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 @@ -1,44 +1,46 @@ increments('id'); - $table->timestamps(); - $table->string('email',100); - $table->string('password',60); - $table->string('reset',32)->nullable(); - $table->string('remember_token',255)->nullable(); - $table->boolean('migrated'); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'users', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->string('email', 100); + $table->string('password', 60); + $table->string('reset', 32)->nullable(); + $table->string('remember_token', 255)->nullable(); + $table->boolean('migrated'); - $table->unique('email'); - }); - } + $table->unique('email'); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('users'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('users'); + } } 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 2653b4fc65..e98a4d4581 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 @@ -1,53 +1,55 @@ increments('id'); - $table->timestamps(); - $table->integer('user_id')->unsigned(); - $table->integer('account_type_id')->unsigned(); - $table->string('name',100); - $table->boolean('active'); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'accounts', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('user_id')->unsigned(); + $table->integer('account_type_id')->unsigned(); + $table->string('name', 100); + $table->boolean('active'); - // connect accounts to users - $table->foreign('user_id') - ->references('id')->on('users') - ->onDelete('cascade'); + // connect accounts to users + $table->foreign('user_id') + ->references('id')->on('users') + ->onDelete('cascade'); - // connect accounts to account_types - $table->foreign('account_type_id') - ->references('id')->on('account_types') - ->onDelete('cascade'); + // connect accounts to account_types + $table->foreign('account_type_id') + ->references('id')->on('account_types') + ->onDelete('cascade'); - $table->unique(['user_id','account_type_id','name']); - }); - } + $table->unique(['user_id', 'account_type_id', 'name']); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('accounts'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('accounts'); + } } 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 94dd180c59..998bef4ddf 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 @@ -1,48 +1,50 @@ increments('id'); - $table->timestamps(); - $table->string('name',50); - $table->integer('user_id')->unsigned(); - $table->string('class',20); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'components', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->string('name', 50); + $table->integer('user_id')->unsigned(); + $table->string('class', 20); - // connect components to users - $table->foreign('user_id') - ->references('id')->on('users') - ->onDelete('cascade'); + // connect components to users + $table->foreign('user_id') + ->references('id')->on('users') + ->onDelete('cascade'); - $table->unique(['user_id','class','name']); - }); + $table->unique(['user_id', 'class', 'name']); + } + ); - } + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('components'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('components'); + } } 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 1a6de1bce2..64c82f8491 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 @@ -1,38 +1,40 @@ increments('id'); - $table->timestamps(); - $table->string('code',3); - }); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'transaction_currencies', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->string('code', 3); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('transaction_currencies'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('transaction_currencies'); + } } 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 e54ab93e89..6cd34a74c5 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 @@ -1,38 +1,40 @@ increments('id'); - $table->timestamps(); - $table->string('type',50); - }); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'transaction_types', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->string('type', 50); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('transaction_types'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('transaction_types'); + } } 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 71a559c18d..9c3ed1fd22 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 @@ -1,58 +1,60 @@ increments('id'); - $table->timestamps(); - $table->integer('user_id')->unsigned(); - $table->integer('transaction_type_id')->unsigned(); - $table->integer('transaction_currency_id')->unsigned(); - $table->string('description',255)->nullable(); - $table->boolean('completed'); - $table->date('date'); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'transaction_journals', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('user_id')->unsigned(); + $table->integer('transaction_type_id')->unsigned(); + $table->integer('transaction_currency_id')->unsigned(); + $table->string('description', 255)->nullable(); + $table->boolean('completed'); + $table->date('date'); - // connect transaction journals to transaction types - $table->foreign('transaction_type_id') - ->references('id')->on('transaction_types') - ->onDelete('cascade'); + // connect transaction journals to transaction types + $table->foreign('transaction_type_id') + ->references('id')->on('transaction_types') + ->onDelete('cascade'); - // connect transaction journals to transaction currencies - $table->foreign('transaction_currency_id') - ->references('id')->on('transaction_currencies') - ->onDelete('cascade'); + // connect transaction journals to transaction currencies + $table->foreign('transaction_currency_id') + ->references('id')->on('transaction_currencies') + ->onDelete('cascade'); - // connect users - $table->foreign('user_id') - ->references('id')->on('users') - ->onDelete('cascade'); - }); - } + // connect users + $table->foreign('user_id') + ->references('id')->on('users') + ->onDelete('cascade'); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('transaction_journals'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('transaction_journals'); + } } 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 291aa6dcf4..4c3a2c825a 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 @@ -1,48 +1,50 @@ increments('id'); - $table->integer('component_id')->unsigned(); - $table->integer('transaction_id')->unsigned(); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'component_transaction', function (Blueprint $table) { + $table->increments('id'); + $table->integer('component_id')->unsigned(); + $table->integer('transaction_id')->unsigned(); - // connect to components - $table->foreign('component_id') - ->references('id')->on('components') - ->onDelete('cascade'); + // connect to components + $table->foreign('component_id') + ->references('id')->on('components') + ->onDelete('cascade'); - // connect to transactions - $table->foreign('transaction_id') - ->references('id')->on('transactions') - ->onDelete('cascade'); - }); - } + // connect to transactions + $table->foreign('transaction_id') + ->references('id')->on('transactions') + ->onDelete('cascade'); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('component_transaction'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('component_transaction'); + } } 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 6bed480a93..125d15a86b 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 @@ -33,7 +33,7 @@ class CreatePiggybanksTable extends Migration $table->foreign('account_id') ->references('id')->on('accounts') ->onDelete('cascade'); - $table->unique(['account_id','name']); + $table->unique(['account_id', 'name']); } ); 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 d9be3d7106..caea6c2d90 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 @@ -1,52 +1,54 @@ increments('id'); - $table->timestamps(); - $table->integer('user_id')->unsigned(); - $table->string('name',50); - $table->string('match',255); - $table->decimal('amount_max',10,2); - $table->decimal('amount_min',10,2); - $table->date('date'); - $table->boolean('active'); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'recurring_transactions', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('user_id')->unsigned(); + $table->string('name', 50); + $table->string('match', 255); + $table->decimal('amount_max', 10, 2); + $table->decimal('amount_min', 10, 2); + $table->date('date'); + $table->boolean('active'); - $table->boolean('automatch'); - $table->enum('repeat_freq', ['daily', 'weekly','monthly','quarterly','half-year','yearly']); - $table->smallInteger('skip')->unsigned(); + $table->boolean('automatch'); + $table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']); + $table->smallInteger('skip')->unsigned(); - $table->unique(['user_id','name']); + $table->unique(['user_id', 'name']); - }); - } + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('recurring_transactions'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('recurring_transactions'); + } } 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 a98d4fef02..1d4b9c5f51 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 @@ -1,48 +1,50 @@ increments('id'); - $table->integer('component_id')->unsigned(); - $table->integer('transaction_journal_id')->unsigned(); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'component_transaction_journal', function (Blueprint $table) { + $table->increments('id'); + $table->integer('component_id')->unsigned(); + $table->integer('transaction_journal_id')->unsigned(); - // link components with component_id - $table->foreign('component_id') - ->references('id')->on('components') - ->onDelete('cascade'); + // link components with component_id + $table->foreign('component_id') + ->references('id')->on('components') + ->onDelete('cascade'); - // link transaction journals with transaction_journal_id - $table->foreign('transaction_journal_id') - ->references('id')->on('transaction_journals') - ->onDelete('cascade'); - }); - } + // link transaction journals with transaction_journal_id + $table->foreign('transaction_journal_id') + ->references('id')->on('transaction_journals') + ->onDelete('cascade'); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('component_transaction_journal'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('component_transaction_journal'); + } } 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 d5f9867866..7e29be1cce 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 @@ -7,31 +7,33 @@ use Illuminate\Database\Migrations\Migration; * * @SuppressWarnings(PHPMD.ShortMethodName) */ -class CreateSessionTable extends Migration { +class CreateSessionTable extends Migration +{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('sessions', function($t) - { - $t->string('id')->unique(); - $t->text('payload'); - $t->integer('last_activity'); - }); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'sessions', function ($t) { + $t->string('id')->unique(); + $t->text('payload'); + $t->integer('last_activity'); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('sessions'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('sessions'); + } } 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 356e146924..0edb4a17c8 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 @@ -1,49 +1,51 @@ increments('id'); - $table->timestamps(); - $table->integer('component_id')->unsigned(); - $table->date('startdate'); - $table->decimal('amount',10,2); - $table->boolean('repeats'); - $table->enum('repeat_freq', ['daily', 'weekly','monthly','quarterly','half-year','yearly']); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'limits', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('component_id')->unsigned(); + $table->date('startdate'); + $table->decimal('amount', 10, 2); + $table->boolean('repeats'); + $table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']); - $table->unique(['component_id','startdate','repeat_freq']); + $table->unique(['component_id', 'startdate', 'repeat_freq']); - // connect component - $table->foreign('component_id') - ->references('id')->on('components') - ->onDelete('cascade'); - }); - } + // connect component + $table->foreign('component_id') + ->references('id')->on('components') + ->onDelete('cascade'); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('limits'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('limits'); + } } 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 7a636d919f..f0578b463a 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 @@ -1,48 +1,50 @@ increments('id'); - $table->timestamps(); - $table->integer('limit_id')->unsigned(); - $table->date('startdate'); - $table->date('enddate'); - $table->decimal('amount',10,2); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'limit_repetitions', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->integer('limit_id')->unsigned(); + $table->date('startdate'); + $table->date('enddate'); + $table->decimal('amount', 10, 2); - $table->unique(['limit_id','startdate','enddate']); + $table->unique(['limit_id', 'startdate', 'enddate']); - // connect limit - $table->foreign('limit_id') - ->references('id')->on('limits') - ->onDelete('cascade'); - }); - } + // connect limit + $table->foreign('limit_id') + ->references('id')->on('limits') + ->onDelete('cascade'); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('limit_repetitions'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('limit_repetitions'); + } } 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 819041d176..18a789b4bd 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 @@ -1,49 +1,51 @@ increments('id'); - $table->integer('component_id')->unsigned(); - $table->integer('recurring_transaction_id')->unsigned(); - $table->boolean('optional'); + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create( + 'component_recurring_transaction', function (Blueprint $table) { + $table->increments('id'); + $table->integer('component_id')->unsigned(); + $table->integer('recurring_transaction_id')->unsigned(); + $table->boolean('optional'); - // link components with component_id - $table->foreign('component_id') - ->references('id')->on('components') - ->onDelete('cascade'); + // link components with component_id + $table->foreign('component_id') + ->references('id')->on('components') + ->onDelete('cascade'); - // link transaction journals with transaction_journal_id - $table->foreign('recurring_transaction_id') - ->references('id')->on('recurring_transactions') - ->onDelete('cascade'); - }); - } + // link transaction journals with transaction_journal_id + $table->foreign('recurring_transaction_id') + ->references('id')->on('recurring_transactions') + ->onDelete('cascade'); + } + ); + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('component_recurring_transaction'); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('component_recurring_transaction'); + } } diff --git a/app/lib/Firefly/Helper/Controllers/Chart.php b/app/lib/Firefly/Helper/Controllers/Chart.php index 2949b7fd46..2a163d011f 100644 --- a/app/lib/Firefly/Helper/Controllers/Chart.php +++ b/app/lib/Firefly/Helper/Controllers/Chart.php @@ -27,9 +27,6 @@ class Chart implements ChartInterface $return = ['name' => $account->name, 'id' => $account->id, 'data' => []]; while ($current <= $end) { - \Log::debug( - 'Now at day: ' . $current . '(' . $current->timestamp . '), (' . ($current->timestamp * 1000) . ') ' - ); if ($current > $today) { $return['data'][] = [$current->timestamp * 1000, $account->predict(clone $current)]; } else { @@ -118,9 +115,6 @@ class Chart implements ChartInterface }] )->orderBy('name', 'ASC')->get(); - $limitInPeriod = 'Envelope for (empty)'; - $spentInPeriod = 'Spent in (empty)'; - foreach ($budgets as $budget) { $budget->count = 0; foreach ($budget->limits as $limit) { diff --git a/app/lib/Firefly/Helper/Form/FormTrigger.php b/app/lib/Firefly/Helper/Form/FormTrigger.php index 187625dc27..44937c72fa 100644 --- a/app/lib/Firefly/Helper/Form/FormTrigger.php +++ b/app/lib/Firefly/Helper/Form/FormTrigger.php @@ -3,6 +3,7 @@ namespace Firefly\Helper\Form; use Illuminate\Events\Dispatcher; + /** * Class FormTrigger * diff --git a/app/lib/Firefly/Helper/Migration/MigrationHelper.php b/app/lib/Firefly/Helper/Migration/MigrationHelper.php index 477072829f..0969abc0d6 100644 --- a/app/lib/Firefly/Helper/Migration/MigrationHelper.php +++ b/app/lib/Firefly/Helper/Migration/MigrationHelper.php @@ -142,6 +142,7 @@ class MigrationHelper implements MigrationHelperInterface foreach ($this->JSON->components as $entry) { switch ($entry->type->type) { case 'beneficiary': + /** @noinspection PhpParamsInspection */ $beneficiary = $this->_importBeneficiary($entry, $beneficiaryAT); $this->map['accounts'][$entry->id] = $beneficiary; break; diff --git a/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php b/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php index 4d42ef9cbf..0b89f567dc 100644 --- a/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php +++ b/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php @@ -62,6 +62,8 @@ class EloquentAccountRepository implements AccountRepositoryInterface } $type = \AccountType::where('description', 'Beneficiary account')->first(); + /** @noinspection PhpParamsInspection */ + return $this->createOrFind($name, $type); } diff --git a/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php b/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php index 11a20c1b55..062b502483 100644 --- a/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php +++ b/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php @@ -122,7 +122,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito $fromTransaction->amount = $amountFrom; if (!$fromTransaction->validate()) { throw new FireflyException('Cannot create valid transaction (from): ' . $fromTransaction->errors()->first( - )); + )); } $fromTransaction->save(); @@ -141,6 +141,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito return $journal; } + /** * @param $journalId * diff --git a/app/models/Account.php b/app/models/Account.php index 291f836d0f..7ec36d36a7 100644 --- a/app/models/Account.php +++ b/app/models/Account.php @@ -62,16 +62,6 @@ class Account extends Ardent return $this->belongsTo('AccountType'); } - /** - * User - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() - { - return $this->belongsTo('User'); - } - /** * Get an accounts current balance. * @@ -92,16 +82,6 @@ class Account extends Ardent ); } - /** - * @param \Carbon\Carbon $date - * - * @return null - */ - public function predict(\Carbon\Carbon $date) - { - return null; - } - /** * Transactions. * @@ -112,4 +92,26 @@ class Account extends Ardent return $this->hasMany('Transaction'); } + /** + * @param \Carbon\Carbon $date + * + * @return null + */ + public function predict( + /** @noinspection PhpUnusedParameterInspection */ + \Carbon\Carbon $date + ) { + return null; + } + + /** + * User + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function user() + { + return $this->belongsTo('User'); + } + } \ No newline at end of file diff --git a/app/tests/TestCase.php b/app/tests/TestCase.php index 4431c97948..c291be445a 100644 --- a/app/tests/TestCase.php +++ b/app/tests/TestCase.php @@ -14,8 +14,10 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase */ public function createApplication() { + /** @noinspection PhpUnusedLocalVariableInspection */ $unitTesting = true; + /** @noinspection PhpUnusedLocalVariableInspection */ $testEnvironment = 'testing'; return require __DIR__ . '/../../bootstrap/start.php';