mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-25 13:10:35 +00:00
Remove static references
This commit is contained in:
@@ -52,8 +52,8 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
// try get array from update server:
|
||||
$updateInfo = $this->contactServer($channel);
|
||||
if ('error' === $updateInfo['level']) {
|
||||
Log::error('Update information contains an error.');
|
||||
Log::error($updateInfo['message']);
|
||||
app('log')->error('Update information contains an error.');
|
||||
app('log')->error($updateInfo['message']);
|
||||
$information['message'] = $updateInfo['message'];
|
||||
|
||||
return $information;
|
||||
@@ -91,17 +91,17 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
];
|
||||
$res = $client->request('GET', $url, $options);
|
||||
} catch (GuzzleException $e) {
|
||||
Log::error('Ran into Guzzle error.');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
app('log')->error('Ran into Guzzle error.');
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$return['message'] = sprintf('Guzzle: %s', strip_tags($e->getMessage()));
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (200 !== $res->getStatusCode()) {
|
||||
Log::error(sprintf('Response status from server is %d.', $res->getStatusCode()));
|
||||
Log::error((string)$res->getBody());
|
||||
app('log')->error(sprintf('Response status from server is %d.', $res->getStatusCode()));
|
||||
app('log')->error((string)$res->getBody());
|
||||
$return['message'] = sprintf('Error: %d', $res->getStatusCode());
|
||||
|
||||
return $return;
|
||||
@@ -110,16 +110,16 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
try {
|
||||
$json = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
Log::error('Body is not valid JSON');
|
||||
Log::error($body);
|
||||
app('log')->error('Body is not valid JSON');
|
||||
app('log')->error($body);
|
||||
$return['message'] = 'Invalid JSON :(';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (!array_key_exists($channel, $json['firefly_iii'])) {
|
||||
Log::error(sprintf('No valid update channel "%s"', $channel));
|
||||
Log::error($body);
|
||||
app('log')->error(sprintf('No valid update channel "%s"', $channel));
|
||||
app('log')->error($body);
|
||||
$return['message'] = sprintf('Unknown update channel "%s" :(', $channel);
|
||||
}
|
||||
|
||||
|
||||
@@ -298,8 +298,8 @@ trait AccountServiceTrait
|
||||
try {
|
||||
$group = $factory->create($submission);
|
||||
} catch (DuplicateTransactionException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
@@ -543,8 +543,8 @@ trait AccountServiceTrait
|
||||
try {
|
||||
$group = $factory->create($submission);
|
||||
} catch (DuplicateTransactionException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
@@ -758,8 +758,8 @@ trait AccountServiceTrait
|
||||
try {
|
||||
$group = $factory->create($submission);
|
||||
} catch (DuplicateTransactionException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,8 +85,8 @@ class CreditRecalculateService
|
||||
try {
|
||||
$this->findByJournal($journal);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error($e->getTraceAsString());
|
||||
Log::error(sprintf('Could not find work account for transaction group #%d.', $this->group->id));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
app('log')->error(sprintf('Could not find work account for transaction group #%d.', $this->group->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ trait RecurringTransactionTrait
|
||||
try {
|
||||
$result = $factory->findOrCreate($accountName, $expectedType);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error($e->getMessage());
|
||||
app('log')->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ trait TransactionTypeTrait
|
||||
$factory = app(TransactionTypeFactory::class);
|
||||
$transactionType = $factory->find($type);
|
||||
if (null === $transactionType) {
|
||||
Log::error(sprintf('Could not find transaction type for "%s"', $type));
|
||||
app('log')->error(sprintf('Could not find transaction type for "%s"', $type));
|
||||
throw new FireflyException(sprintf('Could not find transaction type for "%s"', $type));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ class GroupUpdateService
|
||||
Log::debug('Array of updated IDs: ', $updated);
|
||||
|
||||
if (0 === count($updated)) {
|
||||
Log::error('There were no transactions updated or created. Will not delete anything.');
|
||||
app('log')->error('There were no transactions updated or created. Will not delete anything.');
|
||||
$transactionGroup->refresh();
|
||||
app('preferences')->mark();
|
||||
|
||||
@@ -197,7 +197,7 @@ class GroupUpdateService
|
||||
$updated[] = $newJournal->id;
|
||||
}
|
||||
if (null === $newJournal) {
|
||||
Log::error('createTransactionJournal returned NULL, indicating something went wrong.');
|
||||
app('log')->error('createTransactionJournal returned NULL, indicating something went wrong.');
|
||||
}
|
||||
}
|
||||
if (null !== $journal) {
|
||||
@@ -234,8 +234,8 @@ class GroupUpdateService
|
||||
try {
|
||||
$collection = $factory->create($submission);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
throw new FireflyException(
|
||||
sprintf('Could not create new transaction journal: %s', $e->getMessage()),
|
||||
0,
|
||||
|
||||
@@ -384,7 +384,7 @@ class JournalUpdateService
|
||||
try {
|
||||
$result = $this->getAccount($expectedType, 'source', $sourceInfo);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error(sprintf('Cant get the valid source account: %s', $e->getMessage()));
|
||||
app('log')->error(sprintf('Cant get the valid source account: %s', $e->getMessage()));
|
||||
|
||||
$result = $this->getOriginalSourceAccount();
|
||||
}
|
||||
@@ -404,7 +404,7 @@ class JournalUpdateService
|
||||
|
||||
// cowardly refuse to update if both accounts are the same.
|
||||
if ($source->id === $destination->id) {
|
||||
Log::error(sprintf('Source + dest accounts are equal (%d, "%s")', $source->id, $source->name));
|
||||
app('log')->error(sprintf('Source + dest accounts are equal (%d, "%s")', $source->id, $source->name));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -451,7 +451,7 @@ class JournalUpdateService
|
||||
try {
|
||||
$result = $this->getAccount($expectedType, 'destination', $destInfo);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error(sprintf('getValidDestinationAccount() threw unexpected error: %s', $e->getMessage()));
|
||||
app('log')->error(sprintf('getValidDestinationAccount() threw unexpected error: %s', $e->getMessage()));
|
||||
$result = $this->getOriginalDestinationAccount();
|
||||
}
|
||||
|
||||
@@ -766,7 +766,7 @@ class JournalUpdateService
|
||||
|
||||
// not the same as normal currency
|
||||
if (null !== $foreignCurrency && $foreignCurrency->id === $this->transactionJournal->transaction_currency_id) {
|
||||
Log::error(sprintf('Foreign currency is equal to normal currency (%s)', $foreignCurrency->code));
|
||||
app('log')->error(sprintf('Foreign currency is equal to normal currency (%s)', $foreignCurrency->code));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class PwndVerifierV2 implements Verifier
|
||||
$client = new Client();
|
||||
$res = $client->request('GET', $url, $opt);
|
||||
} catch (GuzzleException | RequestException $e) {
|
||||
Log::error(sprintf('Could not verify password security: %s', $e->getMessage()));
|
||||
app('log')->error(sprintf('Could not verify password security: %s', $e->getMessage()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ class StandardWebhookSender implements WebhookSenderInterface
|
||||
try {
|
||||
$signature = $signatureGenerator->generate($this->message);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error('Did not send message because of a Firefly III Exception.');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
app('log')->error('Did not send message because of a Firefly III Exception.');
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$attempt = new WebhookAttempt();
|
||||
$attempt->webhookMessage()->associate($this->message);
|
||||
$attempt->status_code = 0;
|
||||
@@ -82,9 +82,9 @@ class StandardWebhookSender implements WebhookSenderInterface
|
||||
try {
|
||||
$json = json_encode($this->message->message, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
Log::error('Did not send message because of a JSON error.');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
app('log')->error('Did not send message because of a JSON error.');
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$attempt = new WebhookAttempt();
|
||||
$attempt->webhookMessage()->associate($this->message);
|
||||
$attempt->status_code = 0;
|
||||
@@ -111,9 +111,9 @@ class StandardWebhookSender implements WebhookSenderInterface
|
||||
try {
|
||||
$res = $client->request('POST', $this->message->webhook->url, $options);
|
||||
} catch (RequestException | ConnectException $e) {
|
||||
Log::error('The webhook could NOT be submitted but Firefly III caught the error below.');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
app('log')->error('The webhook could NOT be submitted but Firefly III caught the error below.');
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
|
||||
|
||||
$logs = sprintf("%s\n%s", $e->getMessage(), $e->getTraceAsString());
|
||||
@@ -127,9 +127,9 @@ class StandardWebhookSender implements WebhookSenderInterface
|
||||
$attempt->status_code = 0;
|
||||
if (method_exists($e, 'hasResponse') && method_exists($e, 'getResponse')) {
|
||||
$attempt->status_code = $e->hasResponse() ? $e->getResponse()->getStatusCode() : 0;
|
||||
Log::error(sprintf('The status code of the error response is: %d', $attempt->status_code));
|
||||
app('log')->error(sprintf('The status code of the error response is: %d', $attempt->status_code));
|
||||
$body = (string)($e->hasResponse() ? $e->getResponse()->getBody() : '');
|
||||
Log::error(sprintf('The body of the error response is: %s', $body));
|
||||
app('log')->error(sprintf('The body of the error response is: %s', $body));
|
||||
}
|
||||
$attempt->logs = $logs;
|
||||
$attempt->save();
|
||||
|
||||
Reference in New Issue
Block a user