fab2s/NodalFlow

View on GitHub

Showing 9 of 11 total issues

Function recurse has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    protected function recurse($param = null, int $nodeIdx = 0)
    {
        while ($nodeIdx <= $this->lastIdx) {
            $node          = $this->nodes[$nodeIdx];
            $this->nodeIdx = $nodeIdx;
Severity: Minor
Found in src/NodalFlow.php - About 5 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 getStats has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStats(): array
    {
        $this->resetTotals();
        foreach ($this->flow->getNodes() as $node) {
            $nodeMap = $this->nodeMap[$node->getId()];
Severity: Minor
Found in src/Flows/FlowMap.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 recurse has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function recurse($param = null, int $nodeIdx = 0)
    {
        while ($nodeIdx <= $this->lastIdx) {
            $node          = $this->nodes[$nodeIdx];
            $this->nodeIdx = $nodeIdx;
Severity: Minor
Found in src/NodalFlow.php - About 1 hr to fix

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

        public function getTraversable($param = null): iterable
        {
            $value = null;
            /** @var $nodes TraversableNodeInterface[] */
            $nodes = $this->payload->getNodes();
    Severity: Minor
    Found in src/Nodes/AggregateNode.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

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

        protected function enforceIsATraversable(): self
        {
            if ($this->isFlow()) {
                if ($this->isATraversable) {
                    throw new NodalFlowException('Cannot Traverse a Branch');
    Severity: Minor
    Found in src/Nodes/NodeAbstract.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

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

        protected function listActiveEvent(bool $reload = false): self
        {
            if (!isset($this->dispatcher) || (isset($this->activeEvents) && !$reload)) {
                return $this;
            }
    Severity: Minor
    Found in src/Flows/FlowEventAbstract.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

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

        protected function setFlowIncrement(array $flowIncrements): self
        {
            foreach ($flowIncrements as $incrementKey => $target) {
                if (is_string($target)) {
                    if (!isset($this->flowStats[$target])) {
    Severity: Minor
    Found in src/Flows/FlowMap.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

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

        protected function setNodeIncrement(NodeInterface $node): self
        {
            $nodeId = $node->getId();
            foreach ($node->getNodeIncrements() as $incrementKey => $target) {
                if (is_string($target)) {
    Severity: Minor
    Found in src/Flows/FlowMap.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

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

        public function resetNodeStats(): FlowMapInterface
        {
            foreach ($this->nodeMap as &$nodeStat) {
                foreach ($this->nodeIncrements as $key => $value) {
                    if (isset($nodeStat[$key])) {
    Severity: Minor
    Found in src/Flows/FlowMap.php - About 25 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

    Severity
    Category
    Status
    Source
    Language