chamilo/chamilo-lms

View on GitHub
public/main/cron/import_csv.php

Summary

Maintainability
A
0 mins
Test Coverage

The method ImportCsv::importCareers() calls the typical debug function print_r() which is mostly only used during development.
Open

                        $this->logger->addInfo('Career saved: '.print_r($params, 1));
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

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

The method ImportCsv::run() calls the typical debug function print_r() which is mostly only used during development.
Open

            $this->logger->addInfo(print_r($teacherBackup, 1));
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

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

The method ImportCsv::importCareers() calls the typical debug function print_r() which is mostly only used during development.
Open

                        $this->logger->addInfo('Career updated: '.print_r($params, 1));
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

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

The method importSessionsStatic() has an NPath complexity of 2597832. The configured NPath complexity threshold is 200.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method importCourses() has an NPath complexity of 680. The configured NPath complexity threshold is 200.
Open

    private function importCourses(
        $file,
        $moveFile = true,
        &$teacherBackup = [],
        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method importCareersResults() has an NPath complexity of 514. The configured NPath complexity threshold is 200.
Open

    private function importCareersResults(
        $file,
        $moveFile = false,
        &$teacherBackup = [],
        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method run() has an NPath complexity of 540128. The configured NPath complexity threshold is 200.
Open

    public function run()
    {
        global $_configuration;

        $value = api_get_configuration_value('import_csv_custom_url_id');
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method importCare() has an NPath complexity of 326. The configured NPath complexity threshold is 200.
Open

    public function importCare($file, $moveFile = false)
    {
        $data = Import::csv_reader($file);
        $counter = 1;
        $batchSize = $this->batchSize;
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method importStudents() has an NPath complexity of 121444. The configured NPath complexity threshold is 200.
Open

    private function importStudents($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method importCalendarStatic() has an NPath complexity of 287472702063122. The configured NPath complexity threshold is 200.
Open

    private function importCalendarStatic($file, $moveFile = true)
    {
        $this->fixCSVFile($file);

        $this->updateUsersEmails();
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method importCareersDiagram() has an NPath complexity of 762303. The configured NPath complexity threshold is 200.
Open

    private function importCareersDiagram(
        $file,
        $moveFile = false,
        &$teacherBackup = [],
        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

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

class ImportCsv
{
    public $test;
    public $defaultLanguage = 'dutch';
    public $extraFieldIdNameList = [
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

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 '1175', column '37').
Open

                    $interval = new \DateInterval('P7D');
Severity: Minor
Found in public/main/cron/import_csv.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 '2130', column '33').
Open

                    $date = new \DateTime($dateStart);
Severity: Minor
Found in public/main/cron/import_csv.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 '1460', column '35').
Open

                    $career = new Career();
Severity: Minor
Found in public/main/cron/import_csv.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 '1174', column '33').
Open

                    $date = new \DateTime($sessionInfo['access_start_date']);
Severity: Minor
Found in public/main/cron/import_csv.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 '2574', column '36').
Open

            $extraFieldValue = new ExtraFieldValue('career');
Severity: Minor
Found in public/main/cron/import_csv.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 '2578', column '31').
Open

            $extraField = new ExtraField('career');
Severity: Minor
Found in public/main/cron/import_csv.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 '2135', column '33').
Open

                    $date = new \DateTime($dateEnd);
Severity: Minor
Found in public/main/cron/import_csv.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 '2131', column '37').
Open

                    $interval = new DateInterval('P'.$this->daysCoachAccessBeforeBeginning.'D');
Severity: Minor
Found in public/main/cron/import_csv.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 '842', column '44').
Open

                    $extraFieldValue = new ExtraFieldValue('user');
Severity: Minor
Found in public/main/cron/import_csv.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 '1357', column '31').
Open

                $agenda = new Agenda(
Severity: Minor
Found in public/main/cron/import_csv.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 '1213', column '31').
Open

            $extraField = new ExtraField('calendar_event');
Severity: Minor
Found in public/main/cron/import_csv.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 '2604', column '31').
Open

                $career = new Career();
Severity: Minor
Found in public/main/cron/import_csv.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 '497', column '27').
Open

        $extraField = new ExtraField('career');
Severity: Minor
Found in public/main/cron/import_csv.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 '1209', column '36').
Open

            $extraFieldValue = new ExtraFieldValue('calendar_event');
Severity: Minor
Found in public/main/cron/import_csv.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 '2136', column '37').
Open

                    $interval = new DateInterval('P'.$this->daysCoachAccessAfterBeginning.'D');
