mrcnpdlk/teryt-api

View on GitHub

Showing 52 of 52 total issues

Missing class import via use statement (line '57', column '56').
Open

            $this->statusDate = $oData->STAN_NA ? (new \DateTime($oData->STAN_NA))->format('Y-m-d') : null;

MissingImport

Since: 2.7.0

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

Example

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

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

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

                $this->statusDate = $oData->DataStanu ? (new \DateTime($oData->DataStanu))->format('Y-m-d') : null;

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 addUserToken has a boolean flag argument $digest, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function addUserToken(string $username, string $password, bool $digest = false): void
Severity: Minor
Found in src/TerytSoapClient.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

The method getKeyValues has a boolean flag argument $asUnique, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function getKeyValues(array $tItems, string $sKey, bool $asUnique = true): array
Severity: Minor
Found in src/Helper.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

Missing class import via use statement (line '79', column '60').
Open

                $this->statusDate = $oData->STAN_NA ? (new \DateTime($oData->STAN_NA))->format('Y-m-d') : null;

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

        } else {
            if ($e instanceof Exception) {
                return $e;
            }

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

            } else {
                $tList = NativeApi::getInstance()->PobierzListePowiatow($this->id);
                foreach ($tList as $p) {
                    $answer[] = (new District())->find($p->provinceId . $p->districtId);
                }
Severity: Minor
Found in src/Model/Province.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 class NativeApi has 1406 lines of code. Current threshold is 1000. Avoid really long classes.
Open

final class NativeApi
{
    /**
     * @var string Wyszukiwanie wśród wszystkich rodzajów jednostek
     */
Severity: Minor
Found in src/NativeApi.php by phpmd

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

        } else {
            if ($this->provinceId && $this->districtId && $this->communeId && $this->communeTypeId) {
                $oTerc        = (new Terc())->setIds($this->provinceId, $this->districtId, $this->communeId, $this->communeTypeId);
                $this->tercId = $oTerc->getTercId();
            }

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

        } else {
            $res = NativeApi::getInstance()->WyszukajJednostkeWRejestrze(null, NativeApi::CATEGORY_GMI_ALL, [], [$tercId]);
            if (!empty($res) && 1 === count($res)) {
                $oCommune       = $res[0];
                $this->id       = $id;
Severity: Minor
Found in src/Model/Commune.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

FIXME found
Open

            <item>FIXME</item>
Severity: Minor
Found in phpdoc.xml by fixme

TODO found
Open

            <item>TODO</item>
Severity: Minor
Found in phpdoc.xml by fixme
Severity
Category
Status
Source
Language