Changed a lot of parameters.

This commit is contained in:
James Cole
2016-02-05 09:25:15 +01:00
parent 554640c345
commit 78bcd3e1bb
64 changed files with 539 additions and 572 deletions

View File

@@ -15,11 +15,11 @@ class Account
/** @var Collection */
protected $accounts;
/** @var float */
/** @var string */
protected $difference;
/** @var float */
/** @var string */
protected $end;
/** @var float */
/** @var string */
protected $start;
/**
@@ -31,15 +31,15 @@ class Account
}
/**
* @param \Illuminate\Support\Collection $accounts
* @param Collection $accounts
*/
public function setAccounts($accounts)
public function setAccounts(Collection $accounts)
{
$this->accounts = $accounts;
}
/**
* @return float
* @return string
*/
public function getDifference()
{
@@ -47,15 +47,15 @@ class Account
}
/**
* @param float $difference
* @param string $difference
*/
public function setDifference($difference)
public function setDifference(string $difference)
{
$this->difference = $difference;
}
/**
* @return float
* @return string
*/
public function getEnd()
{
@@ -63,15 +63,15 @@ class Account
}
/**
* @param float $end
* @param string $end
*/
public function setEnd($end)
public function setEnd(string $end)
{
$this->end = $end;
}
/**
* @return float
* @return string
*/
public function getStart()
{
@@ -79,9 +79,9 @@ class Account
}
/**
* @param float $start
* @param string $start
*/
public function setStart($start)
public function setStart(string $start)
{
$this->start = $start;
}

View File

@@ -47,7 +47,7 @@ class Balance
/**
* @param BalanceHeader $balanceHeader
*/
public function setBalanceHeader($balanceHeader)
public function setBalanceHeader(BalanceHeader $balanceHeader)
{
$this->balanceHeader = $balanceHeader;
}

View File

@@ -17,10 +17,10 @@ class BalanceEntry
/** @var AccountModel */
protected $account;
/** @var float */
protected $left = 0.0;
/** @var float */
protected $spent = 0.0;
/** @var string */
protected $left = '0';
/** @var string */
protected $spent = '0';
/**
* @return AccountModel
@@ -33,13 +33,13 @@ class BalanceEntry
/**
* @param AccountModel $account
*/
public function setAccount($account)
public function setAccount(AccountModel $account)
{
$this->account = $account;
}
/**
* @return float
* @return string
*/
public function getLeft()
{
@@ -47,15 +47,15 @@ class BalanceEntry
}
/**
* @param float $left
* @param string $left
*/
public function setLeft($left)
public function setLeft(string $left)
{
$this->left = $left;
}
/**
* @return float
* @return string
*/
public function getSpent()
{
@@ -63,9 +63,9 @@ class BalanceEntry
}
/**
* @param float $spent
* @param string $spent
*/
public function setSpent($spent)
public function setSpent(string $spent)
{
$this->spent = $spent;
}

View File

