Function set_js_vars
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function set_js_vars() {
if ( ! is_array( $this->js_vars ) ) {
$this->js_vars = [];
}
- Read upRead up
- Create a ticketCreate a ticket
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 Field.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Creates and validates field parameters.
*
* @package Kirki
- Create a ticketCreate a ticket
Function set_output
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function set_output() {
if ( empty( $this->output ) ) {
return;
}
if ( ! is_array( $this->output ) ) {
- Read upRead up
- Create a ticketCreate a ticket
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 set_active_callback
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function set_active_callback() {
if ( is_array( $this->active_callback ) ) {
if ( ! is_callable( $this->active_callback ) ) {
// Bugfix for https://github.com/aristath/kirki/issues/1961.
- Read upRead up
- Create a ticketCreate a ticket
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 12 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $config_id = 'global', $args = [] ) {
// In case the user only provides 1 argument,
// assume that the provided argument is $args and set $config_id = 'global'.
if ( is_array( $config_id ) && empty( $args ) ) {
- Read upRead up
- Create a ticketCreate a ticket
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 set_output
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function set_output() {
if ( empty( $this->output ) ) {
return;
}
if ( ! is_array( $this->output ) ) {
- Create a ticketCreate a ticket
Method __construct
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( $config_id = 'global', $args = [] ) {
// In case the user only provides 1 argument,
// assume that the provided argument is $args and set $config_id = 'global'.
if ( is_array( $config_id ) && empty( $args ) ) {
- Create a ticketCreate a ticket
Method set_js_vars
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function set_js_vars() {
if ( ! is_array( $this->js_vars ) ) {
$this->js_vars = [];
}
- Create a ticketCreate a ticket
Function set_partial_refresh
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function set_partial_refresh() {
if ( ! is_array( $this->partial_refresh ) ) {
$this->partial_refresh = [];
}
foreach ( $this->partial_refresh as $id => $args ) {
- Read upRead up
- Create a ticketCreate a ticket
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 set_field
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function set_field() {
$properties = get_class_vars( __CLASS__ );
// Some things must run before the others.
- Read upRead up
- Create a ticketCreate a ticket
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 set_css_vars
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function set_css_vars() {
if ( is_string( $this->css_vars ) ) {
$this->css_vars = [ $this->css_vars ];
}
if ( isset( $this->css_vars[0] ) && is_string( $this->css_vars[0] ) ) {
- Read upRead up
- Create a ticketCreate a ticket
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 set_settings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function set_settings() {
// If settings is not an array, temporarily convert it to an array.
// This is just to allow us to process everything the same way and avoid code duplication.
// if settings is not an array then it will not be set as an array in the end.
- Read upRead up
- Create a ticketCreate a ticket
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"