mambax7/extgallery

View on GitHub
class/PhotoHandler.php

Summary

Maintainability
F
6 days
Test Coverage

getAlbumPhotoAdminPage accesses the super-global variable $GLOBALS.
Open

    public function getAlbumPhotoAdminPage($catId, $start)
    {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('cat_id', $catId));
        $criteria->add(new Criteria('photo_approved', 1));
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

postPhotoTraitement accesses the super-global variable $_POST.
Open

    public function postPhotoTraitement($file, $checkMd5 = false)
    {
        //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';

        $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

makeFileName accesses the super-global variable $GLOBALS.
Open

    public function makeFileName($fileName)
    {
        //DNPROSSI
        //$fileName = preg_replace("/[^a-zA-Z0-9()_\.-]/", "-", $fileName);
        $fileName = \preg_replace("/[^a-zA-Z0-9_\.-]/", '-', $fileName);
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

postPhotoTraitement accesses the super-global variable $_POST.
Open

    public function postPhotoTraitement($file, $checkMd5 = false)
    {
        //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';

        $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getAlbumPhotoAdminPage accesses the super-global variable $GLOBALS.
Open

    public function getAlbumPhotoAdminPage($catId, $start)
    {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('cat_id', $catId));
        $criteria->add(new Criteria('photo_approved', 1));
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

postPhotoTraitement accesses the super-global variable $_POST.
Open

    public function postPhotoTraitement($file, $checkMd5 = false)
    {
        //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';

        $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getAlbumPhotoPage accesses the super-global variable $GLOBALS.
Open

    public function getAlbumPhotoPage($catId, $start, $sortby, $orderby)
    {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('cat_id', $catId));
        $criteria->add(new Criteria('photo_approved', 1));
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

_makeWatermark accesses the super-global variable $GLOBALS.
Open

    public function _makeWatermark($imageTransform)
    {
        if (!\function_exists('imagettfbbox')) {
            return;
        }
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getSlideshowAlbumPhoto accesses the super-global variable $GLOBALS.
Open

    public function getSlideshowAlbumPhoto($catId)
    {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('cat_id', $catId));
        $criteria->add(new Criteria('photo_approved', 1));
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getAlbumPhotoPage accesses the super-global variable $GLOBALS.
Open

    public function getAlbumPhotoPage($catId, $start, $sortby, $orderby)
    {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('cat_id', $catId));
        $criteria->add(new Criteria('photo_approved', 1));
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

makeFileName accesses the super-global variable $GLOBALS.
Open

    public function makeFileName($fileName)
    {
        //DNPROSSI
        //$fileName = preg_replace("/[^a-zA-Z0-9()_\.-]/", "-", $fileName);
        $fileName = \preg_replace("/[^a-zA-Z0-9_\.-]/", '-', $fileName);
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

postPhotoTraitement accesses the super-global variable $_POST.
Open

    public function postPhotoTraitement($file, $checkMd5 = false)
    {
        //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';

        $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

addLocalPhoto accesses the super-global variable $GLOBALS.
Open

    public function addLocalPhoto(
        $catId,
        $dirtyPhotoName,
        $photoTitle = '',
        $photoDesc = '',
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

addLocalPhoto accesses the super-global variable $GLOBALS.
Open

    public function addLocalPhoto(
        $catId,
        $dirtyPhotoName,
        $photoTitle = '',
        $photoDesc = '',
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

addLocalPhoto accesses the super-global variable $GLOBALS.
Open

    public function addLocalPhoto(
        $catId,
        $dirtyPhotoName,
        $photoTitle = '',
        $photoDesc = '',
Severity: Minor
Found in class/PhotoHandler.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

File PhotoHandler.php has 659 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Extgallery;

/**
Severity: Major
Found in class/PhotoHandler.php - About 1 day to fix

    PhotoHandler has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PhotoHandler extends Extgallery\PersistableObjectHandler
    {
        public $photoUploader = null;
    
        /**
    Severity: Minor
    Found in class/PhotoHandler.php - About 6 hrs to fix

      The class PhotoHandler has an overall complexity of 119 which is very high. The configured complexity threshold is 50.
      Open

      class PhotoHandler extends Extgallery\PersistableObjectHandler
      {
          public $photoUploader = null;
      
          /**
      Severity: Minor
      Found in class/PhotoHandler.php by phpmd

      The class PhotoHandler has 23 public methods. Consider refactoring PhotoHandler to keep number of public methods under 10.
      Open

      class PhotoHandler extends Extgallery\PersistableObjectHandler
      {
          public $photoUploader = null;
      
          /**
      Severity: Minor
      Found in class/PhotoHandler.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      Method postPhotoTraitement has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function postPhotoTraitement($file, $checkMd5 = false)
          {
              //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
      
              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
      Severity: Major
      Found in class/PhotoHandler.php - About 2 hrs to fix

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

            public function _makeWatermark($imageTransform)
            {
                if (!\function_exists('imagettfbbox')) {
                    return;
                }
        Severity: Minor
        Found in class/PhotoHandler.php - About 1 hr to fix

          Method addLocalPhoto has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function addLocalPhoto(
                  $catId,
                  $dirtyPhotoName,
                  $photoTitle = '',
                  $photoDesc = '',
          Severity: Minor
          Found in class/PhotoHandler.php - About 1 hr to fix

            Function postPhotoTraitement has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public function postPhotoTraitement($file, $checkMd5 = false)
                {
                    //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
            
                    $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
            Severity: Minor
            Found in class/PhotoHandler.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 _largePhotoTreatment has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _largePhotoTreatment($photoName)
                {
                    /** @var Extgallery\Helper $helper */
                    $helper = Extgallery\Helper::getInstance();
            
            
            Severity: Minor
            Found in class/PhotoHandler.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 getSearchedPhoto has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getSearchedPhoto($queryArray, $condition, $limit, $start, $userId)
                {
                    $criteria = new CriteriaCompo();
                    if ($userId > 0) {
                        $criteria->add(new Criteria('uid', $userId));
            Severity: Minor
            Found in class/PhotoHandler.php - About 1 hr to fix

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

                  public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
                  {
                      /** @var Extgallery\Helper $helper */
                      $helper = Extgallery\Helper::getInstance();
              
              
              Severity: Minor
              Found in class/PhotoHandler.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 _mediumPhotoTreatment has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
                  {
                      /** @var Extgallery\Helper $helper */
                      $helper = Extgallery\Helper::getInstance();
              
              
              Severity: Minor
              Found in class/PhotoHandler.php - About 1 hr to fix

                The class PhotoHandler has 49 public methods and attributes. Consider reducing the number of public items to less than 45.
                Open

                class PhotoHandler extends Extgallery\PersistableObjectHandler
                {
                    public $photoUploader = null;
                
                    /**
                Severity: Minor
                Found in class/PhotoHandler.php by phpmd

                ExcessivePublicCount

                Since: 0.1

                A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

                Example

                public class Foo {
                    public $value;
                    public $something;
                    public $var;
                    // [... more more public attributes ...]
                
                    public function doWork() {}
                    public function doMoreWork() {}
                    public function doWorkAgain() {}
                    // [... more more public methods ...]
                }

                Source https://phpmd.org/rules/codesize.html#excessivepubliccount

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

                    public function _makeWatermark($imageTransform)
                    {
                        if (!\function_exists('imagettfbbox')) {
                            return;
                        }
                Severity: Minor
                Found in class/PhotoHandler.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 getSearchedPhoto has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getSearchedPhoto($queryArray, $condition, $limit, $start, $userId)
                    {
                        $criteria = new CriteriaCompo();
                        if ($userId > 0) {
                            $criteria->add(new Criteria('uid', $userId));
                Severity: Minor
                Found in class/PhotoHandler.php - About 55 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

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

                        $catId,
                        $dirtyPhotoName,
                        $photoTitle = '',
                        $photoDesc = '',
                        $photoExtra = '',
                Severity: Minor
                Found in class/PhotoHandler.php - About 45 mins to fix

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

                      public function getSearchedPhoto($queryArray, $condition, $limit, $start, $userId)
                  Severity: Minor
                  Found in class/PhotoHandler.php - About 35 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return 1;
                    Severity: Major
                    Found in class/PhotoHandler.php - About 30 mins to fix

                      The method postPhotoTraitement() has 113 lines of code. Current threshold is set to 100. Avoid really long methods.
                      Open

                          public function postPhotoTraitement($file, $checkMd5 = false)
                          {
                              //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
                      
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      The method postPhotoTraitement() has an NPath complexity of 720. The configured NPath complexity threshold is 200.
                      Open

                          public function postPhotoTraitement($file, $checkMd5 = false)
                          {
                              //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
                      
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      NPathComplexity

                      Since: 0.1

                      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                      Example

                      class Foo {
                          function bar() {
                              // lots of complicated code
                          }
                      }

                      Source https://phpmd.org/rules/codesize.html#npathcomplexity

                      The class PhotoHandler has 1106 lines of code. Current threshold is 1000. Avoid really long classes.
                      Open

                      class PhotoHandler extends Extgallery\PersistableObjectHandler
                      {
                          public $photoUploader = null;
                      
                          /**
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      The method _mediumPhotoTreatment() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                      Open

                          public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
                          {
                              /** @var Extgallery\Helper $helper */
                              $helper = Extgallery\Helper::getInstance();
                      
                      
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CyclomaticComplexity

                      Since: 0.1

                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                      Example

                      // Cyclomatic Complexity = 11
                      class Foo {
                      1   public function example() {
                      2       if ($a == $b) {
                      3           if ($a1 == $b1) {
                                      fiddle();
                      4           } elseif ($a2 == $b2) {
                                      fiddle();
                                  } else {
                                      fiddle();
                                  }
                      5       } elseif ($c == $d) {
                      6           while ($c == $d) {
                                      fiddle();
                                  }
                      7        } elseif ($e == $f) {
                      8           for ($n = 0; $n < $h; $n++) {
                                      fiddle();
                                  }
                              } else {
                                  switch ($z) {
                      9               case 1:
                                          fiddle();
                                          break;
                      10              case 2:
                                          fiddle();
                                          break;
                      11              case 3:
                                          fiddle();
                                          break;
                                      default:
                                          fiddle();
                                          break;
                                  }
                              }
                          }
                      }

                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                      The method _makeWatermark() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                      Open

                          public function _makeWatermark($imageTransform)
                          {
                              if (!\function_exists('imagettfbbox')) {
                                  return;
                              }
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CyclomaticComplexity

                      Since: 0.1

                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                      Example

                      // Cyclomatic Complexity = 11
                      class Foo {
                      1   public function example() {
                      2       if ($a == $b) {
                      3           if ($a1 == $b1) {
                                      fiddle();
                      4           } elseif ($a2 == $b2) {
                                      fiddle();
                                  } else {
                                      fiddle();
                                  }
                      5       } elseif ($c == $d) {
                      6           while ($c == $d) {
                                      fiddle();
                                  }
                      7        } elseif ($e == $f) {
                      8           for ($n = 0; $n < $h; $n++) {
                                      fiddle();
                                  }
                              } else {
                                  switch ($z) {
                      9               case 1:
                                          fiddle();
                                          break;
                      10              case 2:
                                          fiddle();
                                          break;
                      11              case 3:
                                          fiddle();
                                          break;
                                      default:
                                          fiddle();
                                          break;
                                  }
                              }
                          }
                      }

                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                      The method postPhotoTraitement() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                      Open

                          public function postPhotoTraitement($file, $checkMd5 = false)
                          {
                              //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
                      
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CyclomaticComplexity

                      Since: 0.1

                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                      Example

                      // Cyclomatic Complexity = 11
                      class Foo {
                      1   public function example() {
                      2       if ($a == $b) {
                      3           if ($a1 == $b1) {
                                      fiddle();
                      4           } elseif ($a2 == $b2) {
                                      fiddle();
                                  } else {
                                      fiddle();
                                  }
                      5       } elseif ($c == $d) {
                      6           while ($c == $d) {
                                      fiddle();
                                  }
                      7        } elseif ($e == $f) {
                      8           for ($n = 0; $n < $h; $n++) {
                                      fiddle();
                                  }
                              } else {
                                  switch ($z) {
                      9               case 1:
                                          fiddle();
                                          break;
                      10              case 2:
                                          fiddle();
                                          break;
                      11              case 3:
                                          fiddle();
                                          break;
                                      default:
                                          fiddle();
                                          break;
                                  }
                              }
                          }
                      }

                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                      The method postPhotoTraitement has a boolean flag argument $checkMd5, which is a certain sign of a Single Responsibility Principle violation.
                      Open

                          public function postPhotoTraitement($file, $checkMd5 = false)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      BooleanArgumentFlag

                      Since: 1.4.0

                      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                      Example

                      class Foo {
                          public function bar($flag = true) {
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                      Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_makeWatermark'.
                      Open

                              $helper = Extgallery\Helper::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_getImageDimension'.
                      Open

                              $helper = Extgallery\Helper::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method 'getAutoDescription'.
                      Open

                              $helper = Extgallery\Helper::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

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

                              } else {
                                  $imageTransform->load($this->getUploadPhotoPath() . 'medium/' . $photoName);
                                  $ret['width']  = $imageTransform->getImageWidth();
                                  $ret['height'] = $imageTransform->getImageHeight();
                              }
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ElseExpression

                      Since: 1.4.0

                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                      Example

                      class Foo
                      {
                          public function bar($flag)
                          {
                              if ($flag) {
                                  // one branch
                              } else {
                                  // another branch
                              }
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#elseexpression

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

                              } else {
                                  $borderSize = 0;
                              }
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ElseExpression

                      Since: 1.4.0

                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                      Example

                      class Foo
                      {
                          public function bar($flag)
                          {
                              if ($flag) {
                                  // one branch
                              } else {
                                  // another branch
                              }
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#elseexpression

                      Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_makeThumb'.
                      Open

                              $helper = Extgallery\Helper::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

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

                              } else {
                                  $criteria = new Criteria('cat_id', '(0)', 'IN');
                              }
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ElseExpression

                      Since: 1.4.0

                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                      Example

                      class Foo
                      {
                          public function bar($flag)
                          {
                              if ($flag) {
                                  // one branch
                              } else {
                                  // another branch
                              }
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#elseexpression

                      Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_mediumPhotoTreatment'.
                      Open

                              $helper = Extgallery\Helper::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_largePhotoTreatment'.
                      Open

                              $helper = Extgallery\Helper::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_makeBorder'.
                      Open

                              $helper = Extgallery\Helper::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'.
                      Open

                              if (Request::hasVar('photo_title', 'POST')) {
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'.
                      Open

                              $jupart  = Request::getInt('jupart', 0, 'POST');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\XoopsModules\Extgallery\PublicPermHandler' in method 'addLocalPhoto'.
                      Open

                              $permHandler = Extgallery\PublicPermHandler::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

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

                              } else {
                                  // We got a chunk, so we don't add photo to database
                                  if ($jupart && !$jufinal) {
                                      return 5;
                                  }
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ElseExpression

                      Since: 1.4.0

                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                      Example

                      class Foo
                      {
                          public function bar($flag)
                          {
                              if ($flag) {
                                  // one branch
                              } else {
                                  // another branch
                              }
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#elseexpression

                      Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'.
                      Open

                              $catId = Request::getInt('cat_id', 0, 'POST');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'.
                      Open

                              $jufinal = Request::getInt('jufinal', 1, 'POST');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'.
                      Open

                              if (Request::hasVar('photo_extra', 'POST')) {
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

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

                                  } else {
                                      $title = $photo->getVar('photo_desc');
                                  }
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ElseExpression

                      Since: 1.4.0

                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                      Example

                      class Foo
                      {
                          public function bar($flag)
                          {
                              if ($flag) {
                                  // one branch
                              } else {
                                  // another branch
                              }
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#elseexpression

                      Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'.
                      Open

                              if (Request::hasVar('photo_desc', 'POST')) {
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method 'addLocalPhoto'.
                      Open

                              $helper = Extgallery\Helper::getInstance();
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'.
                      Open

                              if (Request::hasVar('tag', 'POST')) {
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      StaticAccess

                      Since: 1.4.0

                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                      Example

                      class Foo
                      {
                          public function bar()
                          {
                              Bar::baz();
                          }
                      }

                      Source https://phpmd.org/rules/cleancode.html#staticaccess

                      The method getUploadPhotoPath() contains an exit expression.
                      Open

                              exit('getUploadPhotoPath() method must be defined on sub classes');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ExitExpression

                      Since: 0.2

                      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                      Example

                      class Foo {
                          public function bar($param)  {
                              if ($param === 42) {
                                  exit(23);
                              }
                          }
                      }

                      Source https://phpmd.org/rules/design.html#exitexpression

                      The method deleteFile() contains an exit expression.
                      Open

                              exit('deleteFile() method must be defined on sub classes');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ExitExpression

                      Since: 0.2

                      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                      Example

                      class Foo {
                          public function bar($param)  {
                              if ($param === 42) {
                                  exit(23);
                              }
                          }
                      }

                      Source https://phpmd.org/rules/design.html#exitexpression

                      The method getAllSize() contains an exit expression.
                      Open

                              exit('getAllSize() method must be defined on sub classes');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ExitExpression

                      Since: 0.2

                      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                      Example

                      class Foo {
                          public function bar($param)  {
                              if ($param === 42) {
                                  exit(23);
                              }
                          }
                      }

                      Source https://phpmd.org/rules/design.html#exitexpression

                      Avoid unused parameters such as '$checkMd5'.
                      Open

                          public function postPhotoTraitement($file, $checkMd5 = false)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      UnusedFormalParameter

                      Since: 0.2

                      Avoid passing parameters to methods or constructors and then not using those parameters.

                      Example

                      class Foo
                      {
                          private function bar($howdy)
                          {
                              // $howdy is not used
                          }
                      }

                      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                      Avoid unused local variables such as '$catHandler'.
                      Open

                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      UnusedLocalVariable

                      Since: 0.2

                      Detects when a local variable is declared and/or assigned, but not used.

                      Example

                      class Foo {
                          public function doSomething()
                          {
                              $i = 5; // Unused
                          }
                      }

                      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                          public function getAlbumPrevPhoto($catId, $photoId)
                          {
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      
                              $criteria = new CriteriaCompo();
                      Severity: Major
                      Found in class/PhotoHandler.php and 3 other locations - About 3 hrs to fix
                      class/PhotoHandler.php on lines 267..281
                      class/PublicPhotoHandler.php on lines 116..130
                      class/PublicPhotoHandler.php on lines 138..152

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 148.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                          public function getAlbumNextPhoto($catId, $photoId)
                          {
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      
                              $criteria = new CriteriaCompo();
                      Severity: Major
                      Found in class/PhotoHandler.php and 3 other locations - About 3 hrs to fix
                      class/PhotoHandler.php on lines 245..259
                      class/PublicPhotoHandler.php on lines 116..130
                      class/PublicPhotoHandler.php on lines 138..152

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 148.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public function getAlbumCurrentPhotoPlace($catId, $photoId)
                          {
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      
                              $criteria = new CriteriaCompo();
                      Severity: Major
                      Found in class/PhotoHandler.php and 1 other location - About 2 hrs to fix
                      class/PublicPhotoHandler.php on lines 160..173

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 139.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                          public function getTopViewPhoto($param)
                          {
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      
                              $criteria = new CriteriaCompo();
                      Severity: Major
                      Found in class/PhotoHandler.php and 3 other locations - About 2 hrs to fix
                      class/PhotoHandler.php on lines 1069..1082
                      class/PhotoHandler.php on lines 1109..1122
                      class/PhotoHandler.php on lines 1129..1142

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 123.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                          public function getTopEcardPhoto($param)
                          {
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      
                              $criteria = new CriteriaCompo();
                      Severity: Major
                      Found in class/PhotoHandler.php and 3 other locations - About 2 hrs to fix
                      class/PhotoHandler.php on lines 1069..1082
                      class/PhotoHandler.php on lines 1089..1102
                      class/PhotoHandler.php on lines 1109..1122

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 123.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                          public function getLastPhoto($param)
                          {
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      
                              $criteria = new CriteriaCompo();
                      Severity: Major
                      Found in class/PhotoHandler.php and 3 other locations - About 2 hrs to fix
                      class/PhotoHandler.php on lines 1089..1102
                      class/PhotoHandler.php on lines 1109..1122
                      class/PhotoHandler.php on lines 1129..1142

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 123.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                          public function getTopRatedPhoto($param)
                          {
                              $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
                      
                              $criteria = new CriteriaCompo();
                      Severity: Major
                      Found in class/PhotoHandler.php and 3 other locations - About 2 hrs to fix
                      class/PhotoHandler.php on lines 1069..1082
                      class/PhotoHandler.php on lines 1089..1102
                      class/PhotoHandler.php on lines 1129..1142

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 123.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Avoid variables with short names like $in. Configured minimum length is 3.
                      Open

                                  $in = '(' . $cats[0]->getVar('cat_id');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ShortVariable

                      Since: 0.2

                      Detects when a field, local, or parameter has a very short name.

                      Example

                      class Something {
                          private $q = 15; // VIOLATION - Field
                          public static function main( array $as ) { // VIOLATION - Formal
                              $r = 20 + $this->q; // VIOLATION - Local
                              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                  $r += $this->q;
                              }
                          }
                      }

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

                      Avoid variables with short names like $x. Configured minimum length is 3.
                      Open

                                  $x = 0;
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ShortVariable

                      Since: 0.2

                      Detects when a field, local, or parameter has a very short name.

                      Example

                      class Something {
                          private $q = 15; // VIOLATION - Field
                          public static function main( array $as ) { // VIOLATION - Formal
                              $r = 20 + $this->q; // VIOLATION - Local
                              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                  $r += $this->q;
                              }
                          }
                      }

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

                      Avoid variables with short names like $y. Configured minimum length is 3.
                      Open

                                  $y = 0;
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ShortVariable

                      Since: 0.2

                      Detects when a field, local, or parameter has a very short name.

                      Example

                      class Something {
                          private $q = 15; // VIOLATION - Field
                          public static function main( array $as ) { // VIOLATION - Formal
                              $r = 20 + $this->q; // VIOLATION - Local
                              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                  $r += $this->q;
                              }
                          }
                      }

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

                      Avoid variables with short names like $db. Configured minimum length is 3.
                      Open

                          public function __construct(XoopsDatabase $db, $type)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ShortVariable

                      Since: 0.2

                      Detects when a field, local, or parameter has a very short name.

                      Example

                      class Something {
                          private $q = 15; // VIOLATION - Field
                          public static function main( array $as ) { // VIOLATION - Formal
                              $r = 20 + $this->q; // VIOLATION - Local
                              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                  $r += $this->q;
                              }
                          }
                      }

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

                      Avoid variables with short names like $in. Configured minimum length is 3.
                      Open

                                  $in = '(' . $data[0];
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      ShortVariable

                      Since: 0.2

                      Detects when a field, local, or parameter has a very short name.

                      Example

                      class Something {
                          private $q = 15; // VIOLATION - Field
                          public static function main( array $as ) { // VIOLATION - Formal
                              $r = 20 + $this->q; // VIOLATION - Local
                              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                  $r += $this->q;
                              }
                          }
                      }

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

                      There must be one blank line after the last USE statement; 11 found;
                      Open

                      use function md5;
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Method name "_largePhotoTreatment" should not be prefixed with an underscore to indicate visibility
                      Open

                          public function _largePhotoTreatment($photoName)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Method name "_makeBorder" should not be prefixed with an underscore to indicate visibility
                      Open

                          public function _makeBorder($imageTransform)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Method name "_haveLargePhoto" should not be prefixed with an underscore to indicate visibility
                      Open

                          public function _haveLargePhoto($photoName)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Method name "_makeWatermark" should not be prefixed with an underscore to indicate visibility
                      Open

                          public function _makeWatermark($imageTransform)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Method name "_makeThumb" should not be prefixed with an underscore to indicate visibility
                      Open

                          public function _makeThumb($photoName)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Method name "_getImageDimension" should not be prefixed with an underscore to indicate visibility
                      Open

                          public function _getImageDimension($photoName)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Method name "_mediumPhotoTreatment" should not be prefixed with an underscore to indicate visibility
                      Open

                          public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      The 'getPhoto()' method which returns a boolean should be named 'is...()' or 'has...()'
                      Open

                          public function getPhoto($photoId)
                          {
                              $criteria = new CriteriaCompo();
                              $criteria->add(new Criteria('photo_id', $photoId));
                              $criteria->add(new Criteria('photo_approved', 1));
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      BooleanGetMethodName

                      Since: 0.2

                      Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

                      Example

                      class Foo {
                          /**
                           * @return boolean
                           */
                          public function getFoo() {} // bad
                          /**
                           * @return bool
                           */
                          public function isFoo(); // ok
                          /**
                           * @return boolean
                           */
                          public function getFoo($bar); // ok, unless checkParameterizedMethods=true
                      }

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

                      Line exceeds 120 characters; contains 137 characters
                      Open

                              //        $allowedMimeTypes = array('jpg/jpeg', 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpg', 'image/x-png', 'image/png');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Line exceeds 120 characters; contains 143 characters
                      Open

                              $photoStatus = $this->addLocalPhoto($catId, $this->photoUploader->getSavedFileName(), $photoTitle, $photoDesc, $photoExtra, $photoTag);
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Line exceeds 120 characters; contains 160 characters
                      Open

                              $sql = 'SELECT photo_id FROM ' . $this->db->prefix('extgallery_publicphoto') . ' ' . $criteria->renderWhere() . ' ORDER BY photo_weight, photo_id ASC;';
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Line exceeds 120 characters; contains 130 characters
                      Open

                              $imageTransform->fit($helper->getConfig('medium_width') - $borderSize, $helper->getConfig('medium_heigth') - $borderSize);
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Line exceeds 120 characters; contains 140 characters
                      Open

                              $text = (0 == $helper->getConfig('watermark_type')) ? $GLOBALS['xoopsUser']->getVar('uname') : $helper->getConfig('watermark_text');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      Line exceeds 120 characters; contains 126 characters
                      Open

                                  $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); // xoops_getModuleHandler('tag', 'tag');
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpcodesniffer

                      The method _makeThumb is not named in camelCase.
                      Open

                          public function _makeThumb($photoName)
                          {
                              /** @var Extgallery\Helper $helper */
                              $helper = Extgallery\Helper::getInstance();
                      
                      
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CamelCaseMethodName

                      Since: 0.2

                      It is considered best practice to use the camelCase notation to name methods.

                      Example

                      class ClassName {
                          public function get_name() {
                          }
                      }

                      Source

                      The method _getImageDimension is not named in camelCase.
                      Open

                          public function _getImageDimension($photoName)
                          {
                              /** @var Extgallery\Helper $helper */
                              $helper = Extgallery\Helper::getInstance();
                      
                      
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CamelCaseMethodName

                      Since: 0.2

                      It is considered best practice to use the camelCase notation to name methods.

                      Example

                      class ClassName {
                          public function get_name() {
                          }
                      }

                      Source

                      The method _mediumPhotoTreatment is not named in camelCase.
                      Open

                          public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
                          {
                              /** @var Extgallery\Helper $helper */
                              $helper = Extgallery\Helper::getInstance();
                      
                      
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CamelCaseMethodName

                      Since: 0.2

                      It is considered best practice to use the camelCase notation to name methods.

                      Example

                      class ClassName {
                          public function get_name() {
                          }
                      }

                      Source

                      The method _makeBorder is not named in camelCase.
                      Open

                          public function _makeBorder($imageTransform)
                          {
                              /** @var Extgallery\Helper $helper */
                              $helper = Extgallery\Helper::getInstance();
                      
                      
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CamelCaseMethodName

                      Since: 0.2

                      It is considered best practice to use the camelCase notation to name methods.

                      Example

                      class ClassName {
                          public function get_name() {
                          }
                      }

                      Source

                      The method _haveLargePhoto is not named in camelCase.
                      Open

                          public function _haveLargePhoto($photoName)
                          {
                              return \file_exists($this->getUploadPhotoPath() . 'large/large_' . $photoName);
                          }
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CamelCaseMethodName

                      Since: 0.2

                      It is considered best practice to use the camelCase notation to name methods.

                      Example

                      class ClassName {
                          public function get_name() {
                          }
                      }

                      Source

                      The method _makeWatermark is not named in camelCase.
                      Open

                          public function _makeWatermark($imageTransform)
                          {
                              if (!\function_exists('imagettfbbox')) {
                                  return;
                              }
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CamelCaseMethodName

                      Since: 0.2

                      It is considered best practice to use the camelCase notation to name methods.

                      Example

                      class ClassName {
                          public function get_name() {
                          }
                      }

                      Source

                      The method _largePhotoTreatment is not named in camelCase.
                      Open

                          public function _largePhotoTreatment($photoName)
                          {
                              /** @var Extgallery\Helper $helper */
                              $helper = Extgallery\Helper::getInstance();
                      
                      
                      Severity: Minor
                      Found in class/PhotoHandler.php by phpmd

                      CamelCaseMethodName

                      Since: 0.2

                      It is considered best practice to use the camelCase notation to name methods.

                      Example

                      class ClassName {
                          public function get_name() {
                          }
                      }

                      Source

                      There are no issues that match your filters.

                      Category
                      Status