Remove unnecessary slash from in_array()

This commit is contained in:
James Cole
2019-06-22 13:09:25 +02:00
parent 940a730827
commit 956ec23d3c
20 changed files with 34 additions and 34 deletions

View File

@@ -196,7 +196,7 @@ class AttachmentHelper implements AttachmentHelperInterface
return false; // @codeCoverageIgnore return false; // @codeCoverageIgnore
} }
Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model))); Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model)));
if (\is_array($files)) { if (is_array($files)) {
Log::debug('$files is an array.'); Log::debug('$files is an array.');
/** @var UploadedFile $entry */ /** @var UploadedFile $entry */
foreach ($files as $entry) { foreach ($files as $entry) {
@@ -206,7 +206,7 @@ class AttachmentHelper implements AttachmentHelperInterface
} }
Log::debug('Done processing uploads.'); Log::debug('Done processing uploads.');
} }
if (!\is_array($files) || (\is_array($files) && 0 === count($files))) { if (!is_array($files) || (is_array($files) && 0 === count($files))) {
Log::debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.'); Log::debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.');
} }

View File

@@ -82,7 +82,7 @@ class IntroController
$routeKey = str_replace('.', '_', $route); $routeKey = str_replace('.', '_', $route);
Log::debug(sprintf('Has outro step for route %s', $routeKey)); Log::debug(sprintf('Has outro step for route %s', $routeKey));
$elements = config(sprintf('intro.%s', $routeKey)); $elements = config(sprintf('intro.%s', $routeKey));
if (!\is_array($elements)) { if (!is_array($elements)) {
return false; return false;
} }

View File

