Remove static references

This commit is contained in:
James Cole
2023-10-29 06:32:00 +01:00
parent e65d0eef6e
commit 075d459b7c
128 changed files with 391 additions and 391 deletions

View File

@@ -100,9 +100,9 @@ abstract class Controller extends BaseController
try {
$date = request()->query->get($field);
} catch (BadRequestException $e) {
Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
$value = null;
}
$obj = null;
@@ -129,9 +129,9 @@ abstract class Controller extends BaseController
try {
$value = request()->query->get($integer);
} catch (BadRequestException $e) {
Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
$value = null;
}
if (null !== $value) {
@@ -159,9 +159,9 @@ abstract class Controller extends BaseController
try {
$param = (string)request()->query->get('sort');
} catch (BadRequestException $e) {
Log::error('Request field "sort" contains a non-scalar value. Value set to NULL.');
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error('Request field "sort" contains a non-scalar value. Value set to NULL.');
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
$param = '';
}
if ('' === $param) {

View File

@@ -107,7 +107,7 @@ class StoreController extends Controller
$helper = app(AttachmentHelperInterface::class);
$body = $request->getContent();
if ('' === $body) {
Log::error('Body of attachment is empty.');
app('log')->error('Body of attachment is empty.');
return response()->json([], 422);
}

View File

@@ -101,7 +101,7 @@ class StoreController extends Controller
throw new ValidationException($validator, 0, $e);
} catch (FireflyException $e) {
app('log')->warning('Caught an exception. Return error message.');
Log::error($e->getMessage());
app('log')->error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator, 0, $e);

View File

@@ -70,8 +70,8 @@ class ConfigurationController extends Controller
try {
$dynamicData = $this->getDynamicConfiguration();
} catch (FireflyException $e) {
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
throw new FireflyException('200030: Could not load config variables.', 0, $e);
}
$staticData = $this->getStaticConfiguration();

View File

@@ -55,7 +55,7 @@ class TransactionRequest extends FormRequest
];
} catch (JsonException $e) {
// dont really care. the validation should catch invalid json.
Log::error($e->getMessage());
app('log')->error($e->getMessage());
}
return $data;

View File

@@ -103,9 +103,9 @@ class Controller extends BaseController
try {
$date = request()->query->get($field);
} catch (BadRequestException $e) {
Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
}
if (null !== $date) {
try {
@@ -128,8 +128,8 @@ class Controller extends BaseController
try {
$value = request()->query->get($integer);
} catch (BadRequestException $e) {
Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
Log::error($e->getMessage());
app('log')->error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
app('log')->error($e->getMessage());
$value = null;
}
if (null !== $value) {