Severity: Minor
Found in public/main/cron/import_csv.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 '1348', column '24').
Open

            $tpl = new Template(null, false, false, false, false, false, false);
Severity: Minor
Found in public/main/cron/import_csv.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 '1446', column '51').
Open

                    $sessionExtraFieldValue = new ExtraFieldValue('session');
Severity: Minor
Found in public/main/cron/import_csv.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 '488', column '27').
Open

        $extraField = new ExtraField('calendar_event');
Severity: Minor
Found in public/main/cron/import_csv.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 '1070', column '42').
Open

            $courseExtraFieldValue = new ExtraFieldValue('course');
Severity: Minor
Found in public/main/cron/import_csv.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 '1459', column '50').
Open

                    $careerExtraFieldValue = new ExtraFieldValue('career');
Severity: Minor
Found in public/main/cron/import_csv.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 '2680', column '36').
Open

            $extraFieldValue = new ExtraFieldValue('career');
Severity: Minor
Found in public/main/cron/import_csv.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 '2866', column '43').
Open

                            $career = new Career();
Severity: Minor
Found in public/main/cron/import_csv.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 '2816', column '27').
Open

        $extraField = new ExtraField('career');
Severity: Minor
Found in public/main/cron/import_csv.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 '2812', column '32').
Open

        $extraFieldValue = new ExtraFieldValue('career');
