Showing 124 of 139 total issues
Method styles
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function styles($id, $options)
{
$colorVariable = (Str::of(config('forms.bootstrap-version'))->startsWith('5')) ? '--bs-primary' : '--primary';
$position = (Str::of(config('forms.bootstrap-version'))->startsWith('5')) ? 'relative' : 'absolute';
$labelSpacing = (Str::of(config('forms.bootstrap-version'))->startsWith('5')) ? ".form-check-label[for=\"{$id}\"] {margin-left: -24px;}" : '';
Method makeSelect
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function makeSelect($name, $selected, $options)
{
$selectOptions = '';
if (isset($options['attributes']['value'])) {
Function indexHeaders
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
public function indexHeaders()
{
$headers = '';
$columns = (! empty($this->indexColumns())) ? $this->indexColumns() : $this->parseVisibleFields($this->parseFields($this->fields()));
- 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 onLoadJsData
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function onLoadJsData($id, $options)
{
$route = null;
if (isset($options['upload_route'])) {
Function _formsjs_trigger_onclick_function
has a Cognitive Complexity of 16 (exceeds 5 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');
- 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 js
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
return <<<JS
_formsjs_grapesjsField = function (element) {
if (! element.getAttribute('data-formsjs-rendered')) {
File Country.php
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace Grafite\Forms\Fields;
use Grafite\Forms\Fields\AutoSuggestSelect;
File WizardForm.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace Grafite\Forms\Forms;
class WizardForm extends HtmlForm
Method action
has 51 lines of code (exceeds 25 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;
}
Method styles
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function styles($id, $options)
{
$themes = [];
$themes['light'] = <<<CSS
Method edit
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function edit($model = null)
{
if (! is_null($model)) {
$this->setInstance($model);
}
Method indexBody
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function indexBody($query = null)
{
$fields = $this->parseVisibleFields($this->parseFields($this->fields()));
$sortBy = array_keys($fields)[0];
$query = $query;
Method js
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
return <<<JS
_formsjs_trixField = function (element) {
element.addEventListener('grafite-form-change', function (event) {
Method styles
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function styles($id, $options)
{
return <<<CSS
@media (prefers-color-scheme: dark) {
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
Method delete
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function delete($model = null)
{
if (! is_null($model)) {
$this->setInstance($model);
}
Method __construct
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct()
{
parent::__construct();
$this->url = app(UrlGenerator::class);
Method make
has 44 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 create
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function create()
{
$this->submitMethod = $this->submitMethods['create'] ?? null;
if ($this->orientation === 'horizontal') {
Method make
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function make(string $column, array $columnConfig, $object = null)
{
$this->builder
->setLivewire($this->withLivewire)
->setLivewireOnKeydown($this->livewireOnKeydown)
Method formButtonsAndClose
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function formButtonsAndClose()
{
$rowAlignment = config('forms.form.sections.row-alignment-end', 'd-flex justify-content-end');
if (isset($this->buttons['cancel']) || $this->columns === 'steps' || $this->buttonsJustified) {