Function multi_resize
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function multi_resize( $sizes ) {
$metadata = array();
$orig_size = $this->size;
$orig_image = $this->image->getImage();
- 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
File class-wp-image-editor-imagick.php
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WordPress Imagick Image Editor
*
* @package WordPress
Method multi_resize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function multi_resize( $sizes ) {
$metadata = array();
$orig_size = $this->size;
$orig_image = $this->image->getImage();
Method test
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function test( $args = array() ) {
// First, test Imagick's extension and classes.
if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick' ) || ! class_exists( 'ImagickPixel' ) )
return false;
Method crop
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
Function crop
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
if ( $src_abs ) {
$src_w -= $src_x;
$src_h -= $src_y;
}
- 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 load
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function load() {
if ( $this->image instanceof Imagick )
return true;
if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
- 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
Avoid too many return
statements within this method. Open
return $this->update_size( $dst_w, $dst_h );
Avoid too many return
statements within this method. Open
return $updated_size;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return $this->set_quality( $this->quality );
Function update_size
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function update_size( $width = null, $height = null ) {
$size = null;
if ( !$width || !$height ) {
try {
$size = $this->image->getImageGeometry();
- 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"