midasplatform/Midas

View on GitHub
core/controllers/BrowseController.php

Summary

Maintainability
F
5 days
Test Coverage

Function movecopyAction has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
Open

    public function movecopyAction()
    {
        $copytype = $this->getParam('copytype');
        if (isset($copytype) && $copytype == 'reference') {
            $shareSubmit = true;
Severity: Minor
Found in core/controllers/BrowseController.php - About 1 day 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

File BrowseController.php has 484 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*=========================================================================
 Midas Server
 Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France.
 All rights reserved.
Severity: Minor
Found in core/controllers/BrowseController.php - About 7 hrs to fix

Method movecopyAction has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function movecopyAction()
    {
        $copytype = $this->getParam('copytype');
        if (isset($copytype) && $copytype == 'reference') {
            $shareSubmit = true;
Severity: Major
Found in core/controllers/BrowseController.php - About 5 hrs to fix

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

    public function getfolderscontentAction()
    {
        $this->disableLayout();
        $this->disableView();

Severity: Major
Found in core/controllers/BrowseController.php - About 3 hrs to fix

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

class BrowseController extends AppController
{
    public $_models = array('User', 'Community', 'Folder', 'Item', 'ItemRevision');
    public $_daos = array('User', 'Community', 'Folder', 'Item');
    public $_components = array('Date', 'Utility', 'Sortdao');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

Function deleteAction has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteAction()
    {
        if (!$this->logged) {
            throw new Zend_Exception('You must be logged in to delete resources.');
        }
Severity: Minor
Found in core/controllers/BrowseController.php - About 3 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 getelementinfoAction has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getelementinfoAction()
    {
        $this->disableLayout();
        $this->disableView();
        $element = $this->getParam('type');
Severity: Major
Found in core/controllers/BrowseController.php - About 2 hrs to fix

Method deleteAction has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function deleteAction()
    {
        if (!$this->logged) {
            throw new Zend_Exception('You must be logged in to delete resources.');
        }
Severity: Major
Found in core/controllers/BrowseController.php - About 2 hrs to fix

Function getelementinfoAction has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getelementinfoAction()
    {
        $this->disableLayout();
        $this->disableView();
        $element = $this->getParam('type');
Severity: Minor
Found in core/controllers/BrowseController.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

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

    public function getfolderscontentAction()
    {
        $this->disableLayout();
        $this->disableView();

Severity: Minor
Found in core/controllers/BrowseController.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 getmaxpolicyAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getmaxpolicyAction()
    {
        $this->disableLayout();
        $this->disableView();

Severity: Minor
Found in core/controllers/BrowseController.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

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

    public function movecopyAction()
    {
        $copytype = $this->getParam('copytype');
        if (isset($copytype) && $copytype == 'reference') {
            $shareSubmit = true;
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

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

    public function getfolderscontentAction()
    {
        $this->disableLayout();
        $this->disableView();

Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

The method getfolderscontentAction() has an NPath complexity of 480. The configured NPath complexity threshold is 200.
Open

    public function getfolderscontentAction()
    {
        $this->disableLayout();
        $this->disableView();

Severity: Minor
Found in core/controllers/BrowseController.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 method movecopyAction() has an NPath complexity of 1741311. The configured NPath complexity threshold is 200.
Open

    public function movecopyAction()
    {
        $copytype = $this->getParam('copytype');
        if (isset($copytype) && $copytype == 'reference') {
            $shareSubmit = true;
Severity: Minor
Found in core/controllers/BrowseController.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 method deleteAction() has an NPath complexity of 234. The configured NPath complexity threshold is 200.
Open

    public function deleteAction()
    {
        if (!$this->logged) {
            throw new Zend_Exception('You must be logged in to delete resources.');
        }
Severity: Minor
Found in core/controllers/BrowseController.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 method movecopyAction() has a Cyclomatic Complexity of 38. The configured cyclomatic complexity threshold is 10.
Open

    public function movecopyAction()
    {
        $copytype = $this->getParam('copytype');
        if (isset($copytype) && $copytype == 'reference') {
            $shareSubmit = true;
Severity: Minor
Found in core/controllers/BrowseController.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 deleteAction() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
Open

    public function deleteAction()
    {
        if (!$this->logged) {
            throw new Zend_Exception('You must be logged in to delete resources.');
        }
Severity: Minor
Found in core/controllers/BrowseController.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 getfolderscontentAction() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Open

    public function getfolderscontentAction()
    {
        $this->disableLayout();
        $this->disableView();

Severity: Minor
Found in core/controllers/BrowseController.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 getelementinfoAction() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
Open

    public function getelementinfoAction()
    {
        $this->disableLayout();
        $this->disableView();
        $element = $this->getParam('type');
Severity: Minor
Found in core/controllers/BrowseController.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

Missing class import via use statement (line '87', column '27').
Open

                throw new Zend_Exception('Write permission required into the destination folder');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '430', column '31').
Open

                    throw new Zend_Exception('User does not have read permission on the community');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '528', column '23').
Open

            throw new Zend_Exception('You have no access to '.$type.' '.$id, 403);
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '95', column '35').
Open

                        throw new Zend_Exception('You must own a folder in order to move it');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '106', column '35').
Open

                        throw new Zend_Exception('You must have read permission on an item to share it');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '478', column '27').
Open

                throw new Zend_Exception('Please select the right type of element.');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '514', column '23').
Open

            throw new Zend_Exception('Must specify an id parameter');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '83', column '27').
Open

                throw new Zend_Exception('Unable to load destination');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '133', column '35').
Open

                        throw new Zend_Exception('Unable to load destination');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '180', column '27').
Open

                throw new Zend_Exception('No element selected');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '509', column '23').
Open

            throw new Zend_Exception('Must pass id and type parameters');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '128', column '35').
Open

                        throw new Zend_Exception('You must own an item in order to move it');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '136', column '35').
Open

                        throw new Zend_Exception('Unable to load move from folder');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '183', column '27').
Open

                throw new Zend_Exception(MIDAS_LOGIN_REQUIRED, 403);
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '419', column '26').
Open

        $validator = new Zend_Validate_Digits();
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '461', column '31').
Open

                    throw new Zend_Exception('User does not have read permission on the item');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '512', column '26').
Open

        $validator = new Zend_Validate_Digits();
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '122', column '35').
Open

                        throw new Zend_Exception('You must have read permission on an item to duplicate it');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '307', column '23').
Open

            throw new Zend_Exception('Please set the folder Id');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '80', column '27').
Open

                throw new Zend_Exception('No element selected');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '525', column '27').
Open

                throw new Zend_Exception('Parameter type must be either item or folder');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '312', column '23').
Open

            throw new Zend_Exception("Folder doesn't exist");
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '416', column '23').
Open

            throw new Zend_Exception('Please double check the parameters');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '421', column '23').
Open

            throw new Zend_Exception('Must specify an id parameter');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '441', column '31').
