The method __construct() has an NPath complexity of 7704. The configured NPath complexity threshold is 200. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- Read upRead up
- 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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$categoryFilter = ' resource.category IS NULL ';
}
- 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
Avoid unused local variables such as '$resourceNode'. Open
$resourceNode = $lp->getResourceNode();
- 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
The parameter $check_publication_dates is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $user_id is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $alpha_list is not named in camelCase. Open
class LearnpathList
{
// Holds a flat list of learnpaths data from the database.
public $list = [];
// Holds a flat list of learnpaths sorted by alphabetical name order.
- 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 $course_code is not named in camelCase. Open
class LearnpathList
{
// Holds a flat list of learnpaths data from the database.
public $list = [];
// Holds a flat list of learnpaths sorted by alphabetical name order.
- 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 $user_id is not named in camelCase. Open
class LearnpathList
{
// Holds a flat list of learnpaths data from the database.
public $list = [];
// Holds a flat list of learnpaths sorted by alphabetical name order.
- 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 $course_code is not named in camelCase. Open
public static function get_course_lessons($course_code, $session_id)
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
// @todo AND session_id = %s ?
- 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 $session_id is not named in camelCase. Open
public static function get_course_lessons($course_code, $session_id)
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
// @todo AND session_id = %s ?
- 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 $order_by is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $session_id is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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
Variable "user_id" is not in valid camel caps format Open
$user_id,
- Exclude checks
Variable "course_code" is not in valid camel caps format Open
public static function get_course_lessons($course_code, $session_id)
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$user_id,
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
$course = api_get_course_entity($course_id);
- Exclude checks
Member variable "user_id" is not in valid camel caps format Open
public $user_id;
- Exclude checks
Variable "order_by" is not in valid camel caps format Open
$qb->addOrderBy($order_by);
- Exclude checks
Expected 2 spaces after parameter name; 1 found Open
* @param int $session_id Id of session
- Exclude checks
Variable "course_code" is not in valid camel caps format Open
$course = api_get_course_info($course_code);
- Exclude checks
Variable "order_by" is not in valid camel caps format Open
if (!empty($order_by)) {
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
$course_id = $courseInfo['real_id'];
- Exclude checks
Variable "session_id" is not in valid camel caps format Open
$session = api_get_session_entity($session_id);
- Exclude checks
Variable "check_publication_dates" is not in valid camel caps format Open
if ($check_publication_dates) {
- Exclude checks
Variable "sql_query" is not in valid camel caps format Open
$sql_query = sprintf($sql, $course['real_id']);
- Exclude checks
Member variable "alpha_list" is not in valid camel caps format Open
public $alpha_list = [];
- Exclude checks
Member variable "course_code" is not in valid camel caps format Open
public $course_code;
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$this->user_id = $user_id;
- Exclude checks
Expected 4 spaces after parameter type; 2 found Open
* @param int $session_id Id of session
- Exclude checks
Variable "sql_query" is not in valid camel caps format Open
$result = Database::query($sql_query);
- Exclude checks
Variable "order_by" is not in valid camel caps format Open
$order_by = null,
- Exclude checks
Variable "alpha_list" is not in valid camel caps format Open
$this->alpha_list = $names;
- Exclude checks
Method name "LearnpathList::get_course_lessons" is not in camel caps format Open
public static function get_course_lessons($course_code, $session_id)
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$this->user_id = $user_id;
- Exclude checks
Method name "LearnpathList::get_flat_list" is not in camel caps format Open
public function get_flat_list()
- Exclude checks
Variable "session_id" is not in valid camel caps format Open
$session_id = 0,
- Exclude checks
Variable "session_id" is not in valid camel caps format Open
if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) {
- Exclude checks
Variable "check_publication_dates" is not in valid camel caps format Open
$check_publication_dates = false,
- Exclude checks
Variable "session_id" is not in valid camel caps format Open
public static function get_course_lessons($course_code, $session_id)
- Exclude checks
The variable $user_id is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $sql_query is not named in camelCase. Open
public static function get_course_lessons($course_code, $session_id)
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
// @todo AND session_id = %s ?
- 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 $order_by is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $session_id is not named in camelCase. Open
public static function get_course_lessons($course_code, $session_id)
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
// @todo AND session_id = %s ?
- 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 $order_by is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $session_id is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $user_id is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $course_code is not named in camelCase. Open
public static function get_course_lessons($course_code, $session_id)
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
// @todo AND session_id = %s ?
- 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 $sql_query is not named in camelCase. Open
public static function get_course_lessons($course_code, $session_id)
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
// @todo AND session_id = %s ?
- 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 $course_id is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $check_publication_dates is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 $course_id is not named in camelCase. Open
public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
- 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 get_flat_list is not named in camelCase. Open
public function get_flat_list()
{
return $this->list;
}
- 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 get_course_lessons is not named in camelCase. Open
public static function get_course_lessons($course_code, $session_id)
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
// @todo AND session_id = %s ?
- 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() {
}
}