Showing 12 of 617 total issues
Function field
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function field($id)
{
if (!empty($this->form->fields[$id])) {
$field = $this->form->fields[$id];
- 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 __construct
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($data)
{
// Try to parse JSON
if (($form = json_decode($data)) === 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 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($data)
{
// Try to parse JSON
if (($form = json_decode($data)) === null) {
Method field
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function field($id)
{
if (!empty($this->form->fields[$id])) {
$field = $this->form->fields[$id];
Function open
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function open()
{
$open = new Elements\FormOpen;
if ($this->hasToken()) {
- 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 buildRules
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function buildRules()
{
$rules = [];
foreach ($this->fields as $field) {
// Add rule for required 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 buildRules
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildRules()
{
$rules = [];
foreach ($this->fields as $field) {
// Add rule for required fields
Method open
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function open()
{
$open = new Elements\FormOpen;
if ($this->hasToken()) {
Function parseSelectOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function parseSelectOptions($options = null)
{
if (!empty($options && is_array($options))) {
$selectOptions = [];
foreach ($options as $option) {
- 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 filter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function filter(array $data)
{
$filteredData = [];
foreach ($data as $key => $value) {
if (array_key_exists($key, $this->names)) {
- 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 forId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function forId($name)
{
parent::forId($name);
if (!empty($this->form->fields[$name])) {
$this->setAttribute('for', $this->form->fields[$name]->id);
- 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 buildRules
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function buildRules()
{
foreach ($this->rules as $ruleName => $ruleData) {
foreach ($ruleData as $ruleDataItem) {
$params = (!empty($ruleDataItem['params'])) ? $ruleDataItem['params'] : 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"