Showing 910 of 910 total issues

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class ELearn_Views_Lesson
Severity: Minor
Found in src/ELearn/Views/Lesson.php by phpcodesniffer

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class ELearn_Views_Part
Severity: Minor
Found in src/ELearn/Views/Part.php by phpcodesniffer

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class ELearn_Views_Course
Severity: Minor
Found in src/ELearn/Views/Course.php by phpcodesniffer

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class ELearn_Views_Topic
Severity: Minor
Found in src/ELearn/Views/Topic.php by phpcodesniffer

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class ELearn_Vote extends Pluf_Model
Severity: Minor
Found in src/ELearn/Vote.php by phpcodesniffer

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class ELearn_Views{
Severity: Minor
Found in src/ELearn/Views.php by phpcodesniffer

Function remove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function remove($request, $match)
    {
        if (isset($match['topicId'])) {
            $topicId = $match['topicId'];
        } else {
Severity: Minor
Found in src/ELearn/Views/Topic.php - About 55 mins to fix

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 get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get($request, $match)
    {
        // Check and fetch Part
        if (array_key_exists('partId', $match)) {
            $part = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $match['partId']);
Severity: Minor
Found in src/ELearn/Views/Part.php - About 55 mins to fix

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 remove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function remove($request, $match)
    {
        if (isset($match['lessonId'])) {
            $lessonId = $match['lessonId'];
        } else {
Severity: Minor
Found in src/ELearn/Views/Lesson.php - About 55 mins to fix

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 remove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function remove($request, $match)
    {
        if (isset($match['courseId'])) {
            $courseId = $match['courseId'];
        } else {
Severity: Minor
Found in src/ELearn/Views/Course.php - About 55 mins to fix

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 remove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function remove($request, $match)
    {
        // Check and fetch Part
        if (isset($match['partId'])) {
            $partId = $match['partId'];
Severity: Minor
Found in src/ELearn/Views/Part.php - About 55 mins to fix

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

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 12 and the first side effect is on line 2.
Open

<?php

The class ELearn_PartHistory is not named in CamelCase.
Open

class ELearn_PartHistory extends Pluf_Model
{

    /**
     * @brief مدل داده‌ای را بارگذاری می‌کند.
Severity: Minor
Found in src/ELearn/PartHistory.php by phpmd

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

The property $list_filters is not named in camelCase.
Open

class ELearn_Searcher
{

    /**
     * این مدل داده‌ای جستجوگر خواهد شد.
Severity: Minor
Found in src/ELearn/Searcher.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Avoid variables with short names like $p. Configured minimum length is 3.
Open

    public static function create($request, $match, $p)
Severity: Minor
Found in src/ELearn/Views/Lesson.php by phpmd

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 $id. Configured minimum length is 3.
Open

    private static function validatePart($request, $match, $id){
Severity: Minor
Found in src/ELearn/Views/Part.php by phpmd

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 class ELearn_Lesson is not named in CamelCase.
Open

class ELearn_Lesson extends Pluf_Model
{

    /**
     * @brief مدل داده‌ای را بارگذاری می‌کند.
Severity: Minor
Found in src/ELearn/Lesson.php by phpmd

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

The property $sort_fields is not named in camelCase.
Open

class ELearn_Searcher
{

    /**
     * این مدل داده‌ای جستجوگر خواهد شد.
Severity: Minor
Found in src/ELearn/Searcher.php by phpmd

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 $sort_reverse_order is not named in camelCase.
Open

class ELearn_Searcher
{

    /**
     * این مدل داده‌ای جستجوگر خواهد شد.
Severity: Minor
Found in src/ELearn/Searcher.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Avoid variables with short names like $s. Configured minimum length is 3.
Open

            $s = $this->sort_order[1];
Severity: Minor
Found in src/ELearn/Searcher.php by phpmd

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

Severity
Category
Status
Source
Language