Showing 447 of 447 total issues
Avoid using CrEOF\Spatial\PHP\Types\count() function in for loops. Open
for ($i = 0; $i < count($this->lineStrings); $i++) {
$lineStrings[] = $this->getLineString($i);
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}
Source https://phpmd.org/rules/design.html#countinloopexpression
setUp accesses the super-global variable $GLOBALS. Open
protected function setUp()
{
if (count($this->supportedPlatforms) && ! isset($this->supportedPlatforms[$this->getPlatform()->getName()])) {
$this->markTestSkipped(sprintf('No support for platform %s in test class %s.', $this->getPlatform()->getName(), get_class($this)));
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
Avoid using CrEOF\Spatial\PHP\Types\count() function in for loops. Open
for ($i = 0; $i < count($this->rings); $i++) {
$rings[] = $this->getRing($i);
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}
Source https://phpmd.org/rules/design.html#countinloopexpression
The method onNotSuccessfulTest() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
protected function onNotSuccessfulTest(\Exception $e)
{
if (! $GLOBALS['opt_use_debug_stack'] || $e instanceof \PHPUnit_Framework_AssertionFailedError) {
throw $e;
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
getCommonConnectionParameters accesses the super-global variable $GLOBALS. Open
protected static function getCommonConnectionParameters()
{
$connectionParams = array(
'driver' => $GLOBALS['db_type'],
'user' => $GLOBALS['db_username'],
- Read upRead up
- Create a ticketCreate a ticket
- 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
getCommonConnectionParameters accesses the super-global variable $GLOBALS. Open
protected static function getCommonConnectionParameters()
{
$connectionParams = array(
'driver' => $GLOBALS['db_type'],
'user' => $GLOBALS['db_username'],
- Read upRead up
- Create a ticketCreate a ticket
- 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
getCommonConnectionParameters accesses the super-global variable $GLOBALS. Open
protected static function getCommonConnectionParameters()
{
$connectionParams = array(
'driver' => $GLOBALS['db_type'],
'user' => $GLOBALS['db_username'],
- Read upRead up
- Create a ticketCreate a ticket
- 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
The method validateArguments() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10. Open
protected function validateArguments(array $argv = null)
{
$argc = count($argv);
if (1 == $argc && is_array($argv[0])) {
- Read upRead up
- Create a ticketCreate a ticket
- 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
getConnectionParameters accesses the super-global variable $GLOBALS. Open
protected static function getConnectionParameters()
{
$parameters = static::getCommonConnectionParameters();
$parameters['dbname'] = $GLOBALS['db_name'];
- Read upRead up
- Create a ticketCreate a ticket
- 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
setUp accesses the super-global variable $GLOBALS. Open
protected function setUp()
{
if (count($this->supportedPlatforms) && ! isset($this->supportedPlatforms[$this->getPlatform()->getName()])) {
$this->markTestSkipped(sprintf('No support for platform %s in test class %s.', $this->getPlatform()->getName(), get_class($this)));
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
Avoid using CrEOF\Spatial\PHP\Types\count() function in for loops. Open
for ($i = 0; $i < count($this->polygons); $i++) {
$polygons[] = $this->getPolygon($i);
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}
Source https://phpmd.org/rules/design.html#countinloopexpression
getCommonConnectionParameters accesses the super-global variable $GLOBALS. Open
protected static function getCommonConnectionParameters()
{
$connectionParams = array(
'driver' => $GLOBALS['db_type'],
'user' => $GLOBALS['db_username'],
- Read upRead up
- Create a ticketCreate a ticket
- 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
getCommonConnectionParameters accesses the super-global variable $GLOBALS. Open
protected static function getCommonConnectionParameters()
{
$connectionParams = array(
'driver' => $GLOBALS['db_type'],
'user' => $GLOBALS['db_username'],
- Read upRead up
- Create a ticketCreate a ticket
- 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
End of line character is invalid; expected "\n" but found "\r\n" Open
<?php
- Create a ticketCreate a ticket
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $platforms = array('mysql');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$this->markTestSkipped(sprintf('No support for platform %s in test class %s.', $this->getPlatform()->getName(), get_class($this)));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$configuration->addCustomNumericFunction('st_area', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STArea');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
* @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geography\Point::__construct: "5", "5", "5", "5"
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
* @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geometry\Point::__construct: Array, Array, "1234"
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$expected = '{"type":"Polygon","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]],[[0,0],[10,0],[10,10],[0,10],[0,0]]]}';
- Create a ticketCreate a ticket
- Exclude checks