fulldecent/cameralife

View on GitHub

Showing 110 of 127 total issues

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

    public function generateThumbnail()
    {
        $this->loadImage(); // sets $this->EXIF and $this-record
        if ($this->record['modified'] == '1') {
            $this->record['modified'] = null; // legacy before 2.7
Severity: Minor
Found in sources/Models/Photo.php - About 1 hr to fix

    Method getRelated has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getRelated()
        {
            //todo pass in referrer
            global $_SERVER;
            $retval = array($this->getFolder());
    Severity: Minor
    Found in sources/Models/Photo.php - About 1 hr to fix

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

          public function render()
          {
              $start = $this->start;
              $total = $this->total;
              $perPage = $this->perPage;
      Severity: Minor
      Found in sources/Views/PageSelectorView.php - About 1 hr to fix

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

            public function render()
            {
                $message = $this->exception->getMessage();
        
                echo '<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">';
        Severity: Minor
        Found in sources/Views/ExceptionView.php - About 1 hr to fix

          Method listFiles has 40 lines of code (exceeds 25 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 1 hr to fix

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

                public function render()
                {
                    echo "<h2>Review New photos</h2>";
                    
                    $percentDone = 0;
            Severity: Minor
            Found in sources/Views/AdminPhotosView.php - About 1 hr to fix

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

                  public function render()
                  {
                        $gravitarHTML = htmlentities($this->currentUser->gravitarUrl());
                      ?>
              
              
              Severity: Minor
              Found in sources/Views/NavbarView.php - About 1 hr to fix

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

                    public function getMediaURL($scale = 'thumbnail')
                    {
                        $bucket = 'other';
                        $path = '';
                        if ($scale == 'photo') {
                Severity: Minor
                Found in sources/Models/Photo.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 handleGet has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function handleGet($get, $post, $files, $cookies)
                    {
                        $start = isset($get['start']) ? $get['start'] : 0;
                        $section = isset($get['section']) ? $get['section'] : null;
                        $this->model->setPage($start);
                Severity: Minor
                Found in sources/Controllers/FolderController.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 render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function render()
                    {
                        echo '<div>' . PHP_EOL;
                        foreach ($this->openGraphObjects as $view) {
                            $openGraphObject = $view;
                Severity: Minor
                Found in sources/Views/GridView.php - About 1 hr to fix

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

                      public static function loginWithAccessCode($code)
                      {
                          // todo: breaks mvc
                          global $_SERVER;
                          $cookie = bin2hex(random_bytes(16));
                  Severity: Minor
                  Found in sources/Models/User.php - About 1 hr to fix

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

                        public function getMediaURL($scale = 'thumbnail')
                        {
                            $bucket = 'other';
                            $path = '';
                            if ($scale == 'photo') {
                    Severity: Minor
                    Found in sources/Models/Photo.php - About 1 hr to fix

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

                          public function handleGet($get, $post, $files, $cookies)
                          {
                              if (Models\User::currentUser($cookies)->authorizationLevel < 5) {
                                  throw new \Exception('You are not authorized to view this page');
                              }
                      Severity: Minor
                      Found in sources/Controllers/AdminCommentsController.php - About 1 hr to fix

                        Method update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function update()
                            {
                                //TODO: NEED TEST CASES FOR THIS AND ACTUAL TESTING!!!!!!!
                                // move files / delete files / readd files (undelete) / UTF filenames
                                $retval = array();
                        Severity: Minor
                        Found in sources/Models/Folder.php - About 1 hr to fix

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

                              public function handleGet($get, $post, $files, $cookies)
                              {
                                  if (Models\User::currentUser($cookies)->authorizationLevel < 5) {
                                      throw new \Exception('You are not authorized to view this page');
                                  }
                          Severity: Minor
                          Found in sources/Controllers/AdminController.php - About 1 hr to fix

                            Method getFileForPhotoWithScale has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private static function getFileForPhotoWithScale(Models\Photo $photo, $scale)
                                {
                                    $extension = $photo->extension;
                                    $bucket = 'other';
                                    $path = '';
                            Severity: Minor
                            Found in sources/Controllers/MediaController.php - About 1 hr to fix

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

                                  public function handleGet($get, $post, $files, $cookies)
                                  {
                                      $photo = Models\Photo::getPhotoWithID($get['id']);
                                      $scale = isset($get['scale']) ? $get['scale'] : null;
                                      $extension = $photo->extension;
                              Severity: Minor
                              Found in sources/Controllers/MediaController.php - About 1 hr to fix

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

                                    public static function handleRequest($get, $post, $files, $cookies, $server)
                                    {
                                        try {
                                            $page = isset($get['page']) ? $get['page'] : 'mainPage';
                                            $dbIsCurrent = Models\Database::installedSchemaIsCorrectVersion();
                                Severity: Minor
                                Found in sources/Controllers/Controller.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 handleGet has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function handleGet($get, $post, $files, $cookies)
                                    {
                                        $photo = Models\Photo::getPhotoWithID($get['id']);
                                        $scale = isset($get['scale']) ? $get['scale'] : null;
                                        $extension = $photo->extension;
                                Severity: Minor
                                Found in sources/Controllers/MediaController.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function render()
                                    {
                                        $message = $this->exception->getMessage();
                                
                                        echo '<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">';
                                Severity: Minor
                                Found in sources/Views/ExceptionView.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

                                Severity
                                Category
                                Status
                                Source
                                Language