chamilo/chamilo-lms

View on GitHub

Course: Add custom image support for course links in homepage tools - refs #2863
#6039

christianbeeznest wants to merge christianbeeznest:GH-2863 into chamilo:master
Failed
36 issues to fix.

Showing 37 of 37 total issues

Missing function doc comment
New

public function __invoke(CLink $link, CShortcutRepository $shortcutRepository, AssetRepository $assetRepository): Response

Add a single space around assignment operators
New

declare(strict_types=1);

Missing class doc comment
New

class CLinkImageController

Missing function doc comment
New

public function __construct(EntityManagerInterface $entityManager)

Missing function doc comment
New

public function __invoke(CLink $link, Request $request): Response

Missing blank line before return statement
New

return new Response('Error creating cropped image', Response::HTTP_INTERNAL_SERVER_ERROR);

Blank line found at end of control structure
New

 
 

Only one argument is allowed per line in a multi-line function call
New

0, 0,

Only one argument is allowed per line in a multi-line function call
New

$srcX, $srcY,

Only one argument is allowed per line in a multi-line function call
New

$cropWidth, $cropHeight,

Only one argument is allowed per line in a multi-line function call
New

120, 120

Add a single space around assignment operators
New

declare(strict_types=1);

Missing class doc comment
New

final class Version20250118000100 extends AbstractMigrationChamilo

Missing function doc comment
New

public function getDescription(): string

Missing function doc comment
New

public function up(Schema $schema): void

Missing function doc comment
New

public function down(Schema $schema): void

Missing function doc comment
New

public function getCustomImageUrl(): ?string

Missing function doc comment
New

public function setCustomImageUrl(?string $customImageUrl): self

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
New

#[Groups(['cshortcut:read'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
New

#[ORM\ManyToOne(targetEntity: Asset::class, cascade: ['remove'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
New

#[ORM\JoinColumn(name: 'custom_image_id', referencedColumnName: 'id', onDelete: 'SET NULL')]

Line indented incorrectly; expected 8 spaces, found 4
New

private ?Asset $customImage = null;

Line indented incorrectly; expected 8 spaces, found 4
New

public function getCustomImage(): ?Asset

Missing function doc comment
New

public function getCustomImage(): ?Asset

Line indented incorrectly; expected at least 12 spaces, found 8
New

return $this->customImage;

Line indented incorrectly; expected 8 spaces, found 4
New

public function setCustomImage(?Asset $customImage): self

Missing function doc comment
New

public function setCustomImage(?Asset $customImage): self

Line indented incorrectly; expected at least 12 spaces, found 8
New

$this->customImage = $customImage;

Missing blank line before return statement
New

return $this;

The method __invoke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
New

} else {
$details['customImageUrl'] = null;
}

Remove error control operator '@' on line 61.
New

public function __invoke(CLink $link, Request $request): Response
{
$removeImage = $request->request->getBoolean('removeImage', false);
$file = $request->files->get('customImage');
 
 

Missing class import via use statement (line '85', column '23').
New

throw new \RuntimeException('Invalid image file');

Missing class import via use statement (line '99', column '27').
New

throw new \RuntimeException('Unsupported image type');

The method indexJson uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
New

} else {
$shortcut->setCustomImageUrl(null);
}

Avoid unused parameters such as '$schema'.
New

public function up(Schema $schema): void

Avoid unused parameters such as '$schema'.
New

public function down(Schema $schema): void

Missing function doc comment
Fixed

Severity: Minor
Found in src/CoreBundle/Controller/Api/CLinkDetailsController.php by phpcodesniffer
Category
Status