midasplatform/Midas

View on GitHub
modules/visualize/controllers/ParaviewController.php

Summary

Maintainability
F
1 wk
Test Coverage

_getHostName accesses the super-global variable $_SERVER.
Open

    protected function _getHostName()
    {
        if ($this->isTestingEnv()) {
            return 'localhost';
        } else {

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

_getHostName accesses the super-global variable $_SERVER.
Open

    protected function _getHostName()
    {
        if ($this->isTestingEnv()) {
            return 'localhost';
        } else {

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

_getHostName accesses the super-global variable $_SERVER.
Open

    protected function _getHostName()
    {
        if ($this->isTestingEnv()) {
            return 'localhost';
        } else {

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Function volumeAction has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

    public function volumeAction()
    {
        $jsImports = $this->getParam('jsImports');
        if (isset($jsImports)) {
            $this->view->jsImports = explode(';', $jsImports);
Severity: Minor
Found in modules/visualize/controllers/ParaviewController.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

Function sliceAction has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    public function sliceAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';
Severity: Minor
Found in modules/visualize/controllers/ParaviewController.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 ParaviewController.php has 419 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 modules/visualize/controllers/ParaviewController.php - About 6 hrs to fix

Method sliceAction has 129 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function sliceAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';
Severity: Major
Found in modules/visualize/controllers/ParaviewController.php - About 5 hrs to fix

Method volumeAction has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function volumeAction()
    {
        $jsImports = $this->getParam('jsImports');
        if (isset($jsImports)) {
            $this->view->jsImports = explode(';', $jsImports);
Severity: Major
Found in modules/visualize/controllers/ParaviewController.php - About 4 hrs to fix

Function dualAction has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function dualAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';
Severity: Minor
Found in modules/visualize/controllers/ParaviewController.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

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

class Visualize_ParaviewController extends Visualize_AppController
{
    public $_models = array('Bitstream', 'Item', 'ItemRevision', 'Setting');
    public $_moduleComponents = array('Main');

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

    public function dualAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';
Severity: Major
Found in modules/visualize/controllers/ParaviewController.php - About 3 hrs to fix

Method surfaceAction has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function surfaceAction()
    {
        $itemid = $this->getParam('itemId');
        if (!isset($itemid)) {
            throw new Zend_Exception('Must specify an itemId parameter');
Severity: Major
Found in modules/visualize/controllers/ParaviewController.php - About 2 hrs to fix

Function surfaceAction has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function surfaceAction()
    {
        $itemid = $this->getParam('itemId');
        if (!isset($itemid)) {
            throw new Zend_Exception('Must specify an itemId parameter');
Severity: Minor
Found in modules/visualize/controllers/ParaviewController.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

The method dualAction() has an NPath complexity of 5832. The configured NPath complexity threshold is 200.
Open

    public function dualAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';

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

    public function surfaceAction()
    {
        $itemid = $this->getParam('itemId');
        if (!isset($itemid)) {
            throw new Zend_Exception('Must specify an itemId parameter');

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

    public function sliceAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';

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

    public function sliceAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';

The method volumeAction() has an NPath complexity of 260208. The configured NPath complexity threshold is 200.
Open

    public function volumeAction()
    {
        $jsImports = $this->getParam('jsImports');
        if (isset($jsImports)) {
            $this->view->jsImports = explode(';', $jsImports);

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

    public function volumeAction()
    {
        $jsImports = $this->getParam('jsImports');
        if (isset($jsImports)) {
            $this->view->jsImports = explode(';', $jsImports);

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

    public function surfaceAction()
    {
        $itemid = $this->getParam('itemId');
        if (!isset($itemid)) {
            throw new Zend_Exception('Must specify an itemId parameter');

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

    public function volumeAction()
    {
        $jsImports = $this->getParam('jsImports');
        if (isset($jsImports)) {
            $this->view->jsImports = explode(';', $jsImports);

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

    public function dualAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';

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

    public function sliceAction()
    {
        $operations = $this->getParam('operations');
        if (!isset($operations)) {
            $operations = '';

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

Avoid using undefined variables such as '$filePaths' which will lead to PHP notices.
Open

                    $filePaths[$side] = $subPath.'/'.$bitstream->getName();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$filePaths' which will lead to PHP notices.
Open

        $this->view->json['visualize']['urls'] = $filePaths;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$colorArrayNames' which will lead to PHP notices.
Open

                        $colorArrayNames[$side] = 'MetaImage';

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$colorArrayNames' which will lead to PHP notices.
Open

                        $colorArrayNames[$side] = 'ImageFile';

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$filePaths' which will lead to PHP notices.
Open

        $this->view->fileLocations = $filePaths;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$colorArrayNames' which will lead to PHP notices.
Open

        $this->view->json['visualize']['colorArrayNames'] = $colorArrayNames;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

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

            throw new Zend_Exception('Please enable the use of a ParaViewWeb server on the module configuration page');

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

            throw new Zend_Exception("This item doesn't exist or you don't have the permissions.");

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

            throw new Zend_Exception("This item doesn't exist or you don't have the permissions.");

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

            throw new Zend_Exception('Please enable the use of a ParaViewWeb server on the module configuration page');

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

            throw new Zend_Exception('Please enable the use of a ParaViewWeb server on the module configuration page');

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

                throw new Zend_Exception('The item has no revisions', MIDAS_INVALID_POLICY);

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

            throw new Zend_Exception('Please set the ParaView work directory');

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

                throw new Zend_Exception('The item has no revisions', MIDAS_INVALID_POLICY);

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

            throw new Zend_Exception('Please set the ParaView work directory');

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

            throw new Zend_Exception("Right item doesn't exist or you don't have the permissions.");

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

            throw new Zend_Exception("Left item doesn't exist or you don't have the permissions.");

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

            throw new Zend_Exception('The item has no revisions', MIDAS_INVALID_POLICY);

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

            throw new Zend_Exception('Please enable the use of a ParaViewWeb server on the module configuration page');

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

                throw new Zend_Exception('The item has no revisions', MIDAS_INVALID_POLICY);

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

            throw new Zend_Exception('Please set the ParaView work directory');

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

            throw new Zend_Exception('Must specify an itemId 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 '69', column '23').
Open

            throw new Zend_Exception('The item has no revisions', MIDAS_INVALID_POLICY);

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

                throw new Zend_Exception("This item doesn't exist or you don't have the permissions.");

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

            throw new Zend_Exception("This item doesn't exist or you don't have the permissions.");

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

            throw new Zend_Exception('The item has no revisions', MIDAS_INVALID_POLICY);

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

            throw new Zend_Exception('Please set the ParaView work directory');

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

                throw new Zend_Exception("This item doesn't exist or you don't have the permissions.");

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

                } else {
                    copy($bitstream->getFullPath(), $subPath.'/'.$bitstream->getName());
                }

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

        } else {
            $this->view->jsImports = 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 _getHostName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return empty($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['HTTP_X_FORWARDED_HOST'];
        }

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

        } else {
            $this->view->jsImports = 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 surfaceAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->view->renderer = 'webgl';
        }

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

                } else {
                    copy($bitstream->getFullPath(), $otherFile);
                }

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

            } else {
                copy($bitstream->getFullPath(), $path.'/'.$bitstream->getName());
            }

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

            } else {
                copy($bitstream->getFullPath(), $path.'/'.$bitstream->getName());
            }

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

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

                } else {
                    copy($bitstream->getFullPath(), $otherFile);
                }

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

        } else {
            $this->view->jsImports = 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 _getTomcatPort uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return '80';
        }

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

            } else {
                copy($bitstream->getFullPath(), $path.'/'.$bitstream->getName());
            }

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

        } else {
            $meshes = 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

TODO found
Open

        $this->view->jsImports = array(); // TODO

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        foreach ($bitstreams as $bitstream) {
            if ($useSymlinks === 1) {
                symlink($bitstream->getFullPath(), $path.'/'.$bitstream->getName());
            } else {
                copy($bitstream->getFullPath(), $path.'/'.$bitstream->getName());
Severity: Major
Found in modules/visualize/controllers/ParaviewController.php and 1 other location - About 4 hrs to fix
modules/visualize/controllers/ParaviewController.php on lines 255..276

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 175.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        foreach ($bitstreams as $bitstream) {
            if ($useSymlinks === 1) {
                symlink($bitstream->getFullPath(), $path.'/'.$bitstream->getName());
            } else {
                copy($bitstream->getFullPath(), $path.'/'.$bitstream->getName());
Severity: Major
Found in modules/visualize/controllers/ParaviewController.php and 1 other location - About 4 hrs to fix
modules/visualize/controllers/ParaviewController.php on lines 410..431

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 175.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                foreach ($metadata as $metadatum) {
                    if (strtolower($metadatum->getElement()) == 'visualize') {
                        if (strtolower($metadatum->getQualifier()) == 'diffusecolor'
                        ) {
                            try { // must be json encoded, otherwise we ignore it and use the default
Severity: Major
Found in modules/visualize/controllers/ParaviewController.php and 1 other location - About 3 hrs to fix
modules/visualize/controllers/ParaviewController.php on lines 462..481

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 157.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            foreach ($metadata as $metadatum) {
                if (strtolower($metadatum->getElement()) == 'visualize') {
                    if (strtolower($metadatum->getQualifier()) == 'diffusecolor'
                    ) {
                        try { // must be json encoded, otherwise we ignore it and use the default
Severity: Major
Found in modules/visualize/controllers/ParaviewController.php and 1 other location - About 3 hrs to fix
modules/visualize/controllers/ParaviewController.php on lines 306..325

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 157.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid excessively long variable names like $paraViewWorkDirectory. Keep variable name length under 20.
Open

        $paraViewWorkDirectory = $this->Setting->getValueByName(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $this->moduleName);

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $paraViewWorkDirectory. Keep variable name length under 20.
Open

        $paraViewWorkDirectory = $this->Setting->getValueByName(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $this->moduleName);

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $paraViewWorkDirectory. Keep variable name length under 20.
Open

        $paraViewWorkDirectory = $this->Setting->getValueByName(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $this->moduleName);

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $paraViewWorkDirectory. Keep variable name length under 20.
Open

        $paraViewWorkDirectory = $this->Setting->getValueByName(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $this->moduleName);

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

class Visualize_ParaviewController extends Visualize_AppController

The property $_models is not named in camelCase.
Open

class Visualize_ParaviewController extends Visualize_AppController
{
    public $_models = array('Bitstream', 'Item', 'ItemRevision', 'Setting');
    public $_moduleComponents = array('Main');

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 class Visualize_ParaviewController is not named in CamelCase.
Open

class Visualize_ParaviewController extends Visualize_AppController
{
    public $_models = array('Bitstream', 'Item', 'ItemRevision', 'Setting');
    public $_moduleComponents = array('Main');

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

The property $_moduleComponents is not named in camelCase.
Open

class Visualize_ParaviewController extends Visualize_AppController
{
    public $_models = array('Bitstream', 'Item', 'ItemRevision', 'Setting');
    public $_moduleComponents = array('Main');

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 "_getTomcatPort" should not be prefixed with an underscore to indicate visibility
Open

    protected function _getTomcatPort($pwapp)

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

    public $_models = array('Bitstream', 'Item', 'ItemRevision', 'Setting');

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

    public $_moduleComponents = array('Main');

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

    protected function _getHostName()

Line exceeds 120 characters; contains 156 characters
Open

        $header = '<img style="position: relative; top: 3px;" alt="" src="'.$this->view->moduleWebroot.'/public/images/application_tile_horizontal.png" />';

Line exceeds 120 characters; contains 135 characters
Open

        $header = '<img style="position: relative; top: 3px;" alt="" src="'.$this->view->moduleWebroot.'/public/images/volume.png" />';

Line exceeds 120 characters; contains 126 characters
Open

        $paraViewWorkDirectory = $this->Setting->getValueByName(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $this->moduleName);

Line exceeds 120 characters; contains 126 characters
Open

        $paraViewWorkDirectory = $this->Setting->getValueByName(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $this->moduleName);

Line exceeds 120 characters; contains 149 characters
Open

        $header = '<img style="position: relative; top: 3px;" alt="" src="'.$this->view->moduleWebroot.'/public/images/pqUnstructuredGrid16.png" />';

Line exceeds 120 characters; contains 138 characters
Open

        $header = '<img style="position: relative; top: 3px;" alt="" src="'.$this->view->moduleWebroot.'/public/images/sliceView.png" />';

Line exceeds 120 characters; contains 126 characters
Open

        $paraViewWorkDirectory = $this->Setting->getValueByName(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $this->moduleName);

Line exceeds 120 characters; contains 126 characters
Open

        $paraViewWorkDirectory = $this->Setting->getValueByName(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $this->moduleName);

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

            ).'</a> | ';

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

                    MIDAS_POLICY_READ

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 16 spaces but found 20
Open

                    $otherItem,

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

                )

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

                )

Class name "Visualize_ParaviewController" is not in camel caps format
Open

class Visualize_ParaviewController extends Visualize_AppController

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

                    MIDAS_POLICY_READ

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 16 spaces but found 20
Open

                    $otherItem,

The method _getTomcatPort is not named in camelCase.
Open

    protected function _getTomcatPort($pwapp)
    {
        if (preg_match('/:([0-9]+)\//', $pwapp, $matches)) {
            return $matches[1];
        } else {

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

The method _getHostName is not named in camelCase.
Open

    protected function _getHostName()
    {
        if ($this->isTestingEnv()) {
            return 'localhost';
        } else {

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