Passed
Push — master ( 1fd165...dd3d46 )
by Smoren
13:42
created
src/Conditions/Traits/VertexConditionTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,19 +90,19 @@
 block discarded – undo
90 90
      */
91 91
     public function isSuitableVertex(VertexInterface $vertex): bool
92 92
     {
93
-        if($this->vertexTypesOnly !== null && !in_array($vertex->getType(), $this->vertexTypesOnly)) {
93
+        if ($this->vertexTypesOnly !== null && !in_array($vertex->getType(), $this->vertexTypesOnly)) {
94 94
             return false;
95 95
         }
96 96
 
97
-        if($this->vertexIdsOnly !== null && !in_array($vertex->getId(), $this->vertexIdsOnly)) {
97
+        if ($this->vertexIdsOnly !== null && !in_array($vertex->getId(), $this->vertexIdsOnly)) {
98 98
             return false;
99 99
         }
100 100
 
101
-        if(in_array($vertex->getType(), $this->vertexTypesExclude)) {
101
+        if (in_array($vertex->getType(), $this->vertexTypesExclude)) {
102 102
             return false;
103 103
         }
104 104
 
105
-        if(in_array($vertex->getId(), $this->vertexIdsExclude)) {
105
+        if (in_array($vertex->getId(), $this->vertexIdsExclude)) {
106 106
             return false;
107 107
         }
108 108
 
Please login to merge, or discard this patch.
src/Structs/TraverseStepIterator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
27 27
     public static function combine(TraverseStepIteratorInterface ...$iterators): TraverseStepIteratorInterface
28 28
     {
29 29
         $source = [];
30
-        foreach($iterators as $iterator) {
31
-            foreach($iterator as $edge => $vertex) {
30
+        foreach ($iterators as $iterator) {
31
+            foreach ($iterator as $edge => $vertex) {
32 32
                 $source[] = new TraverseStepItem($edge, $vertex);
33 33
             }
34 34
         }
Please login to merge, or discard this patch.
src/Helpers/TraverseHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
     public static function getBranches(Generator $contexts, ?callable $callback = null): array
22 22
     {
23 23
         $branchMap = [];
24
-        foreach($contexts as $context) {
25
-            if(is_callable($callback)) {
24
+        foreach ($contexts as $context) {
25
+            if (is_callable($callback)) {
26 26
                 $callback($context, $contexts);
27 27
             }
28 28
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
             $parentBranchIndex = $context->getBranchContext()->getParentIndex();
32 32
             $vertex = $context->getVertex();
33 33
 
34
-            if(!isset($branchMap[$branchIndex])) {
35
-                if(isset($branchMap[$parentBranchIndex])) {
34
+            if (!isset($branchMap[$branchIndex])) {
35
+                if (isset($branchMap[$parentBranchIndex])) {
36 36
                     $parentBranch = $branchMap[$parentBranchIndex];
37 37
                     $key = array_search($branchContext->getStart(), $parentBranch);
38 38
                     $branchMap[$branchIndex] = array_slice($parentBranch, 0, $key+1);
Please login to merge, or discard this patch.
src/Conditions/Traits/EdgeConditionTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@
 block discarded – undo
54 54
      */
55 55
     public function isSuitableEdge(EdgeInterface $edge): bool
56 56
     {
57
-        if($this->edgeTypesOnly !== null && !in_array($edge->getType(), $this->edgeTypesOnly)) {
57
+        if ($this->edgeTypesOnly !== null && !in_array($edge->getType(), $this->edgeTypesOnly)) {
58 58
             return false;
59 59
         }
60 60
 
61
-        if(in_array($edge->getType(), $this->edgeTypesExclude)) {
61
+        if (in_array($edge->getType(), $this->edgeTypesExclude)) {
62 62
             return false;
63 63
         }
64 64
 
Please login to merge, or discard this patch.
src/Filters/ConfigurableTraverseFilter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $passCondition = $this->getDefaultPassCondition($context);
33 33
 
34
-        if($this->needToPreventLoopPass($context)) {
34
+        if ($this->needToPreventLoopPass($context)) {
35 35
             $passCondition = (clone $passCondition)->onlyVertexTypes([]);
36
-        } elseif($this->needToCheckReturnBackPass() && ($prevVertex = $context->getPrevVertex()) !== null) {
36
+        } elseif ($this->needToCheckReturnBackPass() && ($prevVertex = $context->getPrevVertex()) !== null) {
37 37
             $passCondition = (clone $passCondition)->excludeVertexIds([$prevVertex->getId()]);
38 38
         }
39 39
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $handleCondition = $this->getDefaultHandleCondition($context);
50 50
 
51
-        if($this->needToPreventLoopHandle($context) || $this->needToPreventRepeatHandle($context)) {
51
+        if ($this->needToPreventLoopHandle($context) || $this->needToPreventRepeatHandle($context)) {
52 52
             $handleCondition = (clone $handleCondition)->onlyVertexTypes([]);
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/Traverse/Traverse.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
         $globalPassedVertexesMap = $startContext->getGlobalPassedVertexesMap();
88 88
         $contexts = $this->createContextCollection($traverseMode, $startContext);
89 89
 
90
-        while(count($contexts)) {
90
+        while (count($contexts)) {
91 91
             /** @var TraverseContextInterface $currentContext */
92 92
             $currentContext = $contexts->pop();
93 93
             $currentVertex = $currentContext->getVertex();
94 94
 
95 95
             $customPassCondition = null;
96
-            if($filter->matchesHandleCondition($currentContext)) {
96
+            if ($filter->matchesHandleCondition($currentContext)) {
97 97
                 $cmd = (yield $currentContext);
98 98
 
99
-                if($cmd instanceof FilterConditionInterface) {
99
+                if ($cmd instanceof FilterConditionInterface) {
100 100
                     $customPassCondition = $cmd;
101 101
                     yield $currentContext;
102 102
                 } else {
103
-                    switch($cmd) {
103
+                    switch ($cmd) {
104 104
                         case static::STOP_BRANCH:
105 105
                             yield $currentContext;
106 106
                             continue 2;
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
             $nextVertexes = $this->getNextVertexes($currentVertex, $customPassCondition);
119 119
 
120 120
             $i = 0;
121
-            foreach($nextVertexes as $edge => $vertex) {
121
+            foreach ($nextVertexes as $edge => $vertex) {
122 122
                 $currentBranchContext = $currentContext->getBranchContext();
123
-                if(count($nextVertexes) > 1 && $i > 0) {
123
+                if (count($nextVertexes) > 1 && $i > 0) {
124 124
                     $nextBranchContext = $this->createBranchContext(
125 125
                         ++$lastBranchIndex,
126 126
                         $currentBranchContext->getIndex(),
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         int $traverseMode,
170 170
         TraverseContextInterface $startContext
171 171
     ): Collection {
172
-        if($traverseMode === self::MODE_WIDE) {
172
+        if ($traverseMode === self::MODE_WIDE) {
173 173
             $contexts = new Queue([$startContext]);
174 174
         } else {
175 175
             $contexts = new Stack([$startContext]);
Please login to merge, or discard this patch.
src/Store/PreloadedGraphRepository.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
         array $vertexes,
46 46
         array $edges
47 47
     ) {
48
-        foreach($vertexes as $vertex) {
48
+        foreach ($vertexes as $vertex) {
49 49
             $this->vertexMap[$vertex->getId()] = $vertex;
50 50
         }
51 51
 
52
-        foreach($edges as $edge) {
52
+        foreach ($edges as $edge) {
53 53
             $this->edgesMap[$edge->getId()] = $edge;
54 54
 
55 55
             NestedAccess::set(
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function getVertexById(string $id): VertexInterface
74 74
     {
75
-        if(!isset($this->vertexMap[$id])) {
75
+        if (!isset($this->vertexMap[$id])) {
76 76
             throw new RepositoryException(
77 77
                 "vertex with id '{$id}' not exist",
78 78
                 RepositoryException::VERTEX_NOT_FOUND
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function getEdgeById(string $id): EdgeInterface
89 89
     {
90
-        if(!isset($this->edgesMap[$id])) {
90
+        if (!isset($this->edgesMap[$id])) {
91 91
             throw new RepositoryException(
92 92
                 "edge with id '{$id}' not exist",
93 93
                 RepositoryException::EDGE_NOT_FOUND
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
         ?FilterConditionInterface $condition
141 141
     ): TraverseStepIteratorInterface {
142 142
         $result = [];
143
-        foreach($source[$vertex->getId()] ?? [] as $edgeId => [$edgeType, $targetId]) {
143
+        foreach ($source[$vertex->getId()] ?? [] as $edgeId => [$edgeType, $targetId]) {
144 144
             $edge = $this->getEdgeById($edgeId);
145
-            if($this->isSuitableEdge($edge, $condition)) {
145
+            if ($this->isSuitableEdge($edge, $condition)) {
146 146
                 $target = $this->getVertexById($targetId);
147
-                if($this->isSuitableVertex($target, $condition)) {
147
+                if ($this->isSuitableVertex($target, $condition)) {
148 148
                     $result[] = new TraverseStepItem($edge, $target);
149 149
                 }
150 150
             }
Please login to merge, or discard this patch.