1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | |||
0 ignored issues
–
show
|
|||
3 | namespace UniSharp\Uploadable\Plugins; |
||
4 | |||
5 | use Intervention\Image\Facades\Image; |
||
6 | use Illuminate\Support\Facades\Storage; |
||
7 | |||
8 | class WatermarkPlugin |
||
0 ignored issues
–
show
|
|||
9 | { |
||
0 ignored issues
–
show
|
|||
10 | 2 | public function handle($path) |
|
0 ignored issues
–
show
|
|||
11 | { |
||
0 ignored issues
–
show
|
|||
12 | 2 | $image = Image::make($path); |
|
13 | 2 | $image->insert($this->getWatermark($image), 'bottom-right'); |
|
14 | 2 | $image->save(); |
|
15 | 2 | } |
|
0 ignored issues
–
show
|
|||
16 | |||
17 | 2 | protected function getWatermark($image) |
|
0 ignored issues
–
show
|
|||
18 | { |
||
0 ignored issues
–
show
|
|||
19 | 2 | $storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix(); |
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
20 | 2 | $watermarkPath = $storagePath . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'watermark.png'; |
|
0 ignored issues
–
show
|
|||
21 | 2 | $watermark = Image::make($watermarkPath); |
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
22 | |||
23 | 2 | $watermark->resize($image->getWidth() / 2.5, null, function ($constraint) { |
|
0 ignored issues
–
show
|
|||
24 | $constraint->aspectRatio(); |
||
25 | $constraint->upsize(); |
||
26 | 2 | }); |
|
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
27 | |||
28 | 2 | return $watermark; |
|
29 | } |
||
0 ignored issues
–
show
|
|||
30 | } |
||
0 ignored issues
–
show
|
|||
31 |