Passed
Push — master ( b294ad...5fcf8d )
by Smoren
02:26
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/Traverse/Traverse.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -85,20 +85,20 @@  discard block
 block discarded – undo
85 85
         $lastBranchIndex = $startContext->getBranchContext()->getIndex();
86 86
         $globalPassedVertexesMap = $startContext->getGlobalPassedVertexesMap();
87 87
 
88
-        if($traverseMode === self::MODE_WIDE) {
88
+        if ($traverseMode === self::MODE_WIDE) {
89 89
             $contexts = new Queue([$startContext]);
90 90
         } else {
91 91
             $contexts = new Stack([$startContext]);
92 92
         }
93
-        while(count($contexts)) {
93
+        while (count($contexts)) {
94 94
             /** @var TraverseContextInterface $currentContext */
95 95
             $currentContext = $contexts->pop();
96 96
             $currentVertex = $currentContext->getVertex();
97 97
             $currentEdge = $currentContext->getEdge();
98 98
 
99
-            if($filter->getHandleCondition($currentContext)->isSuitableVertex($currentContext->getVertex())) {
99
+            if ($filter->getHandleCondition($currentContext)->isSuitableVertex($currentContext->getVertex())) {
100 100
                 $cmd = (yield $currentEdge => $currentContext);
101
-                switch($cmd) {
101
+                switch ($cmd) {
102 102
                     case static::STOP_BRANCH:
103 103
                         yield $currentEdge => $currentContext;
104 104
                         continue 2;
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 
114 114
             $nextVertexes = $this->getNextVertexes($currentVertex, $filter->getPassCondition($currentContext));
115 115
             $i = 0;
116
-            foreach($nextVertexes as $edge => $vertex) {
116
+            foreach ($nextVertexes as $edge => $vertex) {
117 117
                 $currentBranchContext = $currentContext->getBranchContext();
118
-                if(count($nextVertexes) > 1 && $i > 0) {
118
+                if (count($nextVertexes) > 1 && $i > 0) {
119 119
                     $nextBranchContext = $this->createBranchContext(
120 120
                         ++$lastBranchIndex,
121 121
                         $currentBranchContext->getIndex(),
Please login to merge, or discard this patch.
src/Filters/BaseTraverseFilter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
     {
20 20
         $passCondition = $this->_getPassCondition();
21 21
 
22
-        if(
22
+        if (
23 23
             $this->config->has(FilterConfig::PREVENT_LOOP_PASS)
24 24
             && $context->isLoop()
25 25
         ) {
26 26
             $passCondition = (clone $passCondition)->onlyVertexTypes([]);
27
-        } elseif(
27
+        } elseif (
28 28
             $this->config->has(FilterConfig::PREVENT_RETURN_BACK_PASS)
29 29
             && ($prevVertex = $context->getPrevVertex()) !== null
30 30
         ) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $handleCondition = $this->_getHandleCondition();
44 44
         $globalPassed = $context->getGlobalPassedVertexesMap();
45 45
 
46
-        if(
46
+        if (
47 47
             (
48 48
                 $this->config->has(FilterConfig::PREVENT_LOOP_HANDLE)
49 49
                 && $context->isLoop()
Please login to merge, or discard this patch.