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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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__);
- Read upRead up
- Exclude checks
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']]);
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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__);
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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
- Exclude checks
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)
- Exclude checks
Unused property Open
$this->_export_tmpdir;
- Exclude checks
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
- Exclude checks
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
- Exclude checks
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
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Importing $label [$prefix] ... STARTED", __METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Importing $label [$prefix] ... DONE", __METHOD__);
- Exclude checks
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']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string Zip file name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$languages => $languages,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->_export_tmpdir;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Initialize Import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$custom => $custom,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $zipfile
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import Module from zip file.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool True for overwriting existing module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function update($instance, $zipfile, $overwrite = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getPrefix()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool True for overwriting existing module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip->unzip([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::register($prefix, $label, null, true, (int)$this->_modulexml->progress);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Importing $label [$prefix] ... DONE", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Constructor.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update Module from zip file.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (string) $this->_modulexml->prefix;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function initImport($zipfile, $overwrite = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function import($zipfile, $overwrite = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param object Instance of Language (to keep Module update API consistent)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$languages = 'languages/' . $prefix;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getModuleNameFromZip($zipfile);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->initImport($zipfile, $overwrite)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->import($zipfile, $overwrite);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::clear();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Importing $label [$prefix] ... STARTED", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip = \App\Zip::openFile($zipfile, ['onlyExtensions' => ['json']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function importLanguage(string $zipfile)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importLanguage($zipfile);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$prefix = $this->_modulexml->prefix;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string Zip file name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import Module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$label = $this->_modulexml->name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$custom = 'custom/' . $languages;
- Exclude checks