src/PHPixie/ORM/Relationships/Type/OneTo/Handler.php

Summary

Maintainability
C
1 day
Test Coverage

Method mapDatabaseQuery has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function mapDatabaseQuery($query, $side, $collectionCondition, $plan)
    {
        $config = $side->config();
        $itemRepository = $this->getRepository($config->itemModel);
        $ownerRepository = $this->getRepository($config->ownerModel);
Severity: Major
Found in src/PHPixie/ORM/Relationships/Type/OneTo/Handler.php - About 2 hrs to fix

    Method mapPreload has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function mapPreload($side, $preloadProperty, $reusableResult, $plan, $relatedLoader)
        {
            $config = $side->config();
    
            $itemRepository = $this->getRepository($config->itemModel);
    Severity: Minor
    Found in src/PHPixie/ORM/Relationships/Type/OneTo/Handler.php - About 1 hr to fix

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

          public function mapDatabaseQuery($query, $side, $collectionCondition, $plan)
          {
              $config = $side->config();
              $itemRepository = $this->getRepository($config->itemModel);
              $ownerRepository = $this->getRepository($config->ownerModel);
      Severity: Minor
      Found in src/PHPixie/ORM/Relationships/Type/OneTo/Handler.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 handleDelete has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handleDelete($side, $reusableResult, $plan, $sidePath)
          {
              $config = $side->config();
              $itemKey = $config->ownerKey;
              $itemModel = $config->itemModel;
      Severity: Minor
      Found in src/PHPixie/ORM/Relationships/Type/OneTo/Handler.php - About 1 hr to fix

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

            public function linkPlan($config, $owner, $items)
            {
                $ownerRepository = $this->getRepository($config->ownerModel);
                $ownerQuery = $ownerRepository->databaseSelectQuery();
                
        Severity: Minor
        Found in src/PHPixie/ORM/Relationships/Type/OneTo/Handler.php - About 1 hr to fix

          Method getUnlinkPlan has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected function getUnlinkPlan($config, $constrainOwners, $owners, $constrainItems, $items, $logic = 'and')
          Severity: Minor
          Found in src/PHPixie/ORM/Relationships/Type/OneTo/Handler.php - About 45 mins to fix

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

                public function mapPreload($side, $preloadProperty, $reusableResult, $plan, $relatedLoader)
            Severity: Minor
            Found in src/PHPixie/ORM/Relationships/Type/OneTo/Handler.php - About 35 mins to fix

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

                  public function handleDelete($side, $reusableResult, $plan, $sidePath)
                  {
                      $config = $side->config();
                      $itemKey = $config->ownerKey;
                      $itemModel = $config->itemModel;
              Severity: Minor
              Found in src/PHPixie/ORM/Relationships/Type/OneTo/Handler.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

              There are no issues that match your filters.

              Category
              Status