Method render
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render()
{
global $xoopsGTicket;
// load all child ids for javascript codes
Method _renderOptionTree
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
{
$tree .= $prefix
. '<input type="checkbox" name="'
. $this->getName()
Function render
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function render()
{
$ret = '';
if (count($this->_appendix) > 0) {
- Read upRead up
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 render
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function render()
{
global $xoopsGTicket;
// load all child ids for javascript codes
- Read upRead up
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 render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render()
{
$ret = '';
if (count($this->_appendix) > 0) {
Function _loadAllChildItemIds
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _loadAllChildItemIds($itemId, &$childIds)
{
if (!empty($this->_itemTree[$itemId]['children'])) {
$first_child = $this->_itemTree[$itemId]['children'];
foreach ($first_child as $fcid) {
- Read upRead up
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 _renderOptionTree
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
{
$tree .= $prefix
. '<input type="checkbox" name="'
. $this->getName()
- Read upRead up
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
Missing class import via use statement (line '183', column '21'). Open
$tray = new XoopsFormElementTray('');
- Read upRead up
- 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 '80', column '31'). Open
$this->addElement(new XoopsFormHidden('modid', $this->_modid));
- Read upRead up
- 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 '161', column '29'). Open
$ele = new MyXoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected);
- Read upRead up
- 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 '176', column '30'). Open
$jscheckbutton = new XoopsFormButton('', 'all', _ALL, 'button');
- Read upRead up
- 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 '173', column '32'). Open
$jstray = new XoopsFormElementTray(' ');
- Read upRead up
- 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 '184', column '31'). Open
$tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset'));
- Read upRead up
- 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 '174', column '32'). Open
$jsuncheckbutton = new XoopsFormButton('', 'none', _NONE, 'button');
- Read upRead up
- 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 '185', column '31'). Open
$tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
- Read upRead up
- 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 setValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->_value[] = $value;
}
- Read upRead up
- 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 render uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ret .= $elements[$i]->render();
}
- Read upRead up
- 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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class MyXoopsGroupFormCheckBox extends XoopsFormElement
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class MyXoopsGroupPermForm extends XoopsForm
- Exclude checks
The property $_permName is not named in camelCase. Open
class MyXoopsGroupPermForm extends XoopsForm
{
/**
* Module ID
* @var int
- Read upRead up
- 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 $_permDesc is not named in camelCase. Open
class MyXoopsGroupPermForm extends XoopsForm
{
/**
* Module ID
* @var int
- Read upRead up
- 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 $_optionTree is not named in camelCase. Open
class MyXoopsGroupFormCheckBox extends XoopsFormElement
{
/**
* Pre-selected value(s)
* @var array;
- Read upRead up
- 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 $_appendix is not named in camelCase. Open
class MyXoopsGroupPermForm extends XoopsForm
{
/**
* Module ID
* @var int
- Read upRead up
- 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 $_itemTree is not named in camelCase. Open
class MyXoopsGroupPermForm extends XoopsForm
{
/**
* Module ID
* @var int
- Read upRead up
- 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 $_modid is not named in camelCase. Open
class MyXoopsGroupPermForm extends XoopsForm
{
/**
* Module ID
* @var int
- Read upRead up
- 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 $_value is not named in camelCase. Open
class MyXoopsGroupFormCheckBox extends XoopsFormElement
{
/**
* Pre-selected value(s)
* @var array;
- Read upRead up
- 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 $_appendix is not named in camelCase. Open
class MyXoopsGroupFormCheckBox extends XoopsFormElement
{
/**
* Pre-selected value(s)
* @var array;
- Read upRead up
- 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 $_groupId is not named in camelCase. Open
class MyXoopsGroupFormCheckBox extends XoopsFormElement
{
/**
* Pre-selected value(s)
* @var array;
- Read upRead up
- 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
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 38 and the first side effect is on line 21. Open
<?php
- Exclude checks
Each class must be in a file by itself Open
class MyXoopsGroupFormCheckBox extends XoopsFormElement
- Exclude checks
Property name "$_itemTree" should not be prefixed with an underscore to indicate visibility Open
public $_itemTree = array();
- Exclude checks
Property name "$_permName" should not be prefixed with an underscore to indicate visibility Open
public $_permName;
- Exclude checks
Property name "$_modid" should not be prefixed with an underscore to indicate visibility Open
public $_modid;
- Exclude checks
Property name "$_permDesc" should not be prefixed with an underscore to indicate visibility Open
public $_permDesc;
- Exclude checks
Method name "_loadAllChildItemIds" should not be prefixed with an underscore to indicate visibility Open
public function _loadAllChildItemIds($itemId, &$childIds)
- Exclude checks
Property name "$_appendix" should not be prefixed with an underscore to indicate visibility Open
public $_appendix = array();
- Exclude checks
Property name "$_groupId" should not be prefixed with an underscore to indicate visibility Open
public $_groupId;
- Exclude checks
Property name "$_optionTree" should not be prefixed with an underscore to indicate visibility Open
public $_optionTree;
- Exclude checks
Property name "$_appendix" should not be prefixed with an underscore to indicate visibility Open
public $_appendix = array();
- Exclude checks
Property name "$_value" should not be prefixed with an underscore to indicate visibility Open
public $_value;
- Exclude checks
Method name "_renderOptionTree" should not be prefixed with an underscore to indicate visibility Open
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
- Exclude checks
Line exceeds 120 characters; contains 259 characters Open
$jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for (i=0;i<length;i++) {if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)) {elements[i].checked=true;}}}\"");
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked !== true) {ele.checked = false;}";
- Exclude checks
Line exceeds 120 characters; contains 169 characters Open
$jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for (i=0;i<length;i++) {if (elements[i].type=='checkbox') {elements[i].checked=false;}}}\"");
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
$this->_appendix[$key]['selected'] = $gpermHandler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid);
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
$tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if (ele.checked !== true) {ele.checked = this.checked;}";
- Exclude checks
Line exceeds 120 characters; contains 391 characters Open
$ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br></td>";
- Exclude checks
The variable $item_id is not named in camelCase. Open
public function render()
{
global $xoopsGTicket;
// load all child ids for javascript codes
- Read upRead up
- 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 $parent_ele is not named in camelCase. Open
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
{
$tree .= $prefix
. '<input type="checkbox" name="'
. $this->getName()
- Read upRead up
- 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 $_fcid is not named in camelCase. Open
public function _loadAllChildItemIds($itemId, &$childIds)
{
if (!empty($this->_itemTree[$itemId]['children'])) {
$first_child = $this->_itemTree[$itemId]['children'];
foreach ($first_child as $fcid) {
- Read upRead up
- 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 $item_id is not named in camelCase. Open
public function render()
{
global $xoopsGTicket;
// load all child ids for javascript codes
- Read upRead up
- 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 $child_ele is not named in camelCase. Open
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
{
$tree .= $prefix
. '<input type="checkbox" name="'
. $this->getName()
- Read upRead up
- 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 $_fcid is not named in camelCase. Open
public function _loadAllChildItemIds($itemId, &$childIds)
{
if (!empty($this->_itemTree[$itemId]['children'])) {
$first_child = $this->_itemTree[$itemId]['children'];
foreach ($first_child as $fcid) {
- Read upRead up
- 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 $first_child is not named in camelCase. Open
public function _loadAllChildItemIds($itemId, &$childIds)
{
if (!empty($this->_itemTree[$itemId]['children'])) {
$first_child = $this->_itemTree[$itemId]['children'];
foreach ($first_child as $fcid) {
- Read upRead up
- 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 $item_id is not named in camelCase. Open
public function render()
{
global $xoopsGTicket;
// load all child ids for javascript codes
- Read upRead up
- 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 $parent_ele is not named in camelCase. Open
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
{
$tree .= $prefix
. '<input type="checkbox" name="'
. $this->getName()
- Read upRead up
- 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 $first_child is not named in camelCase. Open
public function _loadAllChildItemIds($itemId, &$childIds)
{
if (!empty($this->_itemTree[$itemId]['children'])) {
$first_child = $this->_itemTree[$itemId]['children'];
foreach ($first_child as $fcid) {
- Read upRead up
- 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 $_fcid is not named in camelCase. Open
public function _loadAllChildItemIds($itemId, &$childIds)
{
if (!empty($this->_itemTree[$itemId]['children'])) {
$first_child = $this->_itemTree[$itemId]['children'];
foreach ($first_child as $fcid) {
- Read upRead up
- 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 $child_ele is not named in camelCase. Open
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
{
$tree .= $prefix
. '<input type="checkbox" name="'
. $this->getName()
- Read upRead up
- 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 $item_id is not named in camelCase. Open
public function render()
{
global $xoopsGTicket;
// load all child ids for javascript codes
- Read upRead up
- 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 _renderOptionTree is not named in camelCase. Open
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
{
$tree .= $prefix
. '<input type="checkbox" name="'
. $this->getName()
- Read upRead up
- 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() {
}
}
Source
The method _loadAllChildItemIds is not named in camelCase. Open
public function _loadAllChildItemIds($itemId, &$childIds)
{
if (!empty($this->_itemTree[$itemId]['children'])) {
$first_child = $this->_itemTree[$itemId]['children'];
foreach ($first_child as $fcid) {
- Read upRead up
- 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() {
}
}