@@ -34,8 +34,9 @@ |
||
| 34 | 34 | |
| 35 | 35 | /** @var int $nodeWeight */ |
| 36 | 36 | foreach ($matrix[$arrayNodeKey] as $key => $nodeWeight) { |
| 37 | - if( $key == $arrayNodeKey ) |
|
| 38 | - continue; |
|
| 37 | + if( $key == $arrayNodeKey ) { |
|
| 38 | + continue; |
|
| 39 | + } |
|
| 39 | 40 | |
| 40 | 41 | if( $minimumFound > $nodeWeight ){ |
| 41 | 42 | $minimumFound = $nodeWeight; |
@@ -96,8 +96,9 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function setLeftRef(Place &$leftRef): Place |
| 98 | 98 | { |
| 99 | - if( $this->leftRef ) |
|
| 100 | - return $this; |
|
| 99 | + if( $this->leftRef ) { |
|
| 100 | + return $this; |
|
| 101 | + } |
|
| 101 | 102 | |
| 102 | 103 | $this->leftRef = $leftRef; |
| 103 | 104 | $leftRef->setRightRef($this); |
@@ -111,8 +112,9 @@ discard block |
||
| 111 | 112 | */ |
| 112 | 113 | public function setRightRef(Place &$rightRef): Place |
| 113 | 114 | { |
| 114 | - if( $this->rightRef ) |
|
| 115 | - return $this; |
|
| 115 | + if( $this->rightRef ) { |
|
| 116 | + return $this; |
|
| 117 | + } |
|
| 116 | 118 | |
| 117 | 119 | $this->rightRef = $rightRef; |
| 118 | 120 | $rightRef->setLeftRef($this); |
@@ -126,8 +128,9 @@ discard block |
||
| 126 | 128 | */ |
| 127 | 129 | public function setTopRef(Place &$topRef): Place |
| 128 | 130 | { |
| 129 | - if( $this->topRef ) |
|
| 130 | - return $this; |
|
| 131 | + if( $this->topRef ) { |
|
| 132 | + return $this; |
|
| 133 | + } |
|
| 131 | 134 | |
| 132 | 135 | $this->topRef = $topRef; |
| 133 | 136 | $topRef->setBottomRef($this); |
@@ -141,8 +144,9 @@ discard block |
||
| 141 | 144 | */ |
| 142 | 145 | public function setBottomRef(Place &$bottomRef): Place |
| 143 | 146 | { |
| 144 | - if( $this->bottomRef ) |
|
| 145 | - return $this; |
|
| 147 | + if( $this->bottomRef ) { |
|
| 148 | + return $this; |
|
| 149 | + } |
|
| 146 | 150 | |
| 147 | 151 | $this->bottomRef = $bottomRef; |
| 148 | 152 | $bottomRef->setTopRef($this); |
@@ -204,8 +208,9 @@ discard block |
||
| 204 | 208 | public function getWalkableNeighbors() |
| 205 | 209 | { |
| 206 | 210 | return array_filter($this->getNeighbors(), function($place) { |
| 207 | - if( !$place ) |
|
| 208 | - return false; |
|
| 211 | + if( !$place ) { |
|
| 212 | + return false; |
|
| 213 | + } |
|
| 209 | 214 | |
| 210 | 215 | return $place->isWalkable(); |
| 211 | 216 | }); |
@@ -51,8 +51,9 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public static function createFromJson($path) |
| 53 | 53 | { |
| 54 | - if( !$path ) |
|
| 55 | - throw new \Exception('Please select a path'); |
|
| 54 | + if( !$path ) { |
|
| 55 | + throw new \Exception('Please select a path'); |
|
| 56 | + } |
|
| 56 | 57 | |
| 57 | 58 | $placesCollector = new PlacesCollector(); |
| 58 | 59 | $placesCollector->addBasePlaceTypes(); |
@@ -74,8 +75,9 @@ discard block |
||
| 74 | 75 | */ |
| 75 | 76 | public static function createFromMatrix($param) |
| 76 | 77 | { |
| 77 | - if( !is_array($param) ) |
|
| 78 | - throw new \Exception('Matrix should be initialized with an array'); |
|
| 78 | + if( !is_array($param) ) { |
|
| 79 | + throw new \Exception('Matrix should be initialized with an array'); |
|
| 80 | + } |
|
| 79 | 81 | |
| 80 | 82 | $placesCollector = new PlacesCollector(); |
| 81 | 83 | $placesCollector->addBasePlaceTypes(); |
@@ -97,8 +99,9 @@ discard block |
||
| 97 | 99 | */ |
| 98 | 100 | public static function createFromTree($param) |
| 99 | 101 | { |
| 100 | - if( !is_array($param) ) |
|
| 101 | - throw new \Exception('Should be initialized with an array'); |
|
| 102 | + if( !is_array($param) ) { |
|
| 103 | + throw new \Exception('Should be initialized with an array'); |
|
| 104 | + } |
|
| 102 | 105 | |
| 103 | 106 | $placesCollector = new PlacesCollector(); |
| 104 | 107 | $placesCollector->addBasePlaceTypes(); |
@@ -178,8 +181,9 @@ discard block |
||
| 178 | 181 | /** @var Place[][] $resultMatrix */ |
| 179 | 182 | $resultMatrix = array(); |
| 180 | 183 | |
| 181 | - if ( empty($places) ) |
|
| 182 | - throw new \Exception('First add the places'); |
|
| 184 | + if ( empty($places) ) { |
|
| 185 | + throw new \Exception('First add the places'); |
|
| 186 | + } |
|
| 183 | 187 | |
| 184 | 188 | /** @var Place $startingPlace */ |
| 185 | 189 | $startingPlace = reset($places); |