Showing 13 of 13 total issues
Method resizeImage
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resizeImage(int $width = 100, int $height = null)
{
if (!file_exists($this->sImgPath) || !is_readable($this->sImgPath)) {
throw new Exception('Image not exists');
}
Method toGreyScale
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function toGreyScale(int $tone = null)
{
if (is_null($tone)) {
return 'None';
}
The method setVisibleStatusLine has a boolean flag argument $isVisible, which is a certain sign of a Single Responsibility Principle violation. Open
public function setVisibleStatusLine(bool $isVisible = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '32', column '27'). Open
$this->oXml = new \SimpleXMLElement(sprintf('<?xml version="1.0" encoding="UTF-8"?><%s></%s>', $nodeRootName, $nodeRootName));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method setVisibleStatusLine has a boolean flag argument $isVisible, which is a certain sign of a Single Responsibility Principle violation. Open
public function setVisibleStatusLine(bool $isVisible = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '141', column '47'). Open
$imagick->setImageBackgroundColor(new \ImagickPixel('white'));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '151', column '23'). Open
$canvas = new \Imagick();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method setSelected has a boolean flag argument $isSelected, which is a certain sign of a Single Responsibility Principle violation. Open
public function setSelected(bool $isSelected = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '152', column '48'). Open
$canvas->newImage($width, $height, new \ImagickPixel('white'));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '123', column '24'). Open
$imagick = new \Imagick(realpath($this->sImgPath));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method ignoreCallUpdate has a boolean flag argument $ignoreCallUpdate, which is a certain sign of a Single Responsibility Principle violation. Open
public function ignoreCallUpdate(bool $ignoreCallUpdate = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '76', column '40'). Open
$dom = new \DOMDocument("1.0", 'UTF-8');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method resizeImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {//za wysoki
$imgHeight = $height;
$imgWidth = intval($height * $origFactor);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}