Learned that I should not refer to env vars directly so I removed all references.

This commit is contained in:
James Cole
2018-12-15 07:59:02 +01:00
parent 4bd94e5450
commit c54541b839
116 changed files with 239 additions and 157 deletions

View File

@@ -38,6 +38,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
* Class Handler * Class Handler
*
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
@@ -92,7 +93,7 @@ class Handler extends ExceptionHandler
} }
if ($exception instanceof FireflyException || $exception instanceof ErrorException || $exception instanceof OAuthServerException) { if ($exception instanceof FireflyException || $exception instanceof ErrorException || $exception instanceof OAuthServerException) {
$isDebug = env('APP_DEBUG', false); $isDebug = config('app.debug');
return response()->view('errors.FireflyException', ['exception' => $exception, 'debug' => $isDebug], 500); return response()->view('errors.FireflyException', ['exception' => $exception, 'debug' => $isDebug], 500);
} }
@@ -116,7 +117,7 @@ class Handler extends ExceptionHandler
public function report(Exception $exception) public function report(Exception $exception)
{ {
$doMailError = env('SEND_ERROR_MESSAGE', true); $doMailError = config('firefly.send_error_message');
// if the user wants us to mail: // if the user wants us to mail:
if (true === $doMailError if (true === $doMailError
// and if is one of these error instances // and if is one of these error instances
@@ -145,7 +146,7 @@ class Handler extends ExceptionHandler
// create job that will mail. // create job that will mail.
$ipAddress = Request::ip() ?? '0.0.0.0'; $ipAddress = Request::ip() ?? '0.0.0.0';
$job = new MailError($userData, env('SITE_OWNER', ''), $ipAddress, $data); $job = new MailError($userData, (string)config('firefly.site_owner'), $ipAddress, $data);
dispatch($job); dispatch($job);
} }

View File

@@ -51,7 +51,7 @@ class AccountFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -39,7 +39,7 @@ class AccountMetaFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -38,7 +38,7 @@ class AttachmentFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -41,7 +41,7 @@ class BillFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -39,7 +39,7 @@ class BudgetFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -39,7 +39,7 @@ class CategoryFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -42,7 +42,7 @@ class PiggyBankEventFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -38,7 +38,7 @@ class PiggyBankFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -44,7 +44,7 @@ class RecurrenceFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -44,7 +44,7 @@ class TagFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -41,7 +41,7 @@ class TransactionCurrencyFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -50,7 +50,7 @@ class TransactionFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -46,7 +46,7 @@ class TransactionJournalFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -39,7 +39,7 @@ class TransactionJournalMetaFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -37,7 +37,7 @@ class TransactionTypeFactory
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -34,7 +34,7 @@ class ChartJsGenerator implements GeneratorInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -45,7 +45,7 @@ class AutomationHandler
*/ */
public function reportJournals(RequestedReportOnJournals $event): bool public function reportJournals(RequestedReportOnJournals $event): bool
{ {
$sendReport = envNonEmpty('SEND_REPORT_JOURNALS', true); $sendReport = config('firefly.send_report_journals');
if (false === $sendReport) { if (false === $sendReport) {
return true; // @codeCoverageIgnore return true; // @codeCoverageIgnore

View File

@@ -214,7 +214,7 @@ class UserEventHandler
*/ */
public function sendRegistrationMail(RegisteredUser $event): bool public function sendRegistrationMail(RegisteredUser $event): bool
{ {
$sendMail = env('SEND_REGISTRATION_MAIL', true); $sendMail = config('firefly.send_registration_mail');
if ($sendMail) { if ($sendMail) {
// get the email address // get the email address
$email = $event->user->email; $email = $event->user->email;

View File

@@ -65,7 +65,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$this->attachments = new Collection; $this->attachments = new Collection;
$this->uploadDisk = Storage::disk('upload'); $this->uploadDisk = Storage::disk('upload');
if ('testing' === env('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)));
} }
} }

View File

@@ -90,7 +90,7 @@ class MetaPieChart implements MetaPieChartInterface
$this->categories = new Collection; $this->categories = new Collection;
$this->tags = new Collection; $this->tags = new Collection;
if ('testing' === env('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)));
} }

View File

@@ -134,7 +134,7 @@ class TransactionCollector implements TransactionCollectorInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -40,7 +40,7 @@ class FiscalHelper implements FiscalHelperInterface
{ {
$this->useCustomFiscalYear = app('preferences')->get('customFiscalYear', false)->data; $this->useCustomFiscalYear = app('preferences')->get('customFiscalYear', false)->data;
if ('testing' === env('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)));
} }
} }

View File

@@ -45,7 +45,7 @@ class Help implements HelpInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -52,7 +52,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
{ {
$this->budgetRepository = $budgetRepository; $this->budgetRepository = $budgetRepository;
if ('testing' === env('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)));
} }

View File

@@ -48,7 +48,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface
{ {
$this->repository = $repository; $this->repository = $repository;
if ('testing' === env('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)));
} }

View File

@@ -53,7 +53,7 @@ class NetWorth implements NetWorthInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -43,7 +43,7 @@ class PopupReport implements PopupReportInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -53,7 +53,7 @@ class ReportHelper implements ReportHelperInterface
{ {
$this->budgetRepository = $budgetRepository; $this->budgetRepository = $budgetRepository;
if ('testing' === env('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)));
} }

View File

@@ -68,7 +68,7 @@ class ConfigurationController extends Controller
// they don't exist yet. // they don't exist yet.
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$siteOwner = env('SITE_OWNER'); $siteOwner = config('firefly.site_owner');
return view( return view(
'admin.configuration.index', 'admin.configuration.index',

View File

@@ -59,7 +59,8 @@ class ForgotPasswordController extends Controller
*/ */
public function sendResetLinkEmail(Request $request, UserRepositoryInterface $repository) public function sendResetLinkEmail(Request $request, UserRepositoryInterface $repository)
{ {
$loginProvider = envNonEmpty('LOGIN_PROVIDER','eloquent'); Log::info('Start of sendResetLinkEmail()');
$loginProvider = config('firefly.login_provider');
if ('eloquent' !== $loginProvider) { if ('eloquent' !== $loginProvider) {
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider); $message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
Log::error($message); Log::error($message);
@@ -98,7 +99,7 @@ class ForgotPasswordController extends Controller
*/ */
public function showLinkRequestForm() public function showLinkRequestForm()
{ {
$loginProvider = envNonEmpty('LOGIN_PROVIDER','eloquent'); $loginProvider = config('firefly.login_provider');
if ('eloquent' !== $loginProvider) { if ('eloquent' !== $loginProvider) {
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider); $message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);

View File

@@ -130,7 +130,7 @@ class LoginController extends Controller
public function showLoginForm(Request $request) public function showLoginForm(Request $request)
{ {
$count = DB::table('users')->count(); $count = DB::table('users')->count();
$loginProvider = envNonEmpty('LOGIN_PROVIDER', 'eloquent'); $loginProvider = config('firefly.login_provider');
$pageTitle = (string)trans('firefly.login_page_title'); $pageTitle = (string)trans('firefly.login_page_title');
if (0 === $count && 'eloquent' === $loginProvider) { if (0 === $count && 'eloquent' === $loginProvider) {
return redirect(route('register')); // @codeCoverageIgnore return redirect(route('register')); // @codeCoverageIgnore

View File

@@ -72,7 +72,7 @@ class RegisterController extends Controller
{ {
// is allowed to? // is allowed to?
$allowRegistration = true; $allowRegistration = true;
$loginProvider = envNonEmpty('LOGIN_PROVIDER', 'eloquent'); $loginProvider = config('firefly.login_provider');
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$userCount = User::count(); $userCount = User::count();
if (true === $singleUserMode && $userCount > 0 && 'eloquent' === $loginProvider) { if (true === $singleUserMode && $userCount > 0 && 'eloquent' === $loginProvider) {
@@ -113,7 +113,7 @@ class RegisterController extends Controller
public function showRegistrationForm(Request $request) public function showRegistrationForm(Request $request)
{ {
$allowRegistration = true; $allowRegistration = true;
$loginProvider = envNonEmpty('LOGIN_PROVIDER', 'eloquent'); $loginProvider = config('firefly.login_provider');
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$userCount = User::count(); $userCount = User::count();

View File

@@ -71,7 +71,7 @@ class ResetPasswordController extends Controller
*/ */
public function showResetForm(Request $request, $token = null) public function showResetForm(Request $request, $token = null)
{ {
$loginProvider = envNonEmpty('LOGIN_PROVIDER','eloquent'); $loginProvider = config('firefly.login_provider');
if ('eloquent' !== $loginProvider) { if ('eloquent' !== $loginProvider) {
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider); $message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
@@ -103,7 +103,7 @@ class ResetPasswordController extends Controller
*/ */
public function reset(Request $request) public function reset(Request $request)
{ {
$loginProvider = envNonEmpty('LOGIN_PROVIDER','eloquent'); $loginProvider = config('firefly.login_provider');
if ('eloquent' !== $loginProvider) { if ('eloquent' !== $loginProvider) {
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider); $message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);

View File

@@ -77,7 +77,7 @@ class TwoFactorController extends Controller
{ {
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
$siteOwner = env('SITE_OWNER', ''); $siteOwner = config('firefly.site_owner');
$title = (string)trans('firefly.two_factor_forgot_title'); $title = (string)trans('firefly.two_factor_forgot_title');
Log::info( Log::info(

View File

@@ -63,8 +63,8 @@ class Controller extends BaseController
// is site a demo site? // is site a demo site?
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
app('view')->share('IS_DEMO_SITE', $isDemoSite); app('view')->share('IS_DEMO_SITE', $isDemoSite);
app('view')->share('DEMO_USERNAME', env('DEMO_USERNAME', '')); app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
app('view')->share('DEMO_PASSWORD', env('DEMO_PASSWORD', '')); app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
app('view')->share('FF_VERSION', config('firefly.version')); app('view')->share('FF_VERSION', config('firefly.version'));
$this->middleware( $this->middleware(

View File

@@ -77,7 +77,7 @@ class CurrencyController extends Controller
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
$request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
} }
@@ -127,7 +127,7 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
@@ -160,7 +160,7 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
@@ -192,7 +192,7 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
@@ -236,7 +236,7 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
@@ -308,7 +308,7 @@ class CurrencyController extends Controller
$defaultCurrency = $this->repository->getCurrencyByPreference(app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR'))); $defaultCurrency = $this->repository->getCurrencyByPreference(app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR')));
$isOwner = true; $isOwner = true;
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
$request->session()->flash('info', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('info', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));
$isOwner = false; $isOwner = false;
} }
@@ -374,7 +374,7 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd

View File

@@ -128,19 +128,19 @@ class DebugController extends Controller
$drivers = implode(', ', DB::availableDrivers()); $drivers = implode(', ', DB::availableDrivers());
$currentDriver = DB::getDriverName(); $currentDriver = DB::getDriverName();
$userAgent = $request->header('user-agent'); $userAgent = $request->header('user-agent');
$isSandstorm = var_export(env('IS_SANDSTORM', 'unknown'), true); $isSandstorm = var_export(config('firefly.is_sandstorm'), true);
$isDocker = var_export(env('IS_DOCKER', 'unknown'), true); $isDocker = var_export(config('firefly.is_docker'), true);
$toSandbox = var_export(env('BUNQ_USE_SANDBOX', 'unknown'), true); $toSandbox = var_export(config('firefly.bunq_use_sandbox'), true);
$trustedProxies = env('TRUSTED_PROXIES', '(none)'); $trustedProxies = config('firefly.trusted_proxies');
$displayErrors = ini_get('display_errors'); $displayErrors = ini_get('display_errors');
$storageDisks = implode(', ', config('filesystems.disks.upload.disks')); $storageDisks = implode(', ', config('filesystems.disks.upload.disks'));
$errorReporting = $this->errorReporting((int)ini_get('error_reporting')); $errorReporting = $this->errorReporting((int)ini_get('error_reporting'));
$appEnv = env('APP_ENV', ''); $appEnv = config('app.env');
$appDebug = var_export(env('APP_DEBUG', false), true); $appDebug = var_export(config('app.debug'), true);
$logChannel = env('LOG_CHANNEL', ''); $logChannel = config('logging.default');
$appLogLevel = env('APP_LOG_LEVEL', 'info'); $appLogLevel = config('logging.level');
$cacheDriver = env('CACHE_DRIVER', 'unknown'); $cacheDriver = config('cache.default');
$loginProvider = env('LOGIN_PROVIDER', 'unknown'); $loginProvider = config('auth.driver');
// set languages, see what happens: // set languages, see what happens:
$original = setlocale(LC_ALL, 0); $original = setlocale(LC_ALL, 0);

View File

@@ -96,7 +96,7 @@ class SearchController extends Controller
if (!$cache->has()) { if (!$cache->has()) {
// parse search terms: // parse search terms:
$searcher->parseQuery($fullQuery); $searcher->parseQuery($fullQuery);
$searcher->setLimit((int)env('SEARCH_RESULT_LIMIT', 50)); $searcher->setLimit((int)config('firefly.search_result_limit'));
$transactions = $searcher->searchTransactions(); $transactions = $searcher->searchTransactions();
$cache->store($transactions); $cache->store($transactions);
} }

View File

@@ -54,7 +54,7 @@ class Installer
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ('testing' === env('APP_ENV')) { if ('testing' === config('app.env')) {
return $next($request); return $next($request);
} }
$url = $request->url(); $url = $request->url();

View File

@@ -107,7 +107,7 @@ class Range
*/ */
private function loseItAll(Request $request): void private function loseItAll(Request $request): void
{ {
if ('sqlite' === getenv('DB_CONNECTION') && true === getenv('IS_DOCKER')) { if ('sqlite' === config('database.default') && true === config('firefly.is_docker')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash( $request->session()->flash(
'error', 'You seem to be using SQLite in a Docker container. Don\'t do this. If the container restarts all your data will be gone.' 'error', 'You seem to be using SQLite in a Docker container. Don\'t do this. If the container restarts all your data will be gone.'

View File

@@ -44,7 +44,7 @@ class SecureHeaders
{ {
$response = $next($request); $response = $next($request);
$google = ''; $google = '';
$analyticsId = env('ANALYTICS_ID', ''); $analyticsId = config('firefly.analytics_id');
if ('' !== $analyticsId) { if ('' !== $analyticsId) {
$google = 'www.googletagmanager.com/gtag/js'; // @codeCoverageIgnore $google = 'www.googletagmanager.com/gtag/js'; // @codeCoverageIgnore
} }
@@ -76,7 +76,7 @@ class SecureHeaders
"payment 'none'", "payment 'none'",
]; ];
$disableFrameHeader = env('DISABLE_FRAME_HEADER'); $disableFrameHeader = config('firefly.disable_frame_header');
if (false === $disableFrameHeader || null === $disableFrameHeader) { if (false === $disableFrameHeader || null === $disableFrameHeader) {
$response->header('X-Frame-Options', 'deny'); $response->header('X-Frame-Options', 'deny');
} }

View File

@@ -43,7 +43,7 @@ class TrustProxies extends Middleware
*/ */
public function __construct(Repository $config) public function __construct(Repository $config)
{ {
$trustedProxies = (string)env('TRUSTED_PROXIES', null); $trustedProxies = (string)config('firefly.trusted_proxies');
$this->proxies = explode(',', $trustedProxies); $this->proxies = explode(',', $trustedProxies);
if ('**' === $trustedProxies) { if ('**' === $trustedProxies) {
$this->proxies = '**'; $this->proxies = '**';

View File

@@ -63,7 +63,7 @@ class TagFormRequest extends Request
'description' => $this->string('description'), 'description' => $this->string('description'),
'latitude' => $latitude, 'latitude' => $latitude,
'longitude' => $longitude, 'longitude' => $longitude,
'zoomLevel' => $zoomLevel, 'zoom_level' => $zoomLevel,
]; ];
return $data; return $data;
@@ -93,7 +93,7 @@ class TagFormRequest extends Request
'date' => 'date|nullable', 'date' => 'date|nullable',
'latitude' => 'numeric|min:-90|max:90|nullable', 'latitude' => 'numeric|min:-90|max:90|nullable',
'longitude' => 'numeric|min:-90|max:90|nullable', 'longitude' => 'numeric|min:-90|max:90|nullable',
'zoomLevel' => 'numeric|min:0|max:80|nullable', 'zoom_level' => 'numeric|min:0|max:80|nullable',
]; ];
} }
} }

View File

@@ -156,7 +156,7 @@ class BunqPrerequisites implements PrerequisitesInterface
*/ */
private function getBunqEnvironment(): BunqEnumApiEnvironmentType private function getBunqEnvironment(): BunqEnumApiEnvironmentType
{ {
$env = env('BUNQ_USE_SANDBOX'); $env = config('firefly.bunq_use_sandbox');
if (null === $env) { if (null === $env) {
return BunqEnumApiEnvironmentType::PRODUCTION(); return BunqEnumApiEnvironmentType::PRODUCTION();
} }

View File

@@ -337,7 +337,7 @@ class ImportArrayStorage
'description' => null, 'description' => null,
'latitude' => null, 'latitude' => null,
'longitude' => null, 'longitude' => null,
'zoomLevel' => null, 'zoom_level' => null,
'tagMode' => 'nothing', 'tagMode' => 'nothing',
]; ];
$tag = $repository->store($data); $tag = $repository->store($data);

View File

@@ -70,7 +70,7 @@ class MailError extends Job implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
$email = env('SITE_OWNER'); $email = config('firefly.site_owner');
$args = $this->exception; $args = $this->exception;
$args['loggedIn'] = $this->userData['id'] > 0; $args['loggedIn'] = $this->userData['id'] > 0;
$args['user'] = $this->userData; $args['user'] = $this->userData;

View File

@@ -58,6 +58,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property string $interest * @property string $interest
* @property string $interestPeriod * @property string $interestPeriod
* @property string accountTypeString * @property string accountTypeString
* @property Carbon created_at
* @property Carbon updated_at
* *
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/ */

View File

@@ -39,7 +39,7 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void public function boot(): void
{ {
Schema::defaultStringLength(191); Schema::defaultStringLength(191);
if ('heroku' === env('APP_ENV')) { if ('heroku' === config('app.env')) {
URL::forceScheme('https'); URL::forceScheme('https');
} }
} }

View File

@@ -45,7 +45,7 @@ class AccountTasker implements AccountTaskerInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -50,7 +50,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -53,7 +53,7 @@ class BillRepository implements BillRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -61,7 +61,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -52,7 +52,7 @@ class CategoryRepository implements CategoryRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -50,7 +50,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -44,7 +44,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -54,7 +54,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
$this->maxUploadSize = (int)config('firefly.maxUploadSize'); $this->maxUploadSize = (int)config('firefly.maxUploadSize');
$this->uploadDisk = Storage::disk('upload'); $this->uploadDisk = Storage::disk('upload');
if ('testing' === env('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)));
} }
} }

View File

@@ -61,7 +61,7 @@ class JournalRepository implements JournalRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -45,7 +45,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -49,7 +49,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -61,7 +61,7 @@ class RecurringRepository implements RecurringRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -46,7 +46,7 @@ class RuleRepository implements RuleRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -42,7 +42,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -49,7 +49,7 @@ class TagRepository implements TagRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }
@@ -373,7 +373,7 @@ class TagRepository implements TagRepositoryInterface
$tag->description = $data['description']; $tag->description = $data['description'];
$tag->latitude = $data['latitude']; $tag->latitude = $data['latitude'];
$tag->longitude = $data['longitude']; $tag->longitude = $data['longitude'];
$tag->zoomLevel = $data['zoomLevel']; $tag->zoomLevel = $data['zoom_level'];
$tag->save(); $tag->save();
return $tag; return $tag;

View File

@@ -41,7 +41,7 @@ class UserRepository implements UserRepositoryInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -44,7 +44,7 @@ class FixerIOv2 implements ExchangeRateInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }
@@ -70,7 +70,7 @@ class FixerIOv2 implements ExchangeRateInterface
$exchangeRate->created_at = new Carbon; $exchangeRate->created_at = new Carbon;
// get API key // get API key
$apiKey = env('FIXER_API_KEY', ''); $apiKey = config('firefly.fixer_api_key');
// if no API key, return unsaved exchange rate. // if no API key, return unsaved exchange rate.
if ('' === $apiKey) { if ('' === $apiKey) {

View File

@@ -39,7 +39,7 @@ class IpifyOrg implements IPRetrievalInterface
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -43,7 +43,7 @@ class AccountDestroyService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -37,7 +37,7 @@ class CategoryDestroyService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -37,7 +37,7 @@ class CurrencyDestroyService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -40,7 +40,7 @@ class JournalDestroyService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -39,7 +39,7 @@ class RecurrenceDestroyService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -39,7 +39,7 @@ class EncryptService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -38,7 +38,7 @@ class AccountUpdateService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -39,7 +39,7 @@ class BillUpdateService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -36,7 +36,7 @@ class CategoryUpdateService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -36,7 +36,7 @@ class CurrencyUpdateService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -43,7 +43,7 @@ class JournalUpdateService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -39,7 +39,7 @@ class TransactionUpdateService
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -38,7 +38,7 @@ class PwndVerifierV2 implements Verifier
*/ */
public function __construct() public function __construct()
{ {
if ('testing' === env('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)));
} }
} }

View File

@@ -76,7 +76,7 @@ class CacheProperties
*/ */
public function has(): bool public function has(): bool
{ {
if ('testing' === getenv('APP_ENV')) { if ('testing' === config('app.env')) {
return false; return false;
} }
$this->hash(); $this->hash();

View File

@@ -56,7 +56,7 @@ class Search implements SearchInterface
$this->modifiers = new Collection; $this->modifiers = new Collection;
$this->validModifiers = (array)config('firefly.search_modifiers'); $this->validModifiers = (array)config('firefly.search_modifiers');
if ('testing' === env('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)));
} }

View File

@@ -59,7 +59,6 @@ class General extends Twig_Extension
$this->getCurrencyCode(), $this->getCurrencyCode(),
$this->getCurrencySymbol(), $this->getCurrencySymbol(),
$this->phpdate(), $this->phpdate(),
$this->env(),
$this->activeRouteStrict(), $this->activeRouteStrict(),
$this->activeRoutePartial(), $this->activeRoutePartial(),
$this->activeRoutePartialWhat(), $this->activeRoutePartialWhat(),
@@ -158,19 +157,6 @@ class General extends Twig_Extension
); );
} }
/**
* @return Twig_SimpleFunction
*/
protected function env(): Twig_SimpleFunction
{
return new Twig_SimpleFunction(
'env',
function (string $name, string $default): string {
return env($name, $default);
}
);
}
/** /**
* @return Twig_SimpleFunction * @return Twig_SimpleFunction
*/ */

View File

@@ -27,6 +27,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\Attachment; use FireflyIII\Models\Attachment;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -51,6 +52,9 @@ class AttachmentTransformer extends TransformerAbstract
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
$this->repository = app(AttachmentRepositoryInterface::class); $this->repository = app(AttachmentRepositoryInterface::class);
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\AvailableBudget; use FireflyIII\Models\AvailableBudget;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -46,6 +47,9 @@ class AvailableBudgetTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -56,6 +56,9 @@ class BillTransformer extends TransformerAbstract
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
$this->repository = app(BillRepositoryInterface::class); $this->repository = app(BillRepositoryInterface::class);
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -25,6 +25,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\BudgetLimit;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -45,6 +46,9 @@ class BudgetLimitTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -28,6 +28,7 @@ use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -48,6 +49,9 @@ class BudgetTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -31,6 +31,7 @@ use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -51,6 +52,9 @@ class CategoryTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\CurrencyExchangeRate;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -46,6 +47,9 @@ class CurrencyExchangeRateTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -25,6 +25,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -45,6 +46,9 @@ class CurrencyTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\ImportJob; use FireflyIII\Models\ImportJob;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -46,6 +47,9 @@ class ImportJobTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }

View File

@@ -27,6 +27,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\Note; use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournalLink; use FireflyIII\Models\TransactionJournalLink;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -48,6 +49,9 @@ class JournalLinkTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -29,6 +29,7 @@ use FireflyIII\Models\TransactionJournalMeta;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use League\Fractal\Resource\Collection as FractalCollection; use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -49,6 +50,9 @@ class JournalMetaTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\LinkType; use FireflyIII\Models\LinkType;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -61,6 +62,9 @@ class LinkTypeTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -27,6 +27,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\Note; use FireflyIII\Models\Note;
use League\CommonMark\CommonMarkConverter; use League\CommonMark\CommonMarkConverter;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -60,6 +61,9 @@ class NoteTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -28,6 +28,7 @@ use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -48,6 +49,9 @@ class PiggyBankEventTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -30,29 +30,23 @@ use FireflyIII\Models\PiggyBank;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use League\Fractal\Resource\Collection as FractalCollection; use Log;
use League\Fractal\Resource\Item;
use League\Fractal\TransformerAbstract;
use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
* Class PiggyBankTransformer * Class PiggyBankTransformer
*/ */
class PiggyBankTransformer extends TransformerAbstract class PiggyBankTransformer 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')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\Preference; use FireflyIII\Models\Preference;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -44,6 +45,9 @@ class PreferenceTransformer extends TransformerAbstract
public function __construct(ParameterBag $parameters) public function __construct(ParameterBag $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -37,6 +37,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Log;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -60,6 +61,9 @@ class RecurrenceTransformer extends TransformerAbstract
{ {
$this->repository = app(RecurringRepositoryInterface::class); $this->repository = app(RecurringRepositoryInterface::class);
$this->parameters = $parameters; $this->parameters = $parameters;
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

Some files were not shown because too many files have changed in this diff Show More