chamilo/chamilo-lms

View on GitHub
public/plugin/ims_lti/ImsLtiPlugin.php

Summary

Maintainability
A
0 mins
Test Coverage

The class ImsLtiPlugin has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13.
Open

class ImsLtiPlugin extends Plugin
{
    const TABLE_TOOL = 'plugin_ims_lti_tool';
    const TABLE_PLATFORM = 'plugin_ims_lti_platform';

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

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

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

        $xml = new SimpleXMLElement($content);

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 '486', column '23').
Open

            throw new Exception($this->get_lang('NoAccessToUrl'));

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 '493', column '23').
Open

            throw new Exception($this->get_lang('LaunchUrlNotFound'));

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 '721', column '20').
Open

        return new SimpleXMLElement($request);

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 getToolPublicKey uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $publicKey = $tool->publicKey;
        };

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 updateCourseTool uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $courseTool->setTarget('_self');
        }

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 performActionsAfterConfigure uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            if ($platform) {
                $em->remove($platform);
            }
        }

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 getRoleScopeMentorAsArray uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $scope[] = (string) $userInfo['user_id'];
            }

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

Missing function doc comment
Open

    public function trimParams(array &$params)

Doc comment for parameter $isVisible does not match actual variable name $course
Open

     * @param bool $isVisible

Doc comment for parameter $isVisible does not match actual variable name $course
Open

     * @param bool $isVisible

Method name "ImsLtiPlugin::get_name" is not in camel caps format
Open

    public function get_name()

Doc comment for parameter $generateIdForTool. does not match actual variable name $user
Open

     * @param bool $generateIdForTool. Optional. Set TRUE for LTI 1.x.

Missing function doc comment
Open

    public static function isInstructor()

Variable "course_settings" is not in valid camel caps format
Open

        $this->course_settings = [

Missing function doc comment
Open

    public static function getCoursesForParentTool(ImsLtiTool $tool, Session $session = null)

The method get_name is not named in camelCase.
Open

    public function get_name()
    {
        return 'ims_lti';
    }

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

There are no issues that match your filters.

Category
Status