@@ -105,7 +105,7 @@ class PreferencesController extends Controller
{ {
// front page accounts // front page accounts
$frontPageAccounts = []; $frontPageAccounts = [];
if (\is_array($request->get('frontPageAccounts')) && count($request->get('frontPageAccounts')) > 0) { if (is_array($request->get('frontPageAccounts')) && count($request->get('frontPageAccounts')) > 0) {
foreach ($request->get('frontPageAccounts') as $id) { foreach ($request->get('frontPageAccounts') as $id) {
$frontPageAccounts[] = (int)$id; $frontPageAccounts[] = (int)$id;
} }

View File

@@ -102,7 +102,7 @@ class IndexController extends Controller
public function reorderRuleActions(Request $request, Rule $rule): JsonResponse public function reorderRuleActions(Request $request, Rule $rule): JsonResponse
{ {
$ids = $request->get('actions'); $ids = $request->get('actions');
if (\is_array($ids)) { if (is_array($ids)) {
$this->ruleRepos->reorderRuleActions($rule, $ids); $this->ruleRepos->reorderRuleActions($rule, $ids);
} }
@@ -120,7 +120,7 @@ class IndexController extends Controller
public function reorderRuleTriggers(Request $request, Rule $rule): JsonResponse public function reorderRuleTriggers(Request $request, Rule $rule): JsonResponse
{ {
$ids = $request->get('triggers'); $ids = $request->get('triggers');
if (\is_array($ids)) { if (is_array($ids)) {
$this->ruleRepos->reorderRuleTriggers($rule, $ids); $this->ruleRepos->reorderRuleTriggers($rule, $ids);
} }

View File

@@ -97,7 +97,7 @@ class BulkController extends Controller
public function update(BulkEditJournalRequest $request) public function update(BulkEditJournalRequest $request)
{ {
$journalIds = $request->get('journals'); $journalIds = $request->get('journals');
$journalIds = \is_array($journalIds) ? $journalIds : []; $journalIds = is_array($journalIds) ? $journalIds : [];
$ignoreCategory = 1 === (int)$request->get('ignore_category'); $ignoreCategory = 1 === (int)$request->get('ignore_category');
$ignoreBudget = 1 === (int)$request->get('ignore_budget'); $ignoreBudget = 1 === (int)$request->get('ignore_budget');
$ignoreTags = 1 === (int)$request->get('ignore_tags'); $ignoreTags = 1 === (int)$request->get('ignore_tags');

View File

@@ -100,7 +100,7 @@ class MassController extends Controller
{ {
$ids = $request->get('confirm_mass_delete'); $ids = $request->get('confirm_mass_delete');
$count = 0; $count = 0;
if (\is_array($ids)) { if (is_array($ids)) {
/** @var string $journalId */ /** @var string $journalId */
foreach ($ids as $journalId) { foreach ($ids as $journalId) {
/** @var TransactionJournal $journal */ /** @var TransactionJournal $journal */
@@ -190,7 +190,7 @@ class MassController extends Controller
throw new FireflyException('Needs refactor'); throw new FireflyException('Needs refactor');
$journalIds = $request->get('journals'); $journalIds = $request->get('journals');
$count = 0; $count = 0;
if (\is_array($journalIds)) { if (is_array($journalIds)) {
foreach ($journalIds as $journalId) { foreach ($journalIds as $journalId) {
$journal = $repository->findNull((int)$journalId); $journal = $repository->findNull((int)$journalId);
if (null !== $journal) { if (null !== $journal) {

View File

@@ -49,8 +49,8 @@ class ReconciliationStoreRequest extends Request
*/ */
public function getAll(): array public function getAll(): array
{ {
$transactions = $this->get('transactions'); $transactions = $this->get('journals');
if (!\is_array($transactions)) { if (!is_array($transactions)) {
$transactions = []; // @codeCoverageIgnore $transactions = []; // @codeCoverageIgnore
} }
$data = [ $data = [
@@ -59,7 +59,7 @@ class ReconciliationStoreRequest extends Request
'start_balance' => $this->string('startBalance'), 'start_balance' => $this->string('startBalance'),
'end_balance' => $this->string('endBalance'), 'end_balance' => $this->string('endBalance'),
'difference' => $this->string('difference'), 'difference' => $this->string('difference'),
'transactions' => $transactions, 'journals' => $transactions,
'reconcile' => $this->string('reconcile'), 'reconcile' => $this->string('reconcile'),
]; ];
Log::debug('In ReconciliationStoreRequest::getAll(). Will now return data.'); Log::debug('In ReconciliationStoreRequest::getAll(). Will now return data.');
@@ -80,7 +80,7 @@ class ReconciliationStoreRequest extends Request
'startBalance' => 'numeric', 'startBalance' => 'numeric',
'endBalance' => 'numeric', 'endBalance' => 'numeric',
'difference' => 'required|numeric', 'difference' => 'required|numeric',
'transactions' => [new ValidTransactions], 'journals' => [new ValidJournals],
'reconcile' => 'required|in:create,nothing', 'reconcile' => 'required|in:create,nothing',
]; ];
} }

View File

@@ -60,7 +60,7 @@ class ReportFormRequest extends Request
$repository = app(AccountRepositoryInterface::class); $repository = app(AccountRepositoryInterface::class);
$set = $this->get('accounts'); $set = $this->get('accounts');
$collection = new Collection; $collection = new Collection;
if (\is_array($set)) { if (is_array($set)) {
foreach ($set as $accountId) { foreach ($set as $accountId) {
$account = $repository->findNull((int)$accountId); $account = $repository->findNull((int)$accountId);
if (null !== $account) { if (null !== $account) {
@@ -83,7 +83,7 @@ class ReportFormRequest extends Request
$repository = app(BudgetRepositoryInterface::class); $repository = app(BudgetRepositoryInterface::class);
$set = $this->get('budget'); $set = $this->get('budget');
$collection = new Collection; $collection = new Collection;
if (\is_array($set)) { if (is_array($set)) {
foreach ($set as $budgetId) { foreach ($set as $budgetId) {
$budget = $repository->findNull((int)$budgetId); $budget = $repository->findNull((int)$budgetId);
if (null !== $budget) { if (null !== $budget) {
@@ -106,7 +106,7 @@ class ReportFormRequest extends Request
$repository = app(CategoryRepositoryInterface::class); $repository = app(CategoryRepositoryInterface::class);
$set = $this->get('category'); $set = $this->get('category');
$collection = new Collection; $collection = new Collection;
if (\is_array($set)) { if (is_array($set)) {
foreach ($set as $categoryId) { foreach ($set as $categoryId) {
$category = $repository->findNull((int)$categoryId); $category = $repository->findNull((int)$categoryId);
if (null !== $category) { if (null !== $category) {
@@ -157,7 +157,7 @@ class ReportFormRequest extends Request
$repository = app(AccountRepositoryInterface::class); $repository = app(AccountRepositoryInterface::class);
$set = $this->get('exp_rev'); $set = $this->get('exp_rev');
$collection = new Collection; $collection = new Collection;
if (\is_array($set)) { if (is_array($set)) {
foreach ($set as $accountId) { foreach ($set as $accountId) {
$account = $repository->findNull((int)$accountId); $account = $repository->findNull((int)$accountId);
if (null !== $account) { if (null !== $account) {
@@ -208,7 +208,7 @@ class ReportFormRequest extends Request
$set = $this->get('tag'); $set = $this->get('tag');
$collection = new Collection; $collection = new Collection;
Log::debug('Set is:', $set ?? []); Log::debug('Set is:', $set ?? []);
if (\is_array($set)) { if (is_array($set)) {
foreach ($set as $tagTag) { foreach ($set as $tagTag) {
Log::debug(sprintf('Now searching for "%s"', $tagTag)); Log::debug(sprintf('Now searching for "%s"', $tagTag));
$tag = $repository->findByTag($tagTag); $tag = $repository->findByTag($tagTag);

View File

@@ -112,7 +112,7 @@ class RuleFormRequest extends Request
{ {
$return = []; $return = [];
$actionData = $this->get('actions'); $actionData = $this->get('actions');
if (\is_array($actionData)) { if (is_array($actionData)) {
foreach ($actionData as $action) { foreach ($actionData as $action) {
$stopProcessing = $action['stop_processing'] ?? '0'; $stopProcessing = $action['stop_processing'] ?? '0';
$return[] = [ $return[] = [
@@ -133,7 +133,7 @@ class RuleFormRequest extends Request
{ {
$return = []; $return = [];
$triggerData = $this->get('triggers'); $triggerData = $this->get('triggers');
if (\is_array($triggerData)) { if (is_array($triggerData)) {
foreach ($triggerData as $trigger) { foreach ($triggerData as $trigger) {
$stopProcessing = $trigger['stop_processing'] ?? '0'; $stopProcessing = $trigger['stop_processing'] ?? '0';
$return[] = [ $return[] = [

View File

@@ -147,7 +147,7 @@ class AbnAmroDescription implements SpecificInterface
// SEPA plain descriptions contain several key-value pairs, split by a colon // SEPA plain descriptions contain several key-value pairs, split by a colon
preg_match_all('/([A-Za-z]+(?=:\s)):\s([A-Za-z 0-9._#-]+(?=\s|$))/', $this->row[7], $matches, PREG_SET_ORDER); preg_match_all('/([A-Za-z]+(?=:\s)):\s([A-Za-z 0-9._#-]+(?=\s|$))/', $this->row[7], $matches, PREG_SET_ORDER);
if (\is_array($matches)) { if (is_array($matches)) {
foreach ($matches as $match) { foreach ($matches as $match) {
$key = $match[1]; $key = $match[1];
$value = trim($match[2]); $value = trim($match[2]);
@@ -203,7 +203,7 @@ class AbnAmroDescription implements SpecificInterface
// Search for properties specified in the TRTP format. If no description // Search for properties specified in the TRTP format. If no description
// is provided, use the type, name and reference as new description // is provided, use the type, name and reference as new description
if (\is_array($matches)) { if (is_array($matches)) {
foreach ($matches as $match) { foreach ($matches as $match) {
$key = $match[1]; $key = $match[1];
$value = trim($match[2]); $value = trim($match[2]);

View File

@@ -224,7 +224,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
public function getExtendedStatus(ImportJob $job): array public function getExtendedStatus(ImportJob $job): array
{ {
$status = $job->extended_status; $status = $job->extended_status;
if (\is_array($status)) { if (is_array($status)) {
return $status; return $status;
} }

View File

@@ -563,7 +563,7 @@ class JournalRepository implements JournalRepositoryInterface
$value = $entry->data; $value = $entry->data;
if (\is_array($value)) { if (is_array($value)) {
$return = implode(',', $value); $return = implode(',', $value);
$cache->store($return); $cache->store($return);

View File

@@ -291,7 +291,7 @@ trait JournalServiceTrait
// $factory = app(TagFactory::class); // $factory = app(TagFactory::class);
// $factory->setUser($journal->user); // $factory->setUser($journal->user);
// $set = []; // $set = [];
// if (!\is_array($data['tags'])) { // if (!is_array($data['tags'])) {
// return; // @codeCoverageIgnore // return; // @codeCoverageIgnore
// } // }
// foreach ($data['tags'] as $string) { // foreach ($data['tags'] as $string) {

View File

@@ -67,7 +67,7 @@ class Account extends SpectreObject
$this->nature = $data['nature']; $this->nature = $data['nature'];
$this->createdAt = new Carbon($data['created_at']); $this->createdAt = new Carbon($data['created_at']);
$this->updatedAt = new Carbon($data['updated_at']); $this->updatedAt = new Carbon($data['updated_at']);
$extraArray = \is_array($data['extra']) ? $data['extra'] : []; $extraArray = is_array($data['extra']) ? $data['extra'] : [];
foreach ($extraArray as $key => $value) { foreach ($extraArray as $key => $value) {
$this->extra[$key] = $value; $this->extra[$key] = $value;
} }

View File

@@ -68,7 +68,7 @@ trait GetConfigurationData
$routeKey = str_replace('.', '_', $route); $routeKey = str_replace('.', '_', $route);
$elements = config(sprintf('intro.%s', $routeKey)); $elements = config(sprintf('intro.%s', $routeKey));
$steps = []; $steps = [];
if (\is_array($elements) && count($elements) > 0) { if (is_array($elements) && count($elements) > 0) {
foreach ($elements as $key => $options) { foreach ($elements as $key => $options) {
$currentStep = $options; $currentStep = $options;
@@ -188,7 +188,7 @@ trait GetConfigurationData
if ('' !== $specificPage) { if ('' !== $specificPage) {
$routeKey = str_replace('.', '_', $route); $routeKey = str_replace('.', '_', $route);
$elements = config(sprintf('intro.%s', $routeKey . '_' . $specificPage)); $elements = config(sprintf('intro.%s', $routeKey . '_' . $specificPage));
if (\is_array($elements) && count($elements) > 0) { if (is_array($elements) && count($elements) > 0) {
foreach ($elements as $key => $options) { foreach ($elements as $key => $options) {
$currentStep = $options; $currentStep = $options;

View File

@@ -144,7 +144,7 @@ trait RequestInformation
{ {
$triggers = []; $triggers = [];
$data = $request->get('triggers'); $data = $request->get('triggers');
if (\is_array($data)) { if (is_array($data)) {
foreach ($data as $index => $triggerInfo) { foreach ($data as $index => $triggerInfo) {
$triggers[] = [ $triggers[] = [
'type' => $triggerInfo['type'] ?? '', 'type' => $triggerInfo['type'] ?? '',

View File

@@ -96,7 +96,7 @@ trait RuleManagement
$index = 0; $index = 0;
$triggers = []; $triggers = [];
$oldInput = $request->old('actions'); $oldInput = $request->old('actions');
if (\is_array($oldInput)) { if (is_array($oldInput)) {
foreach ($oldInput as $oldAction) { foreach ($oldInput as $oldAction) {
try { try {
$triggers[] = view( $triggers[] = view(
@@ -129,7 +129,7 @@ trait RuleManagement
$index = 0; $index = 0;
$triggers = []; $triggers = [];
$oldInput = $request->old('triggers'); $oldInput = $request->old('triggers');
if (\is_array($oldInput)) { if (is_array($oldInput)) {
foreach ($oldInput as $oldTrigger) { foreach ($oldInput as $oldTrigger) {
try { try {
$triggers[] = view( $triggers[] = view(

View File

@@ -92,7 +92,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
{ {
$config = $this->importJob->configuration; $config = $this->importJob->configuration;
if (isset($data['mapping']) && \is_array($data['mapping'])) { if (isset($data['mapping']) && is_array($data['mapping'])) {
foreach ($data['mapping'] as $index => $array) { foreach ($data['mapping'] as $index => $array) {
$config['column-mapping-config'][$index] = []; $config['column-mapping-config'][$index] = [];
foreach ($array as $value => $mapId) { foreach ($array as $value => $mapId) {

View File

@@ -131,7 +131,7 @@ class ConfigureUploadHandler implements FileConfigurationInterface
{ {
$return = []; $return = [];
// check if specifics given are correct: // check if specifics given are correct:
if (isset($data['specifics']) && \is_array($data['specifics'])) { if (isset($data['specifics']) && is_array($data['specifics'])) {
foreach ($data['specifics'] as $name) { foreach ($data['specifics'] as $name) {
// verify their content. // verify their content.

View File

@@ -190,7 +190,7 @@ class Preferences
if (null !== $preference && null !== $preference->data) { if (null !== $preference && null !== $preference->data) {
$lastActivity = $preference->data; $lastActivity = $preference->data;
} }
if (\is_array($lastActivity)) { if (is_array($lastActivity)) {
$lastActivity = implode(',', $lastActivity); $lastActivity = implode(',', $lastActivity);
} }