Method alumni_makeSelBox
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function alumni_makeSelBox($name, $fieldName, $prefix = '-', $selected = '', $addEmptyOption = false, $key = 0, $extra = '')
Method alumni_makeSelBoxOptions
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
Method alumni_makeArrayTreeOptions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
Function alumni_makeSelBoxOptions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- 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 alumni_getAllChild
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function alumni_getAllChild($key, $ret = [])
{
if (isset($this->_tree[$key]['child'])) {
foreach ($this->_tree[$key]['child'] as $childkey) {
$ret[$childkey] = $this->_tree[$childkey]['obj'];
- 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
The method alumni_makeSelBox has a boolean flag argument $addEmptyOption, which is a certain sign of a Single Responsibility Principle violation. Open
public function alumni_makeSelBox($name, $fieldName, $prefix = '-', $selected = '', $addEmptyOption = false, $key = 0, $extra = '')
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class 'Xoops' in method 'alumni_makeSelBox'. Open
$xoops = Xoops::getInstance();
- Read upRead up
- 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 unused local variables such as '$xoops'. Open
$xoops = Xoops::getInstance();
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class AlumniObjectTree extends XoopsObjectTree
- Exclude checks
The property $_myId is not named in camelCase. Open
class AlumniObjectTree extends XoopsObjectTree
{
/**
* @var string
*/
- 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 parameter $prefix_orig is not named in camelCase. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The property $_tree is not named in camelCase. Open
class AlumniObjectTree extends XoopsObjectTree
{
/**
* @var string
*/
- 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 parameter $prefix_curr is not named in camelCase. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
$value = $this->_tree[$key]['obj']->getVar($this->_myId);
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The property $_parentId is not named in camelCase. Open
class AlumniObjectTree extends XoopsObjectTree
{
/**
* @var string
*/
- 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 $_rootId is not named in camelCase. Open
class AlumniObjectTree extends XoopsObjectTree
{
/**
* @var string
*/
- 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 parameter $prefix_orig is not named in camelCase. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
$value = $this->_tree[$key]['obj']->getVar($this->_myId);
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The property $_objects is not named in camelCase. Open
class AlumniObjectTree extends XoopsObjectTree
{
/**
* @var string
*/
- 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 parameter $prefix_curr is not named in camelCase. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_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 33 and the first side effect is on line 24. Open
<?php
- Exclude checks
Method name "AlumniObjectTree::alumni_makeSelBoxOptions" is not in camel caps format Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
- Exclude checks
Method name "AlumniObjectTree::alumni_makeArrayTreeOptions" is not in camel caps format Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
- Exclude checks
Property name "$_objects" should not be prefixed with an underscore to indicate visibility Open
private $_objects;
- Exclude checks
Method name "AlumniObjectTree::alumni_getFirstChild" is not in camel caps format Open
public function alumni_getFirstChild($key)
- Exclude checks
Method name "AlumniObjectTree::alumni_getAllParent" is not in camel caps format Open
public function alumni_getAllParent($key, $ret = [], $uplevel = 1)
- Exclude checks
Method name "AlumniObjectTree::alumni_makeArrayTree" is not in camel caps format Open
public function alumni_makeArrayTree($fieldName, $prefix = '-', $key = 0)
- Exclude checks
Method name "AlumniObjectTree::alumni_getAllChild" is not in camel caps format Open
public function alumni_getAllChild($key, $ret = [])
- Exclude checks
Method name "AlumniObjectTree::alumni_getByKey" is not in camel caps format Open
public function alumni_getByKey($key)
- Exclude checks
Property name "$_tree" should not be prefixed with an underscore to indicate visibility Open
private $_tree = [];
- Exclude checks
Method name "AlumniObjectTree::alumni_makeSelBox" is not in camel caps format Open
public function alumni_makeSelBox($name, $fieldName, $prefix = '-', $selected = '', $addEmptyOption = false, $key = 0, $extra = '')
- Exclude checks
Property name "$_rootId" should not be prefixed with an underscore to indicate visibility Open
private $_rootId = null;
- Exclude checks
Method name "AlumniObjectTree::alumni_getTree" is not in camel caps format Open
public function alumni_getTree()
- Exclude checks
Property name "$_parentId" should not be prefixed with an underscore to indicate visibility Open
private $_parentId;
- Exclude checks
Property name "$_myId" should not be prefixed with an underscore to indicate visibility Open
private $_myId;
- Exclude checks
Method name "_initialize" should not be prefixed with an underscore to indicate visibility Open
private function _initialize()
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
public function alumni_makeSelBox($name, $fieldName, $prefix = '-', $selected = '', $addEmptyOption = false, $key = 0, $extra = '')
- Exclude checks
The variable $prefix_curr is not named in camelCase. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
$value = $this->_tree[$key]['obj']->getVar($this->_myId);
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName);
- 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 $prefix_orig is not named in camelCase. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- 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 $prefix_orig is not named in camelCase. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
$value = $this->_tree[$key]['obj']->getVar($this->_myId);
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName);
- 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 $prefix_curr is not named in camelCase. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
$value = $this->_tree[$key]['obj']->getVar($this->_myId);
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName);
- 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 $prefix_orig is not named in camelCase. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
$value = $this->_tree[$key]['obj']->getVar($this->_myId);
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName);
- 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 $prefix_curr is not named in camelCase. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- 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 $prefix_orig is not named in camelCase. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- 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 $prefix_curr is not named in camelCase. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- 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 $prefix_curr is not named in camelCase. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- 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 $prefix_curr is not named in camelCase. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
$value = $this->_tree[$key]['obj']->getVar($this->_myId);
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName);
- 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 alumni_getTree is not named in camelCase. Open
public function alumni_getTree()
{
return $this->_tree;
}
- 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 alumni_makeSelBoxOptions is not named in camelCase. Open
private function alumni_makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
/* @var $object XoopsObject */
$object = $this->_tree[$key]['obj'];
- 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 alumni_getByKey is not named in camelCase. Open
public function alumni_getByKey($key)
{
return $this->_tree[$key]['obj'];
}
- 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 alumni_getFirstChild is not named in camelCase. Open
public function alumni_getFirstChild($key)
{
$ret = [];
if (isset($this->_tree[$key]['child'])) {
foreach ($this->_tree[$key]['child'] as $childkey) {
- 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 alumni_makeSelBox is not named in camelCase. Open
public function alumni_makeSelBox($name, $fieldName, $prefix = '-', $selected = '', $addEmptyOption = false, $key = 0, $extra = '')
{
$xoops = Xoops::getInstance();
$ret = '<select name="' . $name . '" id="' . $name . '" ' . $extra . '>';
if (false != $addEmptyOption) {
- 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 alumni_getAllChild is not named in camelCase. Open
public function alumni_getAllChild($key, $ret = [])
{
if (isset($this->_tree[$key]['child'])) {
foreach ($this->_tree[$key]['child'] as $childkey) {
$ret[$childkey] = $this->_tree[$childkey]['obj'];
- 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 alumni_makeArrayTree is not named in camelCase. Open
public function alumni_makeArrayTree($fieldName, $prefix = '-', $key = 0)
{
$ret = [];
$this->alumni_makeArrayTreeOptions($fieldName, $key, $ret, $prefix);
- 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 alumni_getAllParent is not named in camelCase. Open
public function alumni_getAllParent($key, $ret = [], $uplevel = 1)
{
if (isset($this->_tree[$key]['parent']) && isset($this->_tree[$this->_tree[$key]['parent']]['obj'])) {
$ret[$uplevel] = $this->_tree[$this->_tree[$key]['parent']]['obj'];
$parents = $this->alumni_getAllParent($this->_tree[$key]['parent'], $ret, $uplevel + 1);
- 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 alumni_makeArrayTreeOptions is not named in camelCase. Open
public function alumni_makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
{
if ($key > 0) {
$value = $this->_tree[$key]['obj']->getVar($this->_myId);
$ret[$value] = $prefix_curr . $this->_tree[$key]['obj']->getVar($fieldName);
- 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 _initialize is not named in camelCase. Open
private function _initialize()
{
/* @var $object XoopsObject */
foreach ($this->_objects as $object) {
$key1 = $object->getVar($this->_myId);
- 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() {
}
}