mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-10 22:52:10 +00:00
Fix phpstan issues.
This commit is contained in:
@@ -78,7 +78,7 @@ class ParseDateString
|
|||||||
*/
|
*/
|
||||||
public function parseDate(string $date): Carbon
|
public function parseDate(string $date): Carbon
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('parseDate("%s")', $date));
|
Log::debug(sprintf('parseDate("%s")', $date));
|
||||||
$date = strtolower($date);
|
$date = strtolower($date);
|
||||||
// parse keywords:
|
// parse keywords:
|
||||||
if (in_array($date, $this->keywords, true)) {
|
if (in_array($date, $this->keywords, true)) {
|
||||||
@@ -107,7 +107,7 @@ class ParseDateString
|
|||||||
|
|
||||||
// maybe a date range
|
// maybe a date range
|
||||||
if (10 === strlen($date) && (str_contains($date, 'xx') || str_contains($date, 'xxxx'))) {
|
if (10 === strlen($date) && (str_contains($date, 'xx') || str_contains($date, 'xxxx'))) {
|
||||||
app('log')->debug(sprintf('[c] Detected a date range ("%s"), return a fake date.', $date));
|
Log::debug(sprintf('[c] Detected a date range ("%s"), return a fake date.', $date));
|
||||||
|
|
||||||
// very lazy way to parse the date without parsing it, because this specific function
|
// very lazy way to parse the date without parsing it, because this specific function
|
||||||
// cant handle date ranges.
|
// cant handle date ranges.
|
||||||
@@ -158,7 +158,7 @@ class ParseDateString
|
|||||||
|
|
||||||
protected function parseRelativeDate(string $date): Carbon
|
protected function parseRelativeDate(string $date): Carbon
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('Now in parseRelativeDate("%s")', $date));
|
Log::debug(sprintf('Now in parseRelativeDate("%s")', $date));
|
||||||
$parts = explode(' ', $date);
|
$parts = explode(' ', $date);
|
||||||
$today = today(config('app.timezone'))->startOfDay();
|
$today = today(config('app.timezone'))->startOfDay();
|
||||||
$functions = [
|
$functions = [
|
||||||
@@ -179,14 +179,14 @@ class ParseDateString
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
app('log')->debug(sprintf('Now parsing part "%s"', $part));
|
Log::debug(sprintf('Now parsing part "%s"', $part));
|
||||||
$part = trim($part);
|
$part = trim($part);
|
||||||
|
|
||||||
// verify if correct
|
// verify if correct
|
||||||
$pattern = '/[+-]\d+[wqmdy]/';
|
$pattern = '/[+-]\d+[wqmdy]/';
|
||||||
$result = preg_match($pattern, $part);
|
$result = preg_match($pattern, $part);
|
||||||
if (0 === $result || false === $result) {
|
if (0 === $result) {
|
||||||
app('log')->error(sprintf('Part "%s" does not match regular expression. Will be skipped.', $part));
|
Log::error(sprintf('Part "%s" does not match regular expression. Will be skipped.', $part));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -194,14 +194,14 @@ class ParseDateString
|
|||||||
$period = $part[strlen($part) - 1];
|
$period = $part[strlen($part) - 1];
|
||||||
$number = (int) substr($part, 1, -1);
|
$number = (int) substr($part, 1, -1);
|
||||||
if (!array_key_exists($period, $functions[$direction])) {
|
if (!array_key_exists($period, $functions[$direction])) {
|
||||||
app('log')->error(sprintf('No method for direction %d and period "%s".', $direction, $period));
|
Log::error(sprintf('No method for direction %d and period "%s".', $direction, $period));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$func = $functions[$direction][$period];
|
$func = $functions[$direction][$period];
|
||||||
app('log')->debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
|
Log::debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
|
||||||
$today->{$func}($number); // @phpstan-ignore-line
|
$today->{$func}($number); // @phpstan-ignore-line
|
||||||
app('log')->debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
|
Log::debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $today;
|
return $today;
|
||||||
@@ -260,11 +260,11 @@ class ParseDateString
|
|||||||
$pattern = '/^xxxx-xx-(0[1-9]|[12]\d|3[01])$/';
|
$pattern = '/^xxxx-xx-(0[1-9]|[12]\d|3[01])$/';
|
||||||
$result = preg_match($pattern, $date);
|
$result = preg_match($pattern, $date);
|
||||||
if (0 !== $result) {
|
if (0 !== $result) {
|
||||||
app('log')->debug(sprintf('"%s" is a day range.', $date));
|
Log::debug(sprintf('"%s" is a day range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('"%s" is not a day range.', $date));
|
Log::debug(sprintf('"%s" is not a day range.', $date));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -287,11 +287,11 @@ class ParseDateString
|
|||||||
$pattern = '/^xxxx-(0[1-9]|1[012])-xx$/';
|
$pattern = '/^xxxx-(0[1-9]|1[012])-xx$/';
|
||||||
$result = preg_match($pattern, $date);
|
$result = preg_match($pattern, $date);
|
||||||
if (0 !== $result) {
|
if (0 !== $result) {
|
||||||
app('log')->debug(sprintf('"%s" is a month range.', $date));
|
Log::debug(sprintf('"%s" is a month range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('"%s" is not a month range.', $date));
|
Log::debug(sprintf('"%s" is not a month range.', $date));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ class ParseDateString
|
|||||||
*/
|
*/
|
||||||
protected function parseMonthRange(string $date): array
|
protected function parseMonthRange(string $date): array
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('parseMonthRange: Parsed "%s".', $date));
|
Log::debug(sprintf('parseMonthRange: Parsed "%s".', $date));
|
||||||
$parts = explode('-', $date);
|
$parts = explode('-', $date);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -315,11 +315,11 @@ class ParseDateString
|
|||||||
$pattern = '/^(19|20)\d\d-xx-xx$/';
|
$pattern = '/^(19|20)\d\d-xx-xx$/';
|
||||||
$result = preg_match($pattern, $date);
|
$result = preg_match($pattern, $date);
|
||||||
if (0 !== $result) {
|
if (0 !== $result) {
|
||||||
app('log')->debug(sprintf('"%s" is a year range.', $date));
|
Log::debug(sprintf('"%s" is a year range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('"%s" is not a year range.', $date));
|
Log::debug(sprintf('"%s" is not a year range.', $date));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -329,7 +329,7 @@ class ParseDateString
|
|||||||
*/
|
*/
|
||||||
protected function parseYearRange(string $date): array
|
protected function parseYearRange(string $date): array
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('parseYearRange: Parsed "%s"', $date));
|
Log::debug(sprintf('parseYearRange: Parsed "%s"', $date));
|
||||||
$parts = explode('-', $date);
|
$parts = explode('-', $date);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -343,11 +343,11 @@ class ParseDateString
|
|||||||
$pattern = '/^xxxx-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
|
$pattern = '/^xxxx-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
|
||||||
$result = preg_match($pattern, $date);
|
$result = preg_match($pattern, $date);
|
||||||
if (0 !== $result) {
|
if (0 !== $result) {
|
||||||
app('log')->debug(sprintf('"%s" is a month/day range.', $date));
|
Log::debug(sprintf('"%s" is a month/day range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('"%s" is not a month/day range.', $date));
|
Log::debug(sprintf('"%s" is not a month/day range.', $date));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ class ParseDateString
|
|||||||
*/
|
*/
|
||||||
private function parseMonthDayRange(string $date): array
|
private function parseMonthDayRange(string $date): array
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('parseMonthDayRange: Parsed "%s".', $date));
|
Log::debug(sprintf('parseMonthDayRange: Parsed "%s".', $date));
|
||||||
$parts = explode('-', $date);
|
$parts = explode('-', $date);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -372,11 +372,11 @@ class ParseDateString
|
|||||||
$pattern = '/^(19|20)\d\d-xx-(0[1-9]|[12]\d|3[01])$/';
|
$pattern = '/^(19|20)\d\d-xx-(0[1-9]|[12]\d|3[01])$/';
|
||||||
$result = preg_match($pattern, $date);
|
$result = preg_match($pattern, $date);
|
||||||
if (0 !== $result) {
|
if (0 !== $result) {
|
||||||
app('log')->debug(sprintf('"%s" is a day/year range.', $date));
|
Log::debug(sprintf('"%s" is a day/year range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('"%s" is not a day/year range.', $date));
|
Log::debug(sprintf('"%s" is not a day/year range.', $date));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ class ParseDateString
|
|||||||
*/
|
*/
|
||||||
private function parseDayYearRange(string $date): array
|
private function parseDayYearRange(string $date): array
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('parseDayYearRange: Parsed "%s".', $date));
|
Log::debug(sprintf('parseDayYearRange: Parsed "%s".', $date));
|
||||||
$parts = explode('-', $date);
|
$parts = explode('-', $date);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -401,11 +401,11 @@ class ParseDateString
|
|||||||
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-xx$/';
|
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-xx$/';
|
||||||
$result = preg_match($pattern, $date);
|
$result = preg_match($pattern, $date);
|
||||||
if (0 !== $result) {
|
if (0 !== $result) {
|
||||||
app('log')->debug(sprintf('"%s" is a month/year range.', $date));
|
Log::debug(sprintf('"%s" is a month/year range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('"%s" is not a month/year range.', $date));
|
Log::debug(sprintf('"%s" is not a month/year range.', $date));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -415,7 +415,7 @@ class ParseDateString
|
|||||||
*/
|
*/
|
||||||
protected function parseMonthYearRange(string $date): array
|
protected function parseMonthYearRange(string $date): array
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('parseMonthYearRange: Parsed "%s".', $date));
|
Log::debug(sprintf('parseMonthYearRange: Parsed "%s".', $date));
|
||||||
$parts = explode('-', $date);
|
$parts = explode('-', $date);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@@ -1,83 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GetFilterInstructions.php
|
|
||||||
* Copyright (c) 2024 james@firefly-iii.org.
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Support\Request;
|
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
|
||||||
|
|
||||||
trait GetFilterInstructions
|
|
||||||
{
|
|
||||||
private const string INVALID_FILTER = '%INVALID_JAMES_%';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
final public function getFilterInstructions(string $key): array
|
|
||||||
{
|
|
||||||
$config = config(sprintf('firefly.filters.allowed.%s', $key));
|
|
||||||
$allowed = array_keys($config);
|
|
||||||
$set = $this->get('filters', []);
|
|
||||||
$result = [];
|
|
||||||
if (0 === count($set)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
foreach ($set as $info) {
|
|
||||||
$column = $info['column'] ?? 'NOPE';
|
|
||||||
$filterValue = (string) ($info['filter'] ?? self::INVALID_FILTER);
|
|
||||||
if (false === in_array($column, $allowed, true)) {
|
|
||||||
// skip invalid column
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$filterType = $config[$column] ?? false;
|
|
||||||
|
|
||||||
switch ($filterType) {
|
|
||||||
default:
|
|
||||||
throw new FireflyException(sprintf('Do not support filter type "%s"', $filterType));
|
|
||||||
|
|
||||||
case 'boolean':
|
|
||||||
$filterValue = $this->booleanInstruction($filterValue);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'string':
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$result[$column] = $filterValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function booleanInstruction(string $filterValue): ?bool
|
|
||||||
{
|
|
||||||
if ('true' === $filterValue) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ('false' === $filterValue) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GetSortInstructions.php
|
|
||||||
* Copyright (c) 2024 james@firefly-iii.org.
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Support\Request;
|
|
||||||
|
|
||||||
trait GetSortInstructions
|
|
||||||
{
|
|
||||||
final public function getSortInstructions(string $key): array
|
|
||||||
{
|
|
||||||
$allowed = config(sprintf('firefly.sorting.allowed.%s', $key));
|
|
||||||
$set = $this->get('sorting', []);
|
|
||||||
$result = [];
|
|
||||||
if (0 === count($set)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
foreach ($set as $info) {
|
|
||||||
$column = $info['column'] ?? 'NOPE';
|
|
||||||
$direction = $info['direction'] ?? 'NOPE';
|
|
||||||
if ('asc' !== $direction && 'desc' !== $direction) {
|
|
||||||
// skip invalid direction
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (false === in_array($column, $allowed, true)) {
|
|
||||||
// skip invalid column
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$result[$column] = $direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -27,8 +27,8 @@ namespace FireflyIII\Support\Request;
|
|||||||
|
|
||||||
use FireflyIII\Enums\WebhookTrigger;
|
use FireflyIII\Enums\WebhookTrigger;
|
||||||
use FireflyIII\Models\Webhook;
|
use FireflyIII\Models\Webhook;
|
||||||
use Illuminate\Contracts\Validation\Validator;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
trait ValidatesWebhooks
|
trait ValidatesWebhooks
|
||||||
{
|
{
|
||||||
@@ -37,7 +37,7 @@ trait ValidatesWebhooks
|
|||||||
$validator->after(
|
$validator->after(
|
||||||
function (Validator $validator): void {
|
function (Validator $validator): void {
|
||||||
Log::debug('Validating webhook');
|
Log::debug('Validating webhook');
|
||||||
if ($validator->failed()) {
|
if (count($validator->failed()) > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$data = $validator->getData();
|
$data = $validator->getData();
|
||||||
|
@@ -181,8 +181,14 @@ class General extends AbstractExtension
|
|||||||
return new TwigFilter(
|
return new TwigFilter(
|
||||||
'phphost',
|
'phphost',
|
||||||
static function (string $string): string {
|
static function (string $string): string {
|
||||||
$proto = (string)parse_url($string, PHP_URL_SCHEME);
|
$proto = parse_url($string, PHP_URL_SCHEME);
|
||||||
$host = (string)parse_url($string, PHP_URL_HOST);
|
$host = parse_url($string, PHP_URL_HOST);
|
||||||
|
if(is_array($host)) {
|
||||||
|
$host = join(' ', $host);
|
||||||
|
}
|
||||||
|
if(is_array($proto)) {
|
||||||
|
$proto = join(' ', $proto);
|
||||||
|
}
|
||||||
|
|
||||||
return e(sprintf('%s://%s', $proto, $host));
|
return e(sprintf('%s://%s', $proto, $host));
|
||||||
}
|
}
|
||||||
|
@@ -176,18 +176,6 @@ class AccountTransformer extends AbstractTransformer
|
|||||||
return $accountRole;
|
return $accountRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO duplicated in the V2 transformer.
|
|
||||||
*/
|
|
||||||
private function getDate(): Carbon
|
|
||||||
{
|
|
||||||
if (null !== $this->parameters->get('date')) {
|
|
||||||
return $this->parameters->get('date');
|
|
||||||
}
|
|
||||||
|
|
||||||
return today(config('app.timezone'));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getCCInfo(Account $account, ?string $accountRole, string $accountType): array
|
private function getCCInfo(Account $account, ?string $accountRole, string $accountType): array
|
||||||
{
|
{
|
||||||
$monthlyPaymentDate = null;
|
$monthlyPaymentDate = null;
|
||||||
|
@@ -108,19 +108,5 @@ class PiggyBankTransformer extends AbstractTransformer
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderAccounts(PiggyBank $piggyBank): array
|
|
||||||
{
|
|
||||||
$return = [];
|
|
||||||
foreach ($piggyBank->accounts()->get() as $account) {
|
|
||||||
$return[] = [
|
|
||||||
'id' => (string)$account->id,
|
|
||||||
'name' => $account->name,
|
|
||||||
'current_amount' => (string)$account->pivot->current_amount,
|
|
||||||
'pc_current_amount' => (string)$account->pivot->native_current_amount,
|
|
||||||
// TODO add balance, add left to save.
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -54,9 +54,6 @@ class WebhookTransformer extends AbstractTransformer
|
|||||||
'triggers' => $webhook->meta['triggers'],
|
'triggers' => $webhook->meta['triggers'],
|
||||||
'deliveries' => $webhook->meta['deliveries'],
|
'deliveries' => $webhook->meta['deliveries'],
|
||||||
'responses' => $webhook->meta['responses'],
|
'responses' => $webhook->meta['responses'],
|
||||||
// 'trigger' => $this->getEnum('trigger', $webhook->trigger),
|
|
||||||
// 'response' => $this->getEnum('response', $webhook->response),
|
|
||||||
// 'delivery' => $this->getEnum('delivery', $webhook->delivery),
|
|
||||||
'url' => $webhook->url,
|
'url' => $webhook->url,
|
||||||
'links' => [
|
'links' => [
|
||||||
[
|
[
|
||||||
@@ -66,16 +63,4 @@ class WebhookTransformer extends AbstractTransformer
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getEnum(string $type, int $value): string
|
|
||||||
{
|
|
||||||
if ('trigger' === $type) {
|
|
||||||
return WebhookTrigger::from($value)->name;
|
|
||||||
}
|
|
||||||
if ('response' === $type) {
|
|
||||||
return WebhookResponse::from($value)->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WebhookDelivery::from($value)->name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Validation\Api\Data\Bulk;
|
namespace FireflyIII\Validation\Api\Data\Bulk;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
|
|
||||||
use function Safe\json_decode;
|
use function Safe\json_decode;
|
||||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Validation\AutoBudget;
|
namespace FireflyIII\Validation\AutoBudget;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trait ValidatesAutoBudgetRequest
|
* Trait ValidatesAutoBudgetRequest
|
||||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Validation;
|
namespace FireflyIII\Validation;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -118,7 +118,7 @@ class FireflyValidator extends Validator
|
|||||||
}
|
}
|
||||||
$regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i';
|
$regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i';
|
||||||
$result = preg_match($regex, $value);
|
$result = preg_match($regex, $value);
|
||||||
if (false === $result || 0 === $result) {
|
if (0 === $result) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ class FireflyValidator extends Validator
|
|||||||
$value = strtoupper($value);
|
$value = strtoupper($value);
|
||||||
|
|
||||||
// replace characters outside of ASCI range.
|
// replace characters outside of ASCI range.
|
||||||
$value = (string) iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value);
|
$value = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value);
|
||||||
$search = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
|
$search = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
|
||||||
$replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35'];
|
$replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35'];
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Validation;
|
namespace FireflyIII\Validation;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionGroup;
|
use FireflyIII\Models\TransactionGroup;
|
||||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Validation;
|
namespace FireflyIII\Validation;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Recurrence;
|
use FireflyIII\Models\Recurrence;
|
||||||
use FireflyIII\Models\RecurrenceTransaction;
|
use FireflyIII\Models\RecurrenceTransaction;
|
||||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Validation;
|
namespace FireflyIII\Validation;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
use FireflyIII\Enums\AccountTypeEnum;
|
use FireflyIII\Enums\AccountTypeEnum;
|
||||||
use FireflyIII\Enums\TransactionTypeEnum;
|
use FireflyIII\Enums\TransactionTypeEnum;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -296,7 +296,7 @@ trait TransactionValidation
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bool) $this->isAsset($account);
|
return $this->isAsset($account);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isLiability(Account $account): bool
|
private function isLiability(Account $account): bool
|
||||||
|
@@ -25,6 +25,7 @@ use Illuminate\Foundation\Application;
|
|||||||
use Illuminate\Contracts\Http\Kernel;
|
use Illuminate\Contracts\Http\Kernel;
|
||||||
use Illuminate\Contracts\Debug\ExceptionHandler;
|
use Illuminate\Contracts\Debug\ExceptionHandler;
|
||||||
use FireflyIII\Exceptions\Handler;
|
use FireflyIII\Exceptions\Handler;
|
||||||
|
use function Safe\realpath;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use function Safe\parse_url;
|
||||||
|
|
||||||
$databaseUrl = getenv('DATABASE_URL');
|
$databaseUrl = getenv('DATABASE_URL');
|
||||||
$host = '';
|
$host = '';
|
||||||
$username = '';
|
$username = '';
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
use function Safe\parse_url;
|
||||||
return [
|
return [
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
use function Safe\realpath;
|
||||||
$paths = [realpath(base_path('resources/views'))];
|
$paths = [realpath(base_path('resources/views'))];
|
||||||
if ('v2' === env('FIREFLY_III_LAYOUT')) {
|
if ('v2' === env('FIREFLY_III_LAYOUT')) {
|
||||||
$paths = [
|
$paths = [
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
use function Safe\define;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use function Safe\define;
|
||||||
|
|
||||||
if (!defined('DATEFORMAT')) {
|
if (!defined('DATEFORMAT')) {
|
||||||
define('DATEFORMAT', '(19|20)[0-9]{2}-?[0-9]{2}-?[0-9]{2}');
|
define('DATEFORMAT', '(19|20)[0-9]{2}-?[0-9]{2}-?[0-9]{2}');
|
||||||
|
Reference in New Issue
Block a user