Expand tests, do code cleanup.

This commit is contained in:
James Cole
2017-12-17 14:30:53 +01:00
parent b08af77c98
commit 78335e5814
141 changed files with 773 additions and 54 deletions

View File

@@ -26,7 +26,7 @@ use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountMeta;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\Note;
use FireflyIII\Models\Transaction;
@@ -75,6 +75,8 @@ class UpgradeDatabase extends Command
/**
* Execute the console command.
*
* @throws \Exception
*/
public function handle()
{
@@ -282,6 +284,8 @@ class UpgradeDatabase extends Command
/**
* Move all the journal_meta notes to their note object counter parts.
*
* @throws \Exception
*/
private function migrateNotes(): void
{

View File

@@ -33,7 +33,13 @@ class AdminRequestedTestMessage extends Event
{
use SerializesModels;
/**
* @var string
*/
public $ipAddress;
/**
* @var User
*/
public $user;
/**

View File

@@ -32,7 +32,13 @@ class RegisteredUser extends Event
{
use SerializesModels;
/**
* @var string
*/
public $ipAddress;
/**
* @var User
*/
public $user;
/**

View File

@@ -32,8 +32,17 @@ class RequestedNewPassword extends Event
{
use SerializesModels;
/**
* @var string
*/
public $ipAddress;
/**
* @var string
*/
public $token;
/**
* @var User
*/
public $user;
/**

View File

@@ -28,6 +28,9 @@ use FireflyIII\Jobs\MailError;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Request;
/**
* Class Handler
*/
class Handler extends ExceptionHandler
{
/**
@@ -78,6 +81,7 @@ class Handler extends ExceptionHandler
* @param \Exception $exception
*
* @return mixed|void
* @throws Exception
*/
public function report(Exception $exception)
{

View File

@@ -45,44 +45,131 @@ use FireflyIII\Models\Transaction;
final class Entry
{
// @formatter:off
/**
* @var
*/
public $journal_id;
/**
* @var int
*/
public $transaction_id = 0;
/**
* @var
*/
public $date;
/**
* @var
*/
public $description;
/**
* @var
*/
public $currency_code;
/**
* @var
*/
public $amount;
/**
* @var string
*/
public $foreign_currency_code = '';
/**
* @var string
*/
public $foreign_amount = '0';
/**
* @var
*/
public $transaction_type;
/**
* @var
*/
public $asset_account_id;
/**
* @var
*/
public $asset_account_name;
/**
* @var
*/
public $asset_account_iban;
/**
* @var
*/
public $asset_account_bic;
/**
* @var
*/
public $asset_account_number;
/**
* @var
*/
public $asset_currency_code;
/**
* @var
*/
public $opposing_account_id;
/**
* @var
*/
public $opposing_account_name;
/**
* @var
*/
public $opposing_account_iban;
/**
* @var
*/
public $opposing_account_bic;
/**
* @var
*/
public $opposing_account_number;
/**
* @var
*/
public $opposing_currency_code;
/**
* @var
*/
public $budget_id;
/**
* @var
*/
public $budget_name;
/**
* @var
*/
public $category_id;
/**
* @var
*/
public $category_name;
/**
* @var
*/
public $bill_id;
/**
* @var
*/
public $bill_name;
/**
* @var
*/
public $notes;
/**
* @var
*/
public $tags;

View File

@@ -173,6 +173,7 @@ class ExpandedProcessor implements ProcessorInterface
* @return bool
*
* @throws FireflyException
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function createZipFile(): bool
{

View File

@@ -52,6 +52,7 @@ class CsvExporter extends BasicExporter implements ExporterInterface
/**
* @return bool
* @throws \TypeError
*/
public function run(): bool
{

View File

@@ -41,6 +41,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* @return string
* @throws \Throwable
*/
public function generate(): string
{

View File

@@ -40,6 +40,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
/**
* @return string
* @throws \Throwable
*/
public function generate(): string
{

View File

@@ -40,6 +40,7 @@ class YearReportGenerator implements ReportGeneratorInterface
/**
* @return string
* @throws \Throwable
*/
public function generate(): string
{

View File

@@ -32,8 +32,17 @@ use Illuminate\Support\Collection;
*/
class BalanceLine
{
/**
*
*/
const ROLE_DEFAULTROLE = 1;
/**
*
*/
const ROLE_TAGROLE = 2;
/**
*
*/
const ROLE_DIFFROLE = 3;
/** @var Collection */

View File

@@ -203,6 +203,11 @@ interface JournalCollectorInterface
*/
public function setTypes(array $types): JournalCollectorInterface;
/**
* @param User $user
*
* @return mixed
*/
public function setUser(User $user);
/**

View File

@@ -37,6 +37,11 @@ class AmountFilter implements FilterInterface
/** @var int */
private $modifier = 0;
/**
* AmountFilter constructor.
*
* @param int $modifier
*/
public function __construct(int $modifier)
{
$this->modifier = $modifier;

View File

@@ -24,6 +24,11 @@ namespace FireflyIII\Helpers\Filter;
use Illuminate\Support\Collection;
/**
* Interface FilterInterface
*
* @package FireflyIII\Helpers\Filter
*/
interface FilterInterface
{
/**

View File

@@ -34,6 +34,9 @@ use Route;
*/
class Help implements HelpInterface
{
/**
*
*/
const CACHEKEY = 'help_%s_%s';
/** @var string */
protected $userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36';

View File

@@ -111,6 +111,7 @@ class ReconcileController extends Controller
* @return \Illuminate\Http\JsonResponse
*
* @throws FireflyException
* @throws \Throwable
*/
public function overview(Request $request, Account $account, Carbon $start, Carbon $end)
{
@@ -165,6 +166,7 @@ class ReconcileController extends Controller
* @param Carbon|null $end
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
* @throws FireflyException
*/
public function reconcile(Account $account, Carbon $start = null, Carbon $end = null)
{
@@ -294,6 +296,8 @@ class ReconcileController extends Controller
* @param Carbon $end
*
* @return mixed
* @throws \Throwable
* @throws FireflyException
*/
public function transactions(Account $account, Carbon $start, Carbon $end)
{

View File

@@ -151,6 +151,9 @@ class AccountController extends Controller
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
* @return View
* @throws FireflyException
* @throws FireflyException
* @throws FireflyException
*/
public function edit(Request $request, Account $account)
{
@@ -258,6 +261,7 @@ class AccountController extends Controller
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @throws FireflyException
*/
public function show(Request $request, JournalRepositoryInterface $repository, Account $account, string $moment = '')
{

View File

@@ -206,6 +206,13 @@ class LinkController extends Controller
return redirect($this->getPreviousUri('link_types.create.uri'));
}
/**
* @param LinkTypeFormRequest $request
* @param LinkTypeRepositoryInterface $repository
* @param LinkType $linkType
*
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function update(LinkTypeFormRequest $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
{
if (!$linkType->editable) {

View File

@@ -149,6 +149,7 @@ class AttachmentController extends Controller
* @param Attachment $attachment
*
* @return \Illuminate\Http\Response
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function preview(Attachment $attachment)
{

View File

@@ -25,6 +25,9 @@ namespace FireflyIII\Http\Controllers\Auth;
use FireflyIII\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
/**
* Class ForgotPasswordController
*/
class ForgotPasswordController extends Controller
{
/*

View File

@@ -31,6 +31,9 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Session;
/**
* Class RegisterController
*/
class RegisterController extends Controller
{
/*

View File

@@ -25,6 +25,9 @@ namespace FireflyIII\Http\Controllers\Auth;
use FireflyIII\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
/**
* Class ResetPasswordController
*/
class ResetPasswordController extends Controller
{
/*

View File

@@ -70,7 +70,6 @@ class TwoFactorController extends Controller
/**
* @return mixed
*
* @throws FireflyException
*/
public function lostTwoFactor()
{

View File

@@ -74,6 +74,7 @@ class BudgetController extends Controller
/**
* @param Request $request
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
*
* @return \Illuminate\Http\JsonResponse

View File

@@ -342,7 +342,6 @@ class AccountController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*
* @throws FireflyException
*/
public function period(Account $account, Carbon $start)
{

View File

@@ -38,6 +38,9 @@ use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
use Response;
/**
* Class TagReportController
*/
class TagReportController extends Controller
{
/** @var GeneratorInterface */

View File

@@ -273,6 +273,8 @@ class HomeController extends Controller
}
/**
* @param Request $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function testFlash(Request $request)

View File

@@ -27,6 +27,9 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
use FireflyIII\Support\Import\Prerequisites\PrerequisitesInterface;
/**
* Class BankController
*/
class BankController extends Controller
{

View File

@@ -89,6 +89,9 @@ class JavascriptController extends Controller
/**
* @param Request $request
*
* @param AccountRepositoryInterface $repository
* @param CurrencyRepositoryInterface $currencyRepository
*
* @return \Illuminate\Http\Response
*/
public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository)

View File

@@ -36,6 +36,7 @@ class FrontpageController extends Controller
* @param PiggyBankRepositoryInterface $repository
*
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function piggyBanks(PiggyBankRepositoryInterface $repository)
{

View File

@@ -46,6 +46,7 @@ class JsonController extends Controller
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function action(Request $request)
{
@@ -120,6 +121,7 @@ class JsonController extends Controller
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function trigger(Request $request)
{

View File

@@ -81,6 +81,11 @@ class ReportController extends Controller
* @return \Illuminate\Http\JsonResponse
*
* @throws FireflyException
* @throws \Throwable
* @throws \Throwable
* @throws \Throwable
* @throws \Throwable
* @throws \Throwable
*/
public function general(Request $request)
{
@@ -119,6 +124,7 @@ class ReportController extends Controller
* @return string
*
* @throws FireflyException
* @throws \Throwable
*/
private function balanceAmount(array $attributes): string
{
@@ -156,7 +162,7 @@ class ReportController extends Controller
*
* @return string
*
* @throws FireflyException
* @throws \Throwable
*/
private function budgetSpentAmount(array $attributes): string
{
@@ -170,11 +176,11 @@ class ReportController extends Controller
/**
* Returns all expenses in category in range.
*
* @param $attributes
* @param array $attributes
*
* @return string
*
* @throws FireflyException
* @throws \Throwable
*/
private function categoryEntry(array $attributes): string
{
@@ -188,11 +194,11 @@ class ReportController extends Controller
/**
* Returns all the expenses that went to the given expense account.
*
* @param $attributes
* @param array $attributes
*
* @return string
*
* @throws FireflyException
* @throws \Throwable
*/
private function expenseEntry(array $attributes): string
{
@@ -206,11 +212,11 @@ class ReportController extends Controller
/**
* Returns all the incomes that went to the given asset account.
*
* @param $attributes
* @param array $attributes
*
* @return string
*
* @throws FireflyException
* @throws \Throwable
*/
private function incomeEntry(array $attributes): string
{

View File

@@ -71,6 +71,8 @@ class PreferencesController extends Controller
/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws \Exception
* @throws \Exception
*/
public function deleteCode()
{

View File

@@ -259,6 +259,7 @@ class ProfileController extends Controller
}
/**
* @param UserRepositoryInterface $repository
* @param string $token
* @param string $hash
*

View File

@@ -39,6 +39,7 @@ class AccountController extends Controller
* @param Carbon $end
*
* @return mixed|string
* @throws \Throwable
*/
public function general(Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -40,6 +40,7 @@ class BalanceController extends Controller
* @param Carbon $end
*
* @return mixed|string
* @throws \Throwable
*/
public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -41,6 +41,7 @@ class BudgetController extends Controller
* @param Carbon $end
*
* @return mixed|string
* @throws \Throwable
*/
public function general(BudgetReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
{
@@ -68,6 +69,7 @@ class BudgetController extends Controller
* @param Carbon $end
*
* @return mixed|string
* @throws \Throwable
*/
public function period(Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -40,6 +40,7 @@ class CategoryController extends Controller
* @param Carbon $end
*
* @return mixed|string
* @throws \Throwable
*/
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
{
@@ -71,6 +72,7 @@ class CategoryController extends Controller
* @param Collection $accounts
*
* @return string
* @throws \Throwable
*/
public function income(Collection $accounts, Carbon $start, Carbon $end)
{
@@ -104,6 +106,7 @@ class CategoryController extends Controller
* @return mixed|string
*
* @internal param ReportHelperInterface $helper
* @throws \Throwable
*/
public function operations(Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -211,6 +211,15 @@ class ExpenseController extends Controller
}
/**
* @param Collection $accounts
* @param Collection $expense
* @param Carbon $start
* @param Carbon $end
*
* @return string
* @throws \Throwable
*/
public function topExpense(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{
// Properties for cache:
@@ -246,6 +255,15 @@ class ExpenseController extends Controller
}
/**
* @param Collection $accounts
* @param Collection $expense
* @param Carbon $start
* @param Carbon $end
*
* @return mixed|string
* @throws \Throwable
*/
public function topIncome(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{
// Properties for cache:
@@ -366,6 +384,14 @@ class ExpenseController extends Controller
return $sum;
}
/**
* @param Collection $assets
* @param Collection $opposing
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
protected function earnedInPeriod(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array
{
/** @var JournalCollectorInterface $collector */

View File

@@ -40,6 +40,7 @@ class OperationsController extends Controller
* @param Carbon $end
*
* @return mixed|string
* @throws \Throwable
*/
public function expenses(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
{
@@ -67,6 +68,7 @@ class OperationsController extends Controller
* @param Carbon $end
*
* @return string
* @throws \Throwable
*/
public function income(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
{
@@ -95,6 +97,7 @@ class OperationsController extends Controller
* @param Carbon $end
*
* @return mixed|string
* @throws \Throwable
*/
public function operations(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -72,6 +72,8 @@ class RuleController extends Controller
* @param RuleGroup $ruleGroup
*
* @return View
* @throws \Throwable
* @throws \Throwable
*/
public function create(Request $request, RuleGroup $ruleGroup)
{
@@ -164,6 +166,10 @@ class RuleController extends Controller
* @param Rule $rule
*
* @return View
* @throws \Throwable
* @throws \Throwable
* @throws \Throwable
* @throws \Throwable
*/
public function edit(Request $request, RuleRepositoryInterface $repository, Rule $rule)
{
@@ -356,6 +362,7 @@ class RuleController extends Controller
* @param TestRuleFormRequest $request
*
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function testTriggers(TestRuleFormRequest $request)
{
@@ -528,6 +535,7 @@ class RuleController extends Controller
* @param Rule $rule
*
* @return array
* @throws \Throwable
*/
private function getCurrentActions(Rule $rule)
{
@@ -556,6 +564,7 @@ class RuleController extends Controller
* @param Rule $rule
*
* @return array
* @throws \Throwable
*/
private function getCurrentTriggers(Rule $rule)
{
@@ -586,6 +595,7 @@ class RuleController extends Controller
* @param Request $request
*
* @return array
* @throws \Throwable
*/
private function getPreviousActions(Request $request)
{
@@ -615,6 +625,7 @@ class RuleController extends Controller
* @param Request $request
*
* @return array
* @throws \Throwable
*/
private function getPreviousTriggers(Request $request)
{

View File

@@ -69,6 +69,13 @@ class SearchController extends Controller
return view('search.index', compact('query', 'fullQuery', 'subTitle'));
}
/**
* @param Request $request
* @param SearchInterface $searcher
*
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function search(Request $request, SearchInterface $searcher)
{
$fullQuery = strval($request->get('query'));
@@ -79,7 +86,7 @@ class SearchController extends Controller
$cache->addProperty($fullQuery);
if ($cache->has()) {
$transactions = $cache->get();
$transactions = $cache->get(); // @codeCoverageIgnore
}
if (!$cache->has()) {

View File

@@ -161,7 +161,7 @@ class TagController extends Controller
$start = new Carbon;
if (null !== $oldestTag) {
/** @var Carbon $start */
$start = $oldestTag->date;
$start = $oldestTag->date; // @codeCoverageIgnore
}
if (null === $oldestTag) {
/** @var Carbon $start */

View File

@@ -128,6 +128,8 @@ class ConvertController extends Controller
* @param TransactionJournal $journal
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws FireflyException
* @throws FireflyException
*/
public function postIndex(Request $request, JournalRepositoryInterface $repository, TransactionType $destinationType, TransactionJournal $journal)
{

View File

@@ -97,6 +97,11 @@ class SingleController extends Controller
);
}
/**
* @param TransactionJournal $journal
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function cloneTransaction(TransactionJournal $journal)
{
$source = $journal->sourceAccountList()->first();
@@ -149,6 +154,7 @@ class SingleController extends Controller
}
/**
* @param Request $request
* @param string $what
*
* @return View

View File

@@ -69,6 +69,7 @@ class TransactionController extends Controller
* @param string $moment
*
* @return View
* @throws FireflyException
*/
public function index(Request $request, JournalRepositoryInterface $repository, string $what, string $moment = '')
{
@@ -128,6 +129,8 @@ class TransactionController extends Controller
/**
* @param Request $request
* @param JournalRepositoryInterface $repository
*
* @return \Illuminate\Http\JsonResponse
*/
public function reconcile(Request $request, JournalRepositoryInterface $repository)
{
@@ -139,6 +142,7 @@ class TransactionController extends Controller
$repository->reconcile($transaction);
}
return Response::json(['ok'=>'reconciled']);
}
/**
@@ -180,7 +184,7 @@ class TransactionController extends Controller
return $this->redirectToAccount($journal);
}
if ($journal->transactionType->type === TransactionType::RECONCILIATION) {
return redirect(route('accounts.reconcile.show', [$journal->id]));
return redirect(route('accounts.reconcile.show', [$journal->id])); // @codeCoverageIgnore
}
$linkTypes = $linkTypeRepository->get();
$links = $linkTypeRepository->getLinks($journal);
@@ -197,7 +201,6 @@ class TransactionController extends Controller
*
* @return Collection
*
* @throws FireflyException
*/
private function getPeriodOverview(string $what): Collection
{
@@ -248,7 +251,7 @@ class TransactionController extends Controller
];
Log::debug(sprintf('What is %s', $what));
if ($journals->count() > 0) {
$entries->push($array);
$entries->push($array); // @codeCoverageIgnore
}
$end = app('navigation')->subtractPeriod($end, $range, 1);
}

View File

@@ -46,6 +46,9 @@ use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\View\Middleware\ShareErrorsFromSession;
/**
* Class Kernel
*/
class Kernel extends HttpKernel
{
/**

View File

@@ -31,6 +31,9 @@ use Illuminate\Http\Request;
*/
class Binder
{
/**
* @var array
*/
protected $binders = [];
/**

View File

@@ -24,6 +24,9 @@ namespace FireflyIII\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
/**
* Class EncryptCookies
*/
class EncryptCookies extends Middleware
{
/**

View File

@@ -25,6 +25,9 @@ namespace FireflyIII\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
/**
* Class RedirectIfAuthenticated
*/
class RedirectIfAuthenticated
{
/**

View File

@@ -24,6 +24,9 @@ namespace FireflyIII\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
/**
* Class TrimStrings
*/
class TrimStrings extends Middleware
{
/**

View File

@@ -26,6 +26,9 @@ use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Http\Request;
/**
* Class TrustProxies
*/
class TrustProxies extends Middleware
{
/**

View File

@@ -24,6 +24,9 @@ namespace FireflyIII\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
/**
* Class VerifyCsrfToken
*/
class VerifyCsrfToken extends Middleware
{
/**

View File

@@ -84,6 +84,7 @@ class JournalFormRequest extends Request
/**
* @return array
* @throws FireflyException
*/
public function rules()
{

View File

@@ -70,6 +70,7 @@ class CsvProcessor implements FileProcessorInterface
* Does the actual job.
*
* @return bool
* @throws \League\Csv\Exception
*/
public function run(): bool
{
@@ -159,6 +160,9 @@ class CsvProcessor implements FileProcessorInterface
/**
* @return Iterator
* @throws \League\Csv\Exception
* @throws \League\Csv\Exception
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
private function getImportArray(): Iterator
{
@@ -275,6 +279,7 @@ class CsvProcessor implements FileProcessorInterface
* @param array $array
*
* @return bool
* @throws FireflyException
*/
private function rowAlreadyImported(array $array): bool
{

View File

@@ -28,6 +28,9 @@ use FireflyIII\User;
use Illuminate\Support\Collection;
use Log;
/**
* Class ImportCategory
*/
class ImportCategory
{
/** @var Category */

View File

@@ -27,6 +27,9 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Log;
/**
* Class ImportCurrency
*/
class ImportCurrency
{
/** @var array */

View File

@@ -155,6 +155,7 @@ class BunqPrerequisites implements PrerequisitesInterface
* @return DeviceServerId
*
* @throws FireflyException
* @throws \Exception
*/
private function getExistingDevice(): DeviceServerId
{
@@ -292,6 +293,10 @@ class BunqPrerequisites implements PrerequisitesInterface
* - Use this token to send a device server request
* - Store the installation token
* - Use the installation token each time we need a session.
*
* @throws FireflyException
* @throws FireflyException
* @throws \Exception
*/
private function registerDevice(): DeviceServerId
{

View File

@@ -26,6 +26,11 @@ use FireflyIII\User;
use Illuminate\Http\Request;
use Illuminate\Support\MessageBag;
/**
* Interface PrerequisitesInterface
*
* @package FireflyIII\Import\Prerequisites
*/
interface PrerequisitesInterface
{
/**

View File

@@ -25,6 +25,11 @@ namespace FireflyIII\Import\Routine;
use FireflyIII\Models\ImportJob;
use Illuminate\Support\Collection;
/**
* Interface RoutineInterface
*
* @package FireflyIII\Import\Routine
*/
interface RoutineInterface
{
/**

View File

@@ -408,6 +408,12 @@ trait ImportSupport
}
}
/**
* @param array $parameters
*
* @return TransactionJournal
* @throws FireflyException
*/
private function storeJournal(array $parameters): TransactionJournal
{
// find transaction type:

View File

@@ -13,14 +13,22 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Log;
/**
* Class GetSpectreProviders
*/
class GetSpectreProviders implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* @var User
*/
protected $user;
/**
* Create a new job instance.
*
* @param User $user
*/
public function __construct(User $user)
{
@@ -30,6 +38,9 @@ class GetSpectreProviders implements ShouldQueue
/**
* Execute the job.
*
* @throws \Illuminate\Container\EntryNotFoundException
* @throws \Exception
*/
public function handle()
{

View File

@@ -59,6 +59,9 @@ class Account extends Model
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
/** @var array */
protected $hidden = ['encrypted'];
/**
* @var array
*/
protected $rules
= [
'user_id' => 'required|exists:users,id',
@@ -216,7 +219,6 @@ class Account extends Model
*
* @return TransactionJournal
*
* @throws FireflyException
*/
public function getOpeningBalance(): TransactionJournal
{
@@ -267,7 +269,6 @@ class Account extends Model
*
* @return Carbon
*
* @throws FireflyException
*/
public function getOpeningBalanceDate(): Carbon
{

View File

@@ -42,6 +42,9 @@ class AccountMeta extends Model
];
/** @var array */
protected $fillable = ['account_id', 'name', 'data'];
/**
* @var string
*/
protected $table = 'account_meta';
/**

View File

@@ -31,14 +31,41 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class AccountType extends Model
{
const DEFAULT = 'Default account';
/**
*
*/
const CASH = 'Cash account';
/**
*
*/
const ASSET = 'Asset account';
/**
*
*/
const EXPENSE = 'Expense account';
/**
*
*/
const REVENUE = 'Revenue account';
/**
*
*/
const INITIAL_BALANCE = 'Initial balance account';
/**
*
*/
const BENEFICIARY = 'Beneficiary account';
/**
*
*/
const IMPORT = 'Import account';
/**
*
*/
const RECONCILIATION = 'Reconciliation account';
/**
*
*/
const LOAN = 'Loan';
/**
* The attributes that should be casted to native types.

View File

@@ -53,10 +53,19 @@ class Bill extends Model
'name_encrypted' => 'boolean',
'match_encrypted' => 'boolean',
];
/**
* @var array
*/
protected $fillable
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip',
'automatch', 'active',];
/**
* @var array
*/
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];
/**
* @var array
*/
protected $rules = ['name' => 'required|between:1,200'];
/**

View File

@@ -42,6 +42,9 @@ class Configuration extends Model
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* @var string
*/
protected $table = 'configuration';
/**

View File

@@ -44,6 +44,9 @@ class ImportJob extends Model
'updated_at' => 'datetime',
];
/**
* @var array
*/
protected $validStatus
= [
'new',
@@ -176,6 +179,7 @@ class ImportJob extends Model
/**
* @return string
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function uploadFileContents(): string
{

View File

@@ -65,6 +65,9 @@ class LinkType extends Model
throw new NotFoundHttpException;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactionJournalLinks()
{
return $this->hasMany(TransactionJournalLink::class);

View File

@@ -42,7 +42,13 @@ class PiggyBankEvent extends Model
];
/** @var array */
protected $dates = ['date'];
/**
* @var array
*/
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount'];
/**
* @var array
*/
protected $hidden = ['amount_encrypted'];
/**

View File

@@ -41,6 +41,9 @@ class Role extends Model
'updated_at' => 'datetime',
];
/**
* @var array
*/
protected $fillable = ['name', 'display_name', 'description'];
/**

View File

@@ -46,6 +46,9 @@ class RuleGroup extends Model
'order' => 'int',
];
/**
* @var array
*/
protected $fillable = ['user_id', 'order', 'title', 'description', 'active'];
/**

View File

@@ -27,6 +27,9 @@ class SpectreProvider extends Model
'data' => 'array',
];
/**
* @var array
*/
protected $fillable = ['spectre_id', 'code', 'mode', 'name', 'status', 'interactive', 'automatic_fetch', 'country_code', 'data'];
}

View File

@@ -105,6 +105,7 @@ class Tag extends Model
* @param Tag $tag
*
* @return string
* @throws \FireflyIII\Exceptions\FireflyException
*/
public static function tagSum(self $tag): string
{

View File

@@ -84,10 +84,19 @@ class Transaction extends Model
'bill_name_encrypted' => 'boolean',
'reconciled' => 'boolean',
];
/**
* @var array
*/
protected $fillable
= ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id',
'foreign_amount',];
/**
* @var array
*/
protected $hidden = ['encrypted'];
/**
* @var array
*/
protected $rules
= [
'account_id' => 'required|exists:accounts,id',

View File

@@ -32,6 +32,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
class TransactionJournalLink extends Model
{
/**
* @var string
*/
protected $table = 'journal_links';
/**

View File

@@ -33,10 +33,25 @@ class TransactionType extends Model
{
use SoftDeletes;
/**
*
*/
const WITHDRAWAL = 'Withdrawal';
/**
*
*/
const DEPOSIT = 'Deposit';
/**
*
*/
const TRANSFER = 'Transfer';
/**
*
*/
const OPENING_BALANCE = 'Opening balance';
/**
*
*/
const RECONCILIATION = 'Reconciliation';
/**
* The attributes that should be casted to native types.

View File

@@ -25,6 +25,9 @@ namespace FireflyIII\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
/**
* Class RouteServiceProvider
*/
class RouteServiceProvider extends ServiceProvider
{
/**

View File

@@ -72,6 +72,7 @@ class AccountRepository implements AccountRepositoryInterface
* @param Account $moveTo
*
* @return bool
* @throws \Exception
*/
public function destroy(Account $account, Account $moveTo): bool
{
@@ -239,6 +240,8 @@ class AccountRepository implements AccountRepositoryInterface
/**
* @param Account $account
*
* @throws \Exception
*/
protected function deleteInitialBalance(Account $account)
{
@@ -410,6 +413,7 @@ class AccountRepository implements AccountRepositoryInterface
* @param string $name
*
* @return Account
* @throws FireflyException
*/
protected function storeOpposingAccount(string $name): Account
{
@@ -507,6 +511,7 @@ class AccountRepository implements AccountRepositoryInterface
* @param array $data
*
* @return bool
* @throws \Exception
*/
protected function updateOpeningBalanceJournal(Account $account, TransactionJournal $journal, array $data): bool
{

View File

@@ -211,6 +211,7 @@ trait FindAccountsTrait
/**
* @return Account
* @throws FireflyException
*/
public function getCashAccount(): Account
{

View File

@@ -43,6 +43,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
* @param Attachment $attachment
*
* @return bool
* @throws \Exception
*/
public function destroy(Attachment $attachment): bool
{
@@ -129,6 +130,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
* @param Attachment $attachment
*
* @return string
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function getContent(Attachment $attachment): string
{

View File

@@ -48,6 +48,7 @@ class BillRepository implements BillRepositoryInterface
* @param Bill $bill
*
* @return bool
* @throws \Exception
*/
public function destroy(Bill $bill): bool
{
@@ -390,6 +391,8 @@ class BillRepository implements BillRepositoryInterface
* @param Carbon $date
*
* @return \Carbon\Carbon
* @throws \FireflyIII\Support\Facades\FireflyException
* @throws \FireflyIII\Support\Facades\FireflyException
*/
public function nextDateMatch(Bill $bill, Carbon $date): Carbon
{
@@ -427,6 +430,9 @@ class BillRepository implements BillRepositoryInterface
* @param Carbon $date
*
* @return Carbon
* @throws \FireflyIII\Support\Facades\FireflyException
* @throws \FireflyIII\Support\Facades\FireflyException
* @throws \FireflyIII\Support\Facades\FireflyException
*/
public function nextExpectedMatch(Bill $bill, Carbon $date): Carbon
{

View File

@@ -51,6 +51,8 @@ class BudgetRepository implements BudgetRepositoryInterface
/**
* @return bool
* @throws \Exception
* @throws \Exception
*/
public function cleanupBudgets(): bool
{
@@ -123,6 +125,7 @@ class BudgetRepository implements BudgetRepositoryInterface
* @param Budget $budget
*
* @return bool
* @throws \Exception
*/
public function destroy(Budget $budget): bool
{
@@ -604,6 +607,7 @@ class BudgetRepository implements BudgetRepositoryInterface
* @param string $amount
*
* @return BudgetLimit
* @throws \Exception
*/
public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): BudgetLimit
{

View File

@@ -44,6 +44,7 @@ class CategoryRepository implements CategoryRepositoryInterface
* @param Category $category
*
* @return bool
* @throws \Exception
*/
public function destroy(Category $category): bool
{

View File

@@ -53,6 +53,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface
/**
* @return bool
* @throws \Exception
*/
public function cleanup(): bool
{
@@ -137,6 +138,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface
* @param ExportJob $job
*
* @return string
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function getContent(ExportJob $job): string
{

View File

@@ -99,6 +99,7 @@ class JournalRepository implements JournalRepositoryInterface
* @param TransactionJournal $journal
*
* @return bool
* @throws \Exception
*/
public function delete(TransactionJournal $journal): bool
{
@@ -273,6 +274,8 @@ class JournalRepository implements JournalRepositoryInterface
* @param array $data
*
* @return TransactionJournal
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
*/
public function store(array $data): TransactionJournal
{
@@ -358,6 +361,10 @@ class JournalRepository implements JournalRepositoryInterface
* @param array $data
*
* @return TransactionJournal
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
*/
public function update(TransactionJournal $journal, array $data): TransactionJournal
{

View File

@@ -119,6 +119,8 @@ trait SupportJournalsTrait
* @param array $data
*
* @return array
* @throws FireflyException
* @throws FireflyException
*/
protected function storeDepositAccounts(User $user, array $data): array
{
@@ -165,6 +167,8 @@ trait SupportJournalsTrait
* @param array $data
*
* @return array
* @throws FireflyException
* @throws FireflyException
*/
protected function storeWithdrawalAccounts(User $user, array $data): array
{

View File

@@ -51,6 +51,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
* @param LinkType $moveTo
*
* @return bool
* @throws \Exception
*/
public function destroy(LinkType $linkType, LinkType $moveTo): bool
{
@@ -66,6 +67,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
* @param TransactionJournalLink $link
*
* @return bool
* @throws \Exception
*/
public function destroyLink(TransactionJournalLink $link): bool
{

View File

@@ -49,6 +49,9 @@ class RuleRepository implements RuleRepositoryInterface
* @param Rule $rule
*
* @return bool
* @throws \Exception
* @throws \Exception
* @throws \Exception
*/
public function destroy(Rule $rule): bool
{

View File

@@ -49,6 +49,8 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
* @param RuleGroup|null $moveTo
*
* @return bool
* @throws \Exception
* @throws \Exception
*/
public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool
{

View File

@@ -74,6 +74,7 @@ class TagRepository implements TagRepositoryInterface
* @param Tag $tag
*
* @return bool
* @throws \Exception
*/
public function destroy(Tag $tag): bool
{

View File

@@ -132,6 +132,7 @@ class UserRepository implements UserRepositoryInterface
* @param User $user
*
* @return bool
* @throws \Exception
*/
public function destroy(User $user): bool
{

View File

@@ -25,6 +25,9 @@ namespace FireflyIII\Services\Bunq\Object;
use Carbon\Carbon;
use FireflyIII\Services\Bunq\Id\DeviceServerId;
/**
* Class DeviceServer
*/
class DeviceServer extends BunqObject
{
/** @var Carbon */
@@ -40,6 +43,11 @@ class DeviceServer extends BunqObject
/** @var Carbon */
private $updated;
/**
* DeviceServer constructor.
*
* @param array $data
*/
public function __construct(array $data)
{
$id = new DeviceServerId();

View File

@@ -31,7 +31,13 @@ class MonetaryAccountProfile extends BunqObject
private $profileActionRequired = '';
/** @var Amount */
private $profileAmountRequired;
/**
* @var null
*/
private $profileDrain;
/**
* @var null
*/
private $profileFill;
/**

View File

@@ -29,10 +29,19 @@ use Carbon\Carbon;
*/
class UserCompany extends BunqObject
{
/**
* @var
*/
private $addressMain;
/**
* @var
*/
private $addressPostal;
/** @var array */
private $aliases = [];
/**
* @var
*/
private $avatar;
/** @var string */
private $cocNumber = '';
@@ -40,7 +49,13 @@ class UserCompany extends BunqObject
private $counterBankIban = '';
/** @var Carbon */
private $created;
/**
* @var
*/
private $dailyLimit;
/**
* @var
*/
private $directorAlias;
/** @var string */
private $displayName = '';

View File

@@ -29,10 +29,19 @@ use Carbon\Carbon;
*/
class UserPerson extends BunqObject
{
/**
* @var
*/
private $addressMain;
/**
* @var
*/
private $addressPostal;
/** @var array */
private $aliases = [];
/**
* @var
*/
private $avatar;
/** @var array */
private $billingContracts = [];
@@ -40,8 +49,17 @@ class UserPerson extends BunqObject
private $countryOfBirth = '';
/** @var Carbon */
private $created;
/**
* @var
*/
private $customer;
/**
* @var
*/
private $customerLimit;
/**
* @var
*/
private $dailyLimit;
/** @var Carbon */
private $dateOfBirth;
@@ -77,6 +95,9 @@ class UserPerson extends BunqObject
private $publicNickName = '';
/** @var string */
private $publicUuid = '';
/**
* @var mixed
*/
private $region;
/** @var int */
private $sessionTimeout = 0;

View File

@@ -42,6 +42,9 @@ abstract class BunqRequest
private $privateKey = '';
/** @var string */
private $server = '';
/**
* @var array
*/
private $upperCaseHeaders
= [
'x-bunq-client-response-id' => 'X-Bunq-Client-Response-Id',
@@ -327,6 +330,7 @@ abstract class BunqRequest
* @param array $headers
*
* @return array
* @throws Exception
*/
protected function sendUnsignedBunqDelete(string $uri, array $headers): array
{
@@ -356,6 +360,7 @@ abstract class BunqRequest
* @param array $headers
*
* @return array
* @throws Exception
*/
protected function sendUnsignedBunqPost(string $uri, array $data, array $headers): array
{

View File

@@ -35,6 +35,7 @@ class DeleteDeviceSessionRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{

View File

@@ -41,6 +41,7 @@ class DeviceServerRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{

Some files were not shown because too many files have changed in this diff Show More