Removed previous warning suppressions.

This commit is contained in:
James Cole 2014-12-19 21:18:42 +01:00
parent 30ac62ffb7
commit 1a0cbbdb31
45 changed files with 35 additions and 145 deletions

View File

@ -11,9 +11,6 @@ use FireflyIII\Shared\Preferences\PreferencesInterface as Pref;
* TODO Find out what constitutes proper camelCase
* TODO How is object coupling counted?
*
* @SuppressWarnings("CamelCase")
* @SuppressWarnings("TooManyMethods")
* @SuppressWarnings("CouplingBetweenObjects")
*/
class BudgetController extends BaseController
{

View File

@ -6,8 +6,6 @@ use FireflyIII\Exception\FireflyException;
*
* TODO Find out what constitutes proper camelCase
*
* @SuppressWarnings("CamelCase")
*
* Class CategoryController
*/
class CategoryController extends BaseController

View File

@ -3,8 +3,6 @@ use Carbon\Carbon;
use Grumpydictator\Gchart\GChart as GChart;
/**
* @SuppressWarnings("CamelCase")
*
* Class GoogleChartController
*/
class GoogleChartController extends BaseController
@ -33,7 +31,7 @@ class GoogleChartController extends BaseController
$this->_chart->addColumn('Day of month', 'date');
$this->_chart->addColumn('Balance for ' . $account->name, 'number');
// TODO this can be combined in some method, it's
// TODO this can be combined in some method, it's coming up quite often, is it?
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end');
$count = $account->transactions()->count();
@ -48,6 +46,7 @@ class GoogleChartController extends BaseController
$start = new Carbon($first->date);
$end = new Carbon($last->date);
}
// todo until this part.
$current = clone $start;
@ -117,55 +116,31 @@ class GoogleChartController extends BaseController
$bdt = App::make('FireflyIII\Database\Budget\Budget');
$budgets = $bdt->get();
/*
* Loop budgets:
*/
/** @var Budget $budget */
foreach ($budgets as $budget) {
/*
* Is there a repetition starting on this particular date? We can use that.
*/
/** @var \LimitRepetition $repetition */
$repetition = $bdt->repetitionOnStartingOnDate($budget, Session::get('start', Carbon::now()->startOfMonth()));
/*
* If there is, use it. Otherwise, forget it.
*/
if (is_null($repetition)) {
// use the session start and end for our search query
$searchStart = Session::get('start', Carbon::now()->startOfMonth());
$searchEnd = Session::get('end');
// the limit is zero:
$limit = 0;
$limit = 0; // the limit is zero:
} else {
// use the limit's start and end for our search query
$searchStart = $repetition->startdate;
$searchEnd = $repetition->enddate;
// the limit is the repetitions limit:
$limit = floatval($repetition->amount);
$limit = floatval($repetition->amount); // the limit is the repetitions limit:
}
/*
* No matter the result of the search for the repetition, get all the transactions associated
* with the budget, and sum up the expenses made.
*/
$expenses = floatval($budget->transactionjournals()->before($searchEnd)->after($searchStart)->lessThan(0)->sum('amount')) * -1;
if ($expenses > 0) {
$this->_chart->addRow($budget->name, $limit, $expenses);
}
}
/*
* Finally, get all transactions WITHOUT a budget and add those as well.
* (yes this method is oddly specific).
*/
$noBudgetSet = $bdt->transactionsWithoutBudgetInDateRange(Session::get('start', Carbon::now()->startOfMonth()), Session::get('end'));
$sum = $noBudgetSet->sum('amount') * -1;
$this->_chart->addRow('No budget', 0, $sum);
$this->_chart->generate();
return Response::json($this->_chart->getData());

View File

