creof/doctrine2-spatial

View on GitHub

Showing 60 of 447 total issues

Method onNotSuccessfulTest has 32 lines of code (exceeds 25 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 1 hr to fix

Method testSTLineCrossingDirectionWhereParameter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSTLineCrossingDirectionWhereParameter()
    {
        $lineString1 = new LineString(array(
            new Point(8, 15),
            new Point(4, 8)

Method testSelectSTContains has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectSTContains()
    {
        $lineString1 = new LineString(array(
            new Point(0, 0),
            new Point(10, 0),

Method testSelectSTCoveredBy has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectSTCoveredBy()
    {
        $lineString1 = new LineString(array(
            new Point(6, 6),
            new Point(10, 6),

Method testSelectContains has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectContains()
    {
        $lineString1 = new LineString(array(
            new Point(0, 0),
            new Point(10, 0),

Method testSelectSTCovers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectSTCovers()
    {
        $lineString1 = new LineString(array(
            new Point(6, 6),
            new Point(10, 6),

Method testSelectSTClosestPoint has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectSTClosestPoint()
    {
        $ring1 = new LineString(array(
            new Point(0, 0),
            new Point(10, 0),

Method testSelectMBRContains has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectMBRContains()
    {
        $lineString1 = new LineString(array(
            new Point(0, 0),
            new Point(10, 0),

Method testSelectSTContainsProperly has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectSTContainsProperly()
    {
        $lineString1 = new LineString(array(
            new Point(0, 0),
            new Point(10, 0),

Method testSelectSTCentroid has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelectSTCentroid()
    {
        $lineString1 = new LineString(array(
            new Point(6, 6),
            new Point(10, 6),

Method testMultiPolygonFromObjectsGetLastPolygon has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testMultiPolygonFromObjectsGetLastPolygon()
    {
        $polygon1 = new Polygon(
            array(
                new LineString(
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php - About 1 hr to fix

Method testMultiPolygonFromObjectsGetSinglePolygon has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testMultiPolygonFromObjectsGetSinglePolygon()
    {
        $polygon1 = new Polygon(
            array(
                new LineString(
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php - About 1 hr to fix

Method testSTCoversWhereParameter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSTCoversWhereParameter()
    {
        $lineString1 = new LineString(array(
            new Point(6, 6),
            new Point(10, 6),

Method testSTCoveredByWhereParameter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSTCoveredByWhereParameter()
    {
        $lineString1 = new LineString(array(
            new Point(6, 6),
            new Point(10, 6),

Method testSTContainsProperlyWhereParameter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSTContainsProperlyWhereParameter()
    {
        $lineString1 = new LineString(array(
            new Point(0, 0),
            new Point(10, 0),

Method testAsBinary has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testAsBinary()
    {
        $lineString1 = array(
            new Point(0, 0),
            new Point(2, 2),

Method validateArguments has 26 lines of code (exceeds 25 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 1 hr to fix

Consider simplifying this complex logical expression.
Open

            if ((is_numeric($argv[0]) || is_string($argv[0])) && (is_numeric($argv[1]) || is_string($argv[1])) && (is_numeric($argv[2]) || is_null($argv[2]) || is_string($argv[2]))) {
                return $argv;
            }
Severity: Major
Found in lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php - About 1 hr to fix

Function setUpTypes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function setUpTypes()
    {
        foreach (array_keys($this->usedTypes) as $typeName) {
            if (! isset(static::$addedTypes[$typeName]) && ! Type::hasType($typeName)) {
                Type::addType($typeName, static::$types[$typeName]);
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/OrmTestCase.php - About 35 mins 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

Function testDoctrineTypeMapping has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function testDoctrineTypeMapping()
    {
        $platform = $this->getPlatform();

        foreach ($this->getAllClassMetadata() as $metadata) {
Severity: Minor
Found in tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php - About 25 mins 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

Severity
Category
Status
Source
Language