src/Robo/Plugin/Commands/DigipolisSymfonyDefaultHooksCommands.php
env accesses the super-global variable $_ENV. Open
Open
protected function env($key, $default = null)
{
$value = array_key_exists($key, $_ENV) ? $_ENV[$key] : false;
if ($value === false) {
return is_callable($default) ? call_user_func($default) : $default;
- 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
env accesses the super-global variable $_ENV. Open
Open
protected function env($key, $default = null)
{
$value = array_key_exists($key, $_ENV) ? $_ENV[$key] : false;
if ($value === false) {
return is_callable($default) ? call_user_func($default) : $default;
- 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
Method defaultDbConfig
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function defaultDbConfig()
{
$rootDir = $this->getConfig()->get('digipolis.root.project', false);
if (!$rootDir) {
return false;
Avoid too many return
statements within this method. Open
Open
return substr($value, 1, -1);
Avoid too many return
statements within this method. Open
Open
return $value;
Avoid too many return
statements within this method. Open
Open
return;
The method env() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. Open
Open
protected function env($key, $default = null)
{
$value = array_key_exists($key, $_ENV) ? $_ENV[$key] : false;
if ($value === false) {
return is_callable($default) ? call_user_func($default) : $default;
- 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
Line exceeds 120 characters; contains 122 characters Open
Open
preg_match('/^([^:\/\/]*):\/\/([^:]*):([^@]*)@([^:]*):([^\/]*)\/([^\?]*)(\?serverVersion=.*)?$/', $url, $matches);
- Exclude checks
Opening brace should be on a new line Open
Open
public function getPreRestoreBackupRemoteHandler() {
- Exclude checks