Skip to content

Firefly III: a personal finances manager

Various code cleanup [skip ci]

James Cole67fdd2749941
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index 007bb2de70..64da2ec4be 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -17,7 +17,6 @@ use Response;
use Session;
use URL;
use View;
-use Log;
/**
* Class TransactionController
@@ -291,7 +290,6 @@ class TransactionController extends Controller
}
-
/**
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
diff --git a/app/Http/routes.php b/app/Http/routes.php
index 5a6ab19d83..401fb8ca67 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -177,7 +177,7 @@ Route::get('/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'r
Route::controllers(
[
- 'auth' => 'Auth\AuthController',
+ 'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]
);
diff --git a/app/Repositories/Reminder/ReminderRepositoryInterface.php b/app/Repositories/Reminder/ReminderRepositoryInterface.php
index 5692c432c0..8255e58f02 100644
--- a/app/Repositories/Reminder/ReminderRepositoryInterface.php
+++ b/app/Repositories/Reminder/ReminderRepositoryInterface.php
@@ -1,6 +1,7 @@
<?php
namespace FireflyIII\Repositories\Reminder;
+
use Illuminate\Support\Collection;
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index 205db6b61e..c22044997a 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -155,7 +155,7 @@ class Amount
$currencyPreference = Prefs::get('currencyPreference', 'EUR');
- $currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
+ $currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
if ($currency) {
Cache::forever('FFCURRENCYCODE', $currency->code);
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 76270a3ff4..c28c7ea5b8 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -203,7 +203,7 @@ class FireflyValidator extends Validator
$alwaysEncrypted = true;
}
- if(is_null(Auth::user())) {
+ if (is_null(Auth::user())) {
// user is not logged in.. weird.
return true;
} else {
diff --git a/database/migrations/2014_12_13_190730_changes_for_v321.php b/database/migrations/2014_12_13_190730_changes_for_v321.php
index 5a0524d322..a893f8c0a7 100644
--- a/database/migrations/2014_12_13_190730_changes_for_v321.php
+++ b/database/migrations/2014_12_13_190730_changes_for_v321.php
@@ -7,6 +7,7 @@ use FireflyIII\Models\Component;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
+
/**
* @SuppressWarnings(PHPMD.ShortMethodName) // method names are mandated by laravel.
* @SuppressWarnings("TooManyMethods") // I'm fine with this
diff --git a/database/migrations/2015_03_29_174140_changes_for_v336.php b/database/migrations/2015_03_29_174140_changes_for_v336.php
index 304fd78ac9..85bf6420c5 100644
--- a/database/migrations/2015_03_29_174140_changes_for_v336.php
+++ b/database/migrations/2015_03_29_174140_changes_for_v336.php
@@ -134,7 +134,7 @@ class ChangesForV336 extends Migration
// reinstate a long forgotten index:
Schema::table(
'budget_limits', function (Blueprint $table) {
- $table->unique(['budget_id', 'startdate'],'unique_limit');
+ $table->unique(['budget_id', 'startdate'], 'unique_limit');
}
);
diff --git a/database/migrations/2015_04_26_054507_changes_for_v3310.php b/database/migrations/2015_04_26_054507_changes_for_v3310.php
index 2c338242a1..11b13c6c79 100644
--- a/database/migrations/2015_04_26_054507_changes_for_v3310.php
+++ b/database/migrations/2015_04_26_054507_changes_for_v3310.php
@@ -57,7 +57,8 @@ class ChangesForV3310 extends Migration
);
- Schema::create('tag_transaction_journal',function (Blueprint $table) {
+ Schema::create(
+ 'tag_transaction_journal', function (Blueprint $table) {
$table->increments('id');
$table->integer('tag_id')->unsigned();
$table->integer('transaction_journal_id')->unsigned();
@@ -69,7 +70,8 @@ class ChangesForV3310 extends Migration
// add unique.
$table->unique(['tag_id', 'transaction_journal_id'], 'tag_t_joined');
- });
+ }
+ );
}
}
diff --git a/database/migrations/2015_04_28_075317_changes_for_v3310b.php b/database/migrations/2015_04_28_075317_changes_for_v3310b.php
index 5ea3fcfb13..373e6238bb 100644
--- a/database/migrations/2015_04_28_075317_changes_for_v3310b.php
+++ b/database/migrations/2015_04_28_075317_changes_for_v3310b.php
@@ -1,32 +1,32 @@
<?php
-use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
/**
* Class ChangesForV3310b
*/
-class ChangesForV3310b extends Migration {
+class ChangesForV3310b extends Migration
+{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ //
+ }
+
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
// set all current entries to be "balance"
DB::table('transaction_groups')->update(['relation' => 'balance']);
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- //
- }
+ }
}
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 9c2541fa8f..4fa6707c85 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -46,7 +46,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
// create EUR currency
/** @var TransactionCurrency $currency */
- $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
+ $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$currency->code = 'EUR';
$currency->save();
Log::debug('Created new EUR currency.');
@@ -66,8 +66,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
);
-
-
}
/**
diff --git a/tests/controllers/BillControllerTest.php b/tests/controllers/BillControllerTest.php
index e664a5929a..3bead2d0d0 100644
--- a/tests/controllers/BillControllerTest.php
+++ b/tests/controllers/BillControllerTest.php
@@ -191,7 +191,6 @@ class BillControllerTest extends TestCase
Amount::shouldReceive('getCurrencyCode')->andReturn('XX');
-
$this->call('GET', '/bills/show/' . $bill->id);
}
diff --git a/tests/controllers/HelpControllerTest.php b/tests/controllers/HelpControllerTest.php
index 849fb45180..d6a6f23128 100644
--- a/tests/controllers/HelpControllerTest.php
+++ b/tests/controllers/HelpControllerTest.php
@@ -84,7 +84,7 @@ class HelpControllerTest extends TestCase
public function testGetHelpTextNoRoute()
{
// login
- $user = FactoryMuffin::create('FireflyIII\User');
+ $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
// mock some stuff.
diff --git a/tests/controllers/JsonControllerTest.php b/tests/controllers/JsonControllerTest.php
index e8dd10ae38..de5c95e6cd 100644
--- a/tests/controllers/JsonControllerTest.php
+++ b/tests/controllers/JsonControllerTest.php
@@ -210,7 +210,7 @@ class JsonControllerTest extends TestCase
public function testTransactionJournals()
{
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
- $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
+ $type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
$collection = new Collection([$journal]);
$user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
diff --git a/tests/controllers/PiggyBankControllerTest.php b/tests/controllers/PiggyBankControllerTest.php
index ce88e952c2..62d441033c 100644
--- a/tests/controllers/PiggyBankControllerTest.php
+++ b/tests/controllers/PiggyBankControllerTest.php
@@ -6,6 +6,7 @@ use FireflyIII\Models\Preference;
use FireflyIII\Models\TransactionCurrency;
use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin;
+
/**
* Class PiggyBankControllerTest
*/
@@ -110,7 +111,7 @@ class PiggyBankControllerTest extends TestCase
public function testEdit()
{
- $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
+ $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank');
$piggyBank->targetdate = Carbon::now()->addYear();
$piggyBank->save();
$this->be($piggyBank->account->user);
diff --git a/tests/controllers/PreferencesControllerTest.php b/tests/controllers/PreferencesControllerTest.php
index af27739081..e45178a308 100644
--- a/tests/controllers/PreferencesControllerTest.php
+++ b/tests/controllers/PreferencesControllerTest.php
@@ -65,7 +65,7 @@ class PreferencesControllerTest extends TestCase
public function testPostIndex()
{
- $user = FactoryMuffin::create('FireflyIII\User');
+ $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
$data = [
diff --git a/tests/controllers/ReminderControllerTest.php b/tests/controllers/ReminderControllerTest.php
index 0719edd721..43ab7a69c1 100644
--- a/tests/controllers/ReminderControllerTest.php
+++ b/tests/controllers/ReminderControllerTest.php
@@ -59,7 +59,7 @@ class ReminderControllerTest extends TestCase
public function testIndex()
{
- $user = FactoryMuffin::create('FireflyIII\User');
+ $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
$reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
$collection = new Collection([$reminder]);
@@ -77,7 +77,7 @@ class ReminderControllerTest extends TestCase
public function testShow()
{
- $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
+ $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
$reminder->notnow = false;
$reminder->save();
$this->be($reminder->remindersable->account->user);
@@ -88,7 +88,7 @@ class ReminderControllerTest extends TestCase
public function testShowDismissed()
{
- $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
+ $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
$reminder->notnow = true;
$reminder->save();
$this->be($reminder->remindersable->account->user);
diff --git a/tests/controllers/SearchControllerTest.php b/tests/controllers/SearchControllerTest.php
index c4478c342f..f4c3a6f8b7 100644
--- a/tests/controllers/SearchControllerTest.php
+++ b/tests/controllers/SearchControllerTest.php
@@ -1,7 +1,5 @@
<?php
-use Carbon\Carbon;
-use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
@@ -38,7 +36,8 @@ class SearchControllerTest extends TestCase
parent::tearDown();
}
- public function testSearch() {
+ public function testSearch()
+ {
$user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
$words = ['Something'];
@@ -50,7 +49,7 @@ class SearchControllerTest extends TestCase
$repository->shouldReceive('searchBudgets')->with($words)->once()->andReturn([]);
$repository->shouldReceive('searchTags')->with($words)->once()->andReturn([]);
- $this->call('GET','/search?q=Something');
+ $this->call('GET', '/search?q=Something');
$this->assertResponseOk();
}
}
\ No newline at end of file