fulldecent/cameralife

View on GitHub

Showing 110 of 127 total issues

Function photoSortSqlForOption has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function photoSortSqlForOption($option)
    {
        if ($option == 'newest') {
            return 'value desc, photos.id desc';
        } elseif ($option == 'oldest') {
Severity: Minor
Found in sources/Models/Search.php - About 45 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

Function render has a Cognitive Complexity of 8 (exceeds 5 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: Minor
Found in sources/Views/AdminView.php - About 45 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 handleRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static function handleRequest($get, $post, $files, $cookies, $server)
Severity: Minor
Found in sources/Controllers/Controller.php - About 35 mins to fix

    Function tagSortSqlForOption has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function tagSortSqlForOption($option)
        {
            if ($option == 'newest') {
                return 'albums.id desc';
            } elseif ($option == 'oldest') {
    Severity: Minor
    Found in sources/Models/Search.php - About 35 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

    Function handleGet has a Cognitive Complexity of 7 (exceeds 5 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/AdminThumbnailController.php - About 35 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

    Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render()
        {
            echo "<h2>Site change logs</h2>";
            echo "<p class=\"lead\">";
            if ($this->checkpointId > 0) {
    Severity: Minor
    Found in sources/Views/AdminLogsView.php - About 35 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

    Function folderSortSqlForOption has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function folderSortSqlForOption($option)
        {
            if ($option == 'newest') {
                return 'date desc';
            } elseif ($option == 'oldest') {
    Severity: Minor
    Found in sources/Models/Folder.php - About 35 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

    Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render()
        {
            echo "<h2>Site comments review</h2>";
            echo "<p class=\"lead\">";
            if ($this->checkpointId > 0) {
    Severity: Minor
    Found in sources/Views/AdminCommentsView.php - About 35 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

    Function isCacheMissing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isCacheMissing()
        {
            if ($this->record['modified'] == '1') {
                return true; //legacy before 2.7
            }
    Severity: Minor
    Found in sources/Models/Photo.php - About 35 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

    Function folderSortSqlForOption has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function folderSortSqlForOption($option)
        {
            if ($option == 'newest') {
                return 'id desc';
            } elseif ($option == 'oldest') {
    Severity: Minor
    Found in sources/Models/Search.php - About 35 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

    Avoid too many return statements within this method.
    Open

            return 'id desc';
    Severity: Major
    Found in sources/Models/Search.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return array();
      Severity: Major
      Found in sources/Models/FileStore.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return 'hits, photos.id';
        Severity: Major
        Found in sources/Models/Search.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return 'photos.id desc';
          Severity: Major
          Found in sources/Models/Search.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return 'albums.hits desc';
            Severity: Major
            Found in sources/Models/Search.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return 'albums.hits';
              Severity: Major
              Found in sources/Models/Search.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return 'hits desc';
                Severity: Major
                Found in sources/Models/Search.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return 'hits';
                  Severity: Major
                  Found in sources/Models/Search.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return 'hits desc';
                    Severity: Major
                    Found in sources/Models/Folder.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return 'id desc';
                      Severity: Major
                      Found in sources/Models/Folder.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language