Function updateBySelect
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function updateBySelect(): void
{
$options = [];
$toInstall = \App\YetiForce\Updater::getToInstall();
foreach ($toInstall as $package) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method updateBySelect
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateBySelect(): void
{
$options = [];
$toInstall = \App\YetiForce\Updater::getToInstall();
foreach ($toInstall as $package) {
Function updateByType
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function updateByType(string $type): void
{
$types = ['patches', 'version'];
if (!\in_array($this->climate->arguments->get('type'), $types)) {
$this->climate->white('Type not found. Allowed types:')->columns($types);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function update(): void
{
$maxExecutionTime = \ini_get('max_execution_time');
if ($maxExecutionTime < 1 || $maxExecutionTime > 600) {
$this->climate->lightGreen('Max execution time = ' . $maxExecutionTime);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The class System has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. Open
class System extends Base
{
/** {@inheritdoc} */
public $moduleName = 'System';
- Read upRead up
- Exclude checks
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 '277', column '27'). Open
$packageInstance = new \vtlib\Package();
- Read upRead up
- Exclude checks
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 '190', column '26'). Open
$menuRecordModel = new \Settings_Menu_Record_Model();
- Read upRead up
- Exclude checks
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 '94', column '23'). Open
$registration = new \App\YetiForce\Register();
- Read upRead up
- Exclude checks
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 update uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->updateBySelect();
}
- Read upRead up
- Exclude checks
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 using static access to class '\App\YetiForce\Register' in method 'checkRegStatus'. Open
$this->climate->bold('CRM ID: ' . \App\YetiForce\Register::getCrmKey());
- 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\Company' in method 'checkRegStatus'. Open
foreach (\App\Company::getCompany() as $key => $value) {
- 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 assigning values to variables in if clauses and the like (line '96', column '7'). Open
public function checkRegStatus(): void
{
$registration = new \App\YetiForce\Register();
$this->climate->bold('Status: ' . \App\Language::translate(\App\YetiForce\Register::STATUS_MESSAGES[$registration->getStatus(true)], 'Settings::Companies'));
if ($error = $registration->getError()) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\YetiForce\Updater' in method 'updateByType'. Open
foreach (\App\YetiForce\Updater::getToInstall() as $package) {
- 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\YetiForce\Updater' in method 'updateByType'. Open
if (!\App\YetiForce\Updater::isDownloaded($package)) {
- 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\YetiForce\Updater' in method 'updateBySelect'. Open
\App\YetiForce\Updater::download($package);
- 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\Language' in method 'checkRegStatus'. Open
$this->climate->bold('Status: ' . \App\Language::translate(\App\YetiForce\Register::STATUS_MESSAGES[$registration->getStatus(true)], 'Settings::Companies'));
- 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\UserPrivilegesFile' in method 'reloadUserPrivileges'. Open
$this->climate->bold('Users: ' . \App\UserPrivilegesFile::recalculateAll());
- 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\Db\Fixer' in method 'reloadModule'. Open
$this->climate->bold('Actions: ' . \App\Db\Fixer::baseModuleActions());
- 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 '\Settings_Updates_Module_Model' in method 'history'. Open
}, \Settings_Updates_Module_Model::getUpdates());
- 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\Colors' in method 'reloadModule'. Open
\App\Colors::generate();
- 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\YetiForce\Register' in method 'checkRegStatus'. Open
$this->climate->bold('APP ID: ' . \App\YetiForce\Register::getInstanceKey());
- 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\Language' in method 'checkRegStatus'. Open
$this->climate->lightRed('Status error: ' . \App\Language::translateSingleMod($error, 'Other.Exceptions'));
- 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\Db\Fixer' in method 'reloadModule'. Open
$this->climate->bold('Profile field: ' . \App\Db\Fixer::profileField());
- 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\YetiForce\Updater' in method 'updateBySelect'. Open
$toInstall = \App\YetiForce\Updater::getToInstall();
- 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
The method updateBySelect uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
\App\YetiForce\Updater::download($package);
$this->update();
}
- Read upRead up
- Exclude checks
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 using static access to class '\App\YetiForce\Register' in method 'checkRegStatus'. Open
$this->climate->bold('Provider: ' . \App\YetiForce\Register::getProvider());
- 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\Db\Fixer' in method 'reloadModule'. Open
$this->climate->bold('Tools: ' . \App\Db\Fixer::baseModuleTools());
- 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\YetiForce\Updater' in method 'updateBySelect'. Open
if (\App\YetiForce\Updater::isDownloaded($package)) {
- 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
The method updateByPackage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
echo $response . PHP_EOL;
unlink($path);
}
- Read upRead up
- Exclude checks
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 history uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->climate->lightGreen('No updates');
}
- Read upRead up
- Exclude checks
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 using static access to class '\App\YetiForce\Register' in method 'showProducts'. Open
$table = \App\YetiForce\Register::getProducts();
- 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\Module' in method 'reloadModule'. Open
\App\Module::createModuleMetaFile();
- 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\YetiForce\Updater' in method 'updateByType'. Open
\App\YetiForce\Updater::download($package);
- 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
The method update uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->climate->lightRed('Max execution time = ' . $maxExecutionTime);
}
- Read upRead up
- Exclude checks
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 updateBySelect uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$option .= ' - To download';
}
- Read upRead up
- Exclude checks
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 using static access to class '\App\YetiForce\Updater' in method 'updateBySelect'. Open
if (\App\YetiForce\Updater::isDownloaded($package)) {
- 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 '\Settings_ModuleManager_Module_Model' in method 'updateByPackage'. Open
$path = ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . \Settings_ModuleManager_Module_Model::getUploadDirectory() . \DIRECTORY_SEPARATOR . $package['hash'] . '.zip';
- 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\Db\Fixer' in method 'reloadModule'. Open
$this->climate->bold('Share: ' . \App\Db\Fixer::share());
- 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
Define a constant instead of duplicating this literal "toVersion" 3 times. Open
$versionCompare = $package['fromVersion'] !== $package['toVersion'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "System" 7 times. Open
public $moduleName = 'System';
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "action" 6 times. Open
if (!$this->climate->arguments->defined('action')) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "fromVersion" 3 times. Open
$versionCompare = $package['fromVersion'] !== $package['toVersion'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "label" 3 times. Open
$this->climate->inline($package['label'] . ' - Downloading a package ...');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$this->climate->arguments->parse();
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Colors');
- Exclude checks
Call to method table
from undeclared class \League\CLImate\CLImate
Open
$this->climate->table($table);
- Exclude checks
Call to method getStatus
from undeclared class \App\YetiForce\Register
Open
$this->climate->bold('Status: ' . \App\Language::translate(\App\YetiForce\Register::STATUS_MESSAGES[$registration->getStatus(true)], 'Settings::Companies'));
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Create module meta file');
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance('admin')->createCommand()->update('s_#__companies', [
- Exclude checks
Call to method out
from undeclared class \League\CLImate\CLImate
Open
$this->climate->out('- downloaded');
- Exclude checks
Call to method border
from undeclared class \League\CLImate\CLImate
Open
$this->climate->border('─', 200);
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!\in_array($this->climate->arguments->get('type'), $types)) {
- Exclude checks
Call to method border
from undeclared class \League\CLImate\CLImate
Open
$this->climate->border('─', 200);
- Exclude checks
Call to method border
from undeclared class \League\CLImate\CLImate
Open
$this->climate->border('─', 200);
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Call to method white
from undeclared class \League\CLImate\CLImate
Open
$this->climate->white('Type not found. Allowed types:')->columns($types);
- Exclude checks
Call to method lightRed
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightRed($th->__toString());
- Exclude checks
Call to method lightGreen
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightGreen('Max execution time = ' . $maxExecutionTime);
- Exclude checks
Call to method getProducts
from undeclared class \App\YetiForce\Register
Open
$table = \App\YetiForce\Register::getProducts();
- Exclude checks
Call to method table
from undeclared class \League\CLImate\CLImate
Open
$table ? $this->climate->table($table) : $this->climate->bold('None');
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Call to method lightRed
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightRed('Max execution time = ' . $maxExecutionTime);
- Exclude checks
Reference to constant STATUS_MESSAGES
from undeclared class \App\YetiForce\Register
Open
$this->climate->bold('Status: ' . \App\Language::translate(\App\YetiForce\Register::STATUS_MESSAGES[$registration->getStatus(true)], 'Settings::Companies'));
- Exclude checks
Call to method border
from undeclared class \League\CLImate\CLImate
Open
$this->climate->border('─', 200);
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Profile field: ' . \App\Db\Fixer::profileField());
- Exclude checks
Call to method radio
from undeclared class \League\CLImate\CLImate
Open
$input = $this->climate->radio('Updates available:', $options);
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$this->climate->arguments->add([
- Exclude checks
Call to method border
from undeclared class \League\CLImate\CLImate
Open
$this->climate->border('─', 200);
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Status: ' . \App\Language::translate(\App\YetiForce\Register::STATUS_MESSAGES[$registration->getStatus(true)], 'Settings::Companies'));
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Actions: ' . \App\Db\Fixer::baseModuleActions());
- Exclude checks
Call to method inline
from undeclared class \League\CLImate\CLImate
Open
$this->climate->inline($package['label'] . ' - Downloading a package ...');
- Exclude checks
Call to method lightRed
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightRed('Status error: ' . \App\Language::translateSingleMod($error, 'Other.Exceptions'));
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('CRM ID: ' . \App\YetiForce\Register::getCrmKey());
- Exclude checks
Call to method getCrmKey
from undeclared class \App\YetiForce\Register
Open
$this->climate->bold('CRM ID: ' . \App\YetiForce\Register::getCrmKey());
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Provider: ' . \App\YetiForce\Register::getProvider());
- Exclude checks
Call to method lightGreen
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightGreen('No updates');
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->arguments->defined('type')) {
- Exclude checks
Call to method __construct
from undeclared class \App\YetiForce\Register
Open
$registration = new \App\YetiForce\Register();
- Exclude checks
Call to method border
from undeclared class \League\CLImate\CLImate
Open
$this->climate->border('─', 200);
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('APP ID: ' . \App\YetiForce\Register::getInstanceKey());
- Exclude checks
Call to method table
from undeclared class \League\CLImate\CLImate
Open
$this->climate->table([$table]);
- Exclude checks
Call to method lightYellow
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightYellow()->border('─', 200);
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Users: ' . \App\UserPrivilegesFile::recalculateAll());
- Exclude checks
Call to method lightYellow
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightYellow()->border('─', 200);
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Tools: ' . \App\Db\Fixer::baseModuleTools());
- Exclude checks
Call to method lightBlue
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightBlue('Total time: ' . round(microtime(true) - $startTime, 2));
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$this->updateByType($this->climate->arguments->get('type'));
- Exclude checks
Call to method getError
from undeclared class \App\YetiForce\Register
Open
if ($error = $registration->getError()) {
- Exclude checks
Call to method white
from undeclared class \League\CLImate\CLImate
Open
$this->climate->white($package['label'] . ' - Installing the package');
- Exclude checks
Call to method getProvider
from undeclared class \App\YetiForce\Register
Open
$this->climate->bold('Provider: ' . \App\YetiForce\Register::getProvider());
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$table ? $this->climate->table($table) : $this->climate->bold('None');
- Exclude checks
Call to method lightBlue
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightBlue('No updates available');
- Exclude checks
Call to method lightRed
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightRed($packageInstance->_errorText);
- Exclude checks
Call to method getInstanceKey
from undeclared class \App\YetiForce\Register
Open
$this->climate->bold('APP ID: ' . \App\YetiForce\Register::getInstanceKey());
- Exclude checks
Call to method getCompany
from undeclared class \App\Company
Open
foreach (\App\Company::getCompany() as $key => $value) {
- Exclude checks
Call to method bold
from undeclared class \League\CLImate\CLImate
Open
$this->climate->bold('Share: ' . \App\Db\Fixer::share());
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'update' => 'Update',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- 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
$this->climate->border('─', 200);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\App\Company::getCompany() as $key => $value) {
- 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
$this->climate->bold('Share: ' . \App\Db\Fixer::share());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxExecutionTime = \ini_get('max_execution_time');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightGreen('Max execution time = ' . $maxExecutionTime);
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$registration = new \App\YetiForce\Register();
- 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
/** @var string[] Methods list */
- 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
'type' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->border('─', 200);
- 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
$table ? $this->climate->table($table) : $this->climate->bold('None');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->bold('Tools: ' . \App\Db\Fixer::baseModuleTools());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->bold('Profile field: ' . \App\Db\Fixer::profileField());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'checkRegStatus' => 'Check registration status',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'showProducts' => 'Show active products',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightGreen('No updates');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightRed('Max execution time = ' . $maxExecutionTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = [];
- 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
$table = array_map(function ($item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($item['id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->border('─', 200);
- 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
'deleteRegistration' => 'Delete registration data',
- 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 void
- 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->climate->table([$table]);
- 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
* Reload modules.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $methods = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($maxExecutionTime < 1 || $maxExecutionTime > 600) {
- 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 checkRegStatus(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($error = $registration->getError()) {
- 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->climate->border('─', 200);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('action')) {
- 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
'reloadMenus' => 'Reload menus',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* History of uploaded updates.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['result'] = $item['result'] ? 'OK' : 'Error';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->table($table);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('System');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update CRM.
- 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->climate->arguments->defined('type')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateByType($this->climate->arguments->get('type'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- 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
* Check registration status.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->bold('CRM ID: ' . \App\YetiForce\Register::getCrmKey());
- 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->climate->arguments->add([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateBySelect();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightRed('Status error: ' . \App\Language::translateSingleMod($error, 'Other.Exceptions'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->bold('Provider: ' . \App\YetiForce\Register::getProvider());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'Update type. Values: patches, version',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->helpMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->arguments->parse();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function showProducts(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $item;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->border('─', 200);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('System');
- 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->climate->bold('Actions: ' . \App\Db\Fixer::baseModuleActions());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $moduleName = 'System';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'reloadModule' => 'Reload modules',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'reloadUserPrivileges' => 'Reload users privileges',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- 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->climate->border('─', 200);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = \App\YetiForce\Register::getProducts();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('action')) {
- 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 history(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prefix' => 't',
- 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->climate->bold('Status: ' . \App\Language::translate(\App\YetiForce\Register::STATUS_MESSAGES[$registration->getStatus(true)], 'Settings::Companies'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'history' => 'History of uploaded updates',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}, \Settings_Updates_Module_Model::getUpdates());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function update(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Line exceeds 120 characters; contains 165 characters Open
$this->climate->bold('Status: ' . \App\Language::translate(\App\YetiForce\Register::STATUS_MESSAGES[$registration->getStatus(true)], 'Settings::Companies'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->bold('APP ID: ' . \App\YetiForce\Register::getInstanceKey());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table[$key] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Show active products.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('System');
- 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 reloadModule(): void
- 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
'post_code' => '', 'country' => '', 'companysize' => '', 'website' => '', 'logo' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\App\YetiForce\Updater::getToInstall() as $package) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->out('- downloaded');
- 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
$toInstall = \App\YetiForce\Updater::getToInstall();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$option .= " ({$package['fromVersion']} >> {$package['toVersion']})";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$options) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\YetiForce\Updater::isDownloaded($package)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $th) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightBlue('Total time: ' . round(microtime(true) - $startTime, 2));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Module::createModuleMetaFile();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Colors::generate();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateByPackage($package);
- 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 void
- 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
$option .= ' - Downloaded, ready to install';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$option .= ' - To download';
- 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
try {
- Exclude checks
Line exceeds 120 characters; contains 170 characters Open
$path = ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . \Settings_ModuleManager_Module_Model::getUploadDirectory() . \DIRECTORY_SEPARATOR . $package['hash'] . '.zip';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = $packageInstance->import($path, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightRed($th->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightYellow()->border('─', 200);
- 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
$options = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$input = $this->climate->radio('Updates available:', $options);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateByPackage($package);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\YetiForce\Updater::download($package);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->update();
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('System');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Reload users privileges.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightYellow()->border('─', 200);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array($this->climate->arguments->get('type'), $types)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->white('Type not found. Allowed types:')->columns($types);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\YetiForce\Updater::isDownloaded($package)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\YetiForce\Updater::isDownloaded($package)) {
- 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;
- 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 void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->bold('Users: ' . \App\UserPrivilegesFile::recalculateAll());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete registration data.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- 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
} else {
- 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
* Update by package type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($package['fromVersion'] !== $package['toVersion']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->white($package['label'] . ' - Installing the package');
- 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
'firstname' => '', 'lastname' => '', 'email' => '', 'facebook' => '', 'twitter' => '', 'linkedin' => '',
- 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
private function updateByType(string $type): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$types = ['patches', 'version'];
- 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->climate->inline($package['label'] . ' - Downloading a package ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$option = "{$package['label']}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($package['hash'] === $hash) {
- 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->climate->bold('Colors');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('System');
- 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
'name' => '', 'industry' => '', 'vat_id' => '', 'city' => '', 'address' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- 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
$versionUpdate = 'version' === $type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$versionCompare = $package['fromVersion'] !== $package['toVersion'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($toInstall as $package) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startTime = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$packageInstance = new \vtlib\Package();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightRed($packageInstance->_errorText);
- 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
echo $response . PHP_EOL;
- 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
* Reload menus.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function reloadMenus(): void
- 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 by selecting a package.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($toInstall as $package) {
- 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
$hash = $input->prompt();
- 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
$menuRecordModel = new \Settings_Menu_Record_Model();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('System');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($versionCompare && !$versionUpdate) || (!$versionCompare && $versionUpdate)) {
- 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\Db::getInstance('admin')->createCommand()->update('s_#__companies', [
- 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 $type Package type. Values: patches, version
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\YetiForce\Updater::download($package);
- 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
private function updateBySelect(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $package
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unlink($path);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->bold('Create module meta file');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function reloadUserPrivileges(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => 0,
- 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 void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$menuRecordModel->refreshMenuFiles();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options[$package['hash']] = $option;
- 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 package.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$path = ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . \Settings_ModuleManager_Module_Model::getUploadDirectory() . \DIRECTORY_SEPARATOR . $package['hash'] . '.zip';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function deleteRegistration(): void
- 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
$this->climate->lightBlue('No updates available');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function updateByPackage(array $package): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($packageInstance->_errorText) {
- 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