Open

                    throw new Zend_Exception('User does not have read permission on the folder');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '547', column '23').
Open

            throw new Zend_Exception('You must be logged in to delete resources.');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

                    } else {
                        // Do not update item name in item share action
                        $this->Folder->addItem($destinationFolder, $item, false);
                        $this->Item->addReadonlyPolicy($item, $destinationFolder);
                    }
Severity: Minor
Found in core/controllers/BrowseController.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 'JsonComponent' in method 'movecopyAction'.
Open

                echo JsonComponent::encode(array(true, $this->t('Changes saved')));
Severity: Minor
Found in core/controllers/BrowseController.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 movecopyAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $this->view->referenceMessage = 'Create references to the existing items';
                $this->view->copyMessage = 'Copy the existing items into new items';
            }
Severity: Minor
Found in core/controllers/BrowseController.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 selectfolderAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $policy = MIDAS_POLICY_WRITE;
        }
Severity: Minor
Found in core/controllers/BrowseController.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 'JsonComponent' in method 'getmaxpolicyAction'.
Open

        echo JsonComponent::encode(array('policy' => $maxpolicy));
Severity: Minor
Found in core/controllers/BrowseController.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 'JsonComponent' in method 'deleteAction'.
Open

        echo JsonComponent::encode($resp);
Severity: Minor
Found in core/controllers/BrowseController.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 movecopyAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else { // moveSubmit, Move item(s)
                    if (!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_ADMIN)
                    ) {
                        throw new Zend_Exception('You must own an item in order to move it');
                    }
