Showing 16 of 68 total issues
File Html.php
has 819 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace HnhDigital\LaravelHtmlGenerator;
use Illuminate\Support\Arr;
Html
has 96 functions (exceeds 20 allowed). Consider refactoring. Open
class Html extends Markup
{
/**
* @param string $tag
* @param array<mixed> $arguments
Function addOptionsArray
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function addOptionsArray(
array $data,
bool|string $data_value,
bool|string|null $data_name,
array|string|null $selected_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
Function attributesToString
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function attributesToString(): string
{
$string = '';
$XMLConvention = in_array(static::$outputLanguage, [ENT_XML1, ENT_XHTML]);
if (!empty($this->attributeList)) {
- 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
Markup
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Markup implements ArrayAccess
{
/**
* Specifies if attribute values and text input sould be protected from XSS injection.
*/
Function addClass
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function addClass(array|string|null $value = ''): self
{
if (blank($value)) {
return $this;
}
- 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 addOptionsArray
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addOptionsArray(
array $data,
bool|string $data_value,
bool|string|null $data_name,
array|string|null $selected_value = []
Function createElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function createElement($tag = '', $attributes1 = [], $attributes2 = []): static
{
$tag_object = parent::createElement($tag);
$tag_object->setTag($tag);
- 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 addClass
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addClass(array|string|null $value = ''): self
{
if (blank($value)) {
return $this;
}
Method icon
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function icon(string $icon, string|int $size = 0, string $tag = 'i'): self
{
$icon = preg_replace('/(")(.*?)(")/', '$2', $icon);
$icon_array = explode(',', $icon, 2);
Function getNext
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getNext(): ?self
{
$next = null;
$find = false;
if (!is_null($this->parent)) {
- 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 icon
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function icon(string $icon, string|int $size = 0, string $tag = 'i'): self
{
$icon = preg_replace('/(")(.*?)(")/', '$2', $icon);
$icon_array = explode(',', $icon, 2);
- 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 routeLink
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function routeLink(
?string $text = null,
?string $route = null,
array $parameters = [],
array $link_attributes = [],
- 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 routeLink
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
?string $text = null,
?string $route = null,
array $parameters = [],
array $link_attributes = [],
string $extra_link = ''
Function getPrevious
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getPrevious(): ?static
{
$prev = $this;
if (!is_null($this->parent)) {
- 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 remove
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function remove(): ?self
{
$parent = $this->parent;
if (!is_null($parent)) {
- 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"