Showing 124 of 139 total issues
Method js
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
return <<<JS
_formsjs_autoSuggestField = function (element) {
if (! element.getAttribute('data-formsjs-rendered')) {
Method js
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
return <<<JS
_formsjs_bootstrapSimpleDatalistField = function (element) {
if (! element.getAttribute('data-formsjs-rendered')) {
Method styles
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function styles($id, $options)
{
return <<<CSS
.bs-select {
position: relative;
Method styles
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function styles($id, $options)
{
return <<<CSS
.bs-select {
position: relative;
Method js
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
$listGroup = config('forms.html.list-group', 'list-group list-group-flush');
$listGroupItem = config('forms.html.list-group-item', 'list-group-item');
$badge = config('forms.html.badge-tag', 'badge badge-primary float-end');
File ModelForm.php
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace Grafite\Forms\Forms;
use Exception;
File FieldBuilder.php
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace Grafite\Forms\Builders;
use DateTime;
Method styles
has 78 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')) ? 'var(--bs-gray-400)' : 'rgba(0, 0, 0, .1)';
$borderLight = (Str::of(config('forms.bootstrap-version'))->startsWith('5')) ? "1px solid $color !important" : "1px solid $color !important";
$borderDark = (Str::of(config('forms.bootstrap-version'))->startsWith('5')) ? "2px solid #444 !important" : "1px solid #444 !important";
HtmlForm
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class HtmlForm extends Form
{
/**
* Simple wrapper for cards
*
Method styles
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function styles()
{
$color = $this->progressBarColor ?? '#28a745';
$numberOfSteps = count($this->steps($this->fieldsForSteps));
$size = $numberOfSteps * 100;
FormMaker
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class FormMaker
{
use HasLivewire;
use HasErrorBag;
Method makeField
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function makeField($columnConfig, $label, $column, $value, $errors)
{
$field = null;
if (in_array($columnConfig['type'], $this->standard)) {
Method styles
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function styles($id, $options)
{
return <<<CSS
.flatpickr-current-month .flatpickr-monthDropdown-months {
appearance: none !important;
Method styles
has 62 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 js
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
return <<<JS
_formsjs_bootstrapSelect_addInpKeyPress = function (t, ev, id) {
ev.stopPropagation();
Function formButtonsAndClose
has a Cognitive Complexity of 18 (exceeds 5 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) {
- 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
Function indexBody
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
public function indexBody($query = null)
{
$fields = $this->parseVisibleFields($this->parseFields($this->fields()));
$sortBy = array_keys($fields)[0];
$query = $query;
- 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
File Country.php
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace Grafite\Forms\Fields\Bootstrap;
use Grafite\Forms\Fields\Bootstrap\Select;
Method handler
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handler($content)
{
$convertor = new HtmlConvertor([
'raw' => function ($html) {
return $html;
Method js
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function js($id, $options)
{
return <<<JS
_formsjs_editorField = function (element) {
if (! element.getAttribute('data-formsjs-rendered')) {