@ -27,7 +27,6 @@ class ProfileController extends BaseController
/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
* @SuppressWarnings("CyclomaticComplexity")
*/
public function postChangePassword()
{

View File

@ -5,8 +5,6 @@ use FireflyIII\Database\TransactionJournal\TransactionJournal as TransactionJour
use FireflyIII\Report\ReportInterface as Report;
/**
* @SuppressWarnings("CamelCase")
*
*
* Class ReportController
*/
@ -52,9 +50,6 @@ class ReportController extends BaseController
* @param $year
* @param $month
*
* @SuppressWarnings("CyclomaticComplexity")
* @SuppressWarnings("MethodLength")
*
* @return \Illuminate\View\View
*/
public function unbalanced($year, $month)

View File

@ -5,8 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateUsersTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateUsersTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateAccountTypesTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateAccountTypesTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateAccountsTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateAccountsTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateComponentsTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateComponentsTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreatePiggybanksTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreatePiggybanksTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateTransactionCurrenciesTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateTransactionCurrenciesTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateTransactionTypesTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateTransactionTypesTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateRecurringTransactionsTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateRecurringTransactionsTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateTransactionJournalsTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateTransactionJournalsTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateTransactionsTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateTransactionsTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateComponentTransactionTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateComponentTransactionTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateComponentTransactionJournalTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateComponentTransactionJournalTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreatePreferencesTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreatePreferencesTable extends Migration
{

View File

@ -5,7 +5,6 @@ use Illuminate\Database\Migrations\Migration;
/**
* Class CreateSessionTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateSessionTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateLimitsTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateLimitsTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateLimitRepeatTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateLimitRepeatTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateComponentRecurringTransactionTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateComponentRecurringTransactionTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreatePiggyInstance
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreatePiggybankRepetitionsTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreatePiggybankEventsTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreatePiggybankEventsTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateRemindersTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateRemindersTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateAccountMetaTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateAccountMetaTable extends Migration
{

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateTransactionGroupsTable
*
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
class CreateTransactionGroupsTable extends Migration
{

View File

@ -4,7 +4,6 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* SuppressWarnings(PHPMD.ShortMethodName)
* Down:
* 1. Create new Components based on Budgets.
* 2. Create new Components based on Categories

View File

@ -459,13 +459,13 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
*/
public function find($id)
public function find($objectId)
{
return $this->getUser()->accounts()->find($id);
return $this->getUser()->accounts()->find($objectId);
}
/**

View File

@ -71,12 +71,12 @@ class AccountType implements CUD, CommonDatabaseCalls
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
* @throws NotImplementedException
*/
public function find($id)
public function find($objectId)
{
// TODO: Implement find() method.
throw new NotImplementedException;

View File

@ -100,13 +100,13 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
*/
public function find($id)
public function find($objectId)
{
return $this->getUser()->budgets()->find($id);
return $this->getUser()->budgets()->find($objectId);
}
/**

View File

@ -107,12 +107,12 @@ class Category implements CUD, CommonDatabaseCalls
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
* @throws NotImplementedException
*/
public function find($id)
public function find($objectId)
{
// TODO: Implement find() method.
throw new NotImplementedException;

View File

@ -16,11 +16,11 @@ interface CommonDatabaseCalls
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
*/
public function find($id);
public function find($objectId);
/**
* Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc.
@ -39,10 +39,10 @@ interface CommonDatabaseCalls
public function get();
/**
* @param array $ids
* @param array $objectIds
*
* @return Collection
*/
public function getByIds(array $ids);
public function getByIds(array $objectIds);
}

View File

@ -89,10 +89,6 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
*
* Ignore PHPMD rules because Laravel 5.0 will make this method superfluous anyway.
*
* @SuppressWarnings("Cyclomatic")
* @SuppressWarnings("NPath")
* @SuppressWarnings("MethodLength")
*
* @param array $model
*
* @return array
@ -175,14 +171,14 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
*/
public function find($id)
public function find($objectId)
{
return \Piggybank::
leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')->where('piggybanks.id', '=', $id)->where('accounts.user_id', $this->getUser()->id)
leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')->where('piggybanks.id', '=', $objectId)->where('accounts.user_id', $this->getUser()->id)
->first(['piggybanks.*']);
}
@ -246,6 +242,7 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
if ($date >= $rep->startdate && $date <= $rep->targetdate) {
return $rep;
}
return null;
}
);
if ($repetitions->count() == 0) {

View File

@ -153,9 +153,6 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
*
*
* ignored because this method will be gone soon.
* @SuppressWarnings("Cyclomatic")
* @SuppressWarnings("NPath")
* @SuppressWarnings("MethodLength")
*
* @param array $model
*
@ -250,12 +247,12 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
* @throws NotImplementedException
*/
public function find($id)
public function find($objectId)
{
// TODO: Implement find() method.
throw new NotImplementedException;

View File

@ -103,9 +103,6 @@ class RecurringTransaction implements CUD, CommonDatabaseCalls, RecurringTransac
* errors/warnings/successes.
*
* ignored because this method will be gone soon.
* @SuppressWarnings("Cyclomatic")
* @SuppressWarnings("NPath")
* @SuppressWarnings("MethodLength")
*
* @param array $model
*
@ -169,12 +166,12 @@ class RecurringTransaction implements CUD, CommonDatabaseCalls, RecurringTransac
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
* @throws NotImplementedException
*/
public function find($id)
public function find($objectId)
{
// TODO: Implement find() method.
throw new NotImplementedException;

View File

@ -96,12 +96,12 @@ class Transaction implements CUD, CommonDatabaseCalls
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
* @throws NotImplementedException
*/
public function find($id)
public function find($objectId)
{
// TODO: Implement find() method.
throw new NotImplementedException;

View File

@ -108,7 +108,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
$this->storeCategory($data, $model);
/*
* TODO move to transaction thing.
* Now we can update the transactions related to this journal.
*/
$amount = floatval($data['amount']);
@ -136,9 +135,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
* errors/warnings/successes.
*
* ignored because this method will be gone soon.
* @SuppressWarnings("Cyclomatic")
* @SuppressWarnings("NPath")
* @SuppressWarnings("MethodLength")
*
* @param array $model
*
@ -256,27 +252,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
break;
}
// if (isset($model['to_id']) && intval($model['to_id']) < 1) {
// $errors->add('account_to', 'Invalid to-account');
// }
//
// if (isset($model['from_id']) && intval($model['from_id']) < 1) {
// $errors->add('account_from', 'Invalid from-account');
//
// }
// if (isset($model['account_id']) && intval($model['account_id']) < 1) {
// $errors->add('account_id', 'Invalid account!');
// }
// if (isset($model['to']) && !($model['to'] instanceof \Account)) {
// $errors->add('account_to', 'Invalid to-account');
// }
// if (isset($model['from']) && !($model['from'] instanceof \Account)) {
// $errors->add('account_from', 'Invalid from-account');
// }
// if (!isset($model['amount']) || (isset($model['amount']) && floatval($model['amount']) < 0)) {
// $errors->add('amount', 'Invalid amount');
// }
$validator = \Validator::make([$model], \TransactionJournal::$rules);
if ($validator->invalid()) {
@ -419,13 +394,13 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
*/
public function find($id)
public function find($objectId)
{
return $this->getUser()->transactionjournals()->find($id);
return $this->getUser()->transactionjournals()->find($objectId);
}
/**

View File

@ -73,12 +73,12 @@ class TransactionType implements CUD, CommonDatabaseCalls
/**
* Returns an object with id $id.
*
* @param int $id
* @param int $objectId
*
* @return \Eloquent
* @throws NotImplementedException
*/
public function find($id)
public function find($objectId)
{
// TODO: Implement find() method.
throw new NotImplementedException;

View File

@ -12,7 +12,6 @@ use Illuminate\Support\Collection;
/**
* Class Report
*
* @SuppressWarnings("CamelCase")
*
* @package FireflyIII\Report
*/

View File

@ -9,7 +9,6 @@ use FireflyIII\Exception\FireflyException;
* Class Date
*
* @package FireflyIII\Shared\Toolkit
* @SuppressWarnings("ExcessiveClassComplexity")
*/
class Date
{
@ -17,7 +16,6 @@ class Date
* @param Carbon $theDate
* @param $repeatFreq
* @param $skip
* @SuppressWarnings("Cyclomatic")
*
* @return Carbon
* @throws FireflyException
@ -63,7 +61,6 @@ class Date
/**
* @param Carbon $theCurrentEnd
* @param $repeatFreq
* @SuppressWarnings("Cyclomatic")
*
* @return mixed
* @throws FireflyException
@ -106,8 +103,6 @@ class Date
* @param Carbon $theCurrentEnd
* @param $repeatFreq
* @param Carbon $maxDate
* @SuppressWarnings("Cyclomatic")
* @SuppressWarnings("MethodLength")
*
* @return mixed
* @throws FireflyException
@ -156,7 +151,6 @@ class Date
/**
* @param Carbon $date
* @param $repeatFrequency
* @SuppressWarnings("Cyclomatic")
*
* @return string
* @throws FireflyException
@ -191,7 +185,6 @@ class Date
/**
* @param Carbon $theDate
* @param $repeatFreq
* @SuppressWarnings("Cyclomatic")
*
* @return Carbon
* @throws FireflyException
@ -238,7 +231,6 @@ class Date
* @param Carbon $theDate
* @param $repeatFreq
* @param int $subtract
* @SuppressWarnings("Cyclomatic")
*
* @return Carbon
* @throws FireflyException

View File

@ -63,7 +63,6 @@ class Filter
/**
* @param $range
* @param Carbon $start
* @SuppressWarnings("Cyclomatic")
*
* @return Carbon
* @throws FireflyException
@ -189,7 +188,6 @@ class Filter
/**
* @param $range
* @param Carbon $date
* @SuppressWarnings("CyclomaticComplexity")
*
* @return Carbon
* @throws FireflyException

View File

@ -16,7 +16,6 @@ class Form
*
* @param Collection $set
* @param bool $addEmpty
* @SuppressWarnings("CyclomaticComplexity")
*
* @return mixed
*/

View File

@ -1,7 +1,4 @@
<?php
use Carbon\Carbon;
use FireflyIII\Shared\SingleTableInheritanceEntity;
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Watson\Validating\ValidatingTrait;
/**

View File

@ -21,9 +21,8 @@ if (!function_exists('mf')) {
if ($amount > 0) {
return '<span class="text-success">&#8364; ' . $string . '</span>';
}
if ($amount < 0) {
return '<span class="text-danger">&#8364; ' . $string . '</span>';
}
return '<span class="text-danger">&#8364; ' . $string . '</span>';
}
return '&#8364; ' . $string;