chamilo/chamilo-lms

View on GitHub
public/main/lp/scormOrganization.class.php

Summary

Maintainability
A
0 mins
Test Coverage

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

                                        $oItem = new scormItem(

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 '55', column '63').
Open

                                        $this->metadata = new scormMetadata(

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

        } else {
            return '';
        }

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

        } else {
            return '';
        }

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 '$dummy'.
Open

        foreach ($this->items as $id => $dummy) {

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

class scormOrganization
{
    public $identifier = '';
    public $structure = '';
    public $title = '';

CamelCaseClassName

Since: 0.2

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

Example

class class_name {
}

Source

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

                                        if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {

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

                                        $tmp_children = $child->childNodes;

Method name "scormOrganization::get_flat_items_list" is not in camel caps format
Open

    public function get_flat_items_list()

Missing parameter name
Open

     * @param    string    Type of construction needed ('db' or 'manifest', default = 'manifest')

Missing parameter name
Open

     * @param    mixed    Depending on the type given, DB id for the lp_item or reference to the DOM element

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

    public function get_name()

Method name "scormOrganization::get_ref" is not in camel caps format
Open

    public function get_ref()

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

            $this->items[$id]->get_flat_list($list, $abs_order, $i, 0);

Method name "scormOrganization::set_name" is not in camel caps format
Open

    public function set_name($title)

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

            $abs_order = 0;

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

class scormOrganization

The variable $abs_order is not named in camelCase.
Open

    public function get_flat_items_list()
    {
        $list = [];
        $i = 1;
        foreach ($this->items as $id => $dummy) {

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

    public function __construct($type = 'manifest', &$element = null)
    {
        if (isset($element)) {
            // Parsing using PHP5 DOMXML methods.
            switch ($type) {

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

    public function get_flat_items_list()
    {
        $list = [];
        $i = 1;
        foreach ($this->items as $id => $dummy) {

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

    public function __construct($type = 'manifest', &$element = null)
    {
        if (isset($element)) {
            // Parsing using PHP5 DOMXML methods.
            switch ($type) {

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

    public function get_flat_items_list()
    {
        $list = [];
        $i = 1;
        foreach ($this->items as $id => $dummy) {

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

    public function set_name($title)
    {
        if (!empty($title)) {
            $this->title = Database::escape_string($title);
        }

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

    public function get_ref()
    {
        if (!empty($this->identifier)) {
            return Database::escape_string($this->identifier);
        } else {

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

    public function get_name()
    {
        if (!empty($this->title)) {
            return Database::escape_string($this->title);
        } else {

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