Severity: Minor
Found in core/controllers/BrowseController.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 getfolderscontentAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $itemLimit = $limit - $folderCount;
            $items = $this->Folder->getItemsFiltered(
                $parents,
                $this->userSession->Dao,
Severity: Minor
Found in core/controllers/BrowseController.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 'JsonComponent' in method 'getelementinfoAction'.
Open

        echo JsonComponent::encode($jsonContent);
Severity: Minor
Found in core/controllers/BrowseController.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 movecopyAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else { // isset($move)
                $this->view->moveEnabled = true;
                $from = $this->getParam('from');
                $this->view->from = $from;
            }
Severity: Minor
Found in core/controllers/BrowseController.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 deleteAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $resp['failure']['items'][] = $itemId; // permission failure
            }
Severity: Minor
Found in core/controllers/BrowseController.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 deleteAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $resp['failure']['folders'][] = $folderId; // permission failure
            }
Severity: Minor
Found in core/controllers/BrowseController.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 'JsonComponent' in method 'getfolderssizeAction'.
Open

        echo JsonComponent::encode($return);
Severity: Minor
Found in core/controllers/BrowseController.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 getelementinfoAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $jsonContent['creation'] = $this->Component->Date->formatDate(strtotime($item->getDateCreation()));
                    $jsonContent['norevisions'] = true;
                }
Severity: Minor
Found in core/controllers/BrowseController.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 movecopyAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else { // isset($select)
            $this->view->selectEnabled = true;
        }
Severity: Minor
Found in core/controllers/BrowseController.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 'JsonComponent' in method 'getfolderscontentAction'.
Open

        echo JsonComponent::encode($jsonContent);
Severity: Minor
Found in core/controllers/BrowseController.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 'UtilityComponent' in method 'deleteAction'.
Open

        UtilityComponent::disableMemoryLimit();
Severity: Minor
Found in core/controllers/BrowseController.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

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class BrowseController extends AppController

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

        $id = $this->getParam('id');
Severity: Minor
Found in core/controllers/BrowseController.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

The property $_daos is not named in camelCase.
Open

class BrowseController extends AppController
{
    public $_models = array('User', 'Community', 'Folder', 'Item', 'ItemRevision');
    public $_daos = array('User', 'Community', 'Folder', 'Item');
    public $_components = array('Date', 'Utility', 'Sortdao');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The property $_models is not named in camelCase.
Open

class BrowseController extends AppController
{
    public $_models = array('User', 'Community', 'Folder', 'Item', 'ItemRevision');
    public $_daos = array('User', 'Community', 'Folder', 'Item');
    public $_components = array('Date', 'Utility', 'Sortdao');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The property $_components is not named in camelCase.
Open

class BrowseController extends AppController
{
    public $_models = array('User', 'Community', 'Folder', 'Item', 'ItemRevision');
    public $_daos = array('User', 'Community', 'Folder', 'Item');
    public $_components = array('Date', 'Utility', 'Sortdao');
Severity: Minor
Found in core/controllers/BrowseController.php by phpmd

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

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

        $id = $this->getParam('id');
Severity: Minor
Found in core/controllers/BrowseController.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

Property name "$_components" should not be prefixed with an underscore to indicate visibility
Open

    public $_components = array('Date', 'Utility', 'Sortdao');

Property name "$_daos" should not be prefixed with an underscore to indicate visibility
Open

    public $_daos = array('User', 'Community', 'Folder', 'Item');

Property name "$_models" should not be prefixed with an underscore to indicate visibility
Open

    public $_models = array('User', 'Community', 'Folder', 'Item', 'ItemRevision');

Line exceeds 120 characters; contains 140 characters
Open

        if ($limit > 0 && $folderCount > $limit) { // If we have more folder children than the page allows, no need to fetch items this pass

Multi-line function call not indented correctly; expected 16 spaces but found 20
Open

                    $this->userSession->Dao,

Multi-line function call not indented correctly; expected 12 spaces but found 16
Open

                ) && $this->Folder->isDeleteable($folder)

Multi-line function call not indented correctly; expected 16 spaces but found 20
Open

                    $folder,

Multi-line function call not indented correctly; expected 16 spaces but found 20
Open

                    MIDAS_POLICY_ADMIN

There are no issues that match your filters.

Category
Status