fulldecent/cameralife

View on GitHub

Showing 110 of 127 total issues

File Photo.php has 514 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace CameraLife\Models;

/**
 * Class Photo provides a front end to working with photos
Severity: Major
Found in sources/Models/Photo.php - About 1 day to fix

    Method doUpgrade has 177 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function doUpgrade()
        {
            //Database::beginTransaction();
            $sql = '
            CREATE TABLE "albums" (
    Severity: Major
    Found in sources/Models/SchemaUpdaterSqlite0.php - About 7 hrs to fix

      Function loadEXIF has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          private function loadEXIF($file)
          {
              $exif = @exif_read_data($file, 'IFD0', true);
              if ($exif === false) {
                  return;
      Severity: Minor
      Found in sources/Models/Photo.php - About 6 hrs 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 setupTables has 137 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function setupTables()
          {
              empty(self::$pdoConnection) && self::connect();
              $prefix = self::$prefix;
      
      
      Severity: Major
      Found in sources/Models/Database.php - About 5 hrs to fix

        Function listFiles has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            public function listFiles($path = '/', $recursive = true)
            {
                $fullpath = $this->baseDir . $path;
        
                // FEATURE // add " NOCL" to the end of a folder to exclude it
        Severity: Minor
        Found in sources/Models/FileStore.php - About 4 hrs 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 render has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            public function render()
            {
                echo "<h2>Settings for " . $this->moduleName . "</h2>\n";
                if (isset($module->about)) {
                    echo "<p class=\"lead\">" . $module->about . "</p>\n";
        Severity: Minor
        Found in sources/Views/AdminPreferencesView.php - About 4 hrs 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 loadEXIF has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function loadEXIF($file)
            {
                $exif = @exif_read_data($file, 'IFD0', true);
                if ($exif === false) {
                    return;
        Severity: Major
        Found in sources/Models/Photo.php - About 3 hrs to fix

          Method handleGet has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function handleGet($get, $post, $files, $cookies)
              {
                  // todo, get PREV and NEXT links from photo and use meta prev/next in HTML theme header
          
                  $this->htmlBareHeader($cookies);
          Severity: Major
          Found in sources/Controllers/PhotoController.php - About 3 hrs to fix

            Method checkPrerequesites has 93 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function checkPrerequesites()
                {
                    global $_SERVER;
                    $prerequesitesAreMet = true;
            
            
            Severity: Major
            Found in sources/Controllers/SetupInstallController.php - About 3 hrs to fix

              Method render has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function render()
                  {
                      if ($this->photo->get('status') != 0) {
                          echo '<p class="alert alert-danger lead"><strong>Notice:</strong> This photo is not publicly viewable</p>';
                      }
              Severity: Major
              Found in sources/Views/PhotoView.php - About 3 hrs to fix

                Photo has 29 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Photo extends IndexedModel
                {
                    public $record;
                
                    public $image;
                Severity: Minor
                Found in sources/Models/Photo.php - About 3 hrs to fix

                  Method render has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function render()
                      {
                          if (!count($this->openGraphsForTop)) {
                          ?>
                              </div>
                  Severity: Major
                  Found in sources/Views/MainPageView.php - About 3 hrs to fix

                    Method render has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function render()
                        {
                            echo <<<EOL
                            <!-- CAMERALIFE PHONE HOME Global site tag (gtag.js) - Google Analytics -->
                            <script async src="https://www.googletagmanager.com/gtag/js?id=UA-52764-13"></script>
                    Severity: Major
                    Found in sources/Views/AdminView.php - About 3 hrs to fix

                      File Database.php has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      namespace CameraLife\Models;
                      
                      /**
                       * PDO wrapper implementation of the database class
                      Severity: Minor
                      Found in sources/Models/Database.php - About 3 hrs to fix

                        Method handleGet has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function handleGet($get, $post, $files, $cookies)
                            {
                                $nextInstaller = null;
                                if (!Models\Database::installedSchemaIsCorrectVersion()) {
                                    $driver = Models\Database::driverName();
                        Severity: Major
                        Found in sources/Controllers/SetupUpgradeController.php - About 3 hrs to fix

                          Function imagerotateRightAngle has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function imagerotateRightAngle($imgSrc, $angle)
                              {
                                  // dimenstion of source image
                                  $srcX = imagesx($imgSrc);
                                  $srcY = imagesy($imgSrc);
                          Severity: Minor
                          Found in sources/Models/Image.php - About 2 hrs 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 render has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function render()
                              {
                                  //$counts = $this->statistics->getCounts();
                                  $popularPhotos = $this->statistics->getPopularPhotos();
                                  $popularAlbums = $this->statistics->getPopularTags();
                          Severity: Major
                          Found in sources/Views/StatisticsView.php - About 2 hrs to fix

                            Function findChangesOnDisk has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function findChangesOnDisk()
                                {
                                    $retval = array();
                            
                                    $fileStore = FileStore::fileStoreWithName('photo');
                            Severity: Minor
                            Found in sources/Models/Folder.php - About 2 hrs 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 handleGet has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function handleGet($get, $post, $files, $cookies)
                                {
                                    if (file_exists('../../config.php')) {
                                        throw new \Exception("Camera Life already appears to be set up, because modules/config.inc exists.");
                                    }
                            Severity: Major
                            Found in sources/Controllers/SetupInstallController.php - About 2 hrs to fix

                              Method render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function render()
                                  {
                                      echo "<h2>Site change logs</h2>";
                                      echo "<p class=\"lead\">";
                                      if ($this->checkpointId > 0) {
                              Severity: Major
                              Found in sources/Views/AdminLogsView.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language