creof/doctrine2-spatial

View on GitHub

Showing 444 of 444 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function testMultiPointFromObjectsToArray()
    {
        $expected = array(
            array(0, 0),
            array(1, 1),
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php on lines 46..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 149.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function testLineStringGeometry()
    {
        $entity = new GeometryEntity();

        $entity->setGeometry(new LineString(
Severity: Major
Found in tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php and 1 other location - About 2 hrs to fix
tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php on lines 81..101

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 135.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function testLineStringGeography()
    {
        $entity = new GeographyEntity();

        $entity->setGeography(new LineString(
Severity: Major
Found in tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php and 1 other location - About 2 hrs to fix
tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php on lines 128..148

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 135.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function testPoint()
    {
        $entity1 = new GeometryEntity();

        $entity1->setGeometry(new Point(5, 5));
tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php on lines 54..71

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 133.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function testPoint()
    {
        $entity1 = new GeometryEntity();

        $entity1->setGeometry(new Point(5, 5));
tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php on lines 53..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 133.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 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 testSTAreaWhere has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSTAreaWhere()
    {
        $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

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function testPointGeometryWithZeroSrid()
    {
        $entity = new GeometryEntity();
        $point  = new Point(1, 1);

Severity: Major
Found in tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php and 1 other location - About 2 hrs to fix
tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php on lines 87..104

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function testPointGeometryWithSrid()
    {
        $entity = new GeometryEntity();
        $point  = new Point(1, 1);

Severity: Major
Found in tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php and 1 other location - About 2 hrs to fix
tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php on lines 109..126

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        $expected = array(
            array(
                array(
                    array(0, 0),
                    array(10, 0),
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 115..134
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 278..297
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 307..326

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 124.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        $polygons = array(
            array(
                array(
                    array(0, 0),
                    array(10, 0),
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 29..48
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 278..297
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 307..326

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 124.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        $polygons = array(
            array(
                array(
                    array(0, 0),
                    array(10, 0),
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 29..48
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 115..134
tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php on lines 307..326

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 124.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language