The class Gems_Model has an overall complexity of 54 which is very high. The configured complexity threshold is 50. Open
class Gems_Model extends \Gems_Loader_TargetLoaderAbstract
{
const ID_TYPE = 'id_type';
/**
- Exclude checks
Gems_Model
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Gems_Model extends \Gems_Loader_TargetLoaderAbstract
{
const ID_TYPE = 'id_type';
/**
File Model.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
*
* @package Gems
Function setChangeFieldsByPrefix
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 setChangeFieldsByPrefix
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
Method getFileModel
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFileModel($dir, $detailed = true, $extensionsOrMask = null, $recursive = false, $followSymlinks = false)
{
$model = new \MUtil_Model_FolderModel($dir, $extensionsOrMask, $recursive, $followSymlinks);
if ($recursive) {
Method getFileModel
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getFileModel($dir, $detailed = true, $extensionsOrMask = null, $recursive = false, $followSymlinks = false)
The class Gems_Model has a coupling between objects value of 31. Consider to reduce the number of dependencies under 13. Open
class Gems_Model extends \Gems_Loader_TargetLoaderAbstract
{
const ID_TYPE = 'id_type';
/**
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Avoid unused parameters such as '$context'. Open
public function createGemsUserId($value, $isNew = false, $name = null, array $context = array())
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$isNew'. Open
public function createGemsUserId($value, $isNew = false, $name = null, array $context = array())
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$name'. Open
public function createGemsUserId($value, $isNew = false, $name = null, array $context = array())
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid excessively long variable names like $respondentLoginIdField. Keep variable name length under 20. Open
public $respondentLoginIdField = 'gr2o_patient_nr';
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
protected $db;
- 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
Avoid variables with short names like $db. Configured minimum length is 3. Open
public function getExportDbaModel(\Zend_Db_Adapter_Abstract $db, array $directories)
- 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 variable $changed_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $changed_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $created_by_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $created_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $created_by_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $created_by_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $changed_by_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $created_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $created_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $changed_by_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $created_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $created_by_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $changed_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $changed_by_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $changed_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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 $changed_by_field is not named in camelCase. Open
public static function setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, $prefix, $userid = null)
{
$changed_field = $prefix . '_changed';
$changed_by_field = $prefix . '_changed_by';
$created_field = $prefix . '_created';
- 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();
}
}