midasplatform/Midas

View on GitHub
core/controllers/DownloadController.php

Summary

Maintainability
F
3 days
Test Coverage

Function indexAction has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
Open

    public function indexAction()
    {
        $this->disableLayout();
        $itemIds = $this->getParam('items');
        $folderIds = $this->getParam('folders');
Severity: Minor
Found in core/controllers/DownloadController.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

Method indexAction has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function indexAction()
    {
        $this->disableLayout();
        $itemIds = $this->getParam('items');
        $folderIds = $this->getParam('folders');
Severity: Major
Found in core/controllers/DownloadController.php - About 6 hrs to fix

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

class DownloadController extends AppController
{
    /** @var array */
    public $_models = array('Folder', 'Item', 'Community', 'User', 'Bitstream');

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

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

File DownloadController.php has 270 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/DownloadController.php - About 2 hrs to fix

Method checksizeAction has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

The method indexAction() has an NPath complexity of 1005312. The configured NPath complexity threshold is 200.
Open

    public function indexAction()
    {
        $this->disableLayout();
        $itemIds = $this->getParam('items');
        $folderIds = $this->getParam('folders');

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 checksizeAction() has an NPath complexity of 1200. The configured NPath complexity threshold is 200.
Open

    public function checksizeAction()
    {
        $this->disableView();
        $this->disableLayout();
        $itemIds = $this->getParam('itemIds');

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 indexAction() has 182 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function indexAction()
    {
        $this->disableLayout();
        $itemIds = $this->getParam('items');
        $folderIds = $this->getParam('folders');

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

    public function checksizeAction()
    {
        $this->disableView();
        $this->disableLayout();
        $itemIds = $this->getParam('itemIds');

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 indexAction() has a Cyclomatic Complexity of 40. The configured cyclomatic complexity threshold is 10.
Open

    public function indexAction()
    {
        $this->disableLayout();
        $itemIds = $this->getParam('items');
        $folderIds = $this->getParam('folders');

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 '192', column '24').
Open

            $zip = new \ZipStream\ZipStream($name.'.zip');

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 '266', column '31').
Open

                    throw new Zend_Exception('Permission denied on folder '.$folderId, 403);

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 '301', column '23').
Open

            throw new Zend_Exception('Must specify item id as a path parameter');

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 '112', column '31').
Open

                    throw new Zend_Exception('Read permission required on item '.$tmp[0], 403);

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 '85', column '27').
Open

                throw new Zend_Exception('Permission denied');

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 '92', column '23').
Open

            throw new Zend_Exception('No parameters, expecting itemIds or folderIds.');

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 '158', column '28').
Open

                $zip = new \ZipStream\ZipStream($name.'.zip');

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 '364', column '20').
Open

        $zip = new \ZipStream\ZipStream($name.'.zip');

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 '109', column '31').
Open

                    throw new Zend_Exception('Item does not exist: '.$tmp[0], 404);

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 '256', column '31').
Open

                    throw new Zend_Exception('Permission denied on item '.$itemId, 403);

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 '337', column '23').
Open

            throw new Zend_Exception('Must specify bitstream id as a path parameter');

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 '76', column '27').
Open

                throw new Zend_Exception('Invalid bitstream id', 404);

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 '319', column '23').
Open

            throw new Zend_Exception('Must specify folder id as a path parameter');

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 checksizeAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $itemIdArray = array();
        }

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 _downloadEmptyItem uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $name = 'No_item_selected';
        }

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 indexAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $path = '';
                    }

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 indexAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                ob_start();
                $this->_helper->viewRenderer->setNoRender();
                $name = $revision->getItem()->getName();
                $name = substr($name, 0, 50);

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 checksizeAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $folderIdArray = array();
        }

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 indexAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->_helper->viewRenderer->setNoRender();
            if (count($folders) == 1 && empty($revisions)) {
                $name = $folders[0]->getName();
                $name = substr($name, 0, 50);

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 checksizeAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            echo JsonComponent::encode(array('action' => 'download'));
        }

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 indexAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else { // see if module can authenticate with a special parameter
            $authToken = $this->getParam('authToken');
            if (isset($authToken)) {
                $responses = Zend_Registry::get('notifier')->callback(
                    'CALLBACK_CORE_PARAMETER_AUTHENTICATION',

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 indexAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $name = $rootCom->getName().'-'.$name;
                    }

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 'Zend_Registry' in method 'checksizeAction'.
Open

        if ($totalSize > 2E9 && in_array('javauploaddownload', Zend_Registry::get('modulesEnable'))

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 'checksizeAction'.
Open

                array('action' => 'promptApplet', 'sizeStr' => UtilityComponent::formatSize($totalSize))

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 'itemAction'.
Open

        $pathParams = UtilityComponent::extractPathParams();

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 'bitstreamAction'.
Open

        $pathParams = UtilityComponent::extractPathParams();

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 indexAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $name = 'Custom';
            }

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 'checksizeAction'.
Open

            echo JsonComponent::encode(
                array('action' => 'promptApplet', 'sizeStr' => UtilityComponent::formatSize($totalSize))
            );

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 'folderAction'.
Open

        $pathParams = UtilityComponent::extractPathParams();

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 indexAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $tmp = $this->Item->getLastRevision($item);
                    if ($tmp !== false) {
                        $revisions[] = $tmp;
                    }

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 'UtilityComponent' in method 'indexAction'.
Open

            UtilityComponent::disableMemoryLimit();

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 'checksizeAction'.
Open

            echo JsonComponent::encode(array('action' => 'download'));

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 indexAction() contains an exit expression.
Open

                exit();

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 _downloadEmptyItem() contains an exit expression.
Open

        exit();

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 indexAction() contains an exit expression.
Open

            exit();

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

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

class DownloadController extends AppController

The property $_components is not named in camelCase.
Open

class DownloadController extends AppController
{
    /** @var array */
    public $_models = array('Folder', 'Item', 'Community', 'User', 'Bitstream');

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 DownloadController extends AppController
{
    /** @var array */
    public $_models = array('Folder', 'Item', 'Community', 'User', 'Bitstream');

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

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

    private function _downloadEmptyItem($item)

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

    public $_components = array('DownloadBitstream');

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

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

Line exceeds 120 characters; contains 131 characters
Open

     * @param items = 12, 1 (will download the revision 1 of the item 12, a zip if there are multiple bitstream or simply the file)

The method _downloadEmptyItem is not named in camelCase.
Open

    private function _downloadEmptyItem($item)
    {
        ob_start();
        $this->disableView();
        if (isset($item) && $item instanceof ItemDao) {

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