flyimg/flyimg

View on GitHub

OutputImage has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class OutputImage
{
    /** Content TYPE */
    const WEBP_MIME_TYPE = 'image/webp';
    const JPEG_MIME_TYPE = 'image/jpeg';
Severity: Minor
Found in src/Core/Entity/Image/OutputImage.php - About 2 hrs to fix

    Method fileInfoProvider has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function fileInfoProvider(): array
        {
            return [
                [
                    self::JPG_TEST_IMAGE,
    Severity: Minor
    Found in tests/Core/Entity/ImageMetaInfoTest.php - About 2 hrs to fix

      Method testParseOptions has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testParseOptions()
          {
              /**
               * This array needs to be updated every time we
               * add or remove a URL option in the config/parametesr.yml file.
      Severity: Minor
      Found in tests/Core/Entity/Image/OutputImageTest.php - About 1 hr to fix

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

            public function register(Container $app)
            {
                $s3Params = $app['params']->parameterByKey('aws_s3');
                if (in_array("", $s3Params)) {
                    throw new MissingParamsException("One of AWS S3 parameters in empty ! ");
        Severity: Minor
        Found in src/Core/StorageProvider/S3StorageProvider.php - About 1 hr to fix

          Method partialCropTestProvider has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function partialCropTestProvider(): array
              {
                  return [
                      // test partial crops without expanding
                      'Expand and partial crop to square a landscape' =>
          Severity: Minor
          Found in tests/Core/Processor/ImageProcessorTest.php - About 1 hr to fix

            Method generateSize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function generateSize(OutputImage $outputImage): array
                {
                    $targetWidth = $outputImage->extractKey('width');
                    $targetHeight = $outputImage->extractKey('height');
            
            
            Severity: Minor
            Found in src/Core/Processor/ImageProcessor.php - About 1 hr to fix

              Function generateSize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function generateSize(OutputImage $outputImage): array
                  {
                      $targetWidth = $outputImage->extractKey('width');
                      $targetHeight = $outputImage->extractKey('height');
              
              
              Severity: Minor
              Found in src/Core/Processor/ImageProcessor.php - About 1 hr 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

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

                  public function extract(InputImage $inputImage, int $topLeftX, int $topLeftY, int $bottomRightX, int $bottomRightY)
              Severity: Minor
              Found in src/Core/Processor/ExtractProcessor.php - About 35 mins to fix

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

                    protected function tearDown()
                    {
                        unset($this->ImageHandler);
                        unset($this->app);
                
                
                Severity: Minor
                Found in tests/Core/BaseTest.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