GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#2)
by Adrien
01:55
created
src/Converters/Grid/ASCIISyntax.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -96,6 +96,9 @@
 block discarded – undo
96 96
         return $syntax;
97 97
     }
98 98
     
99
+    /**
100
+     * @param string $charToFind
101
+     */
99 102
     public function findAndCreateNode($syntax, $charToFind)
100 103
     {
101 104
         for($x = 0; $x < count($syntax); $x++)
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
     {
21 21
         $matrix = $this->convertToMatrix($syntax);
22 22
         
23
-        foreach($matrix as $x => $line)
23
+        foreach ($matrix as $x => $line)
24 24
         {
25
-            foreach($line as $y => $char)
25
+            foreach ($line as $y => $char)
26 26
             {
27 27
                 $matrix[$x][$y] = ($char !== self::WALL) ? 1 : 0;
28 28
             }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $matrix = array_filter(explode("\n", $syntax));
37 37
         
38
-        foreach($matrix as $key => $line)
38
+        foreach ($matrix as $key => $line)
39 39
         {
40 40
             $matrix[$key] = array_filter(str_split($line));
41 41
         }
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
         $syntax = '';
49 49
         
50 50
         $nodes = $grid->getNodes();
51
-        foreach($nodes as $line)
51
+        foreach ($nodes as $line)
52 52
         {
53
-            foreach($line as $node)
53
+            foreach ($line as $node)
54 54
             {
55 55
                 $syntax .= ($node->isWalkable() ? self::FREE : self::WALL);
56 56
             }
@@ -65,23 +65,23 @@  discard block
 block discarded – undo
65 65
         $syntax = '';
66 66
         
67 67
         $nodes = $grid->getNodes();
68
-        foreach($nodes as $line)
68
+        foreach ($nodes as $line)
69 69
         {
70
-            foreach($line as $node)
70
+            foreach ($line as $node)
71 71
             {
72
-                if(! $node->isWalkable())
72
+                if (!$node->isWalkable())
73 73
                 {
74 74
                     $syntax .= self::WALL;
75 75
                 }
76
-                elseif($node->toString() == $path->getStartNode()->toString())
76
+                elseif ($node->toString() == $path->getStartNode()->toString())
77 77
                 {
78 78
                     $syntax .= self::IN;
79 79
                 }
80
-                elseif($node->toString() == $path->getEndNode()->toString())
80
+                elseif ($node->toString() == $path->getEndNode()->toString())
81 81
                 {
82 82
                     $syntax .= self::OUT;
83 83
                 }
84
-                elseif($path->contains($node))
84
+                elseif ($path->contains($node))
85 85
                 {
86 86
                     $syntax .= self::STEP;
87 87
                 }
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
     
99 99
     public function findAndCreateNode($syntax, $charToFind)
100 100
     {
101
-        for($x = 0; $x < count($syntax); $x++)
101
+        for ($x = 0; $x < count($syntax); $x++)
102 102
         {
103
-            for($y = 0; $y < count($syntax[$x]); $y++)
103
+            for ($y = 0; $y < count($syntax[$x]); $y++)
104 104
             {
105
-                if($syntax[$x][$y] === $charToFind)
105
+                if ($syntax[$x][$y] === $charToFind)
106 106
                 {
107 107
                     return new Node($x, $y);
108 108
                 }
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
     public function findAndCreateNodes($syntax, $charToFind)
114 114
     {
115 115
         $nodes = array();
116
-        for($x = 0; $x < count($syntax); $x++)
116
+        for ($x = 0; $x < count($syntax); $x++)
117 117
         {
118
-            for($y = 0; $y < count($syntax[$x]); $y++)
118
+            for ($y = 0; $y < count($syntax[$x]); $y++)
119 119
             {
120
-                if($syntax[$x][$y] === $charToFind)
120
+                if ($syntax[$x][$y] === $charToFind)
121 121
                 {
122 122
                     $nodes[] = new Node($x, $y);
123 123
                 }
@@ -131,32 +131,32 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $deltas = array(
133 133
             array(-1, -1), array(-1, +0), array(-1, +1),
134
-            array(+0, -1),                array(+0, +1),
134
+            array(+0, -1), array(+0, +1),
135 135
             array(+1, -1), array(+1, +0), array(+1, +1),
136 136
         );
137 137
         
138 138
         $node = $this->findAndCreateNode($matrix, self::IN);
139 139
         $target = $this->findAndCreateNode($matrix, self::OUT);
140 140
         $path = array($node);
141
-        while($node->getId() !== $target->getId())
141
+        while ($node->getId() !== $target->getId())
142 142
         {
143 143
             $newNode = null;
144
-            foreach($deltas as $delta)
144
+            foreach ($deltas as $delta)
145 145
             {
146 146
                 $x = $node->getX() + $delta[0];
147 147
                 $y = $node->getY() + $delta[1];
148 148
                 
149
-                if(! array_key_exists($x, $matrix))
149
+                if (!array_key_exists($x, $matrix))
150 150
                 {
151 151
                     continue;
152 152
                 }
153 153
                 
154
-                if(! array_key_exists($y, $matrix[$x]))
154
+                if (!array_key_exists($y, $matrix[$x]))
155 155
                 {
156 156
                     continue;
157 157
                 }
158 158
                 
159
-                if($matrix[$x][$y] === self::STEP || $matrix[$x][$y] === self::OUT)
159
+                if ($matrix[$x][$y] === self::STEP || $matrix[$x][$y] === self::OUT)
160 160
                 {
161 161
                     $matrix[$x][$y] = self::FREE;
162 162
                     $newNode = new Node($x, $y);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                 }
165 165
             }
166 166
             
167
-            if(! $newNode instanceof Node)
167
+            if (!$newNode instanceof Node)
168 168
             {
169 169
                 throw new \RuntimeException('Path is not continous in the grid');
170 170
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -72,20 +72,16 @@
 block discarded – undo
72 72
                 if(! $node->isWalkable())
73 73
                 {
74 74
                     $syntax .= self::WALL;
75
-                }
76
-                elseif($node->toString() == $path->getStartNode()->toString())
75
+                } elseif($node->toString() == $path->getStartNode()->toString())
77 76
                 {
78 77
                     $syntax .= self::IN;
79
-                }
80
-                elseif($node->toString() == $path->getEndNode()->toString())
78
+                } elseif($node->toString() == $path->getEndNode()->toString())
81 79
                 {
82 80
                     $syntax .= self::OUT;
83
-                }
84
-                elseif($path->contains($node))
81
+                } elseif($path->contains($node))
85 82
                 {
86 83
                     $syntax .= self::STEP;
87
-                }
88
-                else
84
+                } else
89 85
                 {
90 86
                     $syntax .= self::FREE;
91 87
                 }
Please login to merge, or discard this patch.
src/Core/NodePath.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
     {
15 15
         $this->path = array();
16 16
         $this->valid = true;
17
-        foreach($path as $node)
17
+        foreach ($path as $node)
18 18
         {
19
-            if($node instanceof Node)
19
+            if ($node instanceof Node)
20 20
             {
21 21
                 $this->path[$node->getId()] = $node;
22 22
             }
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $length = 0;
70 70
         $prevNode = null;
71
-        foreach($this->path as $node)
71
+        foreach ($this->path as $node)
72 72
         {
73
-            if($prevNode === null)
73
+            if ($prevNode === null)
74 74
             {
75 75
                 $prevNode = $node;
76 76
                 continue;
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
     
86 86
     public function contains(Node $needleNode)
87 87
     {
88
-        foreach($this->path as $node)
88
+        foreach ($this->path as $node)
89 89
         {
90
-            if($node->toString() == $needleNode->toString())
90
+            if ($node->toString() == $needleNode->toString())
91 91
             {
92 92
                 return true;
93 93
             }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     public function toString()
110 110
     {
111 111
         $nodesString = array();
112
-        foreach($this->path as $node)
112
+        foreach ($this->path as $node)
113 113
         {
114 114
             $nodesString[] = $node->toString();
115 115
         }
Please login to merge, or discard this patch.
src/Core/NodeGrid.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     private function computeWidth(array $matrix)
34 34
     {
35 35
         $width = 0;
36
-        foreach($matrix as $line)
36
+        foreach ($matrix as $line)
37 37
         {
38 38
             $width = max(count($line), $width);
39 39
         }
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $nodes = array();
47 47
         
48
-        for($i = 0; $i < $this->height; $i++)
48
+        for ($i = 0; $i < $this->height; $i++)
49 49
         {
50 50
             $nodes[$i] = array();
51
-            for($j = 0; $j < $this->width; $j++)
51
+            for ($j = 0; $j < $this->width; $j++)
52 52
             {
53 53
                 $walkable = isset($matrix[$i][$j]) ? $matrix[$i][$j] : false;
54 54
                 $nodes[$i][$j] = new Node($i, $j, $walkable);
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
     public function buildWalkableNodesList()
67 67
     {
68 68
         $list = array();
69
-        foreach($this->nodes as $line)
69
+        foreach ($this->nodes as $line)
70 70
         {
71
-            foreach($line as $node)
71
+            foreach ($line as $node)
72 72
             {
73
-                if($node->isWalkable())
73
+                if ($node->isWalkable())
74 74
                 {
75 75
                     $list[] = $node;
76 76
                 }
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
     
106 106
     public function getWalkableNeighbors(Node $node)
107 107
     {
108
-        if(! $node->isWalkable())
108
+        if (!$node->isWalkable())
109 109
         {
110 110
             return array();
111 111
         }
112 112
         
113 113
         $deltas = array(
114 114
             array(-1, -1), array(-1, +0), array(-1, +1),
115
-            array(+0, -1),                array(+0, +1),
115
+            array(+0, -1), array(+0, +1),
116 116
             array(+1, -1), array(+1, +0), array(+1, +1),
117 117
         );
118 118
         
119 119
         $neighbors = array();
120
-        foreach($deltas as $delta)
120
+        foreach ($deltas as $delta)
121 121
         {
122 122
             $x = $node->getX() + $delta[0];
123 123
             $y = $node->getY() + $delta[1];
124
-            if($this->isWalkableAt($x, $y))
124
+            if ($this->isWalkableAt($x, $y))
125 125
             {
126 126
                 $neighbors[] = $this->getNodeAt($x, $y);
127 127
             }
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
     
133 133
     private function getNodeAt($x, $y)
134 134
     {
135
-        if(! array_key_exists($x, $this->nodes))
135
+        if (!array_key_exists($x, $this->nodes))
136 136
         {
137 137
             return null;
138 138
         }
139 139
         
140
-        if(! array_key_exists($y, $this->nodes[$x]))
140
+        if (!array_key_exists($y, $this->nodes[$x]))
141 141
         {
142 142
             return null;
143 143
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     private function isWalkableAt($x, $y)
149 149
     {
150 150
         $node = $this->getNodeAt($x, $y);
151
-        if($node instanceof Node)
151
+        if ($node instanceof Node)
152 152
         {
153 153
             return $node->isWalkable();
154 154
         }
Please login to merge, or discard this patch.
src/Core/Pairs.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     
15 15
     public function __construct(array $items)
16 16
     {
17
-        if(count($items) < 2)
17
+        if (count($items) < 2)
18 18
         {
19 19
             throw new \RuntimeException('Pairs must be initialized with at least two items');
20 20
         }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         
26 26
         $this->keys = array();
27 27
         $this->values = array();
28
-        foreach($items as $key => $value)
28
+        foreach ($items as $key => $value)
29 29
         {
30 30
             $this->keys[] = $key;
31 31
             $this->values[] = $value;
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
     public function next()
53 53
     {
54 54
         $this->secondIndex++;
55
-        if($this->secondIndex >= $this->maxIndex)
55
+        if ($this->secondIndex >= $this->maxIndex)
56 56
         {
57 57
             $this->firstIndex++;
58 58
             $this->secondIndex = $this->firstIndex + 1;
59 59
         }
60
-        if($this->secondIndex >= $this->maxIndex)
60
+        if ($this->secondIndex >= $this->maxIndex)
61 61
         {
62 62
             $this->hasNext = false;
63 63
             return null;
Please login to merge, or discard this patch.
src/Core/NodeGraph.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
         $this->edges = array();
15 15
         $this->vertexes = array();
16 16
         $this->symetric = true;
17
-        foreach($nodes as $node)
17
+        foreach ($nodes as $node)
18 18
         {
19
-            if($node instanceof Node)
19
+            if ($node instanceof Node)
20 20
             {
21 21
                 $this->vertexes[$node->getId()] = $node;
22 22
             }
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $aId = $a->getId();
36 36
         $bId = $b->getId();
37
-        if(! array_key_exists($aId, $this->vertexes) || ! array_key_exists($bId, $this->vertexes))
37
+        if (!array_key_exists($aId, $this->vertexes) || !array_key_exists($bId, $this->vertexes))
38 38
         {
39 39
             return;
40 40
         }
41
-        if($aId === $bId)
41
+        if ($aId === $bId)
42 42
         {
43 43
             return;
44 44
         }
45 45
         
46
-        if($this->symetric === true)
46
+        if ($this->symetric === true)
47 47
         {
48 48
             $this->edges[$bId][$aId] = (float) $value;
49 49
         }
@@ -54,19 +54,19 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $aId = $a->getId();
56 56
         $bId = $b->getId();
57
-        if(! array_key_exists($aId, $this->vertexes) || ! array_key_exists($bId, $this->vertexes))
57
+        if (!array_key_exists($aId, $this->vertexes) || !array_key_exists($bId, $this->vertexes))
58 58
         {
59 59
             return null;
60 60
         }
61
-        if($aId === $bId)
61
+        if ($aId === $bId)
62 62
         {
63 63
             return 0;
64 64
         }
65
-        if(! array_key_exists($aId, $this->edges))
65
+        if (!array_key_exists($aId, $this->edges))
66 66
         {
67 67
             return INF;
68 68
         }
69
-        if(! array_key_exists($bId, $this->edges[$aId]))
69
+        if (!array_key_exists($bId, $this->edges[$aId]))
70 70
         {
71 71
             return INF;
72 72
         }
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $aId = $a->getId();
80 80
         $bId = $b->getId();
81
-        if(! array_key_exists($aId, $this->vertexes) || ! array_key_exists($bId, $this->vertexes))
81
+        if (!array_key_exists($aId, $this->vertexes) || !array_key_exists($bId, $this->vertexes))
82 82
         {
83 83
             return false;
84 84
         }
85
-        if($aId === $bId)
85
+        if ($aId === $bId)
86 86
         {
87 87
             return false;
88 88
         }
89
-        if(! array_key_exists($aId, $this->edges))
89
+        if (!array_key_exists($aId, $this->edges))
90 90
         {
91 91
             return false;
92 92
         }
93
-        if(! array_key_exists($bId, $this->edges[$aId]))
93
+        if (!array_key_exists($bId, $this->edges[$aId]))
94 94
         {
95 95
             return false;
96 96
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $aId = $a->getId();
112 112
         $bId = $b->getId();
113
-        if(! array_key_exists($aId, $this->vertexes) || ! array_key_exists($bId, $this->vertexes))
113
+        if (!array_key_exists($aId, $this->vertexes) || !array_key_exists($bId, $this->vertexes))
114 114
         {
115 115
             return;
116 116
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     
127 127
     public function getVertex($id)
128 128
     {
129
-        if(array_key_exists($id, $this->vertexes))
129
+        if (array_key_exists($id, $this->vertexes))
130 130
         {
131 131
             return $this->vertexes[$id];
132 132
         }
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
     {
139 139
         $edges = array();
140 140
         $vertexFromId = $vertexFrom->getId();
141
-        foreach($this->vertexes as $vertexToId => $vertexTo)
141
+        foreach ($this->vertexes as $vertexToId => $vertexTo)
142 142
         {
143
-            if(isset($this->edges[$vertexFromId][$vertexToId]))
143
+            if (isset($this->edges[$vertexFromId][$vertexToId]))
144 144
             {
145 145
                 $edges[$vertexToId] = $this->edges[$vertexFromId][$vertexToId];
146 146
             }
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
     {
154 154
         $edges = array();
155 155
         $vertexToId = $vertexTo->getId();
156
-        foreach($this->vertexes as $vertexFromId => $vertexFrom)
156
+        foreach ($this->vertexes as $vertexFromId => $vertexFrom)
157 157
         {
158
-            if(isset($this->edges[$vertexFromId][$vertexToId]))
158
+            if (isset($this->edges[$vertexFromId][$vertexToId]))
159 159
             {
160 160
                 $edges[$vertexToId] = $this->edges[$vertexFromId][$vertexToId];
161 161
             }
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
     {
169 169
         $length = 0;
170 170
         $prevNode = null;
171
-        foreach($route as $node)
171
+        foreach ($route as $node)
172 172
         {
173
-            if($prevNode === null)
173
+            if ($prevNode === null)
174 174
             {
175 175
                 $prevNode = $node;
176 176
                 continue;
Please login to merge, or discard this patch.
src/Core/NodeMap.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $id = $node->getId();
53 53
         
54
-        if(array_key_exists($id, $this->map))
54
+        if (array_key_exists($id, $this->map))
55 55
         {
56 56
             return $this->map[$id];
57 57
         }
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
     public function lookupFrom(Node $node)
63 63
     {
64 64
         $path = array();
65
-        while($node instanceof Node)
65
+        while ($node instanceof Node)
66 66
         {
67 67
             array_unshift($path, $node);
68 68
             $node = $this->lookup($node);
69 69
             
70
-            if(in_array($node, $path))
70
+            if (in_array($node, $path))
71 71
             {
72 72
                 break;
73 73
             }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $id = $node->getId();
82 82
         $value = null;
83 83
         
84
-        if(array_key_exists($id, $this->map))
84
+        if (array_key_exists($id, $this->map))
85 85
         {
86 86
             $value = $this->map[$id];
87 87
             unset($this->map[$id]);
Please login to merge, or discard this patch.
src/Core/NodePriorityQueueMin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     {
29 29
         $id = $node->getId();
30 30
         
31
-        if(array_key_exists($id, $this->queue))
31
+        if (array_key_exists($id, $this->queue))
32 32
         {
33 33
             return $this->queue[$id];
34 34
         }
Please login to merge, or discard this patch.
src/Algorithms/ShortestDistance/FloydWarshall.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
     
34 34
     public function computeLength(Node $source, Node $target)
35 35
     {
36
-        if(! $this->grid instanceof NodeGrid)
36
+        if (!$this->grid instanceof NodeGrid)
37 37
         {
38 38
             throw new \RuntimeException('Invalid Grid');
39 39
         }
40
-        if(! $this->distanceGraph instanceof NodeGraph)
40
+        if (!$this->distanceGraph instanceof NodeGraph)
41 41
         {
42 42
             throw new \RuntimeException('Invalid Graph');
43 43
         }
44 44
         
45 45
         $edges = $this->distanceGraph->getEdgesFrom($source);
46
-        if(empty($edges))
46
+        if (empty($edges))
47 47
         {
48 48
             $this->computeDistanceGraph();
49 49
         }
@@ -54,43 +54,43 @@  discard block
 block discarded – undo
54 54
     private function computeDistanceGraph()
55 55
     {
56 56
         $nbNodes = $this->grid->getNodesNb();
57
-        for($i = 0; $i < $nbNodes; $i++)
57
+        for ($i = 0; $i < $nbNodes; $i++)
58 58
         {
59 59
             $iNode = $this->grid->getNodeNumber($i);
60 60
             $neighbors = $this->grid->getWalkableNeighbors($iNode);
61
-            foreach($neighbors as $neighbor)
61
+            foreach ($neighbors as $neighbor)
62 62
             {
63 63
                 $alternativeDistance = $this->distance->compute($iNode, $neighbor);
64
-                if($alternativeDistance < $this->distanceGraph->getEdgeBetween($iNode, $neighbor))
64
+                if ($alternativeDistance < $this->distanceGraph->getEdgeBetween($iNode, $neighbor))
65 65
                 {
66 66
                     $this->distanceGraph->createEdgeBetween($iNode, $neighbor, $alternativeDistance);
67 67
                 }
68 68
             }
69 69
         }
70 70
         
71
-        for($k = 0; $k < $nbNodes; $k++)
71
+        for ($k = 0; $k < $nbNodes; $k++)
72 72
         {
73 73
             $kNode = $this->grid->getNodeNumber($k);
74
-            if(! $kNode->isWalkable())
74
+            if (!$kNode->isWalkable())
75 75
             {
76 76
                 continue;
77 77
             }
78
-            for($i = 0; $i < $nbNodes; $i++)
78
+            for ($i = 0; $i < $nbNodes; $i++)
79 79
             {
80 80
                 $iNode = $this->grid->getNodeNumber($i);
81
-                if(! $iNode->isWalkable())
81
+                if (!$iNode->isWalkable())
82 82
                 {
83 83
                     continue;
84 84
                 }
85
-                for($j = 0; $j < $nbNodes; $j++)
85
+                for ($j = 0; $j < $nbNodes; $j++)
86 86
                 {
87 87
                     $jNode = $this->grid->getNodeNumber($j);
88
-                    if(! $jNode->isWalkable())
88
+                    if (!$jNode->isWalkable())
89 89
                     {
90 90
                         continue;
91 91
                     }
92 92
                     $alternativeDistance = $this->distanceGraph->getEdgeBetween($iNode, $kNode) + $this->distanceGraph->getEdgeBetween($kNode, $jNode);
93
-                    if($alternativeDistance < $this->distanceGraph->getEdgeBetween($iNode, $jNode))
93
+                    if ($alternativeDistance < $this->distanceGraph->getEdgeBetween($iNode, $jNode))
94 94
                     {
95 95
                         $this->distanceGraph->createEdgeBetween($iNode, $jNode, $alternativeDistance);
96 96
                     }
Please login to merge, or discard this patch.
src/Algorithms/ShortestDistance/Dijkstra.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
     
36 36
     public function computeLength(Node $source, Node $target)
37 37
     {
38
-        if(! $this->grid instanceof NodeGrid)
38
+        if (!$this->grid instanceof NodeGrid)
39 39
         {
40 40
             throw new \RuntimeException('Invalid Grid');
41 41
         }
42
-        if(! $this->distanceGraph instanceof NodeGraph)
42
+        if (!$this->distanceGraph instanceof NodeGraph)
43 43
         {
44 44
             throw new \RuntimeException('Invalid Graph');
45 45
         }
46 46
         
47 47
         $edges = $this->distanceGraph->getEdgesFrom($source);
48
-        if(empty($edges))
48
+        if (empty($edges))
49 49
         {
50 50
             $this->computeDistanceGraph(array($source));
51 51
         }
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
     
56 56
     private function computeDistanceGraph(array $nodesList)
57 57
     {
58
-        foreach($nodesList as $source)
58
+        foreach ($nodesList as $source)
59 59
         {
60 60
             $priorityQueue = new NodePriorityQueueMin();
61 61
             $priorityQueue->insert($source, 0);
62 62
             
63
-            while(! $priorityQueue->isEmpty())
63
+            while (!$priorityQueue->isEmpty())
64 64
             {
65 65
                 $node = $priorityQueue->extract();
66 66
                 
67 67
                 $neighbors = $this->grid->getWalkableNeighbors($node);
68
-                foreach($neighbors as $neighbor)
68
+                foreach ($neighbors as $neighbor)
69 69
                 {
70 70
                     $alternativeDistance = $this->distanceGraph->getEdgeBetween($source, $node) + $this->distance->compute($node, $neighbor);
71
-                    if(! $this->distanceGraph->existsEdgeBetween($source, $neighbor) || $alternativeDistance < $this->distanceGraph->getEdgeBetween($source, $neighbor))
71
+                    if (!$this->distanceGraph->existsEdgeBetween($source, $neighbor) || $alternativeDistance < $this->distanceGraph->getEdgeBetween($source, $neighbor))
72 72
                     {
73 73
                         $priorityQueue->insert($neighbor, $alternativeDistance);
74 74
                         $this->distanceGraph->createEdgeBetween($source, $neighbor, $alternativeDistance);
Please login to merge, or discard this patch.