src/Application/Model/Components/ElemBitmap.php
Method resizeImage
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
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');
}
Missing class import via use statement (line '141', column '47'). Open
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
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
Missing class import via use statement (line '152', column '48'). Open
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
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 resizeImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
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
}
}
}