Showing 10 of 42 total issues
Method thumbnail
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function thumbnail(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
Function thumbnail
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function thumbnail(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
- 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 thumbnail
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function thumbnail(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
- 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 thumbnail
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function thumbnail(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
Image
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Image implements ImageInterface
{
protected $data;
protected $drivers;
protected $operations;
Method getImage
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getImage(string $format = null) : string
{
if (!$format) {
$format = explode('/', $this->info['mime'], 2)[1];
}
Function resize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function resize(int $width = 0, int $height = 0)
{
if (!$width && !$height) {
throw new ImageException('You must supply at least one dimension');
}
- 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 getImage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getImage(string $format = null) : string
{
if (!$format) {
$format = $this->instance->getImageFormat();
}
- 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 ob_get_clean();
Function resizeLongEdge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function resizeLongEdge(int $size, bool $enlarge = true): ImageInterface
{
$w = $this->width();
$h = $this->height();
if ($w > $h) {
- 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"