midasplatform/Midas

View on GitHub
core/controllers/UserController.php

Summary

Maintainability
F
2 wks
Test Coverage

startingguideAction accesses the super-global variable $_POST.
Open

    public function startingguideAction()
    {
        $this->disableLayout();
        $this->disableView();
        if ($this->logged && isset($_POST['value'])) {
Severity: Minor
Found in core/controllers/UserController.php by phpmd

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

settingsAction accesses the super-global variable $_FILES.
Open

    public function settingsAction()
    {
        if (!($this->_request->isGet() || $this->_request->isPost())) {
            throw new Zend_Exception('Only HTTP Get or Post requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.php by phpmd

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

startingguideAction accesses the super-global variable $_POST.
Open

    public function startingguideAction()
    {
        $this->disableLayout();
        $this->disableView();
        if ($this->logged && isset($_POST['value'])) {
Severity: Minor
Found in core/controllers/UserController.php by phpmd

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 settingsAction has a Cognitive Complexity of 174 (exceeds 5 allowed). Consider refactoring.
Open

    public function settingsAction()
    {
        if (!($this->_request->isGet() || $this->_request->isPost())) {
            throw new Zend_Exception('Only HTTP Get or Post requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.php - About 3 days 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 UserController.php has 1120 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: Major
Found in core/controllers/UserController.php - About 2 days to fix

Method settingsAction has 320 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function settingsAction()
    {
        if (!($this->_request->isGet() || $this->_request->isPost())) {
            throw new Zend_Exception('Only HTTP Get or Post requests are accepted', 400);
        }
Severity: Major
Found in core/controllers/UserController.php - About 1 day to fix

Function loginAction has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

    public function loginAction()
    {
        /** @var Zend_Controller_Request_Http $request */
        $request = $this->getRequest();
        $this->Form->User->uri = $request->getRequestUri();
Severity: Minor
Found in core/controllers/UserController.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 ajaxregisterAction has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    public function ajaxregisterAction()
    {
        $adminCreate = $this->getParam('adminCreate');
        $adminCreate = isset($adminCreate);

Severity: Minor
Found in core/controllers/UserController.php - About 5 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 ajaxregisterAction has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function ajaxregisterAction()
    {
        $adminCreate = $this->getParam('adminCreate');
        $adminCreate = isset($adminCreate);

Severity: Major
Found in core/controllers/UserController.php - About 4 hrs to fix

Method loginAction has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function loginAction()
    {
        /** @var Zend_Controller_Request_Http $request */
        $request = $this->getRequest();
        $this->Form->User->uri = $request->getRequestUri();
Severity: Major
Found in core/controllers/UserController.php - About 4 hrs to fix

Function userpageAction has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function userpageAction()
    {
        if (!$this->_request->isGet()) {
            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.php - About 4 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 UserController has 18 public methods. Consider refactoring UserController to keep number of public methods under 10.
Open

class UserController extends AppController
{
    public $_models = array(
        'User',
        'NewUserInvitation',
Severity: Minor
Found in core/controllers/UserController.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

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

class UserController extends AppController
{
    public $_models = array(
        'User',
        'NewUserInvitation',
Severity: Minor
Found in core/controllers/UserController.php by phpmd

Method userpageAction has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function userpageAction()
    {
        if (!$this->_request->isGet()) {
            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
        }
Severity: Major
Found in core/controllers/UserController.php - About 3 hrs to fix

Function emailregisterAction has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function emailregisterAction()
    {
        $email = $this->getParam('email');
        $authKey = $this->getParam('authKey');

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

Method registerAction has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function registerAction()
    {
        if ((int) $this->Setting->getValueByNameWithDefault('close_registration', 1) === 1) {
            throw new Zend_Exception('New user registration is disabled.');
        }
Severity: Major
Found in core/controllers/UserController.php - About 2 hrs to fix

Method recoverpasswordAction has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function recoverpasswordAction()
    {
        if ($this->logged) {
            throw new Zend_Exception('Shouldn\'t be logged in');
        }
Severity: Minor
Found in core/controllers/UserController.php - About 1 hr to fix

Method emailregisterAction has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function emailregisterAction()
    {
        $email = $this->getParam('email');
        $authKey = $this->getParam('authKey');

Severity: Minor
Found in core/controllers/UserController.php - About 1 hr to fix

Method manageAction has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function manageAction()
    {
        $this->view->Date = $this->Component->Date;
        $userId = $this->getParam('userId');

Severity: Minor
Found in core/controllers/UserController.php - About 1 hr to fix

Method ajaxloginAction has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in core/controllers/UserController.php - About 1 hr to fix

Function registerAction has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function registerAction()
    {
        if ((int) $this->Setting->getValueByNameWithDefault('close_registration', 1) === 1) {
            throw new Zend_Exception('New user registration is disabled.');
        }
Severity: Minor
Found in core/controllers/UserController.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 recoverpasswordAction has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function recoverpasswordAction()
    {
        if ($this->logged) {
            throw new Zend_Exception('Shouldn\'t be logged in');
        }
Severity: Minor
Found in core/controllers/UserController.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public function deleteAction()
    {
        ignore_user_abort(true);

        if (!$this->logged) {
Severity: Minor
Found in core/controllers/UserController.php - About 1 hr to fix

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

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

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

    public function manageAction()
    {
        $this->view->Date = $this->Component->Date;
        $userId = $this->getParam('userId');

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

    public function deleteAction()
    {
        ignore_user_abort(true);

        if (!$this->logged) {
Severity: Minor
Found in core/controllers/UserController.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid too many return statements within this method.
Open

                    return;
Severity: Major
Found in core/controllers/UserController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                        return;
Severity: Major
Found in core/controllers/UserController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                    return;
Severity: Major
Found in core/controllers/UserController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                            return;
Severity: Major
Found in core/controllers/UserController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                            return;
Severity: Major
Found in core/controllers/UserController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                        return;
Severity: Major
Found in core/controllers/UserController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                        return;
Severity: Major
Found in core/controllers/UserController.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                            return;
Severity: Major
Found in core/controllers/UserController.php - About 30 mins to fix

Function userexistsAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function userexistsAction()
    {
        $this->disableLayout();
        $this->disableView();
        $entry = $this->getParam('entry');
Severity: Minor
Found in core/controllers/UserController.php - About 25 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 loginAction() has 129 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function loginAction()
    {
        /** @var Zend_Controller_Request_Http $request */
        $request = $this->getRequest();
        $this->Form->User->uri = $request->getRequestUri();
Severity: Minor
Found in core/controllers/UserController.php by phpmd

The method emailregisterAction() has an NPath complexity of 2310. The configured NPath complexity threshold is 200.
Open

    public function emailregisterAction()
    {
        $email = $this->getParam('email');
        $authKey = $this->getParam('authKey');

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

    public function settingsAction()
    {
        if (!($this->_request->isGet() || $this->_request->isPost())) {
            throw new Zend_Exception('Only HTTP Get or Post requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.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 loginAction() has an NPath complexity of 92738. The configured NPath complexity threshold is 200.
Open

    public function loginAction()
    {
        /** @var Zend_Controller_Request_Http $request */
        $request = $this->getRequest();
        $this->Form->User->uri = $request->getRequestUri();
Severity: Minor
Found in core/controllers/UserController.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 settingsAction() has 364 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function settingsAction()
    {
        if (!($this->_request->isGet() || $this->_request->isPost())) {
            throw new Zend_Exception('Only HTTP Get or Post requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.php by phpmd

The method ajaxregisterAction() has an NPath complexity of 654. The configured NPath complexity threshold is 200.
Open

    public function ajaxregisterAction()
    {
        $adminCreate = $this->getParam('adminCreate');
        $adminCreate = isset($adminCreate);

Severity: Minor
Found in core/controllers/UserController.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 class UserController has 1339 lines of code. Current threshold is 1000. Avoid really long classes.
Open

class UserController extends AppController
{
    public $_models = array(
        'User',
        'NewUserInvitation',
Severity: Minor
Found in core/controllers/UserController.php by phpmd

The method userpageAction() has an NPath complexity of 2592. The configured NPath complexity threshold is 200.
Open

    public function userpageAction()
    {
        if (!$this->_request->isGet()) {
            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.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 ajaxregisterAction() has 140 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function ajaxregisterAction()
    {
        $adminCreate = $this->getParam('adminCreate');
        $adminCreate = isset($adminCreate);

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

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

    public function loginAction()
    {
        /** @var Zend_Controller_Request_Http $request */
        $request = $this->getRequest();
        $this->Form->User->uri = $request->getRequestUri();
Severity: Minor
Found in core/controllers/UserController.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 emailregisterAction() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
Open

    public function emailregisterAction()
    {
        $email = $this->getParam('email');
        $authKey = $this->getParam('authKey');

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

    public function settingsAction()
    {
        if (!($this->_request->isGet() || $this->_request->isPost())) {
            throw new Zend_Exception('Only HTTP Get or Post requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.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 userpageAction() has a Cyclomatic Complexity of 24. The configured cyclomatic complexity threshold is 10.
Open

    public function userpageAction()
    {
        if (!$this->_request->isGet()) {
            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.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 ajaxregisterAction() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
Open

    public function ajaxregisterAction()
    {
        $adminCreate = $this->getParam('adminCreate');
        $adminCreate = isset($adminCreate);

Severity: Minor
Found in core/controllers/UserController.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 class UserController has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13.
Open

class UserController extends AppController
{
    public $_models = array(
        'User',
        'NewUserInvitation',
Severity: Minor
Found in core/controllers/UserController.php by phpmd

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Missing class import via use statement (line '165', column '21').
Open

        $date = new DateTime();
Severity: Minor
Found in core/controllers/UserController.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 '1179', column '27').
Open

                throw new Zend_Exception('Permission error');
Severity: Minor
Found in core/controllers/UserController.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 '91', column '23').
Open

            throw new Zend_Exception('Password reset is disabled');
Severity: Minor
Found in core/controllers/UserController.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 '354', column '27').
Open

                throw new Zend_Exception('User already exists.');
Severity: Minor
Found in core/controllers/UserController.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 '436', column '23').
Open

            throw new Zend_Exception('Must pass email and authKey parameters');
Severity: Minor
Found in core/controllers/UserController.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 '25').
Open

            $user = new Zend_Session_Namespace('Auth_User');
Severity: Minor
Found in core/controllers/UserController.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 '1224', column '23').
Open

            throw new Zend_Exception('Must be logged in');
Severity: Minor
Found in core/controllers/UserController.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 '503', column '25').
Open

            $date = new DateTime();
Severity: Minor
Found in core/controllers/UserController.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 '166', column '25').
Open

        $interval = new DateInterval('P1M');
Severity: Minor
Found in core/controllers/UserController.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 '504', column '29').
Open

            $interval = new DateInterval('P1M');
Severity: Minor
Found in core/controllers/UserController.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 '715', column '30').
Open

            $validator = new Zend_Validate_Digits();
Severity: Minor
Found in core/controllers/UserController.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 '87', column '23').
Open

            throw new Zend_Exception('Shouldn\'t be logged in');
Severity: Minor
Found in core/controllers/UserController.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 '347', column '23').
Open

            throw new Zend_Exception('New user registration is disabled.');
Severity: Minor
Found in core/controllers/UserController.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 '703', column '23').
Open

            throw new Zend_Exception('Only HTTP Get or Post requests are accepted', 400);
Severity: Minor
Found in core/controllers/UserController.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 '1087', column '27').
Open

                throw new Zend_Exception('Permission error');
Severity: Minor
Found in core/controllers/UserController.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 '1286', column '27').
Open

                throw new Zend_Exception('User already exists.');
Severity: Minor
Found in core/controllers/UserController.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 '157', column '25').
Open

        $notifier = new MIDAS_Notifier(false, null);
Severity: Minor
Found in core/controllers/UserController.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 '723', column '23').
Open

            throw new Zend_Exception(MIDAS_ADMIN_PRIVILEGES_REQUIRED);
Severity: Minor
Found in core/controllers/UserController.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 '731', column '23').
Open

            throw new Zend_Exception('Unable to load user');
Severity: Minor
Found in core/controllers/UserController.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 '614', column '41').
Open

                        $interval = new DateInterval('P1M');
Severity: Minor
Found in core/controllers/UserController.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 '1265', column '23').
Open

            throw new Zend_Exception('Invalid email or authKey ('.$email.', '.$authKey.')');
Severity: Minor
Found in core/controllers/UserController.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 '624', column '41').
Open

                            $user = new Zend_Session_Namespace('Auth_User');
Severity: Minor
Found in core/controllers/UserController.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 '943', column '35').
Open

                        throw new Zend_Exception(
Severity: Minor
Found in core/controllers/UserController.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 '1069', column '23').
Open

            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
Severity: Minor
Found in core/controllers/UserController.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 '1277', column '27').
Open

                throw new Zend_Exception('Passwords do not match');
Severity: Minor
Found in core/controllers/UserController.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 '1283', column '27').
Open

                throw new Zend_Exception('First name and last name are required');
Severity: Minor
Found in core/controllers/UserController.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 '613', column '37').
Open

                        $date = new DateTime();
Severity: Minor
Found in core/controllers/UserController.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 '717', column '27').
Open

                throw new Zend_Exception('Must specify a userId parameter');
Severity: Minor
Found in core/controllers/UserController.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 '783', column '31').
Open

                    throw new Zend_Exception('Changing password is disallowed for this user');
Severity: Minor
Found in core/controllers/UserController.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 '1280', column '27').
Open

                throw new Zend_Exception('Password must be at least 3 characters');
Severity: Minor
Found in core/controllers/UserController.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 '440', column '23').
Open

            throw new Zend_Exception('Invalid authKey or email');
Severity: Minor
Found in core/controllers/UserController.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 '1227', column '23').
Open

            throw new Zend_Exception('Must set a userId parameter');
Severity: Minor
Found in core/controllers/UserController.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 '1184', column '23').
Open

            throw new Zend_Exception('Unable to find user');
Severity: Minor
Found in core/controllers/UserController.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 '575', column '31').
Open

                    throw new Zend_Exception('Core version is undefined.');
Severity: Minor
Found in core/controllers/UserController.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 '904', column '35').
Open

                    $upload = new Zend_File_Transfer();
Severity: Minor
Found in core/controllers/UserController.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 '1231', column '23').
Open

            throw new Zend_Exception('Invalid user id');
Severity: Minor
Found in core/controllers/UserController.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 '1092', column '23').
Open

            throw new Zend_Exception('Unable to find user', 404);
Severity: Minor
Found in core/controllers/UserController.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 '1260', column '23').
Open

            throw new Zend_Exception('Must pass email and authKey parameters');
Severity: Minor
Found in core/controllers/UserController.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 '1335', column '29').
Open

            $notifier = new MIDAS_Notifier(false, null);
Severity: Minor
Found in core/controllers/UserController.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 '1325', column '23').
Open

            throw new Zend_Exception('Invalid user id');
Severity: Minor
Found in core/controllers/UserController.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 '1321', column '23').
Open

            throw new Zend_Exception('Must set a userId parameter');
Severity: Minor
Found in core/controllers/UserController.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 '1346', column '33').
Open

                $interval = new DateInterval('P1M');
Severity: Minor
Found in core/controllers/UserController.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 '1328', column '23').
Open

            throw new Zend_Exception('Cannot delete an admin user');
Severity: Minor
Found in core/controllers/UserController.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 '1316', column '23').
Open

            throw new Zend_Exception('Must be logged in');
Severity: Minor
Found in core/controllers/UserController.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 '1345', column '29').
Open

                $date = new DateTime();
Severity: Minor
Found in core/controllers/UserController.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 '1289', column '27').
Open

                throw new Zend_Exception('Must pass firstName, lastName, and password parameters');
Severity: Minor
Found in core/controllers/UserController.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 settingsAction 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(false, $this->t('The old password is incorrect')));

                    return;
                }
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                    echo JsonComponent::encode(array(false, 'Error: First and last name required'));
Severity: Minor
Found in core/controllers/UserController.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 settingsAction 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(false, 'Error'));
                    }
Severity: Minor
Found in core/controllers/UserController.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 'UtilityComponent' in method 'ajaxloginAction'.
Open

            UtilityComponent::setCookie($request, MIDAS_USER_COOKIE_NAME, $value, $expires);
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                        echo JsonComponent::encode(array(false, 'Error'));
Severity: Minor
Found in core/controllers/UserController.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 userpageAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $userDao = $this->User->load($user_id);
            if ($userDao->getPrivacy() == MIDAS_USER_PRIVATE && (!$this->logged || $this->userSession->Dao->getKey(
                    ) != $userDao->getKey()) && (!isset($this->userSession->Dao) || !$this->userSession->Dao->isAdmin())
            ) {
Severity: Minor
Found in core/controllers/UserController.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 'ajaxregisterAction'.
Open

                echo JsonComponent::encode(
                    array(
                        'status' => 'error',
                        'message' => 'Registration failed',
                        'validValues' => $form->getValidValues($this->getRequest()->getPost()),
Severity: Minor
Found in core/controllers/UserController.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 'ajaxloginAction'.
Open

            echo JsonComponent::encode(array('status' => 'error', 'message' => 'Invalid username or password'));
Severity: Minor
Found in core/controllers/UserController.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 settingsAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $userDao = $this->userSession->Dao;
        }
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                    echo JsonComponent::encode(array(false, 'Invalid form value'));
Severity: Minor
Found in core/controllers/UserController.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 'ajaxregisterAction'.
Open

                    echo JsonComponent::encode(array('status' => 'ok', 'message' => 'Verification email sent'));
Severity: Minor
Found in core/controllers/UserController.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 registerAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $email = strtolower(trim($form->getValue('email')));
                $pendingUser = $this->PendingUser->createPendingUser(
                    $email,
                    htmlentities(trim($form->getValue('firstname'))),
Severity: Minor
Found in core/controllers/UserController.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 'ajaxloginAction'.
Open

            echo JsonComponent::encode(array('status' => 'error', 'message' => 'Invalid login form'));
Severity: Minor
Found in core/controllers/UserController.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 'ajaxloginAction'.
Open

            echo JsonComponent::encode(array('status' => 'ok', 'message' => 'Login successful'));
Severity: Minor
Found in core/controllers/UserController.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 userpageAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->User->incrementViewCount($userDao);
        }
Severity: Minor
Found in core/controllers/UserController.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 'ajaxregisterAction'.
Open

                        echo JsonComponent::encode(
                            array(
                                'status' => 'warning',
                                'message' => 'User created, but sending of email failed',
                                'validValues' => $form->getValidValues($this->getRequest()->getPost()),
Severity: Minor
Found in core/controllers/UserController.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 settingsAction 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(false, 'Error'));

                        return;
                    }
Severity: Minor
Found in core/controllers/UserController.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 manageAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $communities = $this->Community->getPublicCommunities();
        }
Severity: Minor
Found in core/controllers/UserController.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 'ajaxregisterAction'.
Open

                    echo JsonComponent::encode(array('status' => 'ok', 'message' => 'User registered successfully'));
Severity: Minor
Found in core/controllers/UserController.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 ajaxregisterAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $pendingUser = $this->PendingUser->createPendingUser(
                    $email,
                    htmlentities(trim($form->getValue('firstname'))),
                    htmlentities(trim($form->getValue('lastname'))),
Severity: Minor
Found in core/controllers/UserController.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 ajaxregisterAction 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('status' => 'warning', 'message' => 'Failed to send verification email')
                    );
                }
Severity: Minor
Found in core/controllers/UserController.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 userexistsAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            echo 'false';
        }
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                    echo JsonComponent::encode(array(false, $this->t('The old password is incorrect')));
Severity: Minor
Found in core/controllers/UserController.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 settingsAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $mime = $_FILES['file']['type'];
                    $upload = new Zend_File_Transfer();
                    $upload->receive();
                    $path = $upload->getFileName();
Severity: Minor
Found in core/controllers/UserController.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 'UtilityComponent' in method 'logoutAction'.
Open

        UtilityComponent::setCookie($request, MIDAS_USER_COOKIE_NAME, false, $expires);
Severity: Minor
Found in core/controllers/UserController.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 'ajaxregisterAction'.
Open

            echo JsonComponent::encode(array('status' => 'error', 'message' => 'New user registration is disabled.'));
Severity: Minor
Found in core/controllers/UserController.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 'registerAction'.
Open

        $this->view->jsonRegister = JsonComponent::encode(
            array(
                'MessageNotValid' => $this->t('The email is not valid'),
                'MessageNotAvailable' => $this->t('That email is already registered'),
                'MessagePassword' => $this->t('Password too short'),
Severity: Minor
Found in core/controllers/UserController.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 'loginAction'.
Open

                $currentVersion = UtilityComponent::getCurrentModuleVersion('core');
Severity: Minor
Found in core/controllers/UserController.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 loginAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $passwordHash = false;
                    $coreAuth = false;
                }
Severity: Minor
Found in core/controllers/UserController.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 'recoverpasswordAction'.
Open

                echo JsonComponent::encode(array(false, $this->t('No user registered with that email.')));
Severity: Minor
Found in core/controllers/UserController.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 loginAction 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('status' => false, 'message' => 'Invalid email or password'));
            }
Severity: Minor
Found in core/controllers/UserController.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 'recoverpasswordAction'.
Open

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

                } else {
                    if (!headers_sent()) {
                        session_start();
                    }
                    $this->userSession->Dao = $newUser;
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                        echo JsonComponent::encode(array(false, 'Error: wrong format'));
Severity: Minor
Found in core/controllers/UserController.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 'loginAction'.
Open

                            UtilityComponent::setCookie($request, MIDAS_USER_COOKIE_NAME, $value, $expires);
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                        echo JsonComponent::encode(array(false, 'Error'));
Severity: Minor
Found in core/controllers/UserController.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 settingsAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $tx = round($thumb / $y * $x);  //--- portrait ---
                        $ty = $thumb;
                    }
Severity: Minor
Found in core/controllers/UserController.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 ajaxregisterAction 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(
                                'status' => 'warning',
                                'message' => 'User created, but sending of email failed',
Severity: Minor
Found in core/controllers/UserController.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 'ajaxregisterAction'.
Open

                    echo JsonComponent::encode(
                        array('status' => 'warning', 'message' => 'Failed to send verification email')
                    );
Severity: Minor
Found in core/controllers/UserController.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 ajaxloginAction 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('status' => 'error', 'message' => 'Invalid username or password'));
        }
Severity: Minor
Found in core/controllers/UserController.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 loginAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $expires = $date->sub($interval);
                            UtilityComponent::setCookie($request, MIDAS_USER_COOKIE_NAME, false, $expires);
                            Zend_Session::start();
                            $user = new Zend_Session_Namespace('Auth_User');
Severity: Minor
Found in core/controllers/UserController.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 'UtilityComponent' in method 'loginAction'.
Open

                            UtilityComponent::setCookie($request, MIDAS_USER_COOKIE_NAME, false, $expires);
Severity: Minor
Found in core/controllers/UserController.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 loginAction 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('status' => false, 'message' => 'Invalid email or password'));
                }
Severity: Minor
Found in core/controllers/UserController.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 'loginAction'.
Open

                echo JsonComponent::encode(array('status' => false, 'message' => 'Invalid email or password'));
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                            echo JsonComponent::encode(array(false, 'Error: Unable to read gif file'));
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

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

        } else {
            $this->view->deleteSelf = true;
        }
Severity: Minor
Found in core/controllers/UserController.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 'loginAction'.
Open

                    echo JsonComponent::encode(array('status' => false, 'message' => 'Invalid email or password'));
Severity: Minor
Found in core/controllers/UserController.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 indexAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $users = $this->User->getAll(true, 100, $order, $offset, $this->userSession->Dao);
            $this->view->isAdmin = false;
        }
Severity: Minor
Found in core/controllers/UserController.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 'Zend_Session' in method 'logoutAction'.
Open

        Zend_Session::ForgetMe();
Severity: Minor
Found in core/controllers/UserController.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 'loginAction'.
Open

                        echo JsonComponent::encode(array('status' => false, 'message' => 'Invalid email or password'));
Severity: Minor
Found in core/controllers/UserController.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 'loginAction'.
Open

                    echo JsonComponent::encode(array('status' => true, 'redirect' => $redirect));
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                    echo JsonComponent::encode(array(true, $this->t('Changes saved')));
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                        echo JsonComponent::encode(
                            array(false, 'Error: that email address belongs to another account')
                        );
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                echo JsonComponent::encode(array(true, $this->t('Changes saved')));
Severity: Minor
Found in core/controllers/UserController.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 'recoverpasswordAction'.
Open

                echo JsonComponent::encode(array(true, 'Password request sent.'));
Severity: Minor
Found in core/controllers/UserController.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 'ajaxregisterAction'.
Open

                echo JsonComponent::encode(
                    array(
                        'status' => 'error',
                        'message' => 'That email is already registered',
                        'alreadyRegistered' => true,
Severity: Minor
Found in core/controllers/UserController.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 settingsAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $this->view->appendFields[] = $field;
            }
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                    echo JsonComponent::encode(array(false, 'Error: invalid privacy flag'));
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                        echo JsonComponent::encode(
                            array(
                                true,
                                $this->t('Changes saved'),
                                $this->view->webroot.'/'.$userDao->getThumbnail(),
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

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

                    } else {
                        $redirect = $this->view->webroot.'/feed?first=true';
                    }
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                            echo JsonComponent::encode(array(false, 'Error: Unable to read jpg file'));
Severity: Minor
Found in core/controllers/UserController.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 'recoverpasswordAction'.
Open

                echo JsonComponent::encode(array(false, 'Could not send password request.'));
Severity: Minor
Found in core/controllers/UserController.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 'Zend_Session' in method 'ajaxloginAction'.
Open

            Zend_Session::start();
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                    echo JsonComponent::encode(array(false, $e->getMessage()));
Severity: Minor
Found in core/controllers/UserController.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 'settingsAction'.
Open

                            echo JsonComponent::encode(array(false, 'Error: Unable to read png file'));
Severity: Minor
Found in core/controllers/UserController.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 settingsAction 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(false, 'Error: wrong format'));

                        return;
                    }
Severity: Minor
Found in core/controllers/UserController.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 manageAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $userDao = $this->User->load($userId);
            if (!$this->userSession->Dao->isAdmin() && $this->userSession->Dao->getKey() != $userId
            ) {
                throw new Zend_Exception('Permission error');
Severity: Minor
Found in core/controllers/UserController.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 recoverpasswordAction 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(false, 'Could not send password request.'));
            }
Severity: Minor
Found in core/controllers/UserController.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 'ajaxregisterAction'.
Open

                        echo JsonComponent::encode(array('status' => 'ok', 'message' => 'User created successfully'));
Severity: Minor
Found in core/controllers/UserController.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 'ajaxloginAction'.
Open

            echo JsonComponent::encode(array('status' => 'error', 'message' => 'Invalid username or password'));
Severity: Minor
Found in core/controllers/UserController.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 'Zend_Session' in method 'loginAction'.
Open

                            Zend_Session::start();
Severity: Minor
Found in core/controllers/UserController.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(array(true, 'User '.$name.' successfully deleted'));
Severity: Minor
Found in core/controllers/UserController.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 deleteAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            // log out if user is deleting his or her own account
            $notifier = new MIDAS_Notifier(false, null);
            $notifier->callback('CALLBACK_CORE_USER_LOGOUT');
            if (!$this->isTestingEnv()) {
Severity: Minor
Found in core/controllers/UserController.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 'emailregisterAction'.
Open

            echo JsonComponent::encode(array('status' => 'ok', 'redirect' => $this->view->webroot.'/user/userpage'));
Severity: Minor
Found in core/controllers/UserController.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 emailregisterAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->view->email = $email;
            $this->view->authKey = $authKey;
            $this->view->header = 'Accept email invitation';
        }
Severity: Minor
Found in core/controllers/UserController.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 'Zend_Session' in method 'deleteAction'.
Open

                Zend_Session::ForgetMe();
Severity: Minor
Found in core/controllers/UserController.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::setCookie($request, MIDAS_USER_COOKIE_NAME, false, $expires);
Severity: Minor
Found in core/controllers/UserController.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 recoverpasswordAction() contains an exit expression.
Open

                exit;
Severity: Minor
Found in core/controllers/UserController.php by phpmd

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

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

            $modifyPictureGravatar = $this->getParam('modifyPictureGravatar');
Severity: Minor
Found in core/controllers/UserController.php by phpmd

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 UserController extends AppController

The property $_daos is not named in camelCase.
Open

class UserController extends AppController
{
    public $_models = array(
        'User',
        'NewUserInvitation',
Severity: Minor
Found in core/controllers/UserController.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 UserController extends AppController
{
    public $_models = array(
        'User',
        'NewUserInvitation',
Severity: Minor
Found in core/controllers/UserController.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 $tx. Configured minimum length is 3.
Open

                        $tx = $thumb;  //--- landscape ---
Severity: Minor
Found in core/controllers/UserController.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

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

                        $ty = round($thumb / $x * $y);
Severity: Minor
Found in core/controllers/UserController.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

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

                    list($x, $y) = getimagesize($path);  //--- get size of img ---
Severity: Minor
Found in core/controllers/UserController.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 $_forms is not named in camelCase.
Open

class UserController extends AppController
{
    public $_models = array(
        'User',
        'NewUserInvitation',
Severity: Minor
Found in core/controllers/UserController.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 $y. Configured minimum length is 3.
Open

                    list($x, $y) = getimagesize($path);  //--- get size of img ---
Severity: Minor
Found in core/controllers/UserController.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 $_models is not named in camelCase.
Open

class UserController extends AppController
{
    public $_models = array(
        'User',
        'NewUserInvitation',
Severity: Minor
Found in core/controllers/UserController.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

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

    public $_models = array(

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

    public $_forms = array('User');

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

    public $_daos = array('User', 'Folder', 'Folderpolicygroup', 'Folderpolicyuser', 'Group');

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

    public $_components = array('Breadcrumb', 'Date', 'Filter', 'Random', 'Sortdao');

Line exceeds 120 characters; contains 189 characters
Open

        echo '<div style="margin-top: 10px; padding-left: 10px;">'.'An email with a link to complete registration has been sent to the '.'specified address. You may close this page.</div>';

Line exceeds 120 characters; contains 134 characters
Open

                    $body = 'An administrator has created a user account for you at the following Midas Platform instance:<br/><br/>';

Line exceeds 120 characters; contains 123 characters
Open

        $this->view->allowPasswordReset = (int) $this->Setting->getValueByNameWithDefault('allow_password_reset', 0) === 1;

Line exceeds 120 characters; contains 132 characters
Open

                            $user->setExpirationSeconds(60 * (int) Zend_Registry::get('configGlobal')->get('session_lifetime', 20));

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

                ) || $this->userSession->Dao->isAdmin())

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

                        ) === false

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

                ) || $this->userSession->Dao->isAdmin()));

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

                    )

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'logout'

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            $previousUri,

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

                    ) != $userDao->getKey()) && (!isset($this->userSession->Dao) || !$this->userSession->Dao->isAdmin())

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

                ) || $this->userSession->Dao->isAdmin())

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

                        $hashedPasswordOld

The variable $user_id is not named in camelCase.
Open

    public function userpageAction()
    {
        if (!$this->_request->isGet()) {
            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.php by phpmd

CamelCaseVariableName

Since: 0.2

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

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $user_id is not named in camelCase.
Open

    public function userpageAction()
    {
        if (!$this->_request->isGet()) {
            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.php by phpmd

CamelCaseVariableName

Since: 0.2

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

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $user_id is not named in camelCase.
Open

    public function userpageAction()
    {
        if (!$this->_request->isGet()) {
            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.php by phpmd

CamelCaseVariableName

Since: 0.2

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

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $user_id is not named in camelCase.
Open

    public function userpageAction()
    {
        if (!$this->_request->isGet()) {
            throw new Zend_Exception('Only HTTP Get requests are accepted', 400);
        }
Severity: Minor
Found in core/controllers/UserController.php by phpmd

CamelCaseVariableName

Since: 0.2

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

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status