src/ELearn/Views/Part.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method find has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function find($request, $match)
    {
        // check for lesson
        if (isset($match['lessonId'])) {
            $lessonId = $match['lessonId'];
Severity: Minor
Found in src/ELearn/Views/Part.php - About 1 hr to fix

    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)
        {
            // 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

    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 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

    Missing class import via use statement (line '150', column '20').
    Open

            return new Pluf_HTTP_Response_Json($partCopy);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '92', column '24').
    Open

                $sql = new Pluf_SQL('lesson=%s', array(
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '160', column '21').
    Open

            $form = new ELearn_Form_PartUpdate(array_merge($request->REQUEST, $request->FILES), $extra);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '190', column '25').
    Open

            $response = new Pluf_HTTP_Response_File($part->getAbsloutPath(), $part->mime_type);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '38', column '21').
    Open

            $form = new ELearn_Form_PartUpdate(array_merge($request->REQUEST, $request->FILES), $extra);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '162', column '20').
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '68', column '27').
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '89', column '21').
    Open

            $part = new ELearn_Part();
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '71', column '20').
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '90', column '26').
    Open

            $paginator = new Pluf_Paginator($part);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '46', column '20').
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '35', column '21').
    Open

            $form = new ELearn_Form_PartCreate($request->REQUEST, $extra);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '185', column '27').
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lessonId . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '210', column '20').
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '233', column '27').
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '123', column '20').
    Open

            return new Pluf_HTTP_Response_Json($paginator->render_object());
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '145', column '27').
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $partId . ') does not exist in lesson with id (' . $lessonId . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '32', column '28').
    Open

                'model' => new ELearn_Part()
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    The method updateFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $part = ELearn_Views_Part::validatePart($request, $match, $match['partId']);
                // Do
                $myfile = fopen($part->getAbsloutPath(), "w") or die("Unable to open file!");
                $entityBody = file_get_contents('php://input', 'r');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    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 using static access to class 'ELearn_Views_Part' in method 'update'.
    Open

            $part = ELearn_Views_Part::validatePart($request, $match, $match['modelId']);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    The method create uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $lessonId = $request->REQUEST['lesson'];
            }
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    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

    The method remove uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $partId = $request->REQUEST['partId'];
            }
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    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

    The method get uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $part = ELearn_Shortcuts_GetPartByNameOr404($match['name']);
            }
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    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 using static access to class 'ELearn_Views_Part' in method 'updateFile'.
    Open

                return ELearn_Views_Part::update($request, $match);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'ELearn_Views_Part' in method 'updateFile'.
    Open

                $part = ELearn_Views_Part::validatePart($request, $match, $match['partId']);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Define a constant instead of duplicating this literal "model" 4 times.
    Open

                'model' => new ELearn_Part()
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "lessonId" 17 times.
    Open

            if (isset($match['lessonId'])) {
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "partId" 7 times.
    Open

            if (array_key_exists('partId', $match)) {
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Remove this commented out code.
    Open

                // $part->file_path . '/' . $content->id);
    Severity: Major
    Found in src/ELearn/Views/Part.php by sonar-php

    Programmers should not comment out code as it bloats programs and reduces readability.

    Unused code should be deleted and can be retrieved from source control history if required.

    See

    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

    Define a constant instead of duplicating this literal "ELearn_Part" 5 times.
    Open

                $part = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $match['partId']);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "lesson" 11 times.
    Open

                $request->REQUEST['lesson'] = $lessonId;
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Remove the unused function parameter "$p".
    Open

        public static function create($request, $match, $p)
    Severity: Major
    Found in src/ELearn/Views/Part.php by sonar-php

    Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

    Noncompliant Code Example

    function doSomething($a, $b) { // "$a" is unused
      return compute($b);
    }
    

    Compliant Solution

    function doSomething($b) {
      return compute($b);
    }
    

    Exceptions

    Functions in classes that override a class or implement interfaces are ignored.

    class C extends B {
    
      function doSomething($a, $b) {     // no issue reported on $b
        compute($a);
      }
    
    }
    

    See

    • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
    • MISRA C:2012, 2.7 - There should be no unused parameters in functions
    • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
    • CERT, MSC12-CPP. - Detect and remove code that has no effect

    Define a constant instead of duplicating this literal ") does not exist in lesson with id (" 4 times.
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Remove the unused function parameter "$p".
    Open

        public static function update($request, $match, $p)
    Severity: Major
    Found in src/ELearn/Views/Part.php by sonar-php

    Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

    Noncompliant Code Example

    function doSomething($a, $b) { // "$a" is unused
      return compute($b);
    }
    

    Compliant Solution

    function doSomething($b) {
      return compute($b);
    }
    

    Exceptions

    Functions in classes that override a class or implement interfaces are ignored.

    class C extends B {
    
      function doSomething($a, $b) {     // no issue reported on $b
        compute($a);
      }
    
    }
    

    See

    • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
    • MISRA C:2012, 2.7 - There should be no unused parameters in functions
    • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
    • CERT, MSC12-CPP. - Detect and remove code that has no effect

    Define a constant instead of duplicating this literal "title" 3 times.
    Open

                'title',
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Remove this commented out code.
    Open

            // $part->downloads += 1;
    Severity: Major
    Found in src/ELearn/Views/Part.php by sonar-php

    Programmers should not comment out code as it bloats programs and reduces readability.

    Unused code should be deleted and can be retrieved from source control history if required.

    See

    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

    Define a constant instead of duplicating this literal "ELearn_Lesson" 6 times.
    Open

            Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $lessonId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "Part with id (" 4 times.
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Critical
    Found in src/ELearn/Views/Part.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Avoid unused parameters such as '$p'.
    Open

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

    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

    The method updateFile() contains an exit expression.
    Open

                $myfile = fopen($part->getAbsloutPath(), "w") or die("Unable to open file!");
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    ExitExpression

    Since: 0.2

    An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

    Example

    class Foo {
        public function bar($param)  {
            if ($param === 42) {
                exit(23);
            }
        }
    }

    Source https://phpmd.org/rules/design.html#exitexpression

    Avoid unused parameters such as '$p'.
    Open

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

    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

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

            } elseif (isset($request->REQUEST['lessonId'])) {
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call with 2 arg(s) to \ELearn_Form_PartUpdate::__construct() which only takes 0 arg(s) defined at /code/src/ELearn/Form/PartUpdate.php:11
    Open

            $form = new ELearn_Form_PartUpdate(array_merge($request->REQUEST, $request->FILES), $extra);
    Severity: Info
    Found in src/ELearn/Views/Part.php by phan

    Return type of find() is undeclared type \Pluf_HTTP_Response_Json
    Open

        public static function find($request, $match)
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to method render_object from undeclared class \Pluf_Paginator
    Open

            return new Pluf_HTTP_Response_Json($paginator->render_object());
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

            $form = new ELearn_Form_PartCreate($request->REQUEST, $extra);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

                $lesson = Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $lessonId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_Exception_DoesNotExist
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $partId . ') does not exist in lesson with id (' . $lessonId . ')');
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

            $form = new ELearn_Form_PartUpdate(array_merge($request->REQUEST, $request->FILES), $extra);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_HTTP_Response_Json
    Open

            return new Pluf_HTTP_Response_Json($partCopy);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_Exception_DoesNotExist
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to undeclared property \ArrayObject->id
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property forced_where from undeclared class \Pluf_Paginator
    Open

                $paginator->forced_where = $sql;
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

            $part = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $partId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared method \ELearn_Part::delete
    Open

                $part->delete();
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Returning type \Pluf_HTTP_Response_Json but create() is declared to return \Pluf_HTTP_Response
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_HTTP_Response_Json
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_Paginator
    Open

            $paginator = new Pluf_Paginator($part);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_HTTP_Response_Json
    Open

            return new Pluf_HTTP_Response_Json($paginator->render_object());
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Parameter $request has undeclared type \Pluf_HTTP_Request
    Open

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

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

                $part = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $match['partId']);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

                $lessonId = $request->REQUEST['lessonId'];
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

            $partCopy = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $partId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Parameter $request has undeclared type \Pluf_HTTP_Request
    Open

        public static function download($request, $match)
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property user from undeclared class \Pluf_HTTP_Request
    Open

                'user' => $request->user,
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to method loadFunction from undeclared class \Pluf
    Open

    Pluf::loadFunction('ELearn_Shortcuts_NormalizeItemPerPage');
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

            Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $lessonId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

                $request->REQUEST['lesson'] = $lessonId;
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call with 2 arg(s) to \ELearn_Form_PartCreate::__construct() which only takes 0 arg(s) defined at /code/src/ELearn/Form/PartCreate.php:12
    Open

            $form = new ELearn_Form_PartCreate($request->REQUEST, $extra);
    Severity: Info
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property FILES from undeclared class \Pluf_HTTP_Request
    Open

            $form = new ELearn_Form_PartUpdate(array_merge($request->REQUEST, $request->FILES), $extra);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Catching undeclared class \Pluf_Exception
    Open

            } catch (Pluf_Exception $e) {
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_SQL
    Open

                $sql = new Pluf_SQL('lesson=%s', array(
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method setFromRequest from undeclared class \Pluf_Paginator
    Open

            $paginator->setFromRequest($request);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method loadFunction from undeclared class \Pluf
    Open

    Pluf::loadFunction('Pluf_Shortcuts_GetObjectOr404');
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

                $lessonId = $request->REQUEST['lesson'];
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Parameter $request has undeclared type \Pluf_HTTP_Request
    Open

        public static function find($request, $match)
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call with 2 arg(s) to \ELearn_Form_PartUpdate::__construct() which only takes 0 arg(s) defined at /code/src/ELearn/Form/PartUpdate.php:11
    Open

            $form = new ELearn_Form_PartUpdate(array_merge($request->REQUEST, $request->FILES), $extra);
    Severity: Info
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

                Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $lessonId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

                $lesson = Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $lessonId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_HTTP_Response_Json
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to undeclared property \ArrayObject->lesson (Did you mean $lesson)
    Open

                if ($part->lesson !== $lesson->id) {
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property list_filters from undeclared class \Pluf_Paginator
    Open

            $paginator->list_filters = array(
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property items_per_page from undeclared class \Pluf_Paginator
    Open

            $paginator->items_per_page = ELearn_Shortcuts_NormalizeItemPerPage($request);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Return type of create() is undeclared type \Pluf_HTTP_Response
    Open

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

    Call to method __construct from undeclared class \Pluf_HTTP_Response_Json
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method configure from undeclared class \Pluf_Paginator
    Open

            $paginator->configure(array(), $search_fields, $sort_fields);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Return type of download() is undeclared type \Pluf_HTTP_Response_File
    Open

        public static function download($request, $match)
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_HTTP_Response_File
    Open

            $response = new Pluf_HTTP_Response_File($part->getAbsloutPath(), $part->mime_type);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call with 2 arg(s) to \ELearn_Views_Part::update() which requires 3 arg(s) defined at /code/src/ELearn/Views/Part.php:153
    Open

                return ELearn_Views_Part::update($request, $match);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

                $lesson = Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $lessonId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_Exception_DoesNotExist
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property headers from undeclared class \Pluf_HTTP_Response_File
    Open

            $response->headers['Content-Disposition'] = sprintf('attachment; filename="%s"', $part->file_name);
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared method \ELearn_Part::update
    Open

                $part->update();
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Parameter $request has undeclared type \Pluf_HTTP_Request
    Open

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

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

            $part = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $match['partId']);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Argument 2 (use_include_path) is 'r' but \file_get_contents() takes bool
    Open

                $entityBody = file_get_contents('php://input', 'r');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

            } else if (isset($request->REQUEST['lesson'])) {
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

            $part = Pluf_Shortcuts_GetObjectOr404('ELearn_Part', $id);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_HTTP_Response_Json
    Open

            return new Pluf_HTTP_Response_Json($part);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

                $lessonId = $request->REQUEST['lesson'];
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to undeclared function \Pluf_Shortcuts_GetObjectOr404()
    Open

                $lesson = Pluf_Shortcuts_GetObjectOr404('ELearn_Lesson', $lessonId);
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

            } else if (isset($request->REQUEST['lesson'])) {
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

                $request->REQUEST['lesson'] = $lessonId;
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Call to method __construct from undeclared class \Pluf_Exception_DoesNotExist
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lessonId . ')');
    Severity: Critical
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

                $lessonId = $request->REQUEST['lesson'];
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    Reference to instance property REQUEST from undeclared class \Pluf_HTTP_Request
    Open

                $request->REQUEST['lesson'] = $lessonId;
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phan

    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

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

    class ELearn_Views_Part
    {
    
        // *******************************************************************
        // Part of Lesson
    Severity: Minor
    Found in src/ELearn/Views/Part.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

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

    <?php
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    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/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

    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/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

    Line exceeds 120 characters; contains 145 characters
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Line exceeds 120 characters; contains 145 characters
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lesson->id . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Line exceeds 120 characters; contains 143 characters
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $part->id . ') does not exist in lesson with id (' . $lessonId . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Line exceeds 120 characters; contains 141 characters
    Open

                    throw new Pluf_Exception_DoesNotExist('Part with id (' . $partId . ') does not exist in lesson with id (' . $lessonId . ')');
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Whitespace found at end of line
    Open

         * @param Pluf_HTTP_Request $request            
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Class name "ELearn_Views_Part" is not in camel caps format
    Open

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

    Whitespace found at end of line
    Open

         * @param Pluf_HTTP_Request $request            
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Usage of ELSE IF is discouraged; use ELSEIF instead
    Open

            } else if (isset($request->REQUEST['lesson'])) {
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Whitespace found at end of line
    Open

         * @param Pluf_HTTP_Request $request            
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Usage of ELSE IF is discouraged; use ELSEIF instead
    Open

            } else if (isset($request->REQUEST['lesson'])) {
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Expected 1 newline at end of file; 0 found
    Open

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

    Whitespace found at end of line
    Open

         * @param array $match            
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Whitespace found at end of line
    Open

         * @param array $match            
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Usage of ELSE IF is discouraged; use ELSEIF instead
    Open

            } else if (isset($request->REQUEST['lesson'])) {
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Usage of ELSE IF is discouraged; use ELSEIF instead
    Open

            } else if (isset($request->REQUEST['lessonId'])) {
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Whitespace found at end of line
    Open

         * @param array $match            
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    Opening brace should be on a new line
    Open

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

    Whitespace found at end of line
    Open

         * @param array $p            
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpcodesniffer

    The variable $search_fields is not named in camelCase.
    Open

        public static function find($request, $match)
        {
            // check for lesson
            if (isset($match['lessonId'])) {
                $lessonId = $match['lessonId'];
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

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

        public static function find($request, $match)
        {
            // check for lesson
            if (isset($match['lessonId'])) {
                $lessonId = $match['lessonId'];
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

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

        public static function find($request, $match)
        {
            // check for lesson
            if (isset($match['lessonId'])) {
                $lessonId = $match['lessonId'];
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

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

        public static function find($request, $match)
        {
            // check for lesson
            if (isset($match['lessonId'])) {
                $lessonId = $match['lessonId'];
    Severity: Minor
    Found in src/ELearn/Views/Part.php by phpmd

    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

    There are no issues that match your filters.

    Category
    Status