mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 16:13:54 +00:00
Make a new abstract class for transformers.
This commit is contained in:
@@ -37,21 +37,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class CategoryTransformer
|
* Class CategoryTransformer
|
||||||
*/
|
*/
|
||||||
class CategoryTransformer extends TransformerAbstract
|
class CategoryTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CategoryTransformer constructor.
|
* CategoryTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -32,21 +32,16 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class CurrencyExchangeRateTransformer
|
* Class CurrencyExchangeRateTransformer
|
||||||
*/
|
*/
|
||||||
class CurrencyExchangeRateTransformer extends TransformerAbstract
|
class CurrencyExchangeRateTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PiggyBankEventTransformer constructor.
|
* PiggyBankEventTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -31,21 +31,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class CurrencyTransformer
|
* Class CurrencyTransformer
|
||||||
*/
|
*/
|
||||||
class CurrencyTransformer extends TransformerAbstract
|
class CurrencyTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CurrencyTransformer constructor.
|
* CurrencyTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -32,21 +32,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class ImportJobTransformer
|
* Class ImportJobTransformer
|
||||||
*/
|
*/
|
||||||
class ImportJobTransformer extends TransformerAbstract
|
class ImportJobTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PiggyBankTransformer constructor.
|
* PiggyBankTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -33,35 +33,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
*
|
*
|
||||||
* Class LinkTypeTransformer
|
* Class LinkTypeTransformer
|
||||||
*/
|
*/
|
||||||
class LinkTypeTransformer extends TransformerAbstract
|
class LinkTypeTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* List of resources possible to include
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $availableIncludes = [];
|
|
||||||
/**
|
|
||||||
* List of resources to automatically include
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $defaultIncludes = [];
|
|
||||||
|
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CurrencyTransformer constructor.
|
* CurrencyTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -34,21 +34,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class PiggyBankEventTransformer
|
* Class PiggyBankEventTransformer
|
||||||
*/
|
*/
|
||||||
class PiggyBankEventTransformer extends TransformerAbstract
|
class PiggyBankEventTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PiggyBankEventTransformer constructor.
|
* PiggyBankEventTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -32,19 +32,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class PreferenceTransformer
|
* Class PreferenceTransformer
|
||||||
*/
|
*/
|
||||||
class PreferenceTransformer extends TransformerAbstract
|
class PreferenceTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PreferenceTransformer constructor.
|
* PreferenceTransformer constructor.
|
||||||
*
|
*
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -44,23 +44,17 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
*
|
*
|
||||||
* Class RecurringTransactionTransformer
|
* Class RecurringTransactionTransformer
|
||||||
*/
|
*/
|
||||||
class RecurrenceTransformer extends TransformerAbstract
|
class RecurrenceTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/** @var RecurringRepositoryInterface */
|
/** @var RecurringRepositoryInterface */
|
||||||
protected $repository;
|
protected $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RecurrenceTransformer constructor.
|
* RecurrenceTransformer constructor.
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->repository = app(RecurringRepositoryInterface::class);
|
$this->repository = app(RecurringRepositoryInterface::class);
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -31,21 +31,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class RuleGroupTransformer
|
* Class RuleGroupTransformer
|
||||||
*/
|
*/
|
||||||
class RuleGroupTransformer extends TransformerAbstract
|
class RuleGroupTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CurrencyTransformer constructor.
|
* CurrencyTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -34,21 +34,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class RuleTransformer
|
* Class RuleTransformer
|
||||||
*/
|
*/
|
||||||
class RuleTransformer extends TransformerAbstract
|
class RuleTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CurrencyTransformer constructor.
|
* CurrencyTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -35,22 +35,15 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
/**
|
/**
|
||||||
* Class TagTransformer
|
* Class TagTransformer
|
||||||
*/
|
*/
|
||||||
class TagTransformer extends TransformerAbstract
|
class TagTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TagTransformer constructor.
|
* TagTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* JournalLinkTransformer.php
|
* TransactionLinkTransformer.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
*
|
*
|
||||||
* This file is part of Firefly III.
|
* This file is part of Firefly III.
|
||||||
@@ -32,23 +32,18 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Class JournalLinkTransformer
|
* Class TransactionLinkTransformer
|
||||||
*/
|
*/
|
||||||
class JournalLinkTransformer extends TransformerAbstract
|
class TransactionLinkTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CurrencyTransformer constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
@@ -26,33 +26,25 @@ namespace FireflyIII\Transformers;
|
|||||||
|
|
||||||
use FireflyIII\Models\Role;
|
use FireflyIII\Models\Role;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use League\Fractal\Resource\Collection as FractalCollection;
|
|
||||||
use League\Fractal\TransformerAbstract;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UserTransformer
|
* Class UserTransformer
|
||||||
*/
|
*/
|
||||||
class UserTransformer extends TransformerAbstract
|
class UserTransformer extends AbstractTransformer
|
||||||
{
|
{
|
||||||
/** @var ParameterBag */
|
|
||||||
protected $parameters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UserTransformer constructor.
|
* UserTransformer constructor.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
|
||||||
* @param ParameterBag $parameters
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ParameterBag $parameters)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parameters = $parameters;
|
|
||||||
if ('testing' === config('app.env')) {
|
if ('testing' === config('app.env')) {
|
||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform user.
|
* Transform user.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user