autowp/image

View on GitHub

Showing 100 of 100 total issues

Method changeImageName has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function changeImageName(int $imageId, array $options = []): void
    {
        $imageRow = $this->getImageRow($imageId);
        if (! $imageRow) {
            throw new Storage\Exception("Image `$imageId` not found");
Severity: Minor
Found in src/Storage.php - About 1 hr to fix

    Method setImageCrop has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setImageCrop(int $imageId, ?array $crop): void
        {
            if (! $imageId) {
                throw new Storage\Exception("Invalid image id provided `$imageId`");
            }
    Severity: Minor
    Found in src/Storage.php - About 1 hr to fix

      Avoid excessively long variable names like $insertAttemptException. Keep variable name length under 20.
      Open

              $insertAttemptException = null;
      Severity: Minor
      Found in src/Storage.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid excessively long variable names like $formatedImageTableName. Keep variable name length under 20.
      Open

          private string $formatedImageTableName = 'formated_image';
      Severity: Minor
      Found in src/Storage.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid excessively long variable names like $insertAttemptException. Keep variable name length under 20.
      Open

              $insertAttemptException = null;
      Severity: Minor
      Found in src/Storage.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Method getConsoleConfig has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getConsoleConfig(): array
          {
              return [
                  'router' => [
                      'routes' => [
      Severity: Minor
      Found in src/ConfigProvider.php - About 1 hr to fix

        Method convertByOuterFit has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function convertByOuterFit(Imagick $imagick, Sampler\Format $format): Imagick
            {
                $srcWidth  = $imagick->getImageWidth();
                $srcHeight = $imagick->getImageHeight();
                $srcRatio  = $srcWidth / $srcHeight;
        Severity: Minor
        Found in src/Sampler.php - About 1 hr to fix

          Method getImageResolution has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getImageResolution(int $imageId): ?array
              {
                  $imageRow = $this->getImageRow($imageId);
          
                  if (! $imageRow) {
          Severity: Minor
          Found in src/Storage.php - About 1 hr to fix

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

                private function getFormatedImageRows(array $imagesId, string $formatName): array
                {
                    $destImageRows = [];
                    if (count($imagesId)) {
                        $select = $this->imageTable->getSql()->select()
            Severity: Minor
            Found in src/Storage.php - About 1 hr to fix

              Function convertByInnerFit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function convertByInnerFit(Imagick $imagick, Sampler\Format $format): Imagick
                  {
                      $srcWidth  = $imagick->getImageWidth();
                      $srcHeight = $imagick->getImageHeight();
                      $srcRatio  = $srcWidth / $srcHeight;
              Severity: Minor
              Found in src/Sampler.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

              Function getFormatedImageRows has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getFormatedImageRows(array $imagesId, string $formatName): array
                  {
                      $destImageRows = [];
                      if (count($imagesId)) {
                          $select = $this->imageTable->getSql()->select()
              Severity: Minor
              Found in src/Storage.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 convertByInnerFit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function convertByInnerFit(Imagick $imagick, Sampler\Format $format): Imagick
                  {
                      $srcWidth  = $imagick->getImageWidth();
                      $srcHeight = $imagick->getImageHeight();
                      $srcRatio  = $srcWidth / $srcHeight;
              Severity: Minor
              Found in src/Sampler.php - About 1 hr to fix

                Method generateLockWrite has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function generateLockWrite(string $dirName, array $options, int $width, int $height, Closure $callback): int
                    {
                        $insertAttemptException = null;
                        $imageId                = 0;
                        $attemptIndex           = 0;
                Severity: Minor
                Found in src/Storage.php - About 1 hr to fix

                  Function setImageCrop has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function setImageCrop(int $imageId, ?array $crop): void
                      {
                          if (! $imageId) {
                              throw new Storage\Exception("Invalid image id provided `$imageId`");
                          }
                  Severity: Minor
                  Found in src/Storage.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

                  Function extendVertical has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function extendVertical(Imagick $imagick, Sampler\Format $format): void
                      {
                          $fRatio = (int) $format->getWidth() / (int) $format->getHeight();
                  
                          $srcWidth  = $imagick->getImageWidth();
                  Severity: Minor
                  Found in src/Sampler.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

                  Function convertByMaximumFit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function convertByMaximumFit(Imagick $imagick, Sampler\Format $format): Imagick
                      {
                          $srcWidth  = $imagick->getImageWidth();
                          $srcHeight = $imagick->getImageHeight();
                          $srcRatio  = $srcWidth / $srcHeight;
                  Severity: Minor
                  Found in src/Sampler.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

                  Function convertByOuterFit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function convertByOuterFit(Imagick $imagick, Sampler\Format $format): Imagick
                      {
                          $srcWidth  = $imagick->getImageWidth();
                          $srcHeight = $imagick->getImageHeight();
                          $srcRatio  = $srcWidth / $srcHeight;
                  Severity: Minor
                  Found in src/Sampler.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

                  Function extendHorizontal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function extendHorizontal(Imagick $imagick, Sampler\Format $format): void
                      {
                          $fRatio = (int) $format->getWidth() / (int) $format->getHeight();
                  
                          $srcWidth  = $imagick->getImageWidth();
                  Severity: Minor
                  Found in src/Sampler.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 convertByMaximumFit has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function convertByMaximumFit(Imagick $imagick, Sampler\Format $format): Imagick
                      {
                          $srcWidth  = $imagick->getImageWidth();
                          $srcHeight = $imagick->getImageHeight();
                          $srcRatio  = $srcWidth / $srcHeight;
                  Severity: Minor
                  Found in src/Sampler.php - About 1 hr to fix

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

                        private function extendEdgeColor(ImagickPixelIterator $iterator): ?ImagickPixel
                        {
                            $sum = [
                                'r' => [],
                                'g' => [],
                    Severity: Minor
                    Found in src/Sampler.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language