Passed
Push — master ( e0ffe6...4f8f39 )
by David
01:56
created
tests/WarehouseTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     public function testTransformToTreeConstructor(): void
10 10
     {
11 11
         /** @var Warehouse $testMatrix */
12
-        $testMatrix = Warehouse::createFromJson(getcwd() . "/resources/simpleWarehouse.json");
12
+        $testMatrix = Warehouse::createFromJson(getcwd()."/resources/simpleWarehouse.json");
13 13
 
14 14
         $calculatedArray = $testMatrix->getPlaces();
15 15
 
Please login to merge, or discard this patch.
src/Warehouse.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,8 +44,9 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public static function createFromJson($path)
46 46
     {
47
-        if( !$path )
48
-            throw new \Exception('Please select a path');
47
+        if( !$path ) {
48
+                    throw new \Exception('Please select a path');
49
+        }
49 50
 
50 51
         $placesCollector = new PlacesCollector();
51 52
         $placesCollector->addBasePlaceTypes();
@@ -65,8 +66,9 @@  discard block
 block discarded – undo
65 66
      */
66 67
     public static function createFromMatrix($param)
67 68
     {
68
-        if( !is_array($param) )
69
-            throw new \Exception('Matrix should be initialized with an array');
69
+        if( !is_array($param) ) {
70
+                    throw new \Exception('Matrix should be initialized with an array');
71
+        }
70 72
 
71 73
         $placesCollector = new PlacesCollector();
72 74
         $placesCollector->addBasePlaceTypes();
@@ -86,8 +88,9 @@  discard block
 block discarded – undo
86 88
      */
87 89
     public static function createFromTree($param)
88 90
     {
89
-        if( !is_array($param) )
90
-            throw new \Exception('Matrix should be initialized with an array');
91
+        if( !is_array($param) ) {
92
+                    throw new \Exception('Matrix should be initialized with an array');
93
+        }
91 94
 
92 95
         $placesCollector = new PlacesCollector();
93 96
         $placesCollector->addBasePlaceTypes();
@@ -196,8 +199,9 @@  discard block
 block discarded – undo
196 199
         /** @var Place[][] $resultMatrix */
197 200
         $resultMatrix = array();
198 201
 
199
-        if ( empty($places) )
200
-            throw new \Exception('First add the places');
202
+        if ( empty($places) ) {
203
+                    throw new \Exception('First add the places');
204
+        }
201 205
 
202 206
         /** @var Place $startingPlace */
203 207
         $startingPlace = reset($places);
Please login to merge, or discard this patch.