geobase/php-countries

View on GitHub

Showing 6 of 10 total issues

CountryEntity has 44 functions (exceeds 20 allowed). Consider refactoring.
Open

class CountryEntity extends CoordinateLogic implements JsonSerializable, CoordinateCollectionInterface
{
    /**
     * @var Coordinate
     */
Severity: Minor
Found in src/Country/CountryEntity.php - About 6 hrs to fix

    RegionEntity has 37 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RegionEntity extends CoordinateLogic implements JsonSerializable, CoordinateCollectionInterface
    {
        /**
         * @var Coordinate
         */
    Severity: Minor
    Found in src/Region/RegionEntity.php - About 4 hrs to fix

      Function get has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get($key)
          {
              if (isset($this->elements[$key])) {
                  return $this->elements[$key];
              } else {
      Severity: Minor
      Found in src/Country/CountryName/CountryNameCollection.php - About 3 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

      Function get has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get($key)
          {
              if (isset($this->elements[$key])) {
                  return $this->elements[$key];
              } else {
      Severity: Minor
      Found in src/Region/RegionName/RegionNameCollection.php - About 3 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

      File CountryEntity.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace GeoBase\Countries\Country;
      
      use GeoBase\Countries\Coordinate\CoordinateCollectionInterface;
      Severity: Minor
      Found in src/Country/CountryEntity.php - About 2 hrs to fix

        Function getChildValueRecursive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getChildValueRecursive($item, $keys)
            {
                $currentKey = current($keys);
                $remainingKeys = array_splice($keys, 1);
                if (method_exists($item, "get{$currentKey}")) {
        Severity: Minor
        Found in src/ArrayCollection.php - About 1 hr 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