Code cleanup

This commit is contained in:
James Cole
2019-08-17 10:47:29 +02:00
parent 23479790fe
commit c2296c3ad5
95 changed files with 463 additions and 507 deletions

View File

@@ -50,8 +50,6 @@ class Amount
*
* @return string
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public static function getAmountJsConfig(bool $sepBySpace, int $signPosn, string $sign, bool $csPrecedes): string
{
@@ -122,7 +120,7 @@ class Amount
* @param bool $coloured
*
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = null): string
{
@@ -164,7 +162,7 @@ class Amount
* @param bool $coloured
*
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @noinspection MoreThanThreeArgumentsInspection
*/
public function formatFlat(string $symbol, int $decimalPlaces, string $amount, bool $coloured = null): string

View File

@@ -40,7 +40,7 @@ class AccountList implements BinderInterface
*
* @return Collection
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public static function routeBinder(string $value, Route $route): Collection
{

View File

@@ -39,7 +39,7 @@ class BudgetList implements BinderInterface
*
* @return Collection
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public static function routeBinder(string $value, Route $route): Collection
{

View File

@@ -38,7 +38,7 @@ class CategoryList implements BinderInterface
*
* @return Collection
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public static function routeBinder(string $value, Route $route): Collection
{

View File

@@ -27,7 +27,6 @@ use FireflyIII\Import\Prerequisites\PrerequisitesInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User;
use Illuminate\Routing\Route;
use Log;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -37,8 +36,8 @@ class ImportProvider implements BinderInterface
{
/**
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*
*/
public static function getProviders(): array
{

View File

@@ -23,32 +23,17 @@ declare(strict_types=1);
namespace FireflyIII\Support;
use Amount as Amt;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use FireflyIII\Support\Form\FormSupport;
use Form;
use Illuminate\Support\Collection;
use Illuminate\Support\HtmlString;
use Illuminate\Support\MessageBag;
use Log;
use RuntimeException;
use Throwable;
/**
* Class ExpandedForm.
*
* @SuppressWarnings(PHPMD.TooManyMethods)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*
* @codeCoverageIgnore
*/
class ExpandedForm
@@ -225,7 +210,7 @@ class ExpandedForm
* @param \Illuminate\Support\Collection $set
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function makeSelectListWithEmpty(Collection $set): array
{

View File

@@ -117,7 +117,7 @@ class CurrencyForm
* @param array $options
*
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function allCurrencyField(string $name, string $view, $value = null, array $options = null): string
{
@@ -168,7 +168,7 @@ class CurrencyForm
* @param array $options
*
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function currencyField(string $name, string $view, $value = null, array $options = null): string
{

View File

@@ -79,8 +79,8 @@ trait AugumentData
*
* @return array
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*
*/
protected function earnedByCategory(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array // get data + augment with info
{
@@ -352,7 +352,7 @@ trait AugumentData
*
* @return array
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function getExpensesForBudget(Collection $limits, Budget $budget, Carbon $start, Carbon $end): array // get data + augment with info
{
@@ -397,7 +397,7 @@ trait AugumentData
*
* @return array
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*
*/
protected function spentInPeriodMulti(Budget $budget, Collection $limits): array // get data + augment with info
@@ -586,8 +586,8 @@ trait AugumentData
* @param Carbon $end
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*
*/
protected function spentByBudget(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array // get data + augment with info
{
@@ -647,8 +647,8 @@ trait AugumentData
*
* @return array
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*
*/
protected function spentByCategory(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array // get data + augment with info
{

View File

@@ -47,8 +47,8 @@ trait ChartGeneration
*
* @return array
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*
*/
protected function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array // chart helper method.
{

View File

@@ -88,7 +88,7 @@ trait GetConfigurationData
* Get config for date range.
*
* @return array
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*/
protected function getDateRangeConfig(): array // get configuration + get preferences.
{
@@ -177,7 +177,7 @@ trait GetConfigurationData
* @param string $specificPage
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function getSpecificSteps(string $route, string $specificPage): array // get config values
{

View File

@@ -28,7 +28,6 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
@@ -281,7 +280,7 @@ trait PeriodOverview
* @param Carbon $theDate
*
* @return array
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*/
protected function getNoCategoryPeriodOverview(Carbon $theDate): array
{

View File

@@ -83,7 +83,7 @@ trait RenderPartialViews
*
* @return string
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function balanceAmount(array $attributes): string // generate view for report.
{

View File

@@ -65,8 +65,8 @@ trait RequestInformation
* @param string $language
*
* @return string
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*
*/
protected function getHelpText(string $route, string $language): string // get from internet.
{
@@ -213,7 +213,7 @@ trait RequestInformation
* @param Carbon $date
*
* @return bool
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function notInSessionRange(Carbon $date): bool // Validate a preference
{

View File

@@ -109,8 +109,6 @@ trait TransactionCalculation
* @param Carbon $end
*
* @return array
*
*
*/
protected function getExpensesInCategories(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): array
{
@@ -175,8 +173,6 @@ trait TransactionCalculation
* @param Carbon $end
*
* @return Collection
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
protected function getIncomeForTags(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): array
{

View File

@@ -272,7 +272,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
*
* @return array
* @throws FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function getValuesForMapping(Reader $reader, array $config, array $columnConfig): array
{

View File

@@ -58,7 +58,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface
* @param array $config
*
* @return MessageBag
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function configurationComplete(array $config): MessageBag
{

View File

@@ -110,7 +110,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
*
* @return array
* @throws FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function getNextData(): array
{

View File

@@ -132,7 +132,7 @@ class ImportTransaction
* @param ColumnValue $columnValue
*
* @throws FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function addColumnValue(ColumnValue $columnValue): void
{

View File

@@ -60,7 +60,7 @@ class AssetAccountMapper
* @param array $data
*
* @return Account
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function map(?int $accountId, array $data): Account
{

View File

@@ -81,7 +81,7 @@ class MappedValuesValidator
*
* @return array
* @throws FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function validate(array $mappings): array
{

View File

@@ -45,7 +45,7 @@ class OpposingAccountMapper
* @param array $data
*
* @return Account
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function map(?int $accountId, string $amount, array $data): Account
{

View File

@@ -108,7 +108,7 @@ class StageImportDataHandler
* @param LocalAccount $originalSource
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
private function convertToArray(array $transactions, SpectreAccount $spectreAccount, LocalAccount $originalSource): array
{

View File

@@ -104,7 +104,7 @@ class Navigation
*
* @return array
* @throws \FireflyIII\Exceptions\FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function blockPeriods(\Carbon\Carbon $start, \Carbon\Carbon $end, string $range): array
{

View File

@@ -70,7 +70,7 @@ trait CalculateRangeOccurrences
* @param string $moment
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function getMonthlyInRange(Carbon $start, Carbon $end, int $skipMod, string $moment): array
{
@@ -150,7 +150,7 @@ trait CalculateRangeOccurrences
* @param string $moment
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function getWeeklyInRange(Carbon $start, Carbon $end, int $skipMod, string $moment): array
{
@@ -194,7 +194,7 @@ trait CalculateRangeOccurrences
* @param string $moment
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function getYearlyInRange(Carbon $start, Carbon $end, int $skipMod, string $moment): array
{

View File

@@ -42,8 +42,8 @@ trait FiltersWeekends
* @param array $dates
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*
*/
protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array
{

View File

@@ -181,7 +181,7 @@ class Search implements SearchInterface
* @param GroupCollectorInterface $collector
*
* @return GroupCollectorInterface
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
private function applyModifiers(GroupCollectorInterface $collector): GroupCollectorInterface
{