Various code cleanup.

This commit is contained in:
James Cole
2021-04-06 17:00:16 +02:00
parent 8572280b7b
commit 38d0f0427f
61 changed files with 419 additions and 369 deletions

View File

@@ -48,7 +48,7 @@ trait RequestInformation
*
* @return string
*/
protected function getDomain(): string // get request info
final protected function getDomain(): string // get request info
{
$url = url()->to('/');
$parts = parse_url($url);
@@ -65,7 +65,7 @@ trait RequestInformation
* @return string
*
*/
protected function getHelpText(string $route, string $language): string // get from internet.
final protected function getHelpText(string $route, string $language): string // get from internet.
{
$help = app(HelpInterface::class);
// get language and default variables.
@@ -119,7 +119,7 @@ trait RequestInformation
/**
* @return string
*/
protected function getPageName(): string // get request info
final protected function getPageName(): string // get request info
{
return str_replace('.', '_', RouteFacade::currentRouteName());
}
@@ -129,7 +129,7 @@ trait RequestInformation
*
* @return string
*/
protected function getSpecificPageName(): string // get request info
final protected function getSpecificPageName(): string // get request info
{
return null === RouteFacade::current()->parameter('objectType') ? '' : '_' . RouteFacade::current()->parameter('objectType');
}
@@ -141,7 +141,7 @@ trait RequestInformation
*
* @return array
*/
protected function getValidTriggerList(TestRuleFormRequest $request): array // process input
final protected function getValidTriggerList(TestRuleFormRequest $request): array // process input
{
$triggers = [];
$data = $request->get('triggers');
@@ -163,7 +163,7 @@ trait RequestInformation
*
* @return bool
*/
protected function hasSeenDemo(): bool // get request info + get preference
final protected function hasSeenDemo(): bool // get request info + get preference
{
$page = $this->getPageName();
$specificPage = $this->getSpecificPageName();
@@ -194,7 +194,7 @@ trait RequestInformation
* @return bool
*
*/
protected function notInSessionRange(Carbon $date): bool // Validate a preference
final protected function notInSessionRange(Carbon $date): bool // Validate a preference
{
/** @var Carbon $start */
$start = session('start', Carbon::now()->startOfMonth());
@@ -219,7 +219,7 @@ trait RequestInformation
*
* @return array
*/
protected function parseAttributes(array $attributes): array // parse input + return result
final protected function parseAttributes(array $attributes): array // parse input + return result
{
$attributes['location'] = $attributes['location'] ?? '';
$attributes['accounts'] = AccountList::routeBinder($attributes['accounts'] ?? '', new Route('get', '', []));
@@ -253,7 +253,7 @@ trait RequestInformation
*
* @throws ValidationException
*/
protected function validatePassword(User $user, string $current, string $new): bool //get request info
final protected function validatePassword(User $user, string $current, string $new): bool //get request info
{
if (!Hash::check($current, $user->password)) {
throw new ValidationException((string)trans('firefly.invalid_current_password'));
@@ -274,7 +274,7 @@ trait RequestInformation
* @return ValidatorContract
* @codeCoverageIgnore
*/
protected function validator(array $data): ValidatorContract
final protected function validator(array $data): ValidatorContract
{
return Validator::make(
$data,