chore: code cleanup.

This commit is contained in:
James Cole
2023-05-29 13:56:55 +02:00
parent 7f7644c92f
commit 1b52147a05
295 changed files with 12418 additions and 12324 deletions

View File

@@ -26,8 +26,8 @@ namespace FireflyIII\Support\Form;
use Carbon\Carbon;
use Carbon\Exceptions\InvalidDateException;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Support\MessageBag;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\MessageBag;
use Throwable;
/**
@@ -61,23 +61,6 @@ trait FormSupport
return $html;
}
/**
* @param string $name
* @param array|null $options
*
* @return string
*/
protected function label(string $name, array $options = null): string
{
$options = $options ?? [];
if (array_key_exists('label', $options)) {
return $options['label'];
}
$name = str_replace('[]', '', $name);
return (string)trans('form.'.$name);
}
/**
* @param string $name
* @param mixed $label
@@ -97,25 +80,6 @@ trait FormSupport
return $options;
}
/**
* @param string $name
*
* @return string
*/
protected function getHolderClasses(string $name): string
{
// Get errors from session:
/** @var MessageBag $errors */
$errors = session('errors');
$classes = 'form-group';
if (null !== $errors && $errors->has($name)) {
$classes = 'form-group has-error has-feedback';
}
return $classes;
}
/**
* @param string $name
* @param mixed|null $value
@@ -163,4 +127,40 @@ trait FormSupport
return $date;
}
/**
* @param string $name
*
* @return string
*/
protected function getHolderClasses(string $name): string
{
// Get errors from session:
/** @var MessageBag $errors */
$errors = session('errors');
$classes = 'form-group';
if (null !== $errors && $errors->has($name)) {
$classes = 'form-group has-error has-feedback';
}
return $classes;
}
/**
* @param string $name
* @param array|null $options
*
* @return string
*/
protected function label(string $name, array $options = null): string
{
$options = $options ?? [];
if (array_key_exists('label', $options)) {
return $options['label'];
}
$name = str_replace('[]', '', $name);
return (string)trans('form.'.$name);
}
}