File class-aricolor.php
has 548 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// phpcs:ignoreFile
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
- Create a ticketCreate a ticket
Function get_mode
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function get_mode( $color ) {
// Check if value is an array.
if ( is_array( $color ) ) {
// Does the array have an 'rgba' key?
- 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 get_word_colors
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_word_colors() {
return array(
'aliceblue' => 'F0F8FF',
'antiquewhite' => 'FAEBD7',
'aqua' => '00FFFF',
- Create a ticketCreate a ticket
Method get_mode
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_mode( $color ) {
// Check if value is an array.
if ( is_array( $color ) ) {
// Does the array have an 'rgba' key?
- Create a ticketCreate a ticket
Function getNew
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function getNew( $property = '', $value = '' ) {
if ( in_array( $property, array( 'red', 'green', 'blue', 'alpha' ), true ) ) {
// Check if we're changing any of the rgba values.
$value = max( 0, min( 255, $value ) );
- 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
ariColor
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class ariColor {
/**
* An array of our instances.
*
- Create a ticketCreate a ticket
Method from_hsl_array
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function from_hsl_array() {
$h = $this->hue / 360;
$s = $this->saturation / 100;
$l = $this->lightness / 100;
- Create a ticketCreate a ticket
Method getNew
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getNew( $property = '', $value = '' ) {
if ( in_array( $property, array( 'red', 'green', 'blue', 'alpha' ), true ) ) {
// Check if we're changing any of the rgba values.
$value = max( 0, min( 255, $value ) );
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if ( 4 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) && isset( $color[3] ) ) {
$this->color = 'rgba(' . intval( $color[0] ) . ',' . intval( $color[1] ) . ',' . intval( $color[2] ) . ',' . intval( $color[3] ) . ')';
return 'rgba';
} elseif ( 3 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) ) {
// Is this a simple array with 3 items?
- Create a ticketCreate a ticket
Method set_hsl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function set_hsl() {
$red = $this->red / 255;
$green = $this->green / 255;
$blue = $this->blue / 255;
- Create a ticketCreate a ticket
Function set_hsl
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function set_hsl() {
$red = $this->red / 255;
$green = $this->green / 255;
$blue = $this->blue / 255;
- 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 from_hex
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function from_hex() {
if ( ! function_exists( 'sanitize_hex_color' ) ) {
require_once wp_normalize_path( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
}
- 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 from_hsl_array
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function from_hsl_array() {
$h = $this->hue / 360;
$s = $this->saturation / 100;
$l = $this->lightness / 100;
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
protected function __construct( $color = '', $mode = 'auto' ) {
$this->color = $color;
if ( is_array( $color ) && isset( $color['fallback'] ) ) {
$this->fallback = $color['fallback'];
- 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
Avoid too many return
statements within this method. Open
return $this;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'hex';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return self::new_color( 'hsla(' . $value . ',' . $this->saturation . '%,' . $this->lightness . '%,' . $this->alpha . ')', 'hsla' );
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return self::new_color( 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $this->alpha . ')', 'rgba' );
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'rgba';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $keeper;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'rgba';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'hex';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $this->mode;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return self::new_color( 'hsla(' . $this->hue . ',' . $value . '%,' . $this->lightness . '%,' . $this->alpha . ')', 'hsla' );
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return self::new_color( 'hsla(' . $this->hue . ',' . $this->saturation . '%,' . $value . '%,' . $this->alpha . ')', 'hsla' );
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return null;
- Create a ticketCreate a ticket
Function toCSS
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function toCSS( $mode = 'hex' ) {
$value = '';
switch ( $mode ) {
- 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"