Passed
Push — master ( 61e3bb...f9ef4e )
by Witali
01:30 queued 13s
created
src/Heuristic/Manhattan.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 
10 10
     public function compare(Node $node, Node $goal)
11 11
     {
12
-        $deltaX = abs($node->getX() - $goal->getX());
13
-        $deltaY = abs($node->getY() - $goal->getY());
14
-        return $deltaX + $deltaY;
12
+        $deltaX = abs($node->getX()-$goal->getX());
13
+        $deltaY = abs($node->getY()-$goal->getY());
14
+        return $deltaX+$deltaY;
15 15
     }
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Heuristic/Euclidean.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
     public function compare(Node $node, Node $goal)
10 10
     {
11 11
 
12
-        $deltaX = abs($node->getX() - $goal->getX());
13
-        $deltaY = abs($node->getY() - $goal->getY());
14
-        return sqrt($deltaX * $deltaX + $deltaY * $deltaY);
12
+        $deltaX = abs($node->getX()-$goal->getX());
13
+        $deltaY = abs($node->getY()-$goal->getY());
14
+        return sqrt($deltaX * $deltaX+$deltaY * $deltaY);
15 15
     }
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Heuristic/Diagonal.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
     public function compare(Node $node, Node $goal)
10 10
     {
11 11
 
12
-        $deltaX = abs($node->getX() - $goal->getX());
13
-        $deltaY = abs($node->getY() - $goal->getY());
12
+        $deltaX = abs($node->getX()-$goal->getX());
13
+        $deltaY = abs($node->getY()-$goal->getY());
14 14
         return max($deltaX, $deltaY);
15 15
     }
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Astar.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
                 if ($neighbor->isClosed() || in_array($neighbor->getCosts(), $this->blocked)) {
80 80
                     continue;
81 81
                 }
82
-                $score = $current->getScore() + $neighbor->getCosts();
82
+                $score = $current->getScore()+$neighbor->getCosts();
83 83
                 $visited = $neighbor->isVisited();
84 84
                 if (!$visited || $score < $neighbor->getScore()) {
85 85
                     $neighbor->visit();
86 86
                     $neighbor->setParent($current);
87 87
                     $neighbor->setGuessedScore($this->heuristic->compare($neighbor, $end));
88 88
                     $neighbor->setScore($score);
89
-                    $neighbor->setTotalScore($neighbor->getScore() + $neighbor->getGuessedScore());
89
+                    $neighbor->setTotalScore($neighbor->getScore()+$neighbor->getGuessedScore());
90 90
                     if (!$visited) {
91 91
                         $heap->insert($neighbor);
92 92
                     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             $result[] = $current;
109 109
             $current = $current->getParent();
110 110
         }
111
-        $result[]=$current;
111
+        $result[] = $current;
112 112
         return array_reverse($result);
113 113
     }
114 114
 }
115 115
\ No newline at end of file
Please login to merge, or discard this patch.
src/Grid.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,16 +38,16 @@
 block discarded – undo
38 38
         $y = $node->getY();
39 39
 
40 40
         $neighbourLocations = [
41
-            [$y - 1, $x],
42
-            [$y + 1, $x],
43
-            [$y, $x - 1],
44
-            [$y, $x + 1]
41
+            [$y-1, $x],
42
+            [$y+1, $x],
43
+            [$y, $x-1],
44
+            [$y, $x+1]
45 45
         ];
46 46
         if ($diagonal) {
47
-            $neighbourLocations[] = [$y - 1, $x - 1];
48
-            $neighbourLocations[] = [$y + 1, $x - 1];
49
-            $neighbourLocations[] = [$y - 1, $x + 1];
50
-            $neighbourLocations[] = [$y + 1, $x + 1];
47
+            $neighbourLocations[] = [$y-1, $x-1];
48
+            $neighbourLocations[] = [$y+1, $x-1];
49
+            $neighbourLocations[] = [$y-1, $x+1];
50
+            $neighbourLocations[] = [$y+1, $x+1];
51 51
         }
52 52
 
53 53
         foreach ($neighbourLocations as $location) {
Please login to merge, or discard this patch.