Various code cleanup.

This commit is contained in:
James Cole
2017-09-09 06:41:45 +02:00
parent 0543733e3d
commit 3a3eb4e84f
38 changed files with 212 additions and 218 deletions

View File

@@ -13,7 +13,6 @@ declare(strict_types=1);
namespace FireflyIII\Support\Import\Information;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Services\Bunq\Object\Alias;
use FireflyIII\Services\Bunq\Object\MonetaryAccountBank;
use FireflyIII\Services\Bunq\Request\DeleteDeviceSessionRequest;

View File

@@ -13,7 +13,6 @@ declare(strict_types=1);
namespace FireflyIII\Support\Import\Information;
use FireflyIII\User;
use Illuminate\Support\Collection;
/**
* Interface InformationInterface
@@ -23,13 +22,6 @@ use Illuminate\Support\Collection;
interface InformationInterface
{
/**
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
*
* @param User $user
*/
public function setUser(User $user): void;
/**
* Returns a collection of accounts. Preferrably, these follow a uniform Firefly III format so they can be managed over banks.
*
@@ -46,4 +38,11 @@ interface InformationInterface
* @return array
*/
public function getAccounts(): array;
/**
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
*
* @param User $user
*/
public function setUser(User $user): void;
}

View File

@@ -32,13 +32,6 @@ interface PrerequisitesInterface
*/
public function getViewParameters(): array;
/**
* @param Request $request
*
* @return MessageBag
*/
public function storePrerequisites(Request $request): MessageBag;
/**
* Returns if this import method has any special prerequisites such as config
* variables or other things.
@@ -53,4 +46,11 @@ interface PrerequisitesInterface
* @param User $user
*/
public function setUser(User $user): void;
/**
* @param Request $request
*
* @return MessageBag
*/
public function storePrerequisites(Request $request): MessageBag;
}

View File

@@ -112,7 +112,7 @@ class Search implements SearchInterface
$collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation();
}
$collector->removeFilter(InternalTransferFilter::class);
$set = $collector->getPaginatedJournals()->getCollection();
$set = $collector->getPaginatedJournals()->getCollection();
Log::debug(sprintf('Found %d journals to check. ', $set->count()));

View File

@@ -114,14 +114,11 @@ class AmountFormat extends Twig_Extension
*
* @return Twig_SimpleFunction
*/
protected function formatAmountBySymbol(): Twig_SimpleFunction
protected function formatAmountByCurrency(): Twig_SimpleFunction
{
return new Twig_SimpleFunction(
'formatAmountBySymbol', function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string {
'formatAmountByCurrency', function (TransactionCurrency $currency, string $amount, bool $coloured = true): string {
$currency = new TransactionCurrency;
$currency->symbol = $symbol;
$currency->decimal_places = $decimalPlaces;
return app('amount')->formatAnything($currency, $amount, $coloured);
@@ -134,10 +131,14 @@ class AmountFormat extends Twig_Extension
*
* @return Twig_SimpleFunction
*/
protected function formatAmountByCurrency(): Twig_SimpleFunction
protected function formatAmountBySymbol(): Twig_SimpleFunction
{
return new Twig_SimpleFunction(
'formatAmountByCurrency', function (TransactionCurrency $currency, string $amount, bool $coloured = true): string {
'formatAmountBySymbol', function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string {
$currency = new TransactionCurrency;
$currency->symbol = $symbol;
$currency->decimal_places = $decimalPlaces;
return app('amount')->formatAnything($currency, $amount, $coloured);

View File

@@ -57,6 +57,14 @@ class Translation extends Twig_Extension
}
/**
* {@inheritDoc}
*/
public function getName(): string
{
return 'FireflyIII\Support\Twig\Translation';
}
/**
* @return Twig_SimpleFunction
*/
@@ -64,9 +72,9 @@ class Translation extends Twig_Extension
{
return new Twig_SimpleFunction(
'journalLinkTranslation', function (int $linkTypeId, string $direction, string $original) {
$key = sprintf('firefly.%d_%s', $linkTypeId, $direction);
$key = sprintf('firefly.%d_%s', $linkTypeId, $direction);
$translation = trans($key);
if($key === $translation) {
if ($key === $translation) {
return $original;
}
@@ -76,12 +84,4 @@ class Translation extends Twig_Extension
}, ['is_safe' => ['html']]
);
}
/**
* {@inheritDoc}
*/
public function getName(): string
{
return 'FireflyIII\Support\Twig\Translation';
}
}