Completed
Push — master ( e8d7a9...7fe401 )
by Yannick
31:55
created
require/class.Elevation.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	private $openedFiles = [];
29 29
 
30 30
 	public function __construct($htgFilesDestination = '', $resolution = 3) {
31
-		if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/';
31
+		if ($htgFilesDestination == '') {
32
+			$htgFilesDestination = dirname(__FILE__).'/../data/';
33
+		}
32 34
 		$this->htgFilesDestination = $htgFilesDestination;
33 35
 		$this->resolution          = $resolution;
34 36
 		switch ($resolution) {
@@ -189,16 +191,26 @@  discard block
 block discarded – undo
189 191
 		$fileName  = $latd.$lond.".hgt";
190 192
 		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
191 193
 			$Common = new Common();
192
-			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
194
+			if ($debug) {
195
+				echo 'Downloading '.$fileName.'.gz ...';
196
+			}
193 197
 			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/'.$latd.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
194 198
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
195
-				if ($debug) echo "File '{$fileName}.gz' not exists.";
199
+				if ($debug) {
200
+					echo "File '{$fileName}.gz' not exists.";
201
+				}
196 202
 				return false;
197 203
 			}
198
-			if ($debug) echo 'Done'."\n";
199
-			if ($debug) echo 'Decompress '.$fileName.' ....';
204
+			if ($debug) {
205
+				echo 'Done'."\n";
206
+			}
207
+			if ($debug) {
208
+				echo 'Decompress '.$fileName.' ....';
209
+			}
200 210
 			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
201
-			if ($debug) echo 'Done'."\n";
211
+			if ($debug) {
212
+				echo 'Done'."\n";
213
+			}
202 214
 			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
203 215
 		}
204 216
 		return true;
Please login to merge, or discard this patch.