Showing 66 of 447 total issues
File OrmTestCase.php
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright (C) 2015 Derek J. Lambert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
- Create a ticketCreate a ticket
The class PointTest has 20 public methods. Consider refactoring PointTest to keep number of public methods under 10. Open
class PointTest extends \PHPUnit_Framework_TestCase
{
public function testGoodNumericPoint()
{
$point1 = new Point(-73.7562317, 42.6525793);
- Read upRead up
- Create a ticketCreate a ticket
- 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 PointTest has 20 public methods. Consider refactoring PointTest to keep number of public methods under 10. Open
class PointTest extends \PHPUnit_Framework_TestCase
{
public function testGoodNumericPoint()
{
- Read upRead up
- Create a ticketCreate a ticket
- 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 OrmTestCase has an overall complexity of 51 which is very high. The configured complexity threshold is 50. Open
abstract class OrmTestCase extends \PHPUnit_Framework_TestCase
{
const GEOMETRY_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeometryEntity';
const NO_HINT_GEOMETRY_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\NoHintGeometryEntity';
const POINT_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\PointEntity';
- Create a ticketCreate a ticket
- Exclude checks
File MultiPolygonTest.php
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CrEOF\Spatial\Tests\PHP\Types\Geometry;
- Create a ticketCreate a ticket
Method testSelectArea
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSelectArea()
{
$entity1 = new PolygonEntity();
$rings1 = array(
new LineString(array(
- Create a ticketCreate a ticket
Method testSelectSTArea
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSelectSTArea()
{
$entity1 = new PolygonEntity();
$rings1 = array(
new LineString(array(
- Create a ticketCreate a ticket
Method testAreaWhere
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAreaWhere()
{
$entity1 = new PolygonEntity();
$rings1 = array(
new LineString(array(
- Create a ticketCreate a ticket
Method testSTAreaWhere
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSTAreaWhere()
{
$entity1 = new PolygonEntity();
$rings1 = array(
new LineString(array(
- Create a ticketCreate a ticket
Function validateArguments
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. 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
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 testSolidMultiPolygonAddPolygon
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSolidMultiPolygonAddPolygon()
{
$expected = array(
new Polygon(
array(
- Create a ticketCreate a ticket
Function onNotSuccessfulTest
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. 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
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 testSolidMultiPolygonFromObjectsToArray
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSolidMultiPolygonFromObjectsToArray()
{
$expected = array(
array(
array(
- Create a ticketCreate a ticket
Method testSolidMultiPolygonFromArraysGetPolygons
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSolidMultiPolygonFromArraysGetPolygons()
{
$expected = array(
new Polygon(
array(
- Create a ticketCreate a ticket
Method setUpFunctions
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function setUpFunctions()
{
$configuration = $this->getEntityManager()->getConfiguration();
if ($this->getPlatform()->getName() == 'postgresql') {
- Create a ticketCreate a ticket
Method testMBRDisjointWhereParameter
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testMBRDisjointWhereParameter()
{
$lineString1 = new LineString(array(
new Point(0, 0),
new Point(10, 0),
- Create a ticketCreate a ticket
Method testSTDisjointWhereParameter
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSTDisjointWhereParameter()
{
$lineString1 = new LineString(array(
new Point(0, 0),
new Point(10, 0),
- Create a ticketCreate a ticket
Method testDisjointWhereParameter
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testDisjointWhereParameter()
{
$lineString1 = new LineString(array(
new Point(0, 0),
new Point(10, 0),
- Create a ticketCreate a ticket
Method testSelectSTDisjoint
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSelectSTDisjoint()
{
$lineString1 = new LineString(array(
new Point(0, 0),
new Point(10, 0),
- Create a ticketCreate a ticket
Method testSelectMBRDisjoint
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSelectMBRDisjoint()
{
$lineString1 = new LineString(array(
new Point(0, 0),
new Point(10, 0),
- Create a ticketCreate a ticket