creof/geo-obj

View on GitHub

Showing 77 of 77 total issues

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

<?php
/**
* Copyright (C) 2016 Derek J. Lambert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
Severity: Major
Found in lib/Validator/Data/FeatureCollectionValidator.php and 1 other location - About 5 hrs to fix
lib/Validator/Data/GeometryCollectionValidator.php on lines 1..88

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

<?php
/**
* Copyright (C) 2016 Derek J. Lambert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
Severity: Major
Found in lib/Validator/Data/GeometryCollectionValidator.php and 1 other location - About 5 hrs to fix
lib/Validator/Data/FeatureCollectionValidator.php on lines 1..88

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

protected function validateRing($ring)
{
if (! is_array($ring)) {
throw new UnexpectedValueException('Polygon value must be array of "array", "' . gettype($ring) . '" found');
}
Severity: Major
Found in lib/Validator/Data/MultiPolygonValidator.php and 1 other location - About 1 hr to fix
lib/Validator/Data/PolygonValidator.php on lines 75..90

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

protected function validateRing($ring)
{
if (! is_array($ring)) {
throw new UnexpectedValueException('Polygon value must be array of "array", "' . gettype($ring) . '" found');
}
Severity: Major
Found in lib/Validator/Data/PolygonValidator.php and 1 other location - About 1 hr to fix
lib/Validator/Data/MultiPolygonValidator.php on lines 97..112

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

public function generate($value, $typeHint = null)
{
if (! is_string($value) || '{' !== $value[0]) {
throw new UnsupportedFormatException();
}
Severity: Minor
Found in lib/Data/Generator/GeoJson.php - About 1 hr to fix

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

    private function getJsonError()
    {
    $error = json_last_error();
     
    switch ($error) {
    Severity: Minor
    Found in lib/Data/Generator/GeoJson.php - About 1 hr to fix

      The class DataFactory has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13.
      Open

      class DataFactory
      {
      use Singleton;
       
      /**
      Severity: Minor
      Found in lib/Data/DataFactory.php by phpmd

      Blank line found at end of control structure
      Open

       
       
      Severity: Minor
      Found in lib/Data/Formatter/Wkb.php by phpcodesniffer

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

      public function validate(array &$data)
      {
      parent::validate($data);
       
      $count = count($data['value']);
      Severity: Minor
      Found in lib/Validator/Data/PointValidator.php - About 35 mins to fix

      Blank line found at start of control structure
      Open

      } catch (\Exception $e) {
      Severity: Minor
      Found in lib/ObjectFactory.php by phpcodesniffer

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

      public function generate($value, $typeHint = null)
      {
      if (! is_string($value) || '{' !== $value[0]) {
      throw new UnsupportedFormatException();
      }
      Severity: Minor
      Found in lib/Data/Generator/GeoJson.php - About 35 mins to fix

      Avoid too many return statements within this method.
      Open

      return 'Malformed UTF-8 characters, possibly incorrectly encoded';
      Severity: Major
      Found in lib/Data/Generator/GeoJson.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

        return 'Syntax error, malformed JSON';
        Severity: Major
        Found in lib/Data/Generator/GeoJson.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

          return 'Unknown error';
          Severity: Major
          Found in lib/Data/Generator/GeoJson.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

            return 'Unsupported type';
            Severity: Major
            Found in lib/Data/Generator/GeoJson.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

              return 'Value includes Inf or NaN';
              Severity: Major
              Found in lib/Data/Generator/GeoJson.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                return 'Recursive references found';
                Severity: Major
                Found in lib/Data/Generator/GeoJson.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                  return null;
                  Severity: Major
                  Found in lib/Data/Generator/SimpleArray.php - About 30 mins to fix

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

                    public static function getTypeClass($type)
                    {
                    if (isset(self::$typeClassCache[$type])) {
                    return self::$typeClassCache[$type];
                    }
                    Severity: Minor
                    Found in lib/ObjectFactory.php - About 25 mins to fix

                    Avoid using static access to class '\CrEOF\Geo\Obj\Data\DataFactory' in method '__construct'.
                    Open

                    $this->valueFactory = DataFactory::getInstance();
                    Severity: Minor
                    Found in lib/ObjectFactory.php by phpmd
                    Severity
                    Category
                    Status
                    Source
                    Language