packages/kirki-framework/field-background/src/Background.php
Method init
has 173 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function init( $args ) {
$args['required'] = isset( $args['required'] ) ? (array) $args['required'] : [];
$args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global';
- Create a ticketCreate a ticket
File Background.php
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Override field methods
*
* @package kirki-framework/control-background
- Create a ticketCreate a ticket
Method sanitize
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function sanitize( $value ) {
if ( ! is_array( $value ) ) {
return [];
}
- Create a ticketCreate a ticket
Function set_js_vars
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function set_js_vars() {
// Typecast to array.
$this->js_vars = (array) $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
Function sanitize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function sanitize( $value ) {
if ( ! is_array( $value ) ) {
return [];
}
- 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"