Showing 651 of 651 total issues
The parameter $add_suffix is not named in camelCase. Open
public function load($langfile, $lang = '', $return = false, $add_suffix = true, $alt_path = '', $_module = '')
{
if (is_array($langfile)) {
foreach ($langfile as $_lang) {
$this->load($_lang);
- 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 $_module is not named in camelCase. Open
class MX_Loader extends CI_Loader
{
protected $_module;
public $_ci_plugins = [];
- 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 $add_suffix is not named in camelCase. Open
public function language($langfile, $idiom = '', $return = false, $add_suffix = true, $alt_path = '')
{
CI::$APP->lang->load($langfile, $idiom, $return, $add_suffix, $alt_path, $this->_module);
return $this;
}
- 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 parameter $alt_path is not named in camelCase. Open
public function language($langfile, $idiom = '', $return = false, $add_suffix = true, $alt_path = '')
{
CI::$APP->lang->load($langfile, $idiom, $return, $add_suffix, $alt_path, $this->_module);
return $this;
}
- 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
Avoid variables with short names like $db. Configured minimum length is 3. Open
if (!$db = CI::$APP->config->item('database') && in_array('database', $autoload['libraries'])) {
- Read upRead up
- 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
The parameter $_ci_data is not named in camelCase. Open
public function _ci_load($_ci_data)
{
extract($_ci_data);
if (isset($_ci_view)) {
- 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 parameter $object_name is not named in camelCase. Open
public function model($model, $object_name = null, $connect = false)
{
if (is_array($model)) {
return $this->models($model);
}
- 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 class MY_Loader is not named in CamelCase. Open
class MY_Loader extends MX_Loader
{
}
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
The class MY_Router is not named in CamelCase. Open
class MY_Router extends MX_Router
{
}
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
The parameter $object_name is not named in camelCase. Open
public function library($library, $params = null, $object_name = null)
{
if (is_array($library)) {
return $this->libraries($library);
}
- 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 class MX_Router is not named in CamelCase. Open
class MX_Router extends CI_Router
{
public $module;
private $located = 0;
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
The parameter $_route is not named in camelCase. Open
protected function _set_module_path(&$_route)
{
if (! empty($_route)) {
// Are module/directory/controller/method segments being specified?
$sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
- 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
Function _set_module_path
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function _set_module_path(&$_route)
{
if (! empty($_route)) {
// Are module/directory/controller/method segments being specified?
$sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
- 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 load
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function load($langfile, $lang = '', $return = false, $add_suffix = true, $alt_path = '', $_module = '')
Function _set_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function _set_request($segments = [])
{
if ($this->translate_uri_dashes === true) {
foreach (range(0, 2) as $v) {
isset($segments[$v]) && $segments[$v] = str_replace('-', '_', $segments[$v]);
- 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 language
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function language($langfile, $idiom = '', $return = false, $add_suffix = true, $alt_path = '')
Function autoload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function autoload($class)
{
// don't autoload CI_ prefixed classes or those using the config subclass_prefix
if (strstr($class, 'CI_') || strstr($class, config_item('subclass_prefix'))) {
return;
- 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 load_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function load_file($file, $path, $type = 'other', $result = true)
{
$file = str_replace(EXT, '', $file);
$location = $path.$file.EXT;
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function initialize($controller = null)
{
// set the module name
$this->_module = CI::$APP->router->fetch_module();
- 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
Property name "$_module" should not be prefixed with an underscore to indicate visibility Open
protected $_module;
- Exclude checks