Code cleanup

This commit is contained in:
James Cole
2018-04-28 06:23:13 +02:00
parent 6f0e1c79ac
commit 13b78bdc20
218 changed files with 621 additions and 681 deletions

View File

@@ -195,7 +195,7 @@ class ImportAccount
*/
private function findByIBAN(AccountType $type): ?Account
{
if (3 === count($this->accountIban)) {
if (3 === \count($this->accountIban)) {
$accounts = $this->repository->getAccountsByType([$type->type]);
$iban = $this->accountIban['value'];
Log::debug(sprintf('Finding account of type %d and IBAN %s', $type->id, $iban));
@@ -233,7 +233,7 @@ class ImportAccount
*/
private function findById(AccountType $type): ?Account
{
if (3 === count($this->accountId)) {
if (3 === \count($this->accountId)) {
Log::debug(sprintf('Finding account of type %d and ID %d', $type->id, $this->accountId['value']));
/** @var Account $account */
$account = $this->user->accounts()
@@ -263,7 +263,7 @@ class ImportAccount
private function findByName(AccountType $type): ?Account
{
// Three: find by name (and type):
if (3 === count($this->accountName)) {
if (3 === \count($this->accountName)) {
$accounts = $this->repository->getAccountsByType([$type->type]);
$name = $this->accountName['value'];
Log::debug(sprintf('Finding account of type %d and name %s', $type->id, $name));
@@ -351,7 +351,7 @@ class ImportAccount
private function getMappedObject(array $array): ?Account
{
Log::debug('In getMappedObject() for Account');
if (0 === count($array)) {
if (0 === \count($array)) {
Log::debug('Array is empty, nothing will come of this.');
return null;

View File

@@ -105,7 +105,7 @@ class ImportBill
*/
private function findById(): ?Bill
{
if (3 === count($this->id)) {
if (3 === \count($this->id)) {
Log::debug(sprintf('Finding bill with ID #%d', $this->id['value']));
/** @var Bill $bill */
$bill = $this->repository->find((int)$this->id['value']);
@@ -125,7 +125,7 @@ class ImportBill
*/
private function findByName(): ?Bill
{
if (3 === count($this->name)) {
if (3 === \count($this->name)) {
$bills = $this->repository->getBills();
$name = $this->name['value'];
Log::debug(sprintf('Finding bill with name %s', $name));
@@ -201,7 +201,7 @@ class ImportBill
private function getMappedObject(array $array): ?Bill
{
Log::debug('In getMappedObject() for Bill');
if (0 === count($array)) {
if (0 === \count($array)) {
Log::debug('Array is empty, nothing will come of this.');
return null;
@@ -250,7 +250,7 @@ class ImportBill
}
$name = $this->name['value'] ?? '';
if (0 === strlen($name)) {
if (0 === \strlen($name)) {
return true;
}

View File

@@ -94,7 +94,7 @@ class ImportBudget
*/
private function findById(): ?Budget
{
if (3 === count($this->id)) {
if (3 === \count($this->id)) {
Log::debug(sprintf('Finding budget with ID #%d', $this->id['value']));
/** @var Budget $budget */
$budget = $this->repository->findNull((int)$this->id['value']);
@@ -114,7 +114,7 @@ class ImportBudget
*/
private function findByName(): ?Budget
{
if (3 === count($this->name)) {
if (3 === \count($this->name)) {
$budgets = $this->repository->getBudgets();
$name = $this->name['value'];
Log::debug(sprintf('Finding budget with name %s', $name));
@@ -190,7 +190,7 @@ class ImportBudget
private function getMappedObject(array $array): ?Budget
{
Log::debug('In getMappedObject() for Budget');
if (0 === count($array)) {
if (0 === \count($array)) {
Log::debug('Array is empty, nothing will come of this.');
return null;
@@ -239,7 +239,7 @@ class ImportBudget
}
$name = $this->name['value'] ?? '';
if (0 === strlen($name)) {
if (0 === \strlen($name)) {
return true;
}

View File

@@ -96,7 +96,7 @@ class ImportCategory
*/
private function findById(): ?Category
{
if (3 === count($this->id)) {
if (3 === \count($this->id)) {
Log::debug(sprintf('Finding category with ID #%d', $this->id['value']));
/** @var Category $category */
$category = $this->repository->findNull((int)$this->id['value']);
@@ -118,7 +118,7 @@ class ImportCategory
*/
private function findByName(): ?Category
{
if (3 === count($this->name)) {
if (3 === \count($this->name)) {
$categories = $this->repository->getCategories();
$name = $this->name['value'];
Log::debug(sprintf('Finding category with name %s', $name));
@@ -195,7 +195,7 @@ class ImportCategory
private function getMappedObject(array $array): ?Category
{
Log::debug('In getMappedObject() for Category');
if (0 === count($array)) {
if (0 === \count($array)) {
Log::debug('Array is empty, nothing will come of this.');
return null;
@@ -244,7 +244,7 @@ class ImportCategory
}
$name = $this->name['value'] ?? '';
if (0 === strlen($name)) {
if (0 === \strlen($name)) {
return true;
}

View File

@@ -201,7 +201,7 @@ class ImportCurrency
private function getMappedObject(array $array): ?TransactionCurrency
{
Log::debug('In getMappedObject()');
if (0 === count($array)) {
if (0 === \count($array)) {
Log::debug('Array is empty, nothing will come of this.');
return null;

View File

@@ -224,7 +224,7 @@ class ImportJournal
*/
public function getMetaString(string $field): ?string
{
if (isset($this->metaFields[$field]) && strlen($this->metaFields[$field]) > 0) {
if (isset($this->metaFields[$field]) && \strlen($this->metaFields[$field]) > 0) {
return (string)$this->metaFields[$field];
}
@@ -278,7 +278,7 @@ class ImportJournal
case 'sepa-ep':
case 'sepa-ci':
$value = trim((string)$array['value']);
if (strlen($value) > 0) {
if (\strlen($value) > 0) {
$this->metaFields[$array['role']] = $value;
}
break;
@@ -411,11 +411,11 @@ class ImportJournal
$info = $this->selectAmountInput();
if (0 === count($info)) {
if (0 === \count($info)) {
throw new FireflyException('No amount information for this row.');
}
$class = $info['class'] ?? '';
if (0 === strlen($class)) {
if (0 === \strlen($class)) {
throw new FireflyException('No amount information (conversion class) for this row.');
}