Passed
Push — master ( 73c04c...2087f9 )
by Smoren
01:52
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/Store/PreloadedGraphRepository.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
         array $vertexes,
40 40
         array $edges
41 41
     ) {
42
-        foreach($vertexes as $vertex) {
42
+        foreach ($vertexes as $vertex) {
43 43
             $this->vertexMap[$vertex->getId()] = $vertex;
44 44
         }
45 45
 
46
-        foreach($edges as $edge) {
46
+        foreach ($edges as $edge) {
47 47
             $this->edgesMap[$edge->getId()] = $edge;
48 48
 
49 49
             NestedHelper::set(
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function getVertexById(string $id): VertexInterface
68 68
     {
69
-        if(!isset($this->vertexMap[$id])) {
69
+        if (!isset($this->vertexMap[$id])) {
70 70
             throw new RepositoryException(
71 71
                 "vertex with id '{$id}' not exist",
72 72
                 RepositoryException::VERTEX_NOT_FOUND
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function getEdgeById(string $id): EdgeInterface
83 83
     {
84
-        if(!isset($this->edgesMap[$id])) {
84
+        if (!isset($this->edgesMap[$id])) {
85 85
             throw new RepositoryException(
86 86
                 "edge with id '{$id}' not exist",
87 87
                 RepositoryException::EDGE_NOT_FOUND
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
         ?FilterConditionInterface $condition
134 134
     ): TraverseStepIteratorInterface {
135 135
         $result = [];
136
-        foreach($source[$vertex->getId()] ?? [] as $edgeId => [$edgeType, $targetId]) {
136
+        foreach ($source[$vertex->getId()] ?? [] as $edgeId => [$edgeType, $targetId]) {
137 137
             $edge = $this->getEdgeById($edgeId);
138
-            if($this->isSuitableEdge($edge, $condition)) {
138
+            if ($this->isSuitableEdge($edge, $condition)) {
139 139
                 $target = $this->getVertexById($targetId);
140
-                if($this->isSuitableVertex($target, $condition)) {
140
+                if ($this->isSuitableVertex($target, $condition)) {
141 141
                     $result[] = new TraverseStepItem($edge, $target);
142 142
                 }
143 143
             }
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   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -87,15 +87,15 @@  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
             $currentEdge = $currentContext->getEdge();
95 95
 
96
-            if($filter->matchesHandleCondition($currentContext)) {
96
+            if ($filter->matchesHandleCondition($currentContext)) {
97 97
                 $cmd = (yield $currentEdge => $currentContext);
98
-                switch($cmd) {
98
+                switch ($cmd) {
99 99
                     case static::STOP_BRANCH:
100 100
                         yield $currentEdge => $currentContext;
101 101
                         continue 2;
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 
111 111
             $nextVertexes = $this->getNextVertexes($currentVertex, $filter->getPassCondition($currentContext));
112 112
             $i = 0;
113
-            foreach($nextVertexes as $edge => $vertex) {
113
+            foreach ($nextVertexes as $edge => $vertex) {
114 114
                 $currentBranchContext = $currentContext->getBranchContext();
115
-                if(count($nextVertexes) > 1 && $i > 0) {
115
+                if (count($nextVertexes) > 1 && $i > 0) {
116 116
                     $nextBranchContext = $this->createBranchContext(
117 117
                         ++$lastBranchIndex,
118 118
                         $currentBranchContext->getIndex(),
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         int $traverseMode,
162 162
         TraverseContextInterface $startContext
163 163
     ): Collection {
164
-        if($traverseMode === self::MODE_WIDE) {
164
+        if ($traverseMode === self::MODE_WIDE) {
165 165
             $contexts = new Queue([$startContext]);
166 166
         } else {
167 167
             $contexts = new Stack([$startContext]);
Please login to merge, or discard this patch.