YetiForceCompany/YetiForceCRM

View on GitHub
vtlib/Vtiger/LanguageImport.php

Summary

Maintainability
A
0 mins
Test Coverage
B
82%

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

    public function update($instance, $zipfile, $overwrite = true)
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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 initImport has a boolean flag argument $overwrite, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function initImport($zipfile, $overwrite = true)
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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 import has a boolean flag argument $overwrite, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function import($zipfile, $overwrite = false)
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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

Avoid using static access to class '\App\Log' in method 'importLanguage'.
Open

        \App\Log::trace("Importing $label [$prefix] ... DONE", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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 '\App\Zip' in method 'importLanguage'.
Open

        $zip = \App\Zip::openFile($zipfile, ['onlyExtensions' => ['json']]);
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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 '\App\Cache' in method 'importLanguage'.
Open

        \App\Cache::clear();
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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 '\App\Log' in method 'importLanguage'.
Open

        \App\Log::trace("Importing $label [$prefix] ... STARTED", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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 '$instance'.
Open

    public function update($instance, $zipfile, $overwrite = true)
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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 '$overwrite'.
Open

    public function initImport($zipfile, $overwrite = true)
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.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

Saw possibly unextractable annotation for a fragment of comment '* @param string Zip file name': after string, did not see an element name (will guess based on comment order)
Open

     * @param string Zip file name
Severity: Info
Found in vtlib/Vtiger/LanguageImport.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param object Instance of Language (to keep Module update API consistent)': after object, did not see an element name (will guess based on comment order)
Open

     * @param object Instance of Language (to keep Module update API consistent)
Severity: Info
Found in vtlib/Vtiger/LanguageImport.php by phan

Unused property
Open

        $this->_export_tmpdir;
Severity: Info
Found in vtlib/Vtiger/LanguageImport.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param bool True for overwriting existing module': after bool, did not see an element name (will guess based on comment order)
Open

     * @param bool True for overwriting existing module
Severity: Info
Found in vtlib/Vtiger/LanguageImport.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string Zip file name': after string, did not see an element name (will guess based on comment order)
Open

     * @param string Zip file name
Severity: Info
Found in vtlib/Vtiger/LanguageImport.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param bool True for overwriting existing module': after bool, did not see an element name (will guess based on comment order)
Open

     * @param bool True for overwriting existing module
Severity: Info
Found in vtlib/Vtiger/LanguageImport.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace("Importing $label [$prefix] ... STARTED", __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/LanguageImport.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace("Importing $label [$prefix] ... DONE", __METHOD__);
Severity: Critical
Found in vtlib/Vtiger/LanguageImport.php by phan

Argument 1 (fileName) is string but \App\Zip::openFile() takes bool|false defined at /code/app/Zip.php:51
Open

        $zip = \App\Zip::openFile($zipfile, ['onlyExtensions' => ['json']]);
Severity: Minor
Found in vtlib/Vtiger/LanguageImport.php by phan

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string Zip file name

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

            $languages => $languages,

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->_export_tmpdir;

Spaces must be used to indent lines; tabs are not allowed
Open

     * Initialize Import.

Spaces must be used to indent lines; tabs are not allowed
Open

            $custom => $custom,

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $zipfile

Spaces must be used to indent lines; tabs are not allowed
Open

     * Import Module from zip file.

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool True for overwriting existing module

Spaces must be used to indent lines; tabs are not allowed
Open

    public function update($instance, $zipfile, $overwrite = true)

Spaces must be used to indent lines; tabs are not allowed
Open

    public function __construct()

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getPrefix()

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool True for overwriting existing module

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        $zip->unzip([

Spaces must be used to indent lines; tabs are not allowed
Open

        self::register($prefix, $label, null, true, (int)$this->_modulexml->progress);

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\Log::trace("Importing $label [$prefix] ... DONE", __METHOD__);

Spaces must be used to indent lines; tabs are not allowed
Open

     * Constructor.

Spaces must be used to indent lines; tabs are not allowed
Open

        parent::__construct();

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * Update Module from zip file.

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        ]);

Spaces must be used to indent lines; tabs are not allowed
Open

        return (string) $this->_modulexml->prefix;

Spaces must be used to indent lines; tabs are not allowed
Open

    public function initImport($zipfile, $overwrite = true)

Spaces must be used to indent lines; tabs are not allowed
Open

    public function import($zipfile, $overwrite = false)

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param object Instance of Language (to keep Module update API consistent)

Spaces must be used to indent lines; tabs are not allowed
Open

        $languages = 'languages/' . $prefix;

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this->getModuleNameFromZip($zipfile);

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        if ($this->initImport($zipfile, $overwrite)) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->import($zipfile, $overwrite);

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\Cache::clear();

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\Log::trace("Importing $label [$prefix] ... STARTED", __METHOD__);

Spaces must be used to indent lines; tabs are not allowed
Open

        $zip = \App\Zip::openFile($zipfile, ['onlyExtensions' => ['json']]);

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function importLanguage(string $zipfile)

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->importLanguage($zipfile);

Spaces must be used to indent lines; tabs are not allowed
Open

        $prefix = $this->_modulexml->prefix;

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string Zip file name

Spaces must be used to indent lines; tabs are not allowed
Open

     * Import Module.

Spaces must be used to indent lines; tabs are not allowed
Open

        $label = $this->_modulexml->name;

Spaces must be used to indent lines; tabs are not allowed
Open

        $custom = 'custom/' . $languages;

There are no issues that match your filters.

Category
Status