whiteCube/lingua

View on GitHub

Showing 36 of 36 total issues

Missing class import via use statement (line '39', column '23').
Open

            throw new \Exception('Unable to create language from "' . $this . '"');
Severity: Minor
Found in src/Lingua/Converter.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

Remove error control operator '@' on line 59.
Open

    protected function loadRepository()
    {
        if(false === @file_get_contents($this->path)) {
            throw new \Exception('Lingua\'s languages repository could not be loaded');
        }
Severity: Minor
Found in src/Lingua/LanguagesRepository.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'parse'.
Open

        $this->repository = LanguagesRepository::find('iso-639-2b', $this->original);
Severity: Minor
Found in src/Lingua/Iso_639_2bConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid unused parameters such as '$arguments'.
Open

    protected function convert($method, $arguments = [])
Severity: Minor
Found in src/Lingua/Service.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 using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'parse'.
Open

        $this->repository = LanguagesRepository::find('iso-639-1', $this->original);
Severity: Minor
Found in src/Lingua/Iso_639_1Converter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'findInRepository'.
Open

                ?? LanguagesRepository::find('iso-639-2b', $this->original['iso']);
Severity: Minor
Found in src/Lingua/ComponentConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'parse'.
Open

        $this->repository = LanguagesRepository::find('iso-639-3', $parsed);
Severity: Minor
Found in src/Lingua/Iso_639_3Converter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'check'.
Open

        if(LanguagesRepository::find('native', self::prepare($format))) return true;
Severity: Minor
Found in src/Lingua/NativeConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'parse'.
Open

        $this->repository = LanguagesRepository::find('native', $this->original);
Severity: Minor
Found in src/Lingua/NativeConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'findInRepository'.
Open

                ?? LanguagesRepository::find('iso-639-2t', $this->original['iso'])
Severity: Minor
Found in src/Lingua/ComponentConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'parse'.
Open

        $this->repository = LanguagesRepository::find('iso-639-2t', $this->original);
Severity: Minor
Found in src/Lingua/Iso_639_2tConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

        foreach (self::$converters as $key => $converter) {
Severity: Minor
Found in src/Lingua/Service.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 using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'parse'.
Open

        $this->repository = LanguagesRepository::find('name', $this->original);
Severity: Minor
Found in src/Lingua/NameConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'findInRepository'.
Open

            return LanguagesRepository::find('iso-639-3', $this->original['iso'])
Severity: Minor
Found in src/Lingua/ComponentConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'findInRepository'.
Open

        return LanguagesRepository::find('iso-639-1', $this->original['iso']);
Severity: Minor
Found in src/Lingua/ComponentConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'check'.
Open

        if(LanguagesRepository::find('name', self::prepare($format))) return true;
Severity: Minor
Found in src/Lingua/NameConverter.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Severity
Category
Status
Source
Language