@@ -25,6 +25,7 @@ class BalanceLine
/** @var BudgetModel */
protected $budget;
/** @var int */
protected $role = self::ROLE_DEFAULTROLE;
/**
@@ -54,7 +55,7 @@ class BalanceLine
/**
* @param Collection $balanceEntries
*/
public function setBalanceEntries($balanceEntries)
public function setBalanceEntries(Collection $balanceEntries)
{
$this->balanceEntries = $balanceEntries;
}
@@ -70,7 +71,7 @@ class BalanceLine
/**
* @param BudgetModel $budget
*/
public function setBudget($budget)
public function setBudget(BudgetModel $budget)
{
$this->budget = $budget;
}
@@ -86,7 +87,7 @@ class BalanceLine
/**
* @param int $role
*/
public function setRole($role)
public function setRole(int $role)
{
$this->role = $role;
}
@@ -118,14 +119,15 @@ class BalanceLine
* on the given budget/repetition. If you subtract all those amounts from the budget/repetition's
* total amount, this is returned:
*
* @return float
* @return string
*/
public function leftOfRepetition()
{
$start = $this->budget->amount ?? 0;
bcscale(2);
$start = $this->budget->amount ?? '0';
/** @var BalanceEntry $balanceEntry */
foreach ($this->getBalanceEntries() as $balanceEntry) {
$start += $balanceEntry->getSpent();
$start = bcadd($balanceEntry->getSpent(), $start);
}
return $start;

View File

@@ -38,7 +38,7 @@ class BillLine
/**
* @param string $amount
*/
public function setAmount($amount)
public function setAmount(string $amount)
{
$this->amount = $amount;
}
@@ -54,7 +54,7 @@ class BillLine
/**
* @param BillModel $bill
*/
public function setBill($bill)
public function setBill(BillModel $bill)
{
$this->bill = $bill;
}
@@ -70,7 +70,7 @@ class BillLine
/**
* @param string $max
*/
public function setMax($max)
public function setMax(string $max)
{
$this->max = $max;
}
@@ -86,7 +86,7 @@ class BillLine
/**
* @param string $min
*/
public function setMin($min)
public function setMin(string $min)
{
$this->min = $min;
}
@@ -100,9 +100,9 @@ class BillLine
}
/**
* @param boolean $active
* @param bool $active
*/
public function setActive($active)
public function setActive(bool $active)
{
$this->active = $active;
}
@@ -116,9 +116,9 @@ class BillLine
}
/**
* @param boolean $hit
* @param bool $hit
*/
public function setHit($hit)
public function setHit(bool $hit)
{
$this->hit = $hit;
}

View File

@@ -41,9 +41,9 @@ class Budget
}
/**
* @param float $add
* @param string $add
*/
public function addBudgeted($add)
public function addBudgeted(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
@@ -51,9 +51,9 @@ class Budget
}
/**
* @param float $add
* @param string $add
*/
public function addLeft($add)
public function addLeft(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
@@ -61,9 +61,9 @@ class Budget
}
/**
* @param float $add
* @param string $add
*/
public function addOverspent($add)
public function addOverspent(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
@@ -71,9 +71,9 @@ class Budget
}
/**
* @param float $add
* @param string $add
*/
public function addSpent($add)
public function addSpent(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
@@ -99,7 +99,7 @@ class Budget
/**
* @param string $budgeted
*/
public function setBudgeted($budgeted)
public function setBudgeted(string $budgeted)
{
$this->budgeted = $budgeted;
}
@@ -115,7 +115,7 @@ class Budget
/**
* @param string $left
*/
public function setLeft($left)
public function setLeft(string $left)
{
$this->left = $left;
}
@@ -131,7 +131,7 @@ class Budget
/**
* @param string $overspent
*/
public function setOverspent($overspent)
public function setOverspent(string $overspent)
{
$this->overspent = strval(round($overspent, 2));
}
@@ -147,7 +147,7 @@ class Budget
/**
* @param string $spent
*/
public function setSpent($spent)
public function setSpent(string $spent)
{
$this->spent = strval(round($spent, 2));
}

View File

@@ -17,16 +17,16 @@ class BudgetLine
/** @var BudgetModel */
protected $budget;
/** @var float */
protected $budgeted = 0;
/** @var float */
protected $left = 0;
/** @var float */
protected $overspent = 0;
/** @var string */
protected $budgeted = '0';
/** @var string */
protected $left = '0';
/** @var string */
protected $overspent = '0';
/** @var LimitRepetition */
protected $repetition;
/** @var float */
protected $spent = 0;
/** @var string */
protected $spent = '0';
/**
* @return BudgetModel
@@ -39,13 +39,13 @@ class BudgetLine
/**
* @param BudgetModel $budget
*/
public function setBudget($budget)
public function setBudget(BudgetModel $budget)
{
$this->budget = $budget;
}
/**
* @return float
* @return string
*/
public function getBudgeted()
{
@@ -53,15 +53,15 @@ class BudgetLine
}
/**
* @param float $budgeted
* @param string $budgeted
*/
public function setBudgeted($budgeted)
public function setBudgeted(string $budgeted)
{
$this->budgeted = $budgeted;
}
/**
* @return float
* @return string
*/
public function getLeft()
{
@@ -69,15 +69,15 @@ class BudgetLine
}
/**
* @param float $left
* @param string $left
*/
public function setLeft($left)
public function setLeft(string $left)
{
$this->left = $left;
}
/**
* @return float
* @return string
*/
public function getOverspent()
{
@@ -85,9 +85,9 @@ class BudgetLine
}
/**
* @param float $overspent
* @param string $overspent
*/
public function setOverspent($overspent)
public function setOverspent(string $overspent)
{
$this->overspent = $overspent;
}
@@ -103,13 +103,13 @@ class BudgetLine
/**
* @param LimitRepetition $repetition
*/
public function setRepetition($repetition)
public function setRepetition(LimitRepetition $repetition)
{
$this->repetition = $repetition;
}
/**
* @return float
* @return string
*/
public function getSpent()
{
@@ -117,9 +117,9 @@ class BudgetLine
}
/**
* @param float $spent
* @param string $spent
*/
public function setSpent($spent)
public function setSpent(string $spent)
{
$this->spent = $spent;
}

View File

@@ -42,9 +42,9 @@ class Category
}
/**
* @param float $add
* @param string $add
*/
public function addTotal($add)
public function addTotal(string $add)
{
$add = strval(round($add, 2));
bcscale(2);

View File

@@ -58,9 +58,9 @@ class Expense
}
/**
* @param $add
* @param string $add
*/
public function addToTotal($add)
public function addToTotal(string $add)
{
bcscale(2);

View File

@@ -20,7 +20,7 @@ class Income
/** @var Collection */
protected $incomes;
/** @var string */
protected $total;
protected $total = '0';
/**
*
@@ -54,9 +54,9 @@ class Income
}
/**
* @param $add
* @param string $add
*/
public function addToTotal($add)
public function addToTotal(string $add)
{
$add = strval(round($add, 2));
bcscale(2);

View File

@@ -19,6 +19,6 @@ class Amount extends BasicConverter implements ConverterInterface
return $this->value;
}
return 0;
return '0';
}
}

