phonetworks/pho-framework

View on GitHub

Showing 38 of 38 total issues

Function pack has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    public static function pack(Framework\ParticleInterface $particle): AbstractLoader
    {
        $obj = new OutgoingEdgeLoader($particle->getRegisteredOutgoingEdges());
        foreach ($obj->cargo->classes as $class) {
            $class = str_replace("ObjectOut", "ObjOut", $class); // for backwards-compatibility.
Severity: Minor
Found in src/Pho/Framework/Loaders/OutgoingEdgeLoader.php - About 7 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 pack has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function pack(Framework\ParticleInterface $particle): AbstractLoader
    {
        $obj = new OutgoingEdgeLoader($particle->getRegisteredOutgoingEdges());
        foreach ($obj->cargo->classes as $class) {
            $class = str_replace("ObjectOut", "ObjOut", $class); // for backwards-compatibility.
Severity: Major
Found in src/Pho/Framework/Loaders/OutgoingEdgeLoader.php - About 3 hrs to fix

    Function probe has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        public function probe(): void
        {
            if(!isset($this->settings["constraints"])) 
                return;
            $constraints = $this->settings["constraints"];
    Severity: Minor
    Found in src/Pho/Framework/FieldHelper.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 probe has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function probe(): void
        {
            if(!isset($this->settings["constraints"])) 
                return;
            $constraints = $this->settings["constraints"];
    Severity: Major
    Found in src/Pho/Framework/FieldHelper.php - About 2 hrs to fix

      Function header has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function header(EntityInterface $entity): array
          {
              error_log("calculating headers: ");
              error_log(get_class($entity));
              $first_hex = 11;
      Severity: Minor
      Found in src/Pho/Framework/ID.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

      Function pack has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function pack(ParticleInterface $particle): AbstractLoader 
          {
              $obj = new IncomingEdgeLoader($particle->getRegisteredIncomingEdges());
              foreach($obj->cargo->classes as $class) {
                  $class = str_replace("ObjectOut", "ObjOut", $class); // for backwards-compatibility.
      Severity: Minor
      Found in src/Pho/Framework/Loaders/IncomingEdgeLoader.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

      Method handle has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function handle(
              ParticleInterface $particle,
              array $pack,
              string $name, 
              array $args // no use -yet-
      Severity: Minor
      Found in src/Pho/Framework/Handlers/Get.php - About 1 hr to fix

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

            public function in(ContextInterface $context): bool
            {
                /*
                // would speed up, but not good for testing.
                if($context instanceof Space)
        Severity: Minor
        Found in src/Pho/Framework/Graph.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

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

            public static function pack(ParticleInterface $particle): AbstractLoader 
            {
                $obj = new IncomingEdgeLoader($particle->getRegisteredIncomingEdges());
                foreach($obj->cargo->classes as $class) {
                    $class = str_replace("ObjectOut", "ObjOut", $class); // for backwards-compatibility.
        Severity: Minor
        Found in src/Pho/Framework/Loaders/IncomingEdgeLoader.php - About 1 hr to fix

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

              protected function fill(array $args): AbstractEdge
              {
                  if( count($this->fields)<=0 ) {
                      return $this;
                  }
          Severity: Minor
          Found in src/Pho/Framework/AbstractEdge.php - About 1 hr to fix

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

            <?php
            
            /*
             * This file is part of the Pho package.
             *
            Severity: Major
            Found in src/Pho/Framework/ObjOut/Mention.php and 1 other location - About 1 hr to fix
            src/Pho/Framework/ActorOut/Subscribe.php on lines 1..46

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

            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

            <?php
            
            /*
             * This file is part of the Pho package.
             *
            Severity: Major
            Found in src/Pho/Framework/ActorOut/Subscribe.php and 1 other location - About 1 hr to fix
            src/Pho/Framework/ObjOut/Mention.php on lines 1..52

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

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

                public function switch(string $name, array $args) /*:  \Pho\Lib\Graph\EntityInterface*/
                {
                    $method = function(string $key) {
                        return $this->adapters[$key] . "::handle";
                    };
            Severity: Minor
            Found in src/Pho/Framework/Handlers/Gateway.php - About 1 hr to fix

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

                  protected static function header(EntityInterface $entity): array
                  {
                      error_log("calculating headers: ");
                      error_log(get_class($entity));
                      $first_hex = 11;
              Severity: Minor
              Found in src/Pho/Framework/ID.php - About 1 hr to fix

                Function handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function handle(
                        ParticleInterface $particle,
                        array $pack,
                        string $name, 
                        array $args // no use -yet-
                Severity: Minor
                Found in src/Pho/Framework/Handlers/Get.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

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

                    public function setup(string $type = "all"): AbstractEdge
                    {
                        $fields = function(): AbstractEdge
                        {
                            $this->fields = Loaders\FieldsLoader::fetchArray($this);
                Severity: Minor
                Found in src/Pho/Framework/AbstractEdge.php - About 1 hr to fix

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

                              if($class_ref->hasConstant("HEAD_CALLABLE_LABELS")) {
                                  $callable = $class_ref->getConstant("HEAD_CALLABLE_LABELS");
                                  $obj->cargo->callable_edge_labels[] = \Stringy\StaticStringy::camelize($callable);
                                  $obj->cargo->callable_edge_label_class_pairs[$callable] = $class;
                  
                  
                  Severity: Minor
                  Found in src/Pho/Framework/Loaders/IncomingEdgeLoader.php and 1 other location - About 50 mins to fix
                  src/Pho/Framework/Loaders/IncomingEdgeLoader.php on lines 58..66

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

                  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

                              if($check) {
                                  $method = $class_ref->getConstant("TAIL_LABELS");
                                  $obj->cargo->labels[] = \Stringy\StaticStringy::camelize($method);
                                  $obj->cargo->label_class_pairs[$method] = $class;
                                  
                  Severity: Minor
                  Found in src/Pho/Framework/Loaders/IncomingEdgeLoader.php and 1 other location - About 50 mins to fix
                  src/Pho/Framework/Loaders/IncomingEdgeLoader.php on lines 68..76

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

                  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

                  Function switch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function switch(string $name, array $args) /*:  \Pho\Lib\Graph\EntityInterface*/
                      {
                          $method = function(string $key) {
                              return $this->adapters[$key] . "::handle";
                          };
                  Severity: Minor
                  Found in src/Pho/Framework/Handlers/Gateway.php - About 45 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

                  Method getEdgeItself has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          ParticleInterface $particle, 
                          array $pack,
                          string $name,
                          Direction $direction,
                          bool $singular = false
                  Severity: Minor
                  Found in src/Pho/Framework/Handlers/Get.php - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language