mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup
This commit is contained in:
@@ -61,7 +61,7 @@ class HaveAccounts implements ConfigurationInterface
|
||||
$currency = $currencyRepository->findNull($currencyId);
|
||||
$dbAccounts[$id] = [
|
||||
'account' => $dbAccount,
|
||||
'currency' => null === $currency ? $defaultCurrency : $currency,
|
||||
'currency' => $currency ?? $defaultCurrency,
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -82,10 +82,10 @@ class Map implements ConfigurationInterface
|
||||
continue;
|
||||
}
|
||||
$value = trim($row[$index]);
|
||||
if (strlen($value) > 0) {
|
||||
if (\strlen($value) > 0) {
|
||||
// we can do some preprocessing here,
|
||||
// which is exclusively to fix the tags:
|
||||
if (null !== $this->data[$index]['preProcessMap'] && strlen($this->data[$index]['preProcessMap']) > 0) {
|
||||
if (null !== $this->data[$index]['preProcessMap'] && \strlen($this->data[$index]['preProcessMap']) > 0) {
|
||||
/** @var PreProcessorInterface $preProcessor */
|
||||
$preProcessor = app($this->data[$index]['preProcessMap']);
|
||||
$result = $preProcessor->run($value);
|
||||
@@ -107,7 +107,7 @@ class Map implements ConfigurationInterface
|
||||
$this->data[$index]['values'] = array_unique($this->data[$index]['values']);
|
||||
asort($this->data[$index]['values']);
|
||||
// if the count of this array is zero, there is nothing to map.
|
||||
if (count($this->data[$index]['values']) === 0) {
|
||||
if (\count($this->data[$index]['values']) === 0) {
|
||||
unset($this->data[$index]);
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ class Map implements ConfigurationInterface
|
||||
$specifics = $config['specifics'] ?? [];
|
||||
$names = array_keys($specifics);
|
||||
foreach ($names as $name) {
|
||||
if (!in_array($name, $this->validSpecifics)) {
|
||||
if (!\in_array($name, $this->validSpecifics)) {
|
||||
throw new FireflyException(sprintf('"%s" is not a valid class name', $name));
|
||||
}
|
||||
$class = config('csv.import_specifics.' . $name);
|
||||
@@ -309,7 +309,7 @@ class Map implements ConfigurationInterface
|
||||
{
|
||||
// is valid column?
|
||||
$validColumns = array_keys(config('csv.import_roles'));
|
||||
if (!in_array($column, $validColumns)) {
|
||||
if (!\in_array($column, $validColumns)) {
|
||||
throw new FireflyException(sprintf('"%s" is not a valid column.', $column));
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,7 @@ class Roles implements ConfigurationInterface
|
||||
foreach ($records as $row) {
|
||||
$row = array_values($row);
|
||||
$row = $this->processSpecifics($row);
|
||||
$count = count($row);
|
||||
$count = \count($row);
|
||||
$this->data['total'] = $count > $this->data['total'] ? $count : $this->data['total'];
|
||||
$this->processRow($row);
|
||||
}
|
||||
@@ -246,7 +246,7 @@ class Roles implements ConfigurationInterface
|
||||
if ('_ignore' !== $role) {
|
||||
++$assigned;
|
||||
}
|
||||
if (in_array($role, ['amount', 'amount_credit', 'amount_debit'])) {
|
||||
if (\in_array($role, ['amount', 'amount_credit', 'amount_debit'])) {
|
||||
$hasAmount = true;
|
||||
}
|
||||
if ($role === 'foreign-currency-code') {
|
||||
@@ -313,7 +313,7 @@ class Roles implements ConfigurationInterface
|
||||
{
|
||||
foreach ($row as $index => $value) {
|
||||
$value = trim($value);
|
||||
if (strlen($value) > 0) {
|
||||
if (\strlen($value) > 0) {
|
||||
$this->data['examples'][$index][] = $value;
|
||||
}
|
||||
}
|
||||
|
@@ -173,7 +173,7 @@ class UploadConfig implements ConfigurationInterface
|
||||
private function storeSpecifics(array $data, array $config): array
|
||||
{
|
||||
// loop specifics.
|
||||
if (isset($data['specifics']) && is_array($data['specifics'])) {
|
||||
if (isset($data['specifics']) && \is_array($data['specifics'])) {
|
||||
$names = array_keys($data['specifics']);
|
||||
foreach ($names as $name) {
|
||||
// verify their content.
|
||||
|
@@ -131,7 +131,6 @@ class BunqInformation implements InformationInterface
|
||||
$request->setSessionToken($sessionToken);
|
||||
$request->call();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,8 +138,7 @@ class BunqInformation implements InformationInterface
|
||||
* @param int $userId
|
||||
*
|
||||
* @return Collection
|
||||
*
|
||||
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getMonetaryAccounts(SessionToken $sessionToken, int $userId): Collection
|
||||
{
|
||||
@@ -191,8 +189,7 @@ class BunqInformation implements InformationInterface
|
||||
|
||||
/**
|
||||
* @return SessionToken
|
||||
*
|
||||
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function startSession(): SessionToken
|
||||
{
|
||||
|
Reference in New Issue
Block a user