Showing 910 of 910 total issues

The class ELearn_Vote is not named in CamelCase.
Open

class ELearn_Vote extends Pluf_Model
{

    /**
     * @brief مدل داده‌ای را بارگذاری می‌کند.
Severity: Minor
Found in src/ELearn/Vote.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

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

    public static function update($request, $match, $p)
Severity: Minor
Found in src/ELearn/Views/Topic.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 $p. Configured minimum length is 3.
Open

    public static function listAll($request, $match, $p){
Severity: Minor
Found in src/ELearn/Views.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

Function setFromRequest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    function setFromRequest($request)
    {
        if (isset($request->REQUEST['_px_q'])) {
            $this->search_string = $request->REQUEST['_px_q'];
        }
Severity: Minor
Found in src/ELearn/Searcher.php - About 45 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get($request, $match)
    {
        $lesson = Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $match['lessonId']);
        // check course if is set
        if (isset($match['courseId'])) {
Severity: Minor
Found in src/ELearn/Views/Lesson.php - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function update($request, $match, $p)
    {
        $course = Pluf_Shortcuts_GetObjectOr404('ELearn_Course', $match['modelId']);
        // check topic
        if (isset($match['topicId'])) {
Severity: Minor
Found in src/ELearn/Views/Course.php - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function update($request, $match, $p)
    {
        $lesson = Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $match['modelId']);
        // check course
        if (isset($match['courseId'])) {
Severity: Minor
Found in src/ELearn/Views/Lesson.php - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get($request, $match)
    {
        $course = Pluf_Shortcuts_GetObjectOr404('ELearn_Course', $match['courseId']);
        // check topic
        if (isset($match['topicId'])) {
Severity: Minor
Found in src/ELearn/Views/Course.php - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function update($request, $match, $p)
    {
        $topic = Pluf_Shortcuts_GetObjectOr404('ELearn_Topic', $match['modelId']);
        // check domain
        if (isset($match['domainId'])) {
Severity: Minor
Found in src/ELearn/Views/Topic.php - About 35 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 validatePart has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function validatePart($request, $match, $id){
        $part = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $id);
        // check lesson
        if (isset($match['lessonId'])) {
            $lessonId = $match['lessonId'];
Severity: Minor
Found in src/ELearn/Views/Part.php - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get($request, $match)
    {
        $topic = Pluf_Shortcuts_GetObjectOr404('ELearn_Topic', $match['topicId']);
        if (isset($match['domainId'])) {
            $domainId = $match['domainId'];
Severity: Minor
Found in src/ELearn/Views/Topic.php - About 35 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 download has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function download($request, $match)
    {
        // get Part
        $part = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $match['partId']);
        // check Lesson if is set
Severity: Minor
Found in src/ELearn/Views/Part.php - About 35 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 render_array has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    function render_array()
    {
        if (count($this->sort_order) != 2) {
            $order = null;
        } else {
Severity: Minor
Found in src/ELearn/Searcher.php - About 35 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

Visibility must be declared on method "preSave"
Open

    function preSave($create = false)
Severity: Minor
Found in src/ELearn/Comment.php by phpcodesniffer

Visibility must be declared on method "preDelete"
Open

    function preDelete()
Severity: Minor
Found in src/ELearn/PartHistory.php by phpcodesniffer

Visibility must be declared on method "setFromRequest"
Open

    function setFromRequest($request)
Severity: Minor
Found in src/ELearn/Searcher.php by phpcodesniffer

Visibility must be declared on method "configure"
Open

    function configure($search_fields = array(), $sort_fields = array())
Severity: Minor
Found in src/ELearn/Searcher.php by phpcodesniffer

Visibility must be declared on method "save"
Open

    function save($commit = true)

Visibility must be declared on method "postSave"
Open

    function postSave($create = false)
Severity: Minor
Found in src/ELearn/Lesson.php by phpcodesniffer

Visibility must be declared on method "preDelete"
Open

    function preDelete()
Severity: Minor
Found in src/ELearn/Part.php by phpcodesniffer
Severity
Category
Status
Source
Language