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
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
20 changed files with 34 additions and 34 deletions

View File

@ -196,7 +196,7 @@ class AttachmentHelper implements AttachmentHelperInterface
return false; // @codeCoverageIgnore
}
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.');
/** @var UploadedFile $entry */
foreach ($files as $entry) {
@ -206,7 +206,7 @@ class AttachmentHelper implements AttachmentHelperInterface
}
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.');
}

View File

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

View File

@ -105,7 +105,7 @@ class PreferencesController extends Controller
{
// front page accounts
$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) {
$frontPageAccounts[] = (int)$id;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -147,7 +147,7 @@ class AbnAmroDescription implements SpecificInterface
// 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);
if (\is_array($matches)) {
if (is_array($matches)) {
foreach ($matches as $match) {
$key = $match[1];
$value = trim($match[2]);
@ -203,7 +203,7 @@ class AbnAmroDescription implements SpecificInterface
// Search for properties specified in the TRTP format. If no description
// is provided, use the type, name and reference as new description
if (\is_array($matches)) {
if (is_array($matches)) {
foreach ($matches as $match) {
$key = $match[1];
$value = trim($match[2]);

View File

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

View File

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

View File

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

View File

@ -67,7 +67,7 @@ class Account extends SpectreObject
$this->nature = $data['nature'];
$this->createdAt = new Carbon($data['created_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) {
$this->extra[$key] = $value;
}

View File

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

View File

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

View File

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

View File

@ -92,7 +92,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
{
$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) {
$config['column-mapping-config'][$index] = [];
foreach ($array as $value => $mapId) {

View File

@ -131,7 +131,7 @@ class ConfigureUploadHandler implements FileConfigurationInterface
{
$return = [];
// 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) {
// verify their content.

View File

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