View File

@@ -23,6 +23,6 @@ class AmountComma extends BasicConverter implements ConverterInterface
return floatval($value);
}
return 0;
return '0';
}
}

View File

@@ -64,7 +64,7 @@ class Data
*
* @param string $csvFileContent
*/
public function setCsvFileContent($csvFileContent)
public function setCsvFileContent(string $csvFileContent)
{
$this->csvFileContent = $csvFileContent;
}
@@ -82,7 +82,7 @@ class Data
*
* @param string $csvFileLocation
*/
public function setCsvFileLocation($csvFileLocation)
public function setCsvFileLocation(string $csvFileLocation)
{
Session::put('csv-file', $csvFileLocation);
$this->csvFileLocation = $csvFileLocation;
@@ -99,9 +99,9 @@ class Data
/**
*
* @param mixed $dateFormat
* @param string $dateFormat
*/
public function setDateFormat($dateFormat)
public function setDateFormat(string $dateFormat)
{
Session::put('csv-date-format', $dateFormat);
$this->dateFormat = $dateFormat;
@@ -120,7 +120,7 @@ class Data
*
* @param string $delimiter
*/
public function setDelimiter($delimiter)
public function setDelimiter(string $delimiter)
{
Session::put('csv-delimiter', $delimiter);
$this->delimiter = $delimiter;
@@ -233,7 +233,7 @@ class Data
*
* @param bool $hasHeaders
*/
public function setHasHeaders($hasHeaders)
public function setHasHeaders(bool $hasHeaders)
{
Session::put('csv-has-headers', $hasHeaders);
$this->hasHeaders = $hasHeaders;
@@ -243,7 +243,7 @@ class Data
*
* @param int $importAccount
*/
public function setImportAccount($importAccount)
public function setImportAccount(int $importAccount)
{
Session::put('csv-import-account', $importAccount);
$this->importAccount = $importAccount;

View File

@@ -136,7 +136,7 @@ class Importer
/**
* @param Data $data
*/
public function setData($data)
public function setData(Data $data)
{
$this->data = $data;
}
@@ -218,12 +218,12 @@ class Importer
}
/**
* @param $row
* @param array $row
*
* @throws FireflyException
* @return string|bool
*/
protected function importRow($row)
protected function importRow(array $row)
{
$data = $this->getFiller(); // These fields are necessary to create a new transaction journal. Some are optional
@@ -266,7 +266,7 @@ class Importer
*
* @return bool
*/
protected function parseRow($index)
protected function parseRow(int $index)
{
return (($this->data->hasHeaders() && $index >= 1) || !$this->data->hasHeaders());
}

View File

@@ -49,7 +49,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
/**
* @param array $data
*/
public function setData($data)
public function setData(array $data)
{
$this->data = $data;
}
@@ -57,7 +57,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
/**
* @param array $row
*/
public function setRow($row)
public function setRow(array $row)
{
$this->row = $row;
}

View File

@@ -35,7 +35,7 @@ class Dummy extends Specifix implements SpecifixInterface
/**
* @param array $data
*/
public function setData($data)
public function setData(array $data)
{
$this->data = $data;
}
@@ -43,7 +43,7 @@ class Dummy extends Specifix implements SpecifixInterface
/**
* @param array $row
*/
public function setRow($row)
public function setRow(array $row)
{
$this->row = $row;
}

View File

@@ -40,7 +40,7 @@ class RabobankDescription extends Specifix implements SpecifixInterface
/**
* @param array $data
*/
public function setData($data)
public function setData(array $data)
{
$this->data = $data;
}
@@ -48,7 +48,7 @@ class RabobankDescription extends Specifix implements SpecifixInterface
/**
* @param array $row
*/
public function setRow($row)
public function setRow(array $row)
{
$this->row = $row;
}

View File

@@ -29,11 +29,11 @@ class Specifix
}
/**
* @param $processorType
* @param int $processorType
*
* @return $this
*/
public function setProcessorType($processorType)
public function setProcessorType(int $processorType)
{
$this->processorType = $processorType;

View File

@@ -24,17 +24,17 @@ interface SpecifixInterface
/**
* @param array $data
*/
public function setData($data);
public function setData(array $data);
/**
* @param int $processorType
*
* @return $this
*/
public function setProcessorType($processorType);
public function setProcessorType(int $processorType);
/**
* @param array $row
*/
public function setRow($row);
public function setRow(array $row);
}

View File

@@ -26,7 +26,7 @@ class Wizard implements WizardInterface
*
* @return array
*/
public function getMappableValues($reader, array $map, $hasHeaders)
public function getMappableValues(Reader $reader, array $map, bool $hasHeaders)
{
$values = [];
/*
@@ -52,11 +52,11 @@ class Wizard implements WizardInterface
/**
* @param array $roles
* @param mixed $map
* @param array $map
*
* @return array
*/
public function processSelectedMapping(array $roles, $map)
public function processSelectedMapping(array $roles, array $map)
{
$configRoles = Config::get('csv.roles');
$maps = [];
@@ -79,11 +79,11 @@ class Wizard implements WizardInterface
}
/**
* @param mixed $input
* @param array $input
*
* @return array
*/
public function processSelectedRoles($input)
public function processSelectedRoles(array $input)
{
$roles = [];
@@ -150,11 +150,11 @@ class Wizard implements WizardInterface
}
/**
* @param $path
* @param string $path
*
* @return string
*/
public function storeCsvFile($path)
public function storeCsvFile(string $path)
{
$time = str_replace(' ', '-', microtime());
$fileName = 'csv-upload-' . Auth::user()->id . '-' . $time . '.csv.encrypted';
@@ -188,7 +188,7 @@ class Wizard implements WizardInterface
*
* @return bool
*/
protected function useRow($hasHeaders, $index)
protected function useRow(bool $hasHeaders, int $index)
{
return ($hasHeaders && $index > 1) || !$hasHeaders;
}

View File

@@ -18,22 +18,22 @@ interface WizardInterface
*
* @return array
*/
public function getMappableValues($reader, array $map, $hasHeaders);
public function getMappableValues(Reader $reader, array $map, bool $hasHeaders);
/**
* @param array $roles
* @param mixed $map
* @param array $map
*
* @return array
*/
public function processSelectedMapping(array $roles, $map);
public function processSelectedMapping(array $roles, array $map);
/**
* @param mixed $input
* @param array $input
*
* @return array
*/
public function processSelectedRoles($input);
public function processSelectedRoles(array $input);
/**
* @param array $fields
@@ -50,10 +50,10 @@ interface WizardInterface
public function showOptions(array $map);
/**
* @param $path
* @param string $path
*
* @return string
*/
public function storeCsvFile($path);
public function storeCsvFile(string $path);
}

View File

@@ -19,11 +19,11 @@ class Help implements HelpInterface
/**
* @codeCoverageIgnore
*
* @param $key
* @param string $key
*
* @return string
*/
public function getFromCache($key)
public function getFromCache(string $key)
{
return Cache::get($key);
}
@@ -31,11 +31,11 @@ class Help implements HelpInterface
/**
* @codeCoverageIgnore
*
* @param $route
* @param string $route
*
* @return array
*/
public function getFromGithub($route)
public function getFromGithub(string $route)
{
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/en/' . e($route) . '.md';
$routeIndex = str_replace('.', '-', $route);
@@ -62,11 +62,11 @@ class Help implements HelpInterface
/**
* @codeCoverageIgnore
*
* @param $route
* @param string $route
*
* @return bool
*/
public function hasRoute($route)
public function hasRoute(string $route)
{
return Route::has($route);
}
@@ -74,11 +74,11 @@ class Help implements HelpInterface
/**
* @codeCoverageIgnore
*
* @param $route
* @param string $route
*
* @return bool
*/
public function inCache($route)
public function inCache(string $route)
{
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
}
@@ -86,12 +86,12 @@ class Help implements HelpInterface
/**
* @codeCoverageIgnore
*
* @param $route
* @param array $content
* @param string $route
* @param array $content
*
* @internal param $title
*/
public function putInCache($route, array $content)
public function putInCache(string $route, array $content)
{
Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.
Cache::put('help.' . $route . '.title', $content['title'], 10080);

View File

@@ -11,38 +11,38 @@ interface HelpInterface
{
/**
* @param $key
* @param string $key
*
* @return string
*/
public function getFromCache($key);
public function getFromCache(string $key);
/**
* @param $route
* @param string $route
*
* @return array
*/
public function getFromGithub($route);
public function getFromGithub(string $route);
/**
* @param $route
* @param string $route
*
* @return bool
*/
public function hasRoute($route);
public function hasRoute(string $route);
/**
* @param $route
* @param string $route
*
* @return bool
*/
public function inCache($route);
public function inCache(string $route);
/**
* @param $route
* @param array $content
* @param string $route
* @param array $content
*
* @return void
*/
public function putInCache($route, array $content);
public function putInCache(string $route, array $content);
}

View File

@@ -132,7 +132,7 @@ class ReportHelper implements ReportHelperInterface
*
* @return Expense
*/
public function getExpenseReport($start, $end, Collection $accounts)
public function getExpenseReport(Carbon $start, Carbon $end, Collection $accounts)
{
$object = new Expense;
$set = $this->query->expense($accounts, $start, $end);
@@ -154,7 +154,7 @@ class ReportHelper implements ReportHelperInterface
*
* @return Income
*/
public function getIncomeReport($start, $end, Collection $accounts)
public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts)
{
$object = new Income;
$set = $this->query->income($accounts, $start, $end);

View File

@@ -49,7 +49,7 @@ interface ReportHelperInterface
*
* @return Expense
*/
public function getExpenseReport($start, $end, Collection $accounts);
public function getExpenseReport(Carbon $start, Carbon $end, Collection $accounts);
/**
* Get a full report on the users incomes during the period for the given accounts.
@@ -60,7 +60,7 @@ interface ReportHelperInterface
*
* @return Income
*/
public function getIncomeReport($start, $end, Collection $accounts);
public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts);
/**
* @param Carbon $date