reliqarts/laravel-guided-image

View on GitHub

Showing 20 of 20 total issues

Method mime2Ext has 187 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function mime2Ext(string $mime): ?string
    {
        $mimeMap = [
            'video/3gpp2' => '3g2',
            'video/3gp' => '3gp',
Severity: Major
Found in src/Helper/FileHelper.php - About 7 hrs to fix

    File ImageDispenser.php has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=1);
    
    namespace ReliqArts\GuidedImage\Service;
    Severity: Minor
    Found in src/Service/ImageDispenser.php - About 2 hrs to fix

      ConfigProvider has 22 functions (exceeds 20 allowed). Consider refactoring.
      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';
      Severity: Minor
      Found in src/Service/ConfigProvider.php - About 2 hrs to fix

        Method getImageThumbnail has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getImageThumbnail(Thumbnail $demand)
            {
                if (!$demand->isValid()) {
                    $this->logger->warning(
                        sprintf('Invalid demand for thumbnail image. Method: %s', $demand->getMethod()),
        Severity: Major
        Found in src/Service/ImageDispenser.php - About 2 hrs to fix

          Method getResizedImage has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getResizedImage(Resize $demand)
              {
                  $guidedImage = $demand->getGuidedImage();
                  $width = $demand->getWidth();
                  $height = $demand->getHeight();
          Severity: Major
          Found in src/Service/ImageDispenser.php - About 2 hrs to fix

            Method upload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function upload(UploadedFile $imageFile, bool $isUrlUpload = false): Result
                {
                    if (!$this->validate($imageFile, $isUrlUpload)) {
                        return new Result(false, self::ERROR_INVALID_IMAGE);
                    }
            Severity: Minor
            Found in src/Service/ImageUploader.php - About 1 hr to fix

              Method register has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function register(): void
                  {
                      $this->configProvider = new ConfigProvider(
                          new ReliqArtsConfigProvider(
                              resolve(ConfigRepository::class),
              Severity: Minor
              Found in src/ServiceProvider.php - About 1 hr to fix

                Method resized has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        ImageDispenser $imageDispenser,
                        Request $request,
                        GuidedImage $guidedImage,
                        $width,
                        $height,
                Severity: Major
                Found in src/Concern/Guide.php - About 50 mins to fix

                  Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          Request $request,
                          GuidedImage $guidedImage,
                          $width,
                          $height,
                          $aspect = true,
                  Severity: Major
                  Found in src/Demand/Resize.php - About 50 mins to fix

                    Method resized has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            ImageDispenser $imageDispenser,
                            Request $request,
                            GuidedImage $guidedImage,
                            $width,
                            $height,
                    Severity: Major
                    Found in src/Contract/ImageGuide.php - About 50 mins to fix

                      Method thumb has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              ImageDispenser $imageDispenser,
                              Request $request,
                              GuidedImage $guidedImage,
                              string $method,
                              $width,
                      Severity: Minor
                      Found in src/Contract/ImageGuide.php - About 45 mins to fix

                        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                ConfigProvider $configProvider,
                                FilesystemManager $filesystemManager,
                                FileHelper $fileHelper,
                                ValidationFactory $validationFactory,
                                GuidedImage $guidedImage,
                        Severity: Minor
                        Found in src/Service/ImageUploader.php - About 45 mins to fix

                          Method thumb has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  ImageDispenser $imageDispenser,
                                  Request $request,
                                  GuidedImage $guidedImage,
                                  $method,
                                  $width,
                          Severity: Minor
                          Found in src/Concern/Guide.php - About 45 mins to fix

                            Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    Request $request,
                                    GuidedImage $guidedImage,
                                    string $method,
                                    $width,
                                    $height,
                            Severity: Minor
                            Found in src/Demand/Thumbnail.php - About 45 mins to fix

                              Method dummy has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      ImageDispenser $imageDispenser,
                                      $width,
                                      $height,
                                      $color = '#eefefe',
                                      $fill = false
                              Severity: Minor
                              Found in src/Contract/ImageGuide.php - About 35 mins to fix

                                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        ConfigProvider $configProvider,
                                        FilesystemManager $filesystemManager,
                                        ImageManager $imageManager,
                                        Logger $logger,
                                        FileHelper $fileHelper
                                Severity: Minor
                                Found in src/Service/ImageDispenser.php - About 35 mins to fix

                                  Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          $width,
                                          $height,
                                          $color = null,
                                          $filling = null,
                                          $returnObject = null
                                  Severity: Minor
                                  Found in src/Demand/Dummy.php - About 35 mins to fix

                                    Method dummy has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                            ImageDispenser $imageDispenser,
                                            $width,
                                            $height,
                                            $color = null,
                                            $fill = null
                                    Severity: Minor
                                    Found in src/Concern/Guide.php - About 35 mins to fix

                                      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          public function __construct(Request $request, GuidedImage $guidedImage, $width, $height, $returnObject = null)
                                      Severity: Minor
                                      Found in src/Demand/ExistingImage.php - About 35 mins to fix

                                        Function getImageThumbnail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function getImageThumbnail(Thumbnail $demand)
                                            {
                                                if (!$demand->isValid()) {
                                                    $this->logger->warning(
                                                        sprintf('Invalid demand for thumbnail image. Method: %s', $demand->getMethod()),
                                        Severity: Minor
                                        Found in src/Service/ImageDispenser.php - About 25 mins to fix

                                        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"

                                        Further reading

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language