Showing 20 of 20 total issues
Method mime2Ext
has 187 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function mime2Ext(string $mime): ?string
{
$mimeMap = [
'video/3gpp2' => '3g2',
'video/3gp' => '3gp',
File ImageDispenser.php
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare(strict_types=1);
namespace ReliqArts\GuidedImage\Service;
ConfigProvider
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
final class ConfigProvider implements ConfigProviderContract
{
private const CONFIG_KEY_ALLOWED_EXTENSIONS = 'allowed_extensions';
private const CONFIG_KEY_ROUTES_CONTROLLERS = 'routes.controllers';
private const CONFIG_KEY_ROUTES_PREFIX = 'routes.prefix';
Method getImageThumbnail
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getImageThumbnail(Thumbnail $demand)
{
if (!$demand->isValid()) {
$this->logger->warning(
sprintf('Invalid demand for thumbnail image. Method: %s', $demand->getMethod()),
Method getResizedImage
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getResizedImage(Resize $demand)
{
$guidedImage = $demand->getGuidedImage();
$width = $demand->getWidth();
$height = $demand->getHeight();
Method upload
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function upload(UploadedFile $imageFile, bool $isUrlUpload = false): Result
{
if (!$this->validate($imageFile, $isUrlUpload)) {
return new Result(false, self::ERROR_INVALID_IMAGE);
}
Method register
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function register(): void
{
$this->configProvider = new ConfigProvider(
new ReliqArtsConfigProvider(
resolve(ConfigRepository::class),
Method resized
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ImageDispenser $imageDispenser,
Request $request,
GuidedImage $guidedImage,
$width,
$height,
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Request $request,
GuidedImage $guidedImage,
$width,
$height,
$aspect = true,
Method resized
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ImageDispenser $imageDispenser,
Request $request,
GuidedImage $guidedImage,
$width,
$height,
Method thumb
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ImageDispenser $imageDispenser,
Request $request,
GuidedImage $guidedImage,
string $method,
$width,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ConfigProvider $configProvider,
FilesystemManager $filesystemManager,
FileHelper $fileHelper,
ValidationFactory $validationFactory,
GuidedImage $guidedImage,
Method thumb
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ImageDispenser $imageDispenser,
Request $request,
GuidedImage $guidedImage,
$method,
$width,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Request $request,
GuidedImage $guidedImage,
string $method,
$width,
$height,
Method dummy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ImageDispenser $imageDispenser,
$width,
$height,
$color = '#eefefe',
$fill = false
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ConfigProvider $configProvider,
FilesystemManager $filesystemManager,
ImageManager $imageManager,
Logger $logger,
FileHelper $fileHelper
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
$width,
$height,
$color = null,
$filling = null,
$returnObject = null
Method dummy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ImageDispenser $imageDispenser,
$width,
$height,
$color = null,
$fill = null
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function __construct(Request $request, GuidedImage $guidedImage, $width, $height, $returnObject = null)
Function getImageThumbnail
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getImageThumbnail(Thumbnail $demand)
{
if (!$demand->isValid()) {
$this->logger->warning(
sprintf('Invalid demand for thumbnail image. Method: %s', $demand->getMethod()),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"