Syndesi/cypher-entity-manager

View on GitHub

Showing 6 of 37 total issues

Method flush has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function flush(): self
    {
        $this->queue->preFlush();
        $this->logger?->debug("Dispatching PreFlushEvent");
        $this->dispatcher->dispatch(new PreFlushEvent());
Severity: Minor
Found in src/Type/EntityManager.php - About 1 hr to fix

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

        public static function relationStatement(RelationInterface $relation): Statement
        {
            $type = $relation->getType();
            if (!$type) {
                throw InvalidArgumentException::createForRelationTypeIsNull();

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

          public static function getTypeFromActionCypherElement(ActionCypherElementInterface $actionCypherElement): ActionCypherElementType
          {
              $element = $actionCypherElement->getElement();
              if ($element instanceof NodeInterface) {
                  return ActionCypherElementType::NODE;
      Severity: Minor
      Found in src/Helper/ActionCypherElementHelper.php - About 1 hr to fix

        Function flush has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function flush(): self
            {
                $this->queue->preFlush();
                $this->logger?->debug("Dispatching PreFlushEvent");
                $this->dispatcher->dispatch(new PreFlushEvent());
        Severity: Minor
        Found in src/Type/EntityManager.php - About 55 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

        Avoid too many return statements within this method.
        Open

                    return ActionCypherElementType::RELATION_CONSTRAINT;
        Severity: Major
        Found in src/Helper/ActionCypherElementHelper.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return ActionCypherElementType::NODE_CONSTRAINT;
          Severity: Major
          Found in src/Helper/ActionCypherElementHelper.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language