webD97/chameleon

View on GitHub

Showing 89 of 89 total issues

Color has 158 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Color implements IColor {
/**
* {@inheritdoc}
*/
public static abstract function fromRGBA(RGBAColor $rgba);
Severity: Major
Found in src/Colors/Color.php - About 3 days to fix

ColorTest has 149 functions (exceeds 20 allowed). Consider refactoring.
Open

final class ColorTest extends TestCase {
/**
* @covers \Chameleon\Colors\Color::transparent
*/
function testTransparent() {
Severity: Major
Found in test/Colors/ColorTest.php - About 2 days to fix

File Color.php has 489 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Chameleon\Colors;
 
use Exception;
 
 
Severity: Minor
Found in src/Colors/Color.php - About 7 hrs to fix

File ColorTest.php has 453 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Chameleon\Colors;
 
use PHPUnit\Framework\TestCase;
 
 
Severity: Minor
Found in test/Colors/ColorTest.php - About 6 hrs to fix

Image has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Image {
private $imageResource;
/**
* @var IColor This color is used as initial background color when creating an image, or if a certain method
* needs a background color as parameter.
Severity: Minor
Found in src/Image.php - About 2 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function __construct(float $brightness = 0) {
if ($brightness < -1 || $brightness > 1) {
throw new ValueOutOfBoundsException("brightness", $brightness, -1, 1);
}
 
 
Severity: Major
Found in src/Filters/BrightnessFilter.php and 1 other location - About 2 hrs to fix
src/Filters/ContrastFilter.php on lines 9..17

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function __construct(int $contrast = 0) {
if ($contrast < -255 || $contrast > 255) {
throw new ValueOutOfBoundsException("contrast", $contrast, -255, 255);
}
 
 
Severity: Major
Found in src/Filters/ContrastFilter.php and 1 other location - About 2 hrs to fix
src/Filters/BrightnessFilter.php on lines 16..24

Similar blocks of code found in 3 locations. Consider refactoring.
Open

public function setSaturation(float $saturation) : self {
if (!$this -> checkRange($saturation, 0, 1)) {
throw new ValueOutOfBoundsException("saturation", $saturation, 0, 1);
}
 
 
Severity: Major
Found in src/Colors/HSVColor.php and 2 other locations - About 1 hr to fix
src/Colors/HSVColor.php on lines 140..149
src/Colors/HSVColor.php on lines 202..211

Similar blocks of code found in 3 locations. Consider refactoring.
Open

public function setValue(float $value) : self {
if (!$this -> checkRange($value, 0, 1)) {
throw new ValueOutOfBoundsException("value", $value, 0, 1);
}
 
 
Severity: Major
Found in src/Colors/HSVColor.php and 2 other locations - About 1 hr to fix
src/Colors/HSVColor.php on lines 140..149
src/Colors/HSVColor.php on lines 171..180

Similar blocks of code found in 3 locations. Consider refactoring.
Open

public function setHue(int $hue) : self {
if (!$this -> checkRange($hue, 0, 359)) {
throw new ValueOutOfBoundsException("hue", $hue, 0, 359);
}
 
 
Severity: Major
Found in src/Colors/HSVColor.php and 2 other locations - About 1 hr to fix
src/Colors/HSVColor.php on lines 171..180
src/Colors/HSVColor.php on lines 202..211

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function setGreen(int $green) {
if (!$this -> checkRange($green, 0, self::GREEN_MAX)) {
throw new ValueOutOfBoundsException("red", $green, 0, self::GREEN_MAX);
}
Severity: Major
Found in src/Colors/RGBColor.php and 1 other location - About 1 hr to fix
src/Colors/RGBColor.php on lines 147..155

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function setBlue(int $blue) {
if (!$this -> checkRange($blue, 0, self::BLUE_MAX)) {
throw new ValueOutOfBoundsException("red", $blue, 0, self::BLUE_MAX);
}
 
 
Severity: Major
Found in src/Colors/RGBColor.php and 1 other location - About 1 hr to fix
src/Colors/RGBColor.php on lines 120..128

Method apply has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function apply(Image $image) : bool {
if ($this -> getArg4() !== null) {
return imagefilter(
$image -> getImageResource(),
$this -> getFilterID(),
Severity: Minor
Found in src/Filters/BuiltinFilter.php - About 1 hr to fix

Similar blocks of code found in 6 locations. Consider refactoring.
Open

public function setHue(int $hue) : self {
if (!$this -> checkRange($hue, 0, 359)) {
throw new ValueOutOfBoundsException("hue", $hue, 0, 359);
}
 
 
Severity: Major
Found in src/Colors/HSLColor.php and 5 other locations - About 1 hr to fix
src/Colors/HSLAColor.php on lines 74..82
src/Colors/HSLColor.php on lines 157..165
src/Colors/HSLColor.php on lines 191..199
src/Colors/Hex8Color.php on lines 101..109
src/Colors/RGBAColor.php on lines 70..78

Similar blocks of code found in 6 locations. Consider refactoring.
Open

public function setLightness(float $lightness) : self {
if (!$this -> checkRange($lightness, 0, 1)) {
throw new ValueOutOfBoundsException("lightness", $lightness, 0, 1);
}
 
 
Severity: Major
Found in src/Colors/HSLColor.php and 5 other locations - About 1 hr to fix
src/Colors/HSLAColor.php on lines 74..82
src/Colors/HSLColor.php on lines 123..131
src/Colors/HSLColor.php on lines 157..165
src/Colors/Hex8Color.php on lines 101..109
src/Colors/RGBAColor.php on lines 70..78

Similar blocks of code found in 6 locations. Consider refactoring.
Open

public function setAlpha(int $alpha) : self {
if (!$this -> checkRange($alpha, 0, 127)) {
throw new ValueOutOfBoundsException("alpha", $alpha, 0, 127);
}
 
 
Severity: Major
Found in src/Colors/Hex8Color.php and 5 other locations - About 1 hr to fix
src/Colors/HSLAColor.php on lines 74..82
src/Colors/HSLColor.php on lines 123..131
src/Colors/HSLColor.php on lines 157..165
src/Colors/HSLColor.php on lines 191..199
src/Colors/RGBAColor.php on lines 70..78

Similar blocks of code found in 6 locations. Consider refactoring.
Open

public function setSaturation(float $saturation) : self{
if (!$this -> checkRange($saturation, 0, 1)) {
throw new ValueOutOfBoundsException("saturation", $saturation, 0, 1);
}
 
 
Severity: Major
Found in src/Colors/HSLColor.php and 5 other locations - About 1 hr to fix
src/Colors/HSLAColor.php on lines 74..82
src/Colors/HSLColor.php on lines 123..131
src/Colors/HSLColor.php on lines 191..199
src/Colors/Hex8Color.php on lines 101..109
src/Colors/RGBAColor.php on lines 70..78

Similar blocks of code found in 6 locations. Consider refactoring.
Open

public function setAlpha(float $alpha) : self {
if (!$this -> checkRange($alpha, 0, 1)) {
throw new ValueOutOfBoundsException("alpha", $alpha, 0, 1);
}
Severity: Major
Found in src/Colors/HSLAColor.php and 5 other locations - About 1 hr to fix
src/Colors/HSLColor.php on lines 123..131
src/Colors/HSLColor.php on lines 157..165
src/Colors/HSLColor.php on lines 191..199
src/Colors/Hex8Color.php on lines 101..109
src/Colors/RGBAColor.php on lines 70..78

Similar blocks of code found in 6 locations. Consider refactoring.
Open

public function setAlpha(float $alpha) : self {
if (!$this -> checkRange($alpha, 0, 1)) {
throw new ValueOutOfBoundsException("alpha", $alpha, 0, 1);
}
 
 
Severity: Major
Found in src/Colors/RGBAColor.php and 5 other locations - About 1 hr to fix
src/Colors/HSLAColor.php on lines 74..82
src/Colors/HSLColor.php on lines 123..131
src/Colors/HSLColor.php on lines 157..165
src/Colors/HSLColor.php on lines 191..199
src/Colors/Hex8Color.php on lines 101..109

Method drawUnicolorBorder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

private function drawUnicolorBorder(Image $image): self {
$backgroundColor = $this->borderPattern->getColorAt(0, 0);
$image->registerColor($backgroundColor);
 
// Top
Severity: Minor
Found in src/Primitives/Rectangle.php - About 1 hr to fix
Severity
Category
Status
Source
Language