Showing 124 of 139 total issues
Method styles
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function styles($id, $options)
{
$color = (Str::of(config('forms.bootstrap-version'))->startsWith('5')) ? '--bs-primary' : '--primary';
$darkTheme = '';
Method formSubmitHtml
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function formSubmitHtml()
{
$html = '';
$onSubmit = null;
Method indexHeaders
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function indexHeaders()
{
$headers = '';
$columns = (! empty($this->indexColumns())) ? $this->indexColumns() : $this->parseVisibleFields($this->parseFields($this->fields()));
Method make
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function make()
{
if ($this->orientation === 'horizontal') {
$this->formClass = $this->formClass ?? config('forms.form.horizontal-class', 'form-horizontal');
}
Method asModal
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function asModal($triggerContent = null, $triggerClass = null, $message = null, $modalTitle = null)
{
$modalTitle = $modalTitle ?? $this->modalTitle;
$title = $modalTitle ?? 'Confirmation';
Method js
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
$url = url('/');
return <<<JS
Method makeCheckInput
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function makeCheckInput($name, $value, $options)
{
$customClasses = $options['attributes']['class'] ?? '';
$customLabelClasses = $options['label_class'] ?? '';
Function makeCheckInput
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
public function makeCheckInput($name, $value, $options)
{
$customClasses = $options['attributes']['class'] ?? '';
$customLabelClasses = $options['label_class'] ?? '';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method styles
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function styles($id, $options)
{
$darkTheme = '';
if (! isset($options['theme']) || (is_bool($options['theme']) && $options['theme'])) {
Method buildSection
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function buildSection($fields, $columns, $label = null)
{
$formChunks = [];
$newFormBuild = [];
Method js
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
return <<<JS
_formsjs_DatepickerField = function (element) {
if (! element.getAttribute('data-formsjs-rendered')) {
Consider simplifying this complex logical expression. Open
Open
if (_input.validity.patternMismatch
|| _input.validity.valueMissing
|| _input.validity.rangeOverflow
|| _input.validity.stepMismatch
|| _input.validity.typeMismatch
Function FormsJS_validate_submission
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
window.FormsJS_validate_submission = function (_form, _processing) {
if (! _form.checkValidity()) {
let _inputs = _form.querySelectorAll('input');
let _selects = _form.querySelectorAll('select');
let _textarea = _form.querySelectorAll('textarea');
Method processOptions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function processOptions($options)
{
$this->customOptions = $options;
$this->type = $options['type'] ?? 'text';
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
$route,
$content = "",
$payload = [],
$method = "post",
$options = [],
Function action
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function action($method, $route, $button = 'Send', $options = [], $asModal = false, $disableOnSubmit = false, $submitViaAjax = false)
{
if (! is_null($this->submitViaAjax)) {
$submitViaAjax = $this->submitViaAjax;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method make
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function make($data = [])
{
$this->data = $data;
if ($this->onKeydown) {
Method make
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function make()
{
if ($this->orientation === 'horizontal') {
$this->formClass = $this->formClass ?? config('forms.form.horizontal-class', 'form-horizontal');
}
Function _formsjs_trigger_onclick_function
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
window._formsjs_trigger_onclick_function = function (event) {
event.preventDefault();
let _form = event.target.form;
let _method = event.target.getAttribute('data-formsjs-onclick');
Method makeRelationship
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function makeRelationship($name, $value, $options)
{
$method = 'all';
$class = $options['model'];