manageAction accesses the super-global variable $_POST. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
manageAction accesses the super-global variable $_POST. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
manageAction accesses the super-global variable $_POST. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
File CommunityController.php
has 737 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.
- Create a ticketCreate a ticket
Function manageAction
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
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 manageAction
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Create a ticketCreate a ticket
Method viewAction
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Create a ticketCreate a ticket
The class CommunityController has 14 public methods. Consider refactoring CommunityController to keep number of public methods under 10. Open
class CommunityController extends AppController
{
public $_models = array(
'Community',
'Folder',
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 CommunityController has an overall complexity of 136 which is very high. The configured complexity threshold is 50. Open
class CommunityController extends AppController
{
public $_models = array(
'Community',
'Folder',
- Create a ticketCreate a ticket
- Exclude checks
Function sendinvitationAction
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function sendinvitationAction()
{
$this->disableLayout();
$this->disableView();
- Read upRead up
- Create a ticketCreate a ticket
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 viewAction
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
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 sendinvitationAction
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendinvitationAction()
{
$this->disableLayout();
$this->disableView();
- Create a ticketCreate a ticket
Function promoteuserAction
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function promoteuserAction()
{
$this->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- Read upRead up
- Create a ticketCreate a ticket
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 promoteuserAction
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function promoteuserAction()
{
$this->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- Create a ticketCreate a ticket
Method addusertogroupAction
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addusertogroupAction()
{
$this->disableLayout();
$this->disableView();
- Create a ticketCreate a ticket
Method promotedialogAction
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function promotedialogAction()
{
$this->disableLayout();
if (!$this->logged) {
- Create a ticketCreate a ticket
Method _sendUserInvitation
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _sendUserInvitation($userDao, $groupDao)
{
if ($this->Group->userInGroup($userDao, $groupDao)) {
echo JsonComponent::encode(
array(false, $userDao->getFullName().' is already a member of this community')
- Create a ticketCreate a ticket
Method indexAction
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function indexAction()
{
$this->view->header = $this->t('Communities');
$this->view->json['community']['createCommunity'] = $this->t('Create a community');
$this->view->json['community']['titleCreateLogin'] = $this->t('Please log in');
- Create a ticketCreate a ticket
Function promotedialogAction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function promotedialogAction()
{
$this->disableLayout();
if (!$this->logged) {
- Read upRead up
- Create a ticketCreate a ticket
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 removeuserfromgroupAction
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function removeuserfromgroupAction()
{
$this->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- Create a ticketCreate a ticket
Method selectgroupAction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function selectgroupAction()
{
$this->disableLayout();
$communityId = $this->getParam('communityId');
- Create a ticketCreate a ticket
Function addusertogroupAction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function addusertogroupAction()
{
$this->disableLayout();
$this->disableView();
- Read upRead up
- Create a ticketCreate a ticket
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 selectgroupAction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function selectgroupAction()
{
$this->disableLayout();
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
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 removeuserfromgroupAction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function removeuserfromgroupAction()
{
$this->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- Read upRead up
- Create a ticketCreate a ticket
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 invitationAction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function invitationAction()
{
$this->disableLayout();
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
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 _sendUserInvitation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function _sendUserInvitation($userDao, $groupDao)
{
if ($this->Group->userInGroup($userDao, $groupDao)) {
echo JsonComponent::encode(
array(false, $userDao->getFullName().' is already a member of this community')
- Read upRead up
- Create a ticketCreate a ticket
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 manageAction() has 219 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Create a ticketCreate a ticket
- Exclude checks
The method promoteuserAction() has an NPath complexity of 480. The configured NPath complexity threshold is 200. Open
public function promoteuserAction()
{
$this->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 promotedialogAction() has an NPath complexity of 288. The configured NPath complexity threshold is 200. Open
public function promotedialogAction()
{
$this->disableLayout();
if (!$this->logged) {
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 viewAction() has an NPath complexity of 756. The configured NPath complexity threshold is 200. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 manageAction() has an NPath complexity of 4210020. The configured NPath complexity threshold is 200. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 viewAction() has 119 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Create a ticketCreate a ticket
- Exclude checks
The method sendinvitationAction() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function sendinvitationAction()
{
$this->disableLayout();
$this->disableView();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 promotedialogAction() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function promotedialogAction()
{
$this->disableLayout();
if (!$this->logged) {
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 viewAction() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 manageAction() has a Cyclomatic Complexity of 35. The configured cyclomatic complexity threshold is 10. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 promoteuserAction() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function promoteuserAction()
{
$this->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Missing class import via use statement (line '66', column '23'). Open
throw new Zend_Exception("This community doesn't exist or you don't have the permissions.", 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '137', column '31'). Open
throw new Zend_Exception('Community Admin permissions required.', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '826', column '23'). Open
throw new Zend_Exception('Must be logged in');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '734', column '23'). Open
throw new Zend_Exception('Must be logged in');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '834', column '23'). Open
throw new Zend_Exception('Must pass a userId parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '86', column '31'). Open
throw new Zend_Exception('Community Admin permissions required.', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '153', column '31'). Open
throw new Zend_Exception('Community Admin permissions required.', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '740', column '23'). Open
throw new Zend_Exception('Must pass a community parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '752', column '23'). Open
throw new Zend_Exception('User is not in community members group');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '580', column '27'). Open
throw new Zend_Exception('Specified group is not in the specified community');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '592', column '27'). Open
throw new Zend_Exception('Invalid userId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '785', column '23'). Open
throw new Zend_Exception('Must pass a communityId parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '442', column '23'). Open
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '485', column '23'). Open
throw new Zend_Exception('Invalid communityId', 404);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '325', column '23'). Open
throw new Zend_Exception("This community doesn't exist or you don't have the permissions.", 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '797', column '23'). Open
throw new Zend_Exception('User is not in community members group');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '801', column '23'). Open
throw new Zend_Exception('Community Admin permissions required.', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '320', column '23'). Open
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '568', column '23'). Open
throw new Zend_Exception('Invalid communityId', 404);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '583', column '27'). Open
throw new Zend_Exception('Only members of the admin group may invite users to the admin group');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '809', column '31'). Open
throw new Zend_Exception('Invalid group id: '.$id);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '104', column '31'). Open
throw new Zend_Exception('Community Admin permissions required.', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '177', column '31'). Open
throw new Zend_Exception('Community Admin permissions required.', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '780', column '23'). Open
throw new Zend_Exception('Must be logged in');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '451', column '23'). Open
throw new Zend_Exception("This community doesn't exist or you don't have the permissions.", 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '626', column '23'). Open
throw new Zend_Exception('Must pass userId or email parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '788', column '23'). Open
throw new Zend_Exception('Must pass a userId parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '794', column '23'). Open
throw new Zend_Exception('Invalid user or community parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '572', column '23'). Open
throw new Zend_Exception('Write permission required on the community', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '831', column '23'). Open
throw new Zend_Exception('Must pass a groupId parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '876', column '23'). Open
throw new Zend_Exception('Moderator or admin privileges required', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '868', column '23'). Open
throw new Zend_Exception('Community id parameter required');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '513', column '23'). Open
throw new Zend_Exception('Admin permission required on the community', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '743', column '23'). Open
throw new Zend_Exception('Must pass a user parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '840', column '23'). Open
throw new Zend_Exception('Invalid user or group parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '846', column '23'). Open
throw new Zend_Exception('Community Admin permissions required.', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '481', column '23'). Open
throw new Zend_Exception('Must pass a communityId parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '756', column '23'). Open
throw new Zend_Exception('Community Admin permissions required.', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '872', column '23'). Open
throw new Zend_Exception('Community '.$communityId.' does not exist', 404);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '57', column '23'). Open
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '489', column '23'). Open
throw new Zend_Exception('Write permission required on the community', 403);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '749', column '23'). Open
throw new Zend_Exception('Invalid user or community parameter');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 sendinvitationAction 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(true, 'Invitation created but not sent'));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 invitationAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$directAdd = 0;
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 sendinvitationAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new Zend_Exception('Must pass userId or email parameter');
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(false, $this->t('Error')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 {
$communities = $this->User->getUserCommunities($this->userSession->Dao);
$communities = array_merge($communities, $this->Community->getPublicCommunities());
$this->view->siteAdmin = false;
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '_sendUserInvitation'. Open
echo JsonComponent::encode(
array(false, $userDao->getFullName().' is already a member of this community')
);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(true, $this->t('Changes saved'), $infoForm->getValue('name')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 manageAction 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('Error')));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 {
$users = explode('-', $this->getParam('users'));
$usersDao = $this->User->load($users);
foreach ($usersDao as $userDao) {
$this->Group->addUser($group, $userDao);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'addusertogroupAction'. Open
echo JsonComponent::encode(array(true, 'User added and notification sent to '.$email));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 _sendUserInvitation 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(true, 'Invitation not sent'));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(true, $this->t('Changes saved')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(false, $this->t('Error')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(false, $this->t('Error')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'viewAction'. Open
UtilityComponent::markdown(htmlspecialchars($communityDao->getDescription(), ENT_COMPAT, 'UTF-8')),
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 sendinvitationAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$group = $community->getMemberGroup();
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 createAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->disableLayout();
$this->view->form = $this->getFormAsArray($form);
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'removeuserfromgroupAction'. Open
echo JsonComponent::encode(
array(true, 'Removed user '.$user->getFullName().' from group '.$group->getName())
);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(true, $this->t('Changes saved'), $new_group->toArray()));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(false, $this->t('Error')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '_sendUserInvitation'. Open
echo JsonComponent::encode(
array(false, $userDao->getFullName().$this->t(' is already invited to this community.'))
);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '_sendUserInvitation'. Open
echo JsonComponent::encode(array(true, 'Invitation not sent'));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(true, $this->t('Changes saved')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(true, $this->t('Changes saved'), $group->toArray()));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 manageAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->Group->delete($group);
echo JsonComponent::encode(array(true, $this->t('Changes saved')));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(false, $this->t('Error')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'addusertogroupAction'. Open
echo JsonComponent::encode(array(false, 'Unable to add user'));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 manageAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$users = explode('-', $this->getParam('users'));
$usersDao = $this->User->load($users);
foreach ($usersDao as $userDao) {
$this->Group->removeUser($group, $userDao);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 validentryAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
echo 'false';
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(false, $this->t('Error')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(false, $this->t('Error')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 manageAction 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('Error')));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 {
echo JsonComponent::encode(array(false, $this->t('Error')));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(true, $this->t('Changes saved')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'addusertogroupAction'. Open
echo JsonComponent::encode(array(true, 'User added but notification not sent'));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 '_sendUserInvitation'. Open
echo JsonComponent::encode(array(true, 'Invitation sent to '.$email));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 sendinvitationAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
/** @var NewUserInvitationModel $newuserModel */
$newuserModel = MidasLoader::loadModel('NewUserInvitation');
$newuserinvite = $newuserModel->createInvitation($email, $group, $this->userSession->Dao);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'sendinvitationAction'. Open
echo JsonComponent::encode(array(true, 'Invitation created but not sent'));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'manageAction'. Open
echo JsonComponent::encode(array(true, $this->t('Changes saved')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 addusertogroupAction 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(true, 'User added but notification not sent'));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 addusertogroupAction 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, 'Unable to add user'));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 {
$group = $this->Group->load($this->getParam('groupId'));
if ($group == false || $group->getCommunity()->getKey() != $communityDao->getKey()
) {
echo JsonComponent::encode(array(false, $this->t('Error')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'MidasLoader' in method 'sendinvitationAction'. Open
$newuserModel = MidasLoader::loadModel('NewUserInvitation');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'sendinvitationAction'. Open
echo JsonComponent::encode(array(true, 'Invitation sent to '.$email));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 'promoteuserAction'. Open
echo JsonComponent::encode(array(true, 'Successfully added user to groups'));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 _sendUserInvitation uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$email = $userDao->getEmail();
$url = $this->getServerURL().$this->view->webroot;
$subject = 'Community Invitation';
$body = 'You have been invited to join the <b>'.$community->getName().'</b> community at '.$url.'.<br/><br/>'.'<a href="'.$url.'/community/'.$community->getKey().'">'.'Click here</a> to see the community, and click the "Join the community" button '.'if you wish to join.';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isset($removeUser)) { // remove users from group
if (!$this->Community->policyCheck($communityDao, $this->userSession->Dao, MIDAS_POLICY_ADMIN)
) {
throw new Zend_Exception('Community Admin permissions required.', 403);
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 211.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isset($addUser)) { // add users to group
if (!$this->Community->policyCheck($communityDao, $this->userSession->Dao, MIDAS_POLICY_ADMIN)
) {
throw new Zend_Exception('Community Admin permissions required.', 403);
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 211.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class CommunityController extends AppController
- Create a ticketCreate a ticket
- Exclude checks
The property $_models is not named in camelCase. Open
class CommunityController extends AppController
{
public $_models = array(
'Community',
'Folder',
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 CommunityController extends AppController
{
public $_models = array(
'Community',
'Folder',
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $_forms is not named in camelCase. Open
class CommunityController extends AppController
{
public $_models = array(
'Community',
'Folder',
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $_daos is not named in camelCase. Open
class CommunityController extends AppController
{
public $_models = array(
'Community',
'Folder',
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
list(, $id) = explode('_', $name);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Method name "_sendUserInvitation" should not be prefixed with an underscore to indicate visibility Open
private function _sendUserInvitation($userDao, $groupDao)
- Create a ticketCreate a ticket
- Exclude checks
Property name "$_models" should not be prefixed with an underscore to indicate visibility Open
public $_models = array(
- Create a ticketCreate a ticket
- Exclude checks
Property name "$_components" should not be prefixed with an underscore to indicate visibility Open
public $_components = array('Sortdao', 'Date', 'Utility', 'Policy');
- Create a ticketCreate a ticket
- Exclude checks
Property name "$_daos" should not be prefixed with an underscore to indicate visibility Open
public $_daos = array('Community', 'Folder', 'Group', 'Folderpolicygroup', 'Group', 'User');
- Create a ticketCreate a ticket
- Exclude checks
Property name "$_forms" should not be prefixed with an underscore to indicate visibility Open
public $_forms = array('Community');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 245 characters Open
$body = $this->userSession->Dao->getFullName().' has added you to the <b>'.$community->getName().'</b> community on Midas Platform.<br/><br/><a href="'.$url.'/community/'.$community->getKey().'">Click here</a> to see the community.';
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 338 characters Open
$body = $this->userSession->Dao->getFullName().' has invited you to join the <b>'.$community->getName().'</b> community on Midas Platform.<br/><br/>'.'<a href="'.$url.'/user/emailregister?email='.$email.'&authKey='.$newuserinvite->getAuthKey().'">Click here</a> to complete your user registration '.'if you wish to join.';
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 284 characters Open
$body = 'You have been invited to join the <b>'.$community->getName().'</b> community at '.$url.'.<br/><br/>'.'<a href="'.$url.'/community/'.$community->getKey().'">'.'Click here</a> to see the community, and click the "Join the community" button '.'if you wish to join.';
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
MIDAS_POLICY_WRITE
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
MIDAS_POLICY_ADMIN
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 12 Open
)
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
$communityDao,
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
$this->userSession->Dao,
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
) || $group->getKey() == $moderator_group->getKey()
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 12 Open
)
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
$this->userSession->Dao,
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
$communityDao,
- Create a ticketCreate a ticket
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
) != $community->getModeratorgroupId() && $group->getKey() != $community->getAdmingroupId()
- Create a ticketCreate a ticket
- Exclude checks
The variable $group_member is not named in camelCase. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $new_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $group_member is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $member_group is not named in camelCase. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $forminfo_privacy is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $group_member is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $member_group is not named in camelCase. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $forminfo_privacy is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $admin_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $member_group is not named in camelCase. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $member_group is not named in camelCase. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $member_group is not named in camelCase. Open
public function addusertogroupAction()
{
$this->disableLayout();
$this->disableView();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $new_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $group_member is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $group_member is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $moderator_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $admin_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $moderator_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $member_group is not named in camelCase. Open
public function addusertogroupAction()
{
$this->disableLayout();
$this->disableView();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $admin_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $moderator_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $moderator_group is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $group_member is not named in camelCase. Open
public function manageAction()
{
$communityId = $this->getParam('communityId');
if (!isset($communityId) || !is_numeric($communityId)) {
throw new Zend_Exception('Community ID should be a number');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $group_member is not named in camelCase. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $member_group is not named in camelCase. Open
public function viewAction()
{
$this->view->Utility = $this->Component->Utility;
$this->view->Date = $this->Component->Date;
$communityId = $this->getParam('communityId');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 method _sendUserInvitation is not named in camelCase. Open
private function _sendUserInvitation($userDao, $groupDao)
{
if ($this->Group->userInGroup($userDao, $groupDao)) {
echo JsonComponent::encode(
array(false, $userDao->getFullName().' is already a member of this community')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}