Showing 16 of 40 total issues
Form
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class Form extends \Galahad\Aire\DTD\Form implements NonInput
{
use CreatesElements, CreatesInputTypes;
/**
File Form.php
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Galahad\Aire\Elements;
use BadMethodCallException;
Function connect
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const connect = (target, rules = {}, messages = {}, form_request = null) => {
if (!supported) {
return null;
}
Input
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Input extends Element
{
public $name = 'input';
/**
Function data
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function data($data_key, $value) : self
{
$key = "data-{$data_key}";
if (null === $value) {
- 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
Attributes
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Attributes implements Htmlable, ArrayAccess, Arrayable
{
/**
* @var array
*/
Function run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const run = (e) => {
if ('undefined' !== typeof e && 'target' in e) {
touch(e);
}
Method variantClassNames
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function variantClassNames() : array
{
if (null === $this->element) {
return [];
}
Method aireHtml
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function aireHtml() : string
{
if (static::$aire_loaded) {
return '';
}
Function getData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const getData = (form) => {
const formData = new FormData(form);
const values = {};
for (let [key, value] of formData.entries()) {
const name = key.replace(/\[]$/, '');
- 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 offsetGet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function offsetGet($key)
{
$value = $this->items[$key] ?? null;
if (isset($this->mutators[$key])) {
- 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 connect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const connect = (target, rules = {}, messages = {}, form_request = null) => {
if (!supported) {
return null;
}
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(Aire $aire, $element_id, array $rules = [], array $messages = [], string $form_request = null, $dev_mode = false)
Avoid too many return
statements within this method. Open
return;
Function getBoundValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getBoundValue($name, $default = null)
{
if (empty($name)) {
return value($default);
}
- 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 getArrayableItems
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getArrayableItems($items)
{
if (is_string($items) && is_subclass_of($items, '\\BenSampo\\Enum\\Enum')) {
if (method_exists($items, 'toSelectArray')) {
$items = forward_static_call([$items, 'toSelectArray']);
- 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"