mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 03:43:07 +00:00
Code cleanup and documentation improvements.
This commit is contained in:
@@ -35,7 +35,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
|||||||
/**
|
/**
|
||||||
* Returns basic information about this installation.
|
* Returns basic information about this installation.
|
||||||
*
|
*
|
||||||
* Class AboutController
|
* Class AboutController.
|
||||||
*/
|
*/
|
||||||
class AboutController extends Controller
|
class AboutController extends Controller
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountController.php
|
* AccountController.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -41,14 +40,15 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AccountController
|
* Class AccountController.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class AccountController extends Controller
|
class AccountController extends Controller
|
||||||
{
|
{
|
||||||
/** @var CurrencyRepositoryInterface */
|
/** @var CurrencyRepositoryInterface The currency repository */
|
||||||
private $currencyRepository;
|
private $currencyRepository;
|
||||||
/** @var AccountRepositoryInterface */
|
/** @var AccountRepositoryInterface The account repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,6 +126,8 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show single instance.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
@@ -147,6 +149,8 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Store a new instance.
|
||||||
|
*
|
||||||
* @param AccountRequest $request
|
* @param AccountRequest $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
@@ -198,13 +202,15 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* All the available types.
|
||||||
|
*
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function mapTypes(string $type): array
|
private function mapTypes(string $type): array
|
||||||
{
|
{
|
||||||
$types = [
|
$types = [
|
||||||
'all' => [AccountType::DEFAULT, AccountType::CASH, AccountType::ASSET, AccountType::EXPENSE, AccountType::REVENUE,
|
'all' => [AccountType::DEFAULT, AccountType::CASH, AccountType::ASSET, AccountType::EXPENSE, AccountType::REVENUE,
|
||||||
AccountType::INITIAL_BALANCE, AccountType::BENEFICIARY, AccountType::IMPORT, AccountType::RECONCILIATION,
|
AccountType::INITIAL_BALANCE, AccountType::BENEFICIARY, AccountType::IMPORT, AccountType::RECONCILIATION,
|
||||||
AccountType::LOAN,],
|
AccountType::LOAN,],
|
||||||
@@ -226,10 +232,11 @@ class AccountController extends Controller
|
|||||||
AccountType::RECONCILIATION => [AccountType::RECONCILIATION],
|
AccountType::RECONCILIATION => [AccountType::RECONCILIATION],
|
||||||
AccountType::LOAN => [AccountType::LOAN],
|
AccountType::LOAN => [AccountType::LOAN],
|
||||||
];
|
];
|
||||||
|
$return = $types['all'];
|
||||||
if (isset($types[$type])) {
|
if (isset($types[$type])) {
|
||||||
return $types[$type];
|
$return = $types[$type];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $types['all']; // @codeCoverageIgnore
|
return $return; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -41,12 +41,13 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AttachmentController
|
* Class AttachmentController.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class AttachmentController extends Controller
|
class AttachmentController extends Controller
|
||||||
{
|
{
|
||||||
/** @var AttachmentRepositoryInterface */
|
/** @var AttachmentRepositoryInterface The attachment repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,6 +83,8 @@ class AttachmentController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Download an attachment.
|
||||||
|
*
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
@@ -212,6 +215,8 @@ class AttachmentController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Upload an attachment.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
|
@@ -40,14 +40,15 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AvailableBudgetController
|
* Class AvailableBudgetController.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class AvailableBudgetController extends Controller
|
class AvailableBudgetController extends Controller
|
||||||
{
|
{
|
||||||
/** @var CurrencyRepositoryInterface */
|
/** @var CurrencyRepositoryInterface The currency repository */
|
||||||
private $currencyRepository;
|
private $currencyRepository;
|
||||||
/** @var BudgetRepositoryInterface */
|
/** @var BudgetRepositoryInterface The budget repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -40,11 +40,11 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BillController
|
* Class BillController.
|
||||||
*/
|
*/
|
||||||
class BillController extends Controller
|
class BillController extends Controller
|
||||||
{
|
{
|
||||||
/** @var BillRepositoryInterface */
|
/** @var BillRepositoryInterface The bill repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,6 +107,8 @@ class BillController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show the specified bill.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
@@ -128,6 +130,8 @@ class BillController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Store a bill.
|
||||||
|
*
|
||||||
* @param BillRequest $request
|
* @param BillRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -151,6 +155,8 @@ class BillController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update a bill.
|
||||||
|
*
|
||||||
* @param BillRequest $request
|
* @param BillRequest $request
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
|
@@ -39,12 +39,13 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BudgetController
|
* Class BudgetController.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class BudgetController extends Controller
|
class BudgetController extends Controller
|
||||||
{
|
{
|
||||||
/** @var BudgetRepositoryInterface */
|
/** @var BudgetRepositoryInterface The budget repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,6 +117,8 @@ class BudgetController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show a budget.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
@@ -137,6 +140,8 @@ class BudgetController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Store a budget.
|
||||||
|
*
|
||||||
* @param BudgetRequest $request
|
* @param BudgetRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -159,6 +164,8 @@ class BudgetController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update a budget.
|
||||||
|
*
|
||||||
* @param BudgetRequest $request
|
* @param BudgetRequest $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
|
@@ -43,12 +43,13 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
|||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BudgetLimitController
|
* Class BudgetLimitController.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class BudgetLimitController extends Controller
|
class BudgetLimitController extends Controller
|
||||||
{
|
{
|
||||||
/** @var BudgetRepositoryInterface */
|
/** @var BudgetRepositoryInterface The budget repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -39,12 +39,13 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CategoryController
|
* Class CategoryController.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class CategoryController extends Controller
|
class CategoryController extends Controller
|
||||||
{
|
{
|
||||||
/** @var CategoryRepositoryInterface */
|
/** @var CategoryRepositoryInterface The category repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,6 +117,8 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show the category.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
@@ -137,6 +140,8 @@ class CategoryController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Store new category.
|
||||||
|
*
|
||||||
* @param CategoryRequest $request
|
* @param CategoryRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -159,6 +164,8 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update the category.
|
||||||
|
*
|
||||||
* @param CategoryRequest $request
|
* @param CategoryRequest $request
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
|
@@ -31,13 +31,13 @@ use Illuminate\Http\JsonResponse;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ConfigurationController
|
* Class ConfigurationController.
|
||||||
*/
|
*/
|
||||||
class ConfigurationController extends Controller
|
class ConfigurationController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/** @var UserRepositoryInterface */
|
/** @var UserRepositoryInterface The user repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,6 +63,8 @@ class ConfigurationController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show all configuration.
|
||||||
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function index(): JsonResponse
|
public function index(): JsonResponse
|
||||||
@@ -73,6 +75,8 @@ class ConfigurationController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update the configuration.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -104,6 +108,8 @@ class ConfigurationController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all config values.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
*/
|
*/
|
||||||
|
@@ -43,7 +43,7 @@ class Controller extends BaseController
|
|||||||
{
|
{
|
||||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||||
|
|
||||||
/** @var ParameterBag */
|
/** @var ParameterBag Parameters from the URI are stored here. */
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,6 +57,8 @@ class Controller extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Method to help build URI's.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
@@ -81,6 +83,8 @@ class Controller extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Method to grab all parameters from the URI.
|
||||||
|
*
|
||||||
* @return ParameterBag
|
* @return ParameterBag
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
*/
|
*/
|
||||||
|
@@ -41,14 +41,15 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CurrencyController
|
* Class CurrencyController.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class CurrencyController extends Controller
|
class CurrencyController extends Controller
|
||||||
{
|
{
|
||||||
/** @var CurrencyRepositoryInterface */
|
/** @var CurrencyRepositoryInterface The currency repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
/** @var UserRepositoryInterface */
|
/** @var UserRepositoryInterface The user repository */
|
||||||
private $userRepository;
|
private $userRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,6 +130,8 @@ class CurrencyController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show a currency.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
@@ -152,6 +155,8 @@ class CurrencyController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Store new currency.
|
||||||
|
*
|
||||||
* @param CurrencyRequest $request
|
* @param CurrencyRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -182,6 +187,8 @@ class CurrencyController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update a currency.
|
||||||
|
*
|
||||||
* @param CurrencyRequest $request
|
* @param CurrencyRequest $request
|
||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
|
@@ -36,12 +36,11 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Class CurrencyExchangeRateController
|
* Class CurrencyExchangeRateController
|
||||||
*/
|
*/
|
||||||
class CurrencyExchangeRateController extends Controller
|
class CurrencyExchangeRateController extends Controller
|
||||||
{
|
{
|
||||||
/** @var CurrencyRepositoryInterface */
|
/** @var CurrencyRepositoryInterface The currency repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,6 +64,8 @@ class CurrencyExchangeRateController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show an exchange rate.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
|
@@ -40,17 +40,20 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Class JournalLinkController.
|
||||||
*
|
*
|
||||||
* Class JournalLinkController
|
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class JournalLinkController extends Controller
|
class JournalLinkController extends Controller
|
||||||
{
|
{
|
||||||
/** @var JournalRepositoryInterface */
|
/** @var JournalRepositoryInterface The journal repository */
|
||||||
private $journalRepository;
|
private $journalRepository;
|
||||||
/** @var LinkTypeRepositoryInterface */
|
/** @var LinkTypeRepositoryInterface The link type repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JournalLinkController constructor.
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -180,6 +183,8 @@ class JournalLinkController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update object.
|
||||||
|
*
|
||||||
* @param JournalLinkRequest $request
|
* @param JournalLinkRequest $request
|
||||||
* @param TransactionJournalLink $journalLink
|
* @param TransactionJournalLink $journalLink
|
||||||
*
|
*
|
||||||
|
@@ -40,18 +40,21 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Class LinkTypeController.
|
||||||
*
|
*
|
||||||
* Class LinkTypeController
|
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class LinkTypeController extends Controller
|
class LinkTypeController extends Controller
|
||||||
{
|
{
|
||||||
/** @var LinkTypeRepositoryInterface */
|
/** @var LinkTypeRepositoryInterface The link type repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/** @var UserRepositoryInterface */
|
/** @var UserRepositoryInterface The user repository */
|
||||||
private $userRepository;
|
private $userRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LinkTypeController constructor.
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -172,6 +175,8 @@ class LinkTypeController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update object.
|
||||||
|
*
|
||||||
* @param LinkTypeRequest $request
|
* @param LinkTypeRequest $request
|
||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
*
|
*
|
||||||
|
@@ -39,16 +39,19 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO order up and down.
|
* Class PiggyBankController.
|
||||||
* Class PiggyBankController
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class PiggyBankController extends Controller
|
class PiggyBankController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var PiggyBankRepositoryInterface */
|
/** @var PiggyBankRepositoryInterface The piggy bank repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PiggyBankController constructor.
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -163,6 +166,8 @@ class PiggyBankController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update piggy bank.
|
||||||
|
*
|
||||||
* @param PiggyBankRequest $request
|
* @param PiggyBankRequest $request
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
|
@@ -102,6 +102,8 @@ class PreferenceController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update a preference.
|
||||||
|
*
|
||||||
* @param PreferenceRequest $request
|
* @param PreferenceRequest $request
|
||||||
* @param Preference $preference
|
* @param Preference $preference
|
||||||
*
|
*
|
||||||
|
@@ -38,14 +38,16 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Class RecurrenceController
|
* Class RecurrenceController
|
||||||
*/
|
*/
|
||||||
class RecurrenceController extends Controller
|
class RecurrenceController extends Controller
|
||||||
{
|
{
|
||||||
/** @var RecurringRepositoryInterface */
|
/** @var RecurringRepositoryInterface The recurring transaction repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RecurrenceController constructor.
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -155,6 +157,8 @@ class RecurrenceController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update single recurrence.
|
||||||
|
*
|
||||||
* @param RecurrenceRequest $request
|
* @param RecurrenceRequest $request
|
||||||
* @param Recurrence $recurrence
|
* @param Recurrence $recurrence
|
||||||
*
|
*
|
||||||
|
@@ -42,9 +42,12 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
|||||||
*/
|
*/
|
||||||
class RuleController extends Controller
|
class RuleController extends Controller
|
||||||
{
|
{
|
||||||
/** @var RuleRepositoryInterface */
|
/** @var RuleRepositoryInterface The rule repository */
|
||||||
private $ruleRepository;
|
private $ruleRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RuleController constructor.
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -153,6 +156,8 @@ class RuleController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update a rule.
|
||||||
|
*
|
||||||
* @param RuleRequest $request
|
* @param RuleRequest $request
|
||||||
* @param Rule $rule
|
* @param Rule $rule
|
||||||
*
|
*
|
||||||
|
@@ -38,11 +38,17 @@ use League\Fractal\Resource\Item;
|
|||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RuleGroupController
|
||||||
|
*/
|
||||||
class RuleGroupController extends Controller
|
class RuleGroupController extends Controller
|
||||||
{
|
{
|
||||||
/** @var RuleGroupRepositoryInterface */
|
/** @var RuleGroupRepositoryInterface The rule group repository */
|
||||||
private $ruleGroupRepository;
|
private $ruleGroupRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RuleGroupController constructor.
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -151,6 +157,8 @@ class RuleGroupController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update a rule group.
|
||||||
|
*
|
||||||
* @param RuleGroupRequest $request
|
* @param RuleGroupRequest $request
|
||||||
* @param RuleGroup $ruleGroup
|
* @param RuleGroup $ruleGroup
|
||||||
*
|
*
|
||||||
|
@@ -50,7 +50,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
|||||||
class TransactionController extends Controller
|
class TransactionController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var JournalRepositoryInterface */
|
/** @var JournalRepositoryInterface The journal repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,6 +89,8 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show all transactions.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -133,6 +135,8 @@ class TransactionController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show a single transaction.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Transaction $transaction
|
* @param Transaction $transaction
|
||||||
* @param string $include
|
* @param string $include
|
||||||
@@ -173,6 +177,8 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Store a new transaction.
|
||||||
|
*
|
||||||
* @param TransactionRequest $request
|
* @param TransactionRequest $request
|
||||||
*
|
*
|
||||||
* @param JournalRepositoryInterface $repository
|
* @param JournalRepositoryInterface $repository
|
||||||
@@ -218,6 +224,8 @@ class TransactionController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update a transaction.
|
||||||
|
*
|
||||||
* @param TransactionRequest $request
|
* @param TransactionRequest $request
|
||||||
* @param JournalRepositoryInterface $repository
|
* @param JournalRepositoryInterface $repository
|
||||||
* @param Transaction $transaction
|
* @param Transaction $transaction
|
||||||
@@ -262,13 +270,15 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* All the types you can request.
|
||||||
|
*
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function mapTypes(string $type): array
|
private function mapTypes(string $type): array
|
||||||
{
|
{
|
||||||
$types = [
|
$types = [
|
||||||
'all' => [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER, TransactionType::OPENING_BALANCE,
|
'all' => [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER, TransactionType::OPENING_BALANCE,
|
||||||
TransactionType::RECONCILIATION,],
|
TransactionType::RECONCILIATION,],
|
||||||
'withdrawal' => [TransactionType::WITHDRAWAL,],
|
'withdrawal' => [TransactionType::WITHDRAWAL,],
|
||||||
@@ -286,11 +296,12 @@ class TransactionController extends Controller
|
|||||||
'specials' => [TransactionType::OPENING_BALANCE, TransactionType::RECONCILIATION,],
|
'specials' => [TransactionType::OPENING_BALANCE, TransactionType::RECONCILIATION,],
|
||||||
'default' => [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER,],
|
'default' => [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER,],
|
||||||
];
|
];
|
||||||
|
$return = $types['default'];
|
||||||
if (isset($types[$type])) {
|
if (isset($types[$type])) {
|
||||||
return $types[$type];
|
$return = $types[$type];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $types['default']; // @codeCoverageIgnore
|
return $return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,13 +40,14 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UserController
|
* Class UserController.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var UserRepositoryInterface */
|
/** @var UserRepositoryInterface The user repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,6 +120,8 @@ class UserController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Show a single user.
|
||||||
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*
|
*
|
||||||
@@ -142,6 +145,8 @@ class UserController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Store a new user.
|
||||||
|
*
|
||||||
* @param UserRequest $request
|
* @param UserRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -167,6 +172,8 @@ class UserController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update a user.
|
||||||
|
*
|
||||||
* @param UserRequest $request
|
* @param UserRequest $request
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*
|
*
|
||||||
|
@@ -30,6 +30,8 @@ class AccountRequest extends Request
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -39,6 +41,8 @@ class AccountRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -66,6 +70,8 @@ class AccountRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -34,6 +34,8 @@ use FireflyIII\Rules\IsValidAttachmentModel;
|
|||||||
class AttachmentRequest extends Request
|
class AttachmentRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -43,6 +45,8 @@ class AttachmentRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -57,6 +61,8 @@ class AttachmentRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -29,6 +29,8 @@ namespace FireflyIII\Api\V1\Requests;
|
|||||||
class AvailableBudgetRequest extends Request
|
class AvailableBudgetRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -38,6 +40,8 @@ class AvailableBudgetRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -51,6 +55,8 @@ class AvailableBudgetRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -33,6 +33,8 @@ class BillRequest extends Request
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -42,6 +44,8 @@ class BillRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -64,6 +68,8 @@ class BillRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -30,6 +30,8 @@ namespace FireflyIII\Api\V1\Requests;
|
|||||||
class BudgetLimitRequest extends Request
|
class BudgetLimitRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -39,6 +41,8 @@ class BudgetLimitRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -52,6 +56,8 @@ class BudgetLimitRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -31,6 +31,8 @@ use FireflyIII\Models\Budget;
|
|||||||
class BudgetRequest extends Request
|
class BudgetRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -40,6 +42,8 @@ class BudgetRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -52,6 +56,8 @@ class BudgetRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -31,6 +31,8 @@ use FireflyIII\Models\Category;
|
|||||||
class CategoryRequest extends Request
|
class CategoryRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -40,6 +42,8 @@ class CategoryRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -51,6 +55,8 @@ class CategoryRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -30,6 +30,8 @@ namespace FireflyIII\Api\V1\Requests;
|
|||||||
class CurrencyRequest extends Request
|
class CurrencyRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -39,6 +41,8 @@ class CurrencyRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -53,6 +57,8 @@ class CurrencyRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -31,6 +31,8 @@ namespace FireflyIII\Api\V1\Requests;
|
|||||||
class JournalLinkRequest extends Request
|
class JournalLinkRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -40,6 +42,8 @@ class JournalLinkRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -53,6 +57,8 @@ class JournalLinkRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -33,6 +33,8 @@ use Illuminate\Validation\Rule;
|
|||||||
class LinkTypeRequest extends Request
|
class LinkTypeRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -42,6 +44,8 @@ class LinkTypeRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -56,6 +60,8 @@ class LinkTypeRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -33,6 +33,8 @@ use FireflyIII\Rules\IsAssetAccountId;
|
|||||||
class PiggyBankRequest extends Request
|
class PiggyBankRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -42,6 +44,8 @@ class PiggyBankRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -58,6 +62,8 @@ class PiggyBankRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -32,6 +32,8 @@ class PreferenceRequest extends Request
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -40,6 +42,11 @@ class PreferenceRequest extends Request
|
|||||||
return auth()->check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -47,6 +54,11 @@ class PreferenceRequest extends Request
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@@ -37,6 +37,8 @@ class RecurrenceRequest extends Request
|
|||||||
use RecurrenceValidation, TransactionValidation;
|
use RecurrenceValidation, TransactionValidation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -46,6 +48,8 @@ class RecurrenceRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -74,6 +78,8 @@ class RecurrenceRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -33,6 +33,8 @@ use FireflyIII\Models\RuleGroup;
|
|||||||
class RuleGroupRequest extends Request
|
class RuleGroupRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -42,6 +44,8 @@ class RuleGroupRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -54,6 +58,8 @@ class RuleGroupRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -32,6 +32,8 @@ use Illuminate\Validation\Validator;
|
|||||||
class RuleRequest extends Request
|
class RuleRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -41,6 +43,8 @@ class RuleRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -77,6 +81,8 @@ class RuleRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -37,6 +37,8 @@ class TransactionRequest extends Request
|
|||||||
use TransactionValidation;
|
use TransactionValidation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
@@ -78,6 +80,8 @@ class TransactionRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*/
|
*/
|
||||||
@@ -156,6 +160,8 @@ class TransactionRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get transaction data.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
* @SuppressWarnings(PHPMD.NPathComplexity)
|
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||||
* @return array
|
* @return array
|
||||||
|
@@ -34,28 +34,32 @@ use FireflyIII\User;
|
|||||||
class UserRequest extends Request
|
class UserRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Authorize logged in users.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
|
$result = false;
|
||||||
// Only allow authenticated users
|
// Only allow authenticated users
|
||||||
if (!auth()->check()) {
|
if (auth()->check()) {
|
||||||
return false; // @codeCoverageIgnore
|
/** @var User $user */
|
||||||
}
|
$user = auth()->user();
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
/** @var UserRepositoryInterface $repository */
|
/** @var UserRepositoryInterface $repository */
|
||||||
$repository = app(UserRepositoryInterface::class);
|
$repository = app(UserRepositoryInterface::class);
|
||||||
|
|
||||||
if (!$repository->hasRole($user, 'owner')) {
|
if ($repository->hasRole($user, 'owner')) {
|
||||||
return false; // @codeCoverageIgnore
|
$result = true; // @codeCoverageIgnore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get all data from the request.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
@@ -70,6 +74,8 @@ class UserRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CreateExport.php
|
* CreateExport.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -20,6 +19,8 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection MultipleReturnStatementsInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CreateImport.php
|
* CreateImport.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -20,6 +19,8 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection MultipleReturnStatementsInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DecryptAttachment.php
|
* DecryptAttachment.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -20,6 +19,8 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection MultipleReturnStatementsInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EncryptFile.php
|
* EncryptFile.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php /** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import.php
|
* Import.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -20,6 +19,9 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection MultipleReturnStatementsInspection */
|
||||||
|
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
@@ -52,6 +54,8 @@ class Import extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the import routine.
|
* Run the import routine.
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
@@ -102,10 +106,11 @@ class Import extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->infoLine(sprintf('The import has finished. %d transactions have been imported.', $count));
|
$this->infoLine(sprintf('The import has finished. %d transactions have been imported.', $count));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Displays an error.
|
||||||
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array|null $data
|
* @param array|null $data
|
||||||
*/
|
*/
|
||||||
@@ -117,6 +122,8 @@ class Import extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Displays an informational message.
|
||||||
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php /** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ScanAttachments.php
|
* ScanAttachments.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -20,6 +19,8 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
@@ -63,13 +64,13 @@ class ScanAttachments extends Command
|
|||||||
try {
|
try {
|
||||||
$content = $disk->get($fileName);
|
$content = $disk->get($fileName);
|
||||||
} catch (FileNotFoundException $e) {
|
} catch (FileNotFoundException $e) {
|
||||||
$this->error(sprintf('Could not find data for attachment #%d', $attachment->id));
|
$this->error(sprintf('Could not find data for attachment #%d: %s', $attachment->id, $e->getMessage()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$decrypted = Crypt::decrypt($content);
|
$decrypted = Crypt::decrypt($content);
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException $e) {
|
||||||
$this->error(sprintf('Could not decrypt data of attachment #%d', $attachment->id));
|
$this->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$tmpfname = tempnam(sys_get_temp_dir(), 'FireflyIII');
|
$tmpfname = tempnam(sys_get_temp_dir(), 'FireflyIII');
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php /** @noinspection PhpStaticAsDynamicMethodCallInspection */
|
<?php
|
||||||
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UpgradeDatabase.php
|
* UpgradeDatabase.php
|
||||||
@@ -21,6 +20,10 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection MultipleReturnStatementsInspection */
|
||||||
|
/** @noinspection PhpStaticAsDynamicMethodCallInspection */
|
||||||
|
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
@@ -59,6 +62,8 @@ use UnexpectedValueException;
|
|||||||
* Class UpgradeDatabase.
|
* Class UpgradeDatabase.
|
||||||
*
|
*
|
||||||
* Upgrade user database.
|
* Upgrade user database.
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class UpgradeDatabase extends Command
|
class UpgradeDatabase extends Command
|
||||||
{
|
{
|
||||||
@@ -94,6 +99,13 @@ class UpgradeDatabase extends Command
|
|||||||
$this->info('Firefly III database is up to date.');
|
$this->info('Firefly III database is up to date.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since it is one routine these warnings make sense and should be supressed.
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
|
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||||
|
*/
|
||||||
public function migrateBillsToRules(): void
|
public function migrateBillsToRules(): void
|
||||||
{
|
{
|
||||||
foreach (User::get() as $user) {
|
foreach (User::get() as $user) {
|
||||||
@@ -104,11 +116,14 @@ class UpgradeDatabase extends Command
|
|||||||
$currencyPreference = Preferences::getForUser($user, 'currencyPreference', config('firefly.default_currency', 'EUR'));
|
$currencyPreference = Preferences::getForUser($user, 'currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||||
|
|
||||||
if (null === $currencyPreference) {
|
if (null === $currencyPreference) {
|
||||||
|
$this->error('User has no currency preference. Impossible.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$currency = TransactionCurrency::where('code', $currencyPreference->data)->first();
|
$currency = TransactionCurrency::where('code', $currencyPreference->data)->first();
|
||||||
if (null === $currency) {
|
if (null === $currency) {
|
||||||
|
$this->line('Fall back to default currency in migrateBillsToRules().');
|
||||||
$currency = app('amount')->getDefaultCurrency();
|
$currency = app('amount')->getDefaultCurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,6 +280,9 @@ class UpgradeDatabase extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Each (asset) account must have a reference to a preferred currency. If the account does not have one, it's forced upon the account.
|
* Each (asset) account must have a reference to a preferred currency. If the account does not have one, it's forced upon the account.
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*/
|
*/
|
||||||
public function updateAccountCurrencies(): void
|
public function updateAccountCurrencies(): void
|
||||||
{
|
{
|
||||||
@@ -325,6 +343,9 @@ class UpgradeDatabase extends Command
|
|||||||
*
|
*
|
||||||
* Both source and destination must match the respective currency preference of the related asset account.
|
* Both source and destination must match the respective currency preference of the related asset account.
|
||||||
* So FF3 must verify all transactions.
|
* So FF3 must verify all transactions.
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*/
|
*/
|
||||||
public function updateOtherCurrencies(): void
|
public function updateOtherCurrencies(): void
|
||||||
{
|
{
|
||||||
@@ -570,7 +591,11 @@ class UpgradeDatabase extends Command
|
|||||||
*
|
*
|
||||||
* The transaction that is sent to this function MUST be the source transaction (amount negative).
|
* The transaction that is sent to this function MUST be the source transaction (amount negative).
|
||||||
*
|
*
|
||||||
* Method is long and complex bit I'm taking it for granted.
|
* Method is long and complex but I'll allow it. https://imgur.com/gallery/dVDJiez
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
|
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||||
*
|
*
|
||||||
* @param Transaction $transaction
|
* @param Transaction $transaction
|
||||||
*/
|
*/
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UpgradeFireflyInstructions.php
|
* UpgradeFireflyInstructions.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UseEncryption.php
|
* UseEncryption.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VerifiesAccessToken.php
|
* VerifiesAccessToken.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php /** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VerifyDatabase.php
|
* VerifyDatabase.php
|
||||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
@@ -20,6 +19,8 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
@@ -40,12 +41,16 @@ use FireflyIII\User;
|
|||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Log;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Schema;
|
use Schema;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class VerifyDatabase.
|
* Class VerifyDatabase.
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class VerifyDatabase extends Command
|
class VerifyDatabase extends Command
|
||||||
{
|
{
|
||||||
@@ -144,9 +149,10 @@ class VerifyDatabase extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix the situation where the matching transactions
|
* Fix the situation where the matching transactions of a journal somehow have non-matching categories or budgets.
|
||||||
* of a journal somehow have non-matching categories
|
*
|
||||||
* or budgets
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*/
|
*/
|
||||||
private function fixBadMeta(): void
|
private function fixBadMeta(): void
|
||||||
{
|
{
|
||||||
@@ -207,6 +213,12 @@ class VerifyDatabase extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes sure amounts are stored correctly.
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
|
*/
|
||||||
private function fixDoubleAmounts(): void
|
private function fixDoubleAmounts(): void
|
||||||
{
|
{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
@@ -256,7 +268,7 @@ class VerifyDatabase extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Removes bills from journals that should not have bills.
|
||||||
*/
|
*/
|
||||||
private function removeBills(): void
|
private function removeBills(): void
|
||||||
{
|
{
|
||||||
@@ -396,6 +408,7 @@ class VerifyDatabase extends Command
|
|||||||
$objName = Crypt::decrypt($objName);
|
$objName = Crypt::decrypt($objName);
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException $e) {
|
||||||
// it probably was not encrypted.
|
// it probably was not encrypted.
|
||||||
|
Log::debug(sprintf('Not a problem: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// also count the transactions:
|
// also count the transactions:
|
||||||
@@ -433,6 +446,7 @@ class VerifyDatabase extends Command
|
|||||||
$objName = Crypt::decrypt($objName);
|
$objName = Crypt::decrypt($objName);
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException $e) {
|
||||||
// it probably was not encrypted.
|
// it probably was not encrypted.
|
||||||
|
Log::debug(sprintf('Not a problem: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// also count the transactions:
|
// also count the transactions:
|
||||||
@@ -571,6 +585,7 @@ class VerifyDatabase extends Command
|
|||||||
$objName = Crypt::decrypt($objName);
|
$objName = Crypt::decrypt($objName);
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException $e) {
|
||||||
// it probably was not encrypted.
|
// it probably was not encrypted.
|
||||||
|
Log::debug(sprintf('Not a problem: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$line = sprintf(
|
$line = sprintf(
|
||||||
@@ -598,7 +613,8 @@ class VerifyDatabase extends Command
|
|||||||
$sum = (string)$user->transactions()->sum('amount');
|
$sum = (string)$user->transactions()->sum('amount');
|
||||||
if (0 !== bccomp($sum, '0')) {
|
if (0 !== bccomp($sum, '0')) {
|
||||||
$this->error('Error: Transactions for user #' . $user->id . ' (' . $user->email . ') are off by ' . $sum . '!');
|
$this->error('Error: Transactions for user #' . $user->id . ' (' . $user->email . ') are off by ' . $sum . '!');
|
||||||
} else {
|
}
|
||||||
|
if (0 === bccomp($sum, '0')) {
|
||||||
$this->info(sprintf('Amount integrity OK for user #%d', $user->id));
|
$this->info(sprintf('Amount integrity OK for user #%d', $user->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user