mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Use PSR-12 code style
This commit is contained in:
@@ -33,7 +33,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class AccountList implements BinderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param Route $route
|
||||
@@ -45,7 +44,7 @@ class AccountList implements BinderInterface
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$collection = new Collection;
|
||||
$collection = new Collection();
|
||||
if ('allAssetAccounts' === $value) {
|
||||
/** @var Collection $collection */
|
||||
$collection = auth()->user()->accounts()
|
||||
@@ -70,6 +69,6 @@ class AccountList implements BinderInterface
|
||||
}
|
||||
}
|
||||
Log::error(sprintf('Trying to show account list (%s), but user is not logged in or list is empty.', $route->uri));
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,6 @@ class BudgetList implements BinderInterface
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
if (auth()->check()) {
|
||||
|
||||
if ('allBudgets' === $value) {
|
||||
return auth()->user()->budgets()->where('active', true)
|
||||
->orderBy('order', 'ASC')
|
||||
@@ -57,7 +56,7 @@ class BudgetList implements BinderInterface
|
||||
|
||||
if (empty($list)) {
|
||||
Log::warning('Budget list count is zero, return 404.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
|
||||
@@ -69,15 +68,14 @@ class BudgetList implements BinderInterface
|
||||
|
||||
// add empty budget if applicable.
|
||||
if (in_array(0, $list, true)) {
|
||||
$collection->push(new Budget);
|
||||
$collection->push(new Budget());
|
||||
}
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
Log::warning('BudgetList fallback to 404.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class CLIToken implements BinderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param Route $route
|
||||
@@ -62,6 +61,6 @@ class CLIToken implements BinderInterface
|
||||
}
|
||||
}
|
||||
Log::error(sprintf('Recognized no users by access token "%s"', $value));
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ class CategoryList implements BinderInterface
|
||||
|
||||
$list = array_unique(array_map('\intval', explode(',', $value)));
|
||||
if (empty($list)) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
/** @var Collection $collection */
|
||||
@@ -61,13 +61,13 @@ class CategoryList implements BinderInterface
|
||||
|
||||
// add empty category if applicable.
|
||||
if (in_array(0, $list, true)) {
|
||||
$collection->push(new Category);
|
||||
$collection->push(new Category());
|
||||
}
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -46,6 +46,6 @@ class CurrencyCode implements BinderInterface
|
||||
return $currency;
|
||||
}
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ class Date implements BinderInterface
|
||||
$result = new Carbon($value);
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage()));
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@@ -31,7 +31,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class DynamicConfigKey
|
||||
{
|
||||
|
||||
public static array $accepted
|
||||
= [
|
||||
'configuration.is_demo_site',
|
||||
@@ -52,7 +51,6 @@ class DynamicConfigKey
|
||||
if (in_array($value, self::$accepted, true)) {
|
||||
return $value;
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -68,6 +68,6 @@ class EitherConfigKey
|
||||
if (in_array($value, self::$static, true) || in_array($value, DynamicConfigKey::$accepted, true)) {
|
||||
return $value;
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -53,12 +53,12 @@ class JournalList implements BinderInterface
|
||||
$collector->setJournalIds($list);
|
||||
$result = $collector->getExtractedJournals();
|
||||
if (empty($result)) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ class JournalList implements BinderInterface
|
||||
{
|
||||
$list = array_unique(array_map('\intval', explode(',', $value)));
|
||||
if (empty($list)) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
@@ -44,7 +44,6 @@ class TagList implements BinderInterface
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
if (auth()->check()) {
|
||||
|
||||
if ('allTags' === $value) {
|
||||
return auth()->user()->tags()
|
||||
->orderBy('tag', 'ASC')
|
||||
@@ -55,7 +54,7 @@ class TagList implements BinderInterface
|
||||
|
||||
if (empty($list)) {
|
||||
Log::error('Tag list is empty.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +81,6 @@ class TagList implements BinderInterface
|
||||
}
|
||||
}
|
||||
Log::error('TagList: user is not logged in.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -54,9 +54,9 @@ class TagOrId implements BinderInterface
|
||||
return $result;
|
||||
}
|
||||
Log::error('TagOrId: tag not found.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
Log::error('TagOrId: user is not logged in.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user