__construct accesses the super-global variable $_ENV. Open
public function __construct($instance, $direct = false, $full = true, $onlyCode = false)
{
$this->setIO(App::get('io'));
$this->instance = $instance;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
__construct accesses the super-global variable $_ENV. Open
public function __construct($instance, $direct = false, $full = true, $onlyCode = false)
{
$this->setIO(App::get('io'));
$this->instance = $instance;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
File Backup.php
has 414 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// Copyright (c) 2016, Avan.Tech, et. al.
// Copyright (c) 2008, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
The class Backup has 11 public methods. Consider refactoring Backup to keep number of public methods under 10. Open
class Backup
{
public const FULL_BACKUP = 'full';
public const PARTIAL_BACKUP = 'partial';
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Backup has an overall complexity of 109 which is very high. The configured complexity threshold is 50. Open
class Backup
{
public const FULL_BACKUP = 'full';
public const PARTIAL_BACKUP = 'partial';
- Exclude checks
Function copyDirectories
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- 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
Backup
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Backup
{
public const FULL_BACKUP = 'full';
public const PARTIAL_BACKUP = 'partial';
Method copyDirectories
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
Method fixPermissions
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fixPermissions($path)
{
$filesystem = new Filesystem();
$perm = $this->getFilePerm();
$user = $this->getFileUser();
Function fixPermissions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function fixPermissions($path)
{
$filesystem = new Filesystem();
$perm = $this->getFilePerm();
$user = $this->getFileUser();
- 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 createArchive
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createArchive($archiveDir = null)
{
$archiveDir = $archiveDir ?: $this->archiveDir;
$nice = 'nice -n 19';
Method create
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create($skipArchive = false, $backupDir = null)
{
$backupDir = $backupDir ?: $this->backupDir;
$this->io->writeln('Checking directories...');
Function create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function create($skipArchive = false, $backupDir = null)
{
$backupDir = $backupDir ?: $this->backupDir;
$this->io->writeln('Checking directories...');
- 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 createTempPartial
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function createTempPartial($root, $files)
{
$fileSystem = new Filesystem();
$temp = implode(
\DIRECTORY_SEPARATOR,
- 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 createDir
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function createDir($folder)
{
$parentFolder = dirname($folder);
$exceptionMessage = 'Folder "%s" is not writable. Tiki-manager requires write privileges in order to create backups.';
- 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 setArchiveSymlink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setArchiveSymlink($symlinkPath = null, $archiveDir = null, $instance = null)
{
if (file_exists($symlinkPath)) { // if destination path exists, skip
return true;
}
- 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 method create() has an NPath complexity of 240. The configured NPath complexity threshold is 200. Open
public function create($skipArchive = false, $backupDir = null)
{
$backupDir = $backupDir ?: $this->backupDir;
$this->io->writeln('Checking directories...');
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method create() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function create($skipArchive = false, $backupDir = null)
{
$backupDir = $backupDir ?: $this->backupDir;
$this->io->writeln('Checking directories...');
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method createArchive() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
public function createArchive($archiveDir = null)
{
$archiveDir = $archiveDir ?: $this->archiveDir;
$nice = 'nice -n 19';
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method fixPermissions() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function fixPermissions($path)
{
$filesystem = new Filesystem();
$perm = $this->getFilePerm();
$user = $this->getFileUser();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method copyDirectories() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method create has a boolean flag argument $skipArchive, which is a certain sign of a Single Responsibility Principle violation. Open
public function create($skipArchive = false, $backupDir = null)
- 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 __construct has a boolean flag argument $onlyCode, which is a certain sign of a Single Responsibility Principle violation. Open
public function __construct($instance, $direct = false, $full = true, $onlyCode = 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
Remove error control operator '@' on line 302. Open
public function createManifest($data, $backupDir = null)
{
$backupDir = $backupDir ?: $this->backupDir;
$manifestFile = $backupDir . DIRECTORY_SEPARATOR . 'manifest.txt';
$file = fopen($manifestFile, 'w');
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Missing class import via use statement (line '283', column '23'). Open
throw new \RuntimeException('Unsuccessful database backup. Aborting.');
- 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 __construct has a boolean flag argument $direct, which is a certain sign of a Single Responsibility Principle violation. Open
public function __construct($instance, $direct = false, $full = true, $onlyCode = 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
The method __construct has a boolean flag argument $full, which is a certain sign of a Single Responsibility Principle violation. Open
public function __construct($instance, $direct = false, $full = true, $onlyCode = 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
The method copyDirectories uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
list($type, $dir) = $target;
$hash = md5($dir);
$destDir = $backupDir . DIRECTORY_SEPARATOR . $hash;
if ($type == 'app' && !$this->full) {
- 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 copyDirectories uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$error_code = $access->localizeFolder($dir, $destDir);
}
- 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 '\TikiManager\Libs\VersionControl\VersionControlSystem' in method 'copyDirectories'. Open
$svn = VersionControlSystem::getVersionControlSystem($this->instance);
- 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 '\TikiManager\Libs\Helpers\ApplicationHelper' in method 'copySystemIniConfigFile'. Open
$filePath = ApplicationHelper::getAbsolutePath($filePath);
- 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 setArchiveSymlink uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
mkdir($archiveDir, $this->getFilePerm(), true);
}
- 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 copyDirectories uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->errors[$error_code] = [$error_code => $dir];
}
- 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 '\TikiManager\Libs\Helpers\ApplicationHelper' in method 'createArchive'. Open
if (ApplicationHelper::isWindows()) {
- 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 '302', column '17'). Open
public function createManifest($data, $backupDir = null)
{
$backupDir = $backupDir ?: $this->backupDir;
$manifestFile = $backupDir . DIRECTORY_SEPARATOR . 'manifest.txt';
$file = fopen($manifestFile, 'w');
- 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
The method createManifest uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->io->warning("Failed to generate manifest entry line");
$error = "Invalid/insufficient data to generate the manifest:\n" .
"Received " . count($data) . " arguments instead of " . (!$this->direct ? 4 : 2) . "\n" .
var_export($data, true);
- 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 createTempPartial uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fileSystem->copy($src, $dest, true);
}
- 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 copyDirectories uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($this->instance->vcs_type == 'svn') {
/** @var Svn $svn */
$svn = VersionControlSystem::getVersionControlSystem($this->instance);
$svn->ensureTempFolder($destDir . DIRECTORY_SEPARATOR . basename($dir));
- 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
Argument 1 (str)
is int
but \md5()
takes string
Open
[Environment::get('TEMP_FOLDER'), md5(time()), basename($this->instance->webroot)]
- Exclude checks
Possibly zero references to use statement for classlike/namespace Svn
(\TikiManager\Libs\VersionControl\Svn)
Open
use TikiManager\Libs\VersionControl\Svn;
- Exclude checks
The variable $error_code is not named in camelCase. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $return_var is not named in camelCase. Open
public function createArchive($archiveDir = null)
{
$archiveDir = $archiveDir ?: $this->archiveDir;
$nice = 'nice -n 19';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $error_code is not named in camelCase. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $return_var is not named in camelCase. Open
public function createArchive($archiveDir = null)
{
$archiveDir = $archiveDir ?: $this->archiveDir;
$nice = 'nice -n 19';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $return_var is not named in camelCase. Open
public function createArchive($archiveDir = null)
{
$archiveDir = $archiveDir ?: $this->archiveDir;
$nice = 'nice -n 19';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $error_code is not named in camelCase. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $return_var is not named in camelCase. Open
public function createArchive($archiveDir = null)
{
$archiveDir = $archiveDir ?: $this->archiveDir;
$nice = 'nice -n 19';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $error_code is not named in camelCase. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $error_code is not named in camelCase. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $error_code is not named in camelCase. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $return_var is not named in camelCase. Open
public function createArchive($archiveDir = null)
{
$archiveDir = $archiveDir ?: $this->archiveDir;
$nice = 'nice -n 19';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $return_var is not named in camelCase. Open
public function createArchive($archiveDir = null)
{
$archiveDir = $archiveDir ?: $this->archiveDir;
$nice = 'nice -n 19';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $error_code is not named in camelCase. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}