Severity: Minor
Found in public/main/cron/import_csv.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 importStudents uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    if (empty($userInfo)) {
                        $this->logger->addError("Students - Can't update user :".$row['username']);
                        continue;
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCareers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    if (isset($item['item_id'])) {
                        $params = [
                            'id' => $item['item_id'],
                            'name' => $row['CareerName'],
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $this->logger->addError(
                                "Error when trying to add announcement with title $subject here: $info and SenderId = $senderId"
                            );
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 importSessionsStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $this->logger->addInfo("Failed creating session: ".$session['SessionName']);
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 importStudents uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $this->logger->addError("Students - User NOT created: ".$row['username']." ".$row['firstname']." ".$row['lastname']);
                        $this->logger->addError(strip_tags(Display::getFlashToString()));
                        Display::cleanFlashMessages();
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $externalCareerIds = [$externalCareerIdList];
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCourses uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $this->logger->addError("Courses - Can't create course:".$row['title']);
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    if (COURSE_VISIBILITY_HIDDEN == $courseInfo['visibility']) {
                        $this->logger->addInfo("Course '".$courseInfo['code']."' has hidden visiblity. Skip");
                        $errorFound = true;
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $this->logger->addInfo(
                        "Send Mail: ".intval($sendMail).' - Already added: '.intval($alreadyAdded)
                    );
                    if (false == $sendMail) {
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $this->logger->addInfo(
                            "Error while creating event external id: $externalEventId"
                        );
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCourses uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $this->logger->addError("Courses - Course NOT updated ".$courseInfo['code']);
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $teachers = CourseManager::get_coach_list_from_course_code(
                            $courseInfo['code'],
                            $sessionId
                        );
Severity: Minor
Found in public/main/cron/import_csv.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 importSessionsStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                foreach ($enreg as $tag_name) {
                    $tag_names[] = api_preg_replace(
                        '/[^a-zA-Z0-9_\-]/',
                        '',
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $generalCoachesId = SessionManager::getGeneralCoachesIdForSession($sessionId);
                            $teacherId = $generalCoachesId[0] ?? 0;
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 moveFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->logger->addError(
                "Error - Cant move file to the treated folder: $file"
            );
        }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    // First time
                    $eventStartDateList[$courseInfo['real_id']][$event['session_id']] = $event['start'];
                    $eventEndDateList[$courseInfo['real_id']][$event['session_id']] = $event['end'];
                }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $this->logger->addInfo("Error while creating event external id: $externalEventId");
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 importSessionsStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                            } else {
                                $this->logger->addInfo("No coaches added");
                            }
Severity: Minor
Found in public/main/cron/import_csv.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 importSessionsStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $this->logger->addInfo(
                            'SessionID not found in system.'
                        );
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 run uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $this->$method($file, true);
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 importTeachers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $this->logger->addError("Teachers - User NOT created: ".$row['username']." ".$row['firstname']." ".$row['lastname']);
                        $this->logger->addError(strip_tags(Display::getFlashToString()));
                        Display::cleanFlashMessages();
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $this->logger->addInfo(
                                "Error while updating event with external id: $externalEventId"
                            );
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 importCourses uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    // Update
                    $params = [
                        'title' => $row['title'],
                        'category_code' => $row['course_category'],
Severity: Minor
Found in public/main/cron/import_csv.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 importSessionsStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $sessionInfo = api_get_session_info($sessionId);
                        $accessBefore = null;
                        $accessAfter = null;

Severity: Minor
Found in public/main/cron/import_csv.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 run uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        echo "Error - This file '$file' can't be processed.".PHP_EOL;
                        echo "Trying to call $method".PHP_EOL;
                        echo "The file have to has this format:".PHP_EOL;
                        echo "prefix_students_ddmmyyyy.csv, prefix_teachers_ddmmyyyy.csv,
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        // The event already exists, just update
                        $eventResult = $agenda->editEvent(
                            $item['item_id'],
                            $event['start'],
Severity: Minor
Found in public/main/cron/import_csv.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 importSubscribeUserToCourseSessionExtStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $userIdList[] = $userId;
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 run uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $fileToProcessStatic[$parts[1]][] = [
                                'method' => $method,
                                'file' => $path.$fileInfo['basename'],
                            ];
Severity: Minor
Found in public/main/cron/import_csv.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 importTeachers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $this->logger->addError("Teachers - User not updated: ".$row['username']);
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $teachersToString = SessionManager::getCoachesByCourseSessionToString(
                            $sessionId,
                            $courseInfo['real_id'],
                            ','
Severity: Minor
Found in public/main/cron/import_csv.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 moveFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $result = rename($file, $moved);
        }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $date = api_format_date($start, DATE_TIME_FORMAT_LONG_24H).' - '.
                            api_format_date($end, DATE_TIME_FORMAT_LONG_24H);
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importStudents uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $this->logger->addError("Students - User NOT updated: ".$row['username']." ".$row['firstname']." ".$row['lastname']);
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $externalEventId = $event[$extraFieldName];
                    if (empty($externalEventId)) {
                        $this->logger->addInfo('external_calendar_itemID was set but empty. Skipping ...');
                        continue;
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    // New event. Create it.
                    $eventId = $agenda->addEvent(
                        $event['start'],
                        $event['end'],
Severity: Minor
Found in public/main/cron/import_csv.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 importCourses uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        CourseManager::updateTeachers(
                            $courseInfo,
                            $row['teachers'],
                            true,
Severity: Minor
Found in public/main/cron/import_csv.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 importSessionsStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                            } else {
                                $this->logger->addInfo("No users to register.");
                            }
Severity: Minor
Found in public/main/cron/import_csv.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 importSessionsStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $this->logger->addInfo('SessionID does not exists');
                }
Severity: Minor
Found in public/main/cron/import_csv.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 importTeachers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    if (empty($userInfo)) {
                        $this->logger->addError("Teachers - Can't update user :".$row['username']);
                        continue;
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $this->logger->addInfo('Calendar event not found '.$item['item_id']);
                }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $eventAlreadySent[$courseInfo['real_id']][$event['session_id']] = true;
                }
Severity: Minor
Found in public/main/cron/import_csv.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 importSessionsStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->logger->addInfo($error_message);
        }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $errorFound = true;
                }
Severity: Minor
Found in public/main/cron/import_csv.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 importCalendarStatic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $report['mail_not_sent_announcement_exists']++;
                        $this->logger->addInfo(
                            "Mail NOT sent. An announcement seems to be already saved in '$info'"
                        );
Severity: Minor
Found in public/main/cron/import_csv.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 importSubscribeUserToCourse uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $this->logger->addInfo(
                        "User $userId was NOT ADDED to course ".$courseInfo['code']." with status '$status' with course category: '$userCourseCategory'"
                    );
                }
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            $careerIdList[$careerId] = 0;
                            //$this->logger->addInfo("Career not found: $careerId case 2");
                            continue;
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersDiagram uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $current = $graph->createVertex($currentCourseId);
                        $current->setAttribute('graphviz.label', $name);
                        $current->setAttribute('DefinedColor', $color);
                        $current->setAttribute('Notes', $notes);
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        if (isset($item['item_id'])) {
                            $careerChamiloId = $item['item_id'];
                            $careerIdList[$careerId] = $careerChamiloId;
                        } else {
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $studentId = UserManager::get_user_id_from_original_id(
                        $rowStudentId,
                        $this->extraFieldIdNameList['user']
                    );
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersDiagram uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        continue;
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersDiagram uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        if (isset($item['item_id'])) {
                            $careerChamiloId = $item['item_id'];
                            $career = new Career();
                            $career = $career->find($careerChamiloId);
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersDiagram uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                        } else {
                            continue;
                        }
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $item = $extraFieldValue->get_item_id_from_field_variable_and_field_value(
                        $extraFieldName,
                        $careerId
                    );
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersDiagram uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        continue;
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 importCareersDiagram uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                    } else {
                        $graph = new Graph($careerId);
                        $graph->setAttribute('graphviz.graph.rankdir', 'LR');
                        $careerList[$careerId] = $graph;
                    }
Severity: Minor
Found in public/main/cron/import_csv.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 unused private methods such as 'importSessionsExtIdStatic'.
Open

    private function importSessionsExtIdStatic($file, $moveFile = true)
    {
        $data = Import::csv_reader($file);

        if (!empty($data)) {
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'importTeachersStatic'.
Open

    private function importTeachersStatic($file)
    {
        $this->importTeachers($file, true);
    }
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'importStudentsStatic'.
Open

    private function importStudentsStatic($file)
    {
        $this->importStudents($file, true);
    }
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'importOpenSessions'.
Open

    private function importOpenSessions(
        $file,
        $moveFile = true,
        &$teacherBackup = [],
        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'importSubscribeStatic'.
Open

    private function importSubscribeStatic($file, $moveFile = true)
    {
        $data = Import::csv_reader($file);

        if (!empty($data)) {
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused local variables such as '$externalEventId'.
Open

            $externalEventId = null;
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

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

Avoid unused private methods such as 'importUnsubSessionsExtIdStatic'.
Open

    private function importUnsubSessionsExtIdStatic($file, $moveFile = true)
    {
        $data = Import::csv_reader($file);

        if (!empty($data)) {
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'importCalendarStatic'.
Open

    private function importCalendarStatic($file, $moveFile = true)
    {
        $this->fixCSVFile($file);

        $this->updateUsersEmails();
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'importCareersResults'.
Open

    private function importCareersResults(
        $file,
        $moveFile = false,
        &$teacherBackup = [],
        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'importSubscribeUserToCourse'.
Open

    private function importSubscribeUserToCourse($file, $moveFile = false, &$teacherBackup = [])
    {
        $data = Import::csv_reader($file);

        if (!empty($data)) {
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused parameters such as '$moveFile'.
Open

        $moveFile = false,
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused parameters such as '$teacherBackup'.
Open

        &$teacherBackup = [],
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused parameters such as '$groupBackup'.
Open

        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused private methods such as 'importSessionsStatic'.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'importSubscribeUserToCourseSessionExtStatic'.
Open

    private function importSubscribeUserToCourseSessionExtStatic($file, $moveFile = true)
    {
        $data = Import::csv_reader($file);
        if (!empty($data)) {
            $this->logger->addInfo(count($data)." records found.");
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused local variables such as '$dateStop'.
Open

                $dateStop = $row['DateStop'];
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

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

Avoid unused parameters such as '$moveFile'.
Open

    public function importCare($file, $moveFile = false)
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused private methods such as 'importCoursesStatic'.
Open

    private function importCoursesStatic($file, $moveFile, &$teacherBackup = [], &$groupBackup = [])
    {
        $this->importCourses($file, true, $teacherBackup, $groupBackup);
    }
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused parameters such as '$moveFile'.
Open

        $moveFile = false,
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused parameters such as '$teacherBackup'.
Open

        &$teacherBackup = [],
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused parameters such as '$moveFile'.
Open

    private function importCoursesStatic($file, $moveFile, &$teacherBackup = [], &$groupBackup = [])
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused private methods such as 'importCareers'.
Open

    private function importCareers(
        $file,
        $moveFile = false,
        &$teacherBackup = [],
        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused parameters such as '$groupBackup'.
Open

        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused private methods such as 'importCareersDiagram'.
Open

    private function importCareersDiagram(
        $file,
        $moveFile = false,
        &$teacherBackup = [],
        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused local variables such as '$externalEventId'.
Open

        $externalEventId = null;
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

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

Avoid unused parameters such as '$moveFile'.
Open

        $moveFile = false,
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused parameters such as '$file'.
Open

    private function fixCSVFile($file)
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused parameters such as '$groupBackup'.
Open

        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused parameters such as '$teacherBackup'.
Open

        &$teacherBackup = [],
Severity: Minor
Found in public/main/cron/import_csv.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

Avoid unused private methods such as 'importUnsubscribeStatic'.
Open

    private function importUnsubscribeStatic(
        $file,
        $moveFile = false,
        &$teacherBackup = [],
        &$groupBackup = []
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Missing parameter name
Open

     * @param array

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

                        if (!empty($user_id) && $value != $user_id) {

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

            $this->logger->addInfo($error_message);

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

global $language_interface;

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

                foreach ($tag_names as $tag_key => $tag_name) {

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

                        $sessions[$key - 1][$tag_name] = $enreg[$tag_key];

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

                                $tbl_session,

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

$cronImportCSVConditions = isset($_configuration['cron_import_csv_conditions']) ? $_configuration['cron_import_csv_conditions'] : null;

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

                        $tag_name

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

$language_interface_initial_value = $language;

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

                $user_id = UserManager::get_user_id_from_original_id(

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

                foreach ($tag_names as $tag_key => $tag_name) {

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

                    !in_array('DateStart', $tag_names) || !in_array('DateEnd', $tag_names)

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

    $import->defaultAdminId = $_configuration['default_admin_user_id_for_cron'];

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

if (isset($_configuration['import_csv_test'])) {

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

$cronImportCSVConditions = isset($_configuration['cron_import_csv_conditions']) ? $_configuration['cron_import_csv_conditions'] : null;

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

                        if (!empty($user_id) && $value != $user_id) {

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

                foreach ($tag_names as $tag_key => $tag_name) {

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

    true == $_configuration['import_csv_fix_permissions']

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

        $tag_names = [];

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

                    !in_array('DateStart', $tag_names) || !in_array('DateEnd', $tag_names)

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

    true == $_configuration['import_csv_disable_dump']

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

                $user_id = UserManager::get_user_id_from_original_id(

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

                    $userInfo = api_get_user_info($user_id, false, true);

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

                        $sessions[$key - 1][$tag_name] = $enreg[$tag_key];

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

                if (!in_array('SessionName', $tag_names) ||

Missing parameter name
Open

     * @param $file

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

                    $error_message = get_lang('NoNeededData');

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

if (isset($_configuration['import_csv_fix_permissions']) &&

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

                if (!empty($user_id)) {

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

                    $userInfo = api_get_user_info($user_id);

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

                    if (isset($enreg[$tag_key])) {

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

    $import->test = $_configuration['import_csv_test'];

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

                foreach ($enreg as $tag_name) {

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

                    $tag_names[] = api_preg_replace(

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

                if (!empty($user_id)) {

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

                            $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);

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

if (isset($_configuration['default_admin_user_id_for_cron'])) {

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

if (isset($_configuration['import_csv_disable_dump']) &&

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

$language_interface = $language;

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

global $language_interface_initial_value;

The 'getDumpValues()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getDumpValues()
    {
        return $this->dumpValues;
    }
Severity: Minor
Found in public/main/cron/import_csv.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

The variable $_configuration is not named in camelCase.
Open

    public function run()
    {
        global $_configuration;

        $value = api_get_configuration_value('import_csv_custom_url_id');
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_key is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $user_id is not named in camelCase.
Open

    private function importTeachers($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.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 $user_id is not named in camelCase.
Open

    private function importTeachers($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.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 $tbl_session is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $user_id is not named in camelCase.
Open

    private function importStudents($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.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 $user_id is not named in camelCase.
Open

    private function importStudents($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.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 $user_id is not named in camelCase.
Open

    private function importStudents($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.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 $user_id is not named in camelCase.
Open

    private function importStudents($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.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 $_configuration is not named in camelCase.
Open

    public function run()
    {
        global $_configuration;

        $value = api_get_configuration_value('import_csv_custom_url_id');
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_key is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_name is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_name is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_names is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_names is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_name is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_names is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $user_id is not named in camelCase.
Open

    private function importTeachers($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.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 $tag_names is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tbl_session is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_names is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_key is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $error_message is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $user_id is not named in camelCase.
Open

    private function importStudents($file, $moveFile = true)
    {
        $this->fixCSVFile($file);
        $data = Import::csvToArray($file);

Severity: Minor
Found in public/main/cron/import_csv.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 $error_message is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_names is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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 $tag_name is not named in camelCase.
Open

    private function importSessionsStatic($file, $moveFile = true)
    {
        $content = file($file);
        $sessions = [];
        $tag_names = [];
Severity: Minor
Found in public/main/cron/import_csv.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