creof/doctrine2-spatial

View on GitHub

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
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/OrmTestCase.php - About 3 hrs to fix

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);

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()
    {

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';

File MultiPolygonTest.php has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php


namespace CrEOF\Spatial\Tests\PHP\Types\Geometry;

Severity: Minor
Found in tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php - About 3 hrs to fix

Method testSelectArea has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectArea()
    {
        $entity1 = new PolygonEntity();
        $rings1 = array(
            new LineString(array(
Severity: Major
Found in tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php - About 2 hrs to fix

Method testSelectSTArea has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectSTArea()
    {
        $entity1 = new PolygonEntity();
        $rings1 = array(
            new LineString(array(

Method testAreaWhere has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testAreaWhere()
    {
        $entity1 = new PolygonEntity();
        $rings1 = array(
            new LineString(array(
Severity: Major
Found in tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php - About 2 hrs to fix

Method testSTAreaWhere has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSTAreaWhere()
    {
        $entity1 = new PolygonEntity();
        $rings1 = array(
            new LineString(array(

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])) {
Severity: Minor
Found in lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php - About 2 hrs to fix

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(
Severity: Major
Found in tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php - About 2 hrs to fix

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;
        }
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/OrmTestCase.php - About 2 hrs to fix

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(
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php - About 2 hrs to fix

Method testSolidMultiPolygonFromArraysGetPolygons has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSolidMultiPolygonFromArraysGetPolygons()
    {
        $expected = array(
            new Polygon(
                array(
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php - About 2 hrs to fix

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') {
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/OrmTestCase.php - About 1 hr to fix

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),

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),

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),

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),

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),
Severity
Category
Status
Source
Language