mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-30 10:47:06 -06:00
Add annotated methods.
This commit is contained in:
parent
7b41c5b301
commit
ac8776aea4
@ -71,7 +71,6 @@ class LinkTypeRequest extends Request
|
|||||||
'outward' => 'required|unique:link_types,outward|min:1|different:inward',
|
'outward' => 'required|unique:link_types,outward|min:1|different:inward',
|
||||||
'inward' => 'required|unique:link_types,inward|min:1|different:outward',
|
'inward' => 'required|unique:link_types,inward|min:1|different:outward',
|
||||||
];
|
];
|
||||||
// Rule::unique('users')->ignore($user->id),
|
|
||||||
|
|
||||||
|
|
||||||
switch ($this->method()) {
|
switch ($this->method()) {
|
||||||
|
@ -31,7 +31,7 @@ use Exception;
|
|||||||
use FireflyIII\Jobs\MailError;
|
use FireflyIII\Jobs\MailError;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException as LaravelValidationException;
|
||||||
use League\OAuth2\Server\Exception\OAuthServerException;
|
use League\OAuth2\Server\Exception\OAuthServerException;
|
||||||
use Request;
|
use Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
@ -54,7 +54,7 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
public function render($request, Exception $exception)
|
public function render($request, Exception $exception)
|
||||||
{
|
{
|
||||||
if ($exception instanceof ValidationException && $request->expectsJson()) {
|
if ($exception instanceof LaravelValidationException && $request->expectsJson()) {
|
||||||
// ignore it: controller will handle it.
|
// ignore it: controller will handle it.
|
||||||
return parent::render($request, $exception);
|
return parent::render($request, $exception);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ use Illuminate\Support\Collection;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Support.
|
* Class Support.
|
||||||
|
* @method Collection getExpenses()
|
||||||
|
* @method Collection getIncome()
|
||||||
*/
|
*/
|
||||||
class Support
|
class Support
|
||||||
{
|
{
|
||||||
|
@ -64,6 +64,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property string $transaction_journal_category_name
|
* @property string $transaction_journal_category_name
|
||||||
* @property int $bill_id
|
* @property int $bill_id
|
||||||
* @property string $bill_name
|
* @property string $bill_name
|
||||||
|
* @property string $bill_name_encrypted
|
||||||
* @property string $notes
|
* @property string $notes
|
||||||
* @property string $tags
|
* @property string $tags
|
||||||
* @property string $transaction_currency_symbol
|
* @property string $transaction_currency_symbol
|
||||||
@ -87,7 +88,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property string $after // used in audit reports.
|
* @property string $after // used in audit reports.
|
||||||
* @property int $opposing_id // ID of the opposing transaction, used in collector
|
* @property int $opposing_id // ID of the opposing transaction, used in collector
|
||||||
* @property bool $encrypted // is the journal encrypted
|
* @property bool $encrypted // is the journal encrypted
|
||||||
* @property $bill_name_encrypted
|
|
||||||
*/
|
*/
|
||||||
class Transaction extends Model
|
class Transaction extends Model
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,7 @@ use Session;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ExpandedForm.
|
* Class ExpandedForm.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class ExpandedForm
|
class ExpandedForm
|
||||||
{
|
{
|
||||||
|
@ -24,13 +24,20 @@ namespace FireflyIII\Support\Facades;
|
|||||||
|
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* Class Amount.
|
* Class Amount.
|
||||||
*
|
*
|
||||||
|
* @method string formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true)
|
||||||
|
* @method Collection getAllCurrencies()
|
||||||
|
* @method string getCurrencyCode()
|
||||||
|
* @method string getCurrencySymbol()
|
||||||
|
* @method TransactionCurrency getDefaultCurrency()
|
||||||
* @method TransactionCurrency getDefaultCurrencyByUser(User $user)
|
* @method TransactionCurrency getDefaultCurrencyByUser(User $user)
|
||||||
|
* @method array getJsConfig(array $config)
|
||||||
*/
|
*/
|
||||||
class Amount extends Facade
|
class Amount extends Facade
|
||||||
{
|
{
|
||||||
|
@ -22,11 +22,15 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Support\Facades;
|
namespace FireflyIII\Support\Facades;
|
||||||
|
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* Class ExpandedForm.
|
* Class ExpandedForm.
|
||||||
|
*
|
||||||
|
* @method array makeSelectList(Collection $set)
|
||||||
|
* @method array makeSelectListWithEmpty(Collection $set)
|
||||||
*/
|
*/
|
||||||
class ExpandedForm extends Facade
|
class ExpandedForm extends Facade
|
||||||
{
|
{
|
||||||
|
@ -22,14 +22,28 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Support\Facades;
|
namespace FireflyIII\Support\Facades;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* Class Navigation.
|
* Class Navigation.
|
||||||
*
|
*
|
||||||
* @method array blockPeriods(\Carbon\Carbon $start, \Carbon\Carbon $end, string $range)
|
* @method Carbon addPeriod(Carbon $theDate, string $repeatFreq, int $skip)
|
||||||
* @method string periodShow(\Carbon\Carbon $theDate, string $repeatFrequency)
|
* @method array blockPeriods(Carbon $start, Carbon $end, string $range)
|
||||||
|
* @method Carbon endOfPeriod(Carbon $end, string $repeatFreq)
|
||||||
|
* @method Carbon endOfX(Carbon $theCurrentEnd, string $repeatFreq, Carbon $maxDate = null)
|
||||||
|
* @method array listOfPeriods(Carbon $start, Carbon $end)
|
||||||
|
* @method string periodShow(Carbon $theDate, string $repeatFrequency)
|
||||||
|
* @method string preferredCarbonFormat(Carbon $start, Carbon $end)
|
||||||
|
* @method string preferredCarbonLocalizedFormat(Carbon $start, Carbon $end)
|
||||||
|
* @method string preferredEndOfPeriod(Carbon $start, Carbon $end)
|
||||||
|
* @method string preferredRangeFormat(Carbon $start, Carbon $end)
|
||||||
|
* @method string preferredSqlFormat(Carbon $start, Carbon $end)
|
||||||
|
* @method Carbon startOfPeriod(Carbon $theDate, string $repeatFreq)
|
||||||
|
* @method Carbon subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = 1)
|
||||||
|
* @method Carbon updateEndDate(string $range, Carbon $start)
|
||||||
|
* @method Carbon updateStartDate(string $range, Carbon $start)
|
||||||
*/
|
*/
|
||||||
class Navigation extends Facade
|
class Navigation extends Facade
|
||||||
{
|
{
|
||||||
|
@ -24,16 +24,23 @@ namespace FireflyIII\Support\Facades;
|
|||||||
|
|
||||||
use FireflyIII\Models\Preference;
|
use FireflyIII\Models\Preference;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* Class Preferences.
|
* Class Preferences.
|
||||||
*
|
*
|
||||||
* @method Preference set(string $name, $value)
|
* @method Collection beginsWith(User $user, string $search)
|
||||||
|
* @method bool delete(string $name)
|
||||||
|
* @method Collection findByName(string $name)
|
||||||
* @method Preference get(string $name, $value)
|
* @method Preference get(string $name, $value)
|
||||||
|
* @method array getArrayForUser(User $user, array $list)
|
||||||
* @method Preference|null getForUser(User $user, string $name, $default = null)
|
* @method Preference|null getForUser(User $user, string $name, $default = null)
|
||||||
|
* @method string lastActivity()
|
||||||
* @method void mark()
|
* @method void mark()
|
||||||
|
* @method Preference set(string $name, $value)
|
||||||
|
* @method Preference setForUser(User $user, string $name, $value)
|
||||||
*/
|
*/
|
||||||
class Preferences extends Facade
|
class Preferences extends Facade
|
||||||
{
|
{
|
||||||
|
@ -22,12 +22,26 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Support\Facades;
|
namespace FireflyIII\Support\Facades;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* Class Steam.
|
* Class Steam.
|
||||||
|
* @method string balance(Account $account, Carbon $date)
|
||||||
|
* @method string balanceIgnoreVirtual(Account $account, Carbon $date)
|
||||||
|
* @method array balanceInRange(Account $account, Carbon $start, Carbon $end)
|
||||||
|
* @method array balancesByAccounts(Collection $accounts, Carbon $date)
|
||||||
|
* @method decrypt(int $isEncrypted, string $value)
|
||||||
|
* @method array getLastActivities(array $accounts)
|
||||||
|
* @method string negative(string $amount)
|
||||||
|
* @method string|null opposite(string $amount = null)
|
||||||
|
* @method int phpBytes(string $string)
|
||||||
|
* @method tryDecrypt($value)
|
||||||
* @method string positive(string $amount)
|
* @method string positive(string $amount)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class Steam extends Facade
|
class Steam extends Facade
|
||||||
{
|
{
|
||||||
|
@ -505,9 +505,10 @@ class Navigation
|
|||||||
*
|
*
|
||||||
* @throws \FireflyIII\Exceptions\FireflyException
|
* @throws \FireflyIII\Exceptions\FireflyException
|
||||||
*/
|
*/
|
||||||
public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = 1): Carbon
|
public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = null): Carbon
|
||||||
{
|
{
|
||||||
$date = clone $theDate;
|
$subtract = $subtract ?? 1;
|
||||||
|
$date = clone $theDate;
|
||||||
// 1D 1W 1M 3M 6M 1Y
|
// 1D 1W 1M 3M 6M 1Y
|
||||||
Log::debug(sprintf('subtractPeriod: date is %s, repeat frequency is %s and subtract is %d', $date->format('Y-m-d'), $repeatFreq, $subtract));
|
Log::debug(sprintf('subtractPeriod: date is %s, repeat frequency is %s and subtract is %d', $date->format('Y-m-d'), $repeatFreq, $subtract));
|
||||||
$functionMap = [
|
$functionMap = [
|
||||||
|
@ -302,11 +302,11 @@ class Steam
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $string
|
* @param string $string
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function phpBytes($string): int
|
public function phpBytes(string $string): int
|
||||||
{
|
{
|
||||||
$string = strtolower($string);
|
$string = strtolower($string);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ trait TransactionValidation
|
|||||||
}
|
}
|
||||||
|
|
||||||
// no valid descriptions and empty journal description? error.
|
// no valid descriptions and empty journal description? error.
|
||||||
if ($validDescriptions === 0 && '' === $journalDescription) {
|
if (0 === $validDescriptions && '' === $journalDescription) {
|
||||||
$validator->errors()->add('description', (string)trans('validation.filled', ['attribute' => (string)trans('validation.attributes.description')]));
|
$validator->errors()->add('description', (string)trans('validation.filled', ['attribute' => (string)trans('validation.attributes.description')]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ trait TransactionValidation
|
|||||||
$data = $validator->getData();
|
$data = $validator->getData();
|
||||||
$transactions = $data['transactions'] ?? [];
|
$transactions = $data['transactions'] ?? [];
|
||||||
// need at least one transaction
|
// need at least one transaction
|
||||||
if (\count($transactions) === 0) {
|
if (0 === \count($transactions)) {
|
||||||
$validator->errors()->add('description', (string)trans('validation.at_least_one_transaction'));
|
$validator->errors()->add('description', (string)trans('validation.at_least_one_transaction'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ trait TransactionValidation
|
|||||||
$repository->setUser($admin);
|
$repository->setUser($admin);
|
||||||
$set = $repository->getAccountsById([$accountId]);
|
$set = $repository->getAccountsById([$accountId]);
|
||||||
Log::debug(sprintf('Count of accounts found by ID %d is: %d', $accountId, $set->count()));
|
Log::debug(sprintf('Count of accounts found by ID %d is: %d', $accountId, $set->count()));
|
||||||
if ($set->count() === 1) {
|
if (1 === $set->count()) {
|
||||||
/** @var Account $first */
|
/** @var Account $first */
|
||||||
$first = $set->first();
|
$first = $set->first();
|
||||||
if ($first->accountType->type !== AccountType::ASSET) {
|
if ($first->accountType->type !== AccountType::ASSET) {
|
||||||
|
Loading…
Reference in New Issue
Block a user