@@ -229,6 +229,8 @@ discard block  | 
                                                    ||
| 229 | 229 | /**  | 
                                                        
| 230 | 230 | * allows extending classes to add custom sources  | 
                                                        
| 231 | 231 | * used by unit tests to add a mock http source.  | 
                                                        
| 232 | + * @param string $source  | 
                                                        |
| 233 | + * @return string  | 
                                                        |
| 232 | 234 | */  | 
                                                        
| 233 | 235 | protected static function normalizeHttpSource($source)  | 
                                                        
| 234 | 236 |      { | 
                                                        
@@ -238,6 +240,7 @@ discard block  | 
                                                    ||
| 238 | 240 | /**  | 
                                                        
| 239 | 241 | * allows extending classes to add custom sources  | 
                                                        
| 240 | 242 | * used by unit tests to add a mock http source.  | 
                                                        
| 243 | + * @param string $source  | 
                                                        |
| 241 | 244 | */  | 
                                                        
| 242 | 245 | protected static function isHttpSource($source)  | 
                                                        
| 243 | 246 |      { | 
                                                        
@@ -251,7 +254,7 @@ discard block  | 
                                                    ||
| 251 | 254 | * - normalized basePath.  | 
                                                        
| 252 | 255 | *  | 
                                                        
| 253 | 256 | * @param $source  | 
                                                        
| 254 | - * @param $basePath  | 
                                                        |
| 257 | + * @param null|string $basePath  | 
                                                        |
| 255 | 258 | *  | 
                                                        
| 256 | 259 | * @return object  | 
                                                        
| 257 | 260 | *  | 
                                                        
@@ -326,16 +329,25 @@ discard block  | 
                                                    ||
| 326 | 329 | return (object) ['descriptor' => $descriptor, 'basePath' => $basePath];  | 
                                                        
| 327 | 330 | }  | 
                                                        
| 328 | 331 | |
| 332 | + /**  | 
                                                        |
| 333 | + * @param string $source  | 
                                                        |
| 334 | + */  | 
                                                        |
| 329 | 335 | protected static function isHttpZipSource($source)  | 
                                                        
| 330 | 336 |      { | 
                                                        
| 331 | 337 | return strtolower(substr($source, -4)) == '.zip';  | 
                                                        
| 332 | 338 | }  | 
                                                        
| 333 | 339 | |
| 340 | + /**  | 
                                                        |
| 341 | + * @param string $source  | 
                                                        |
| 342 | + */  | 
                                                        |
| 334 | 343 | protected static function isFileZipSource($source)  | 
                                                        
| 335 | 344 |      { | 
                                                        
| 336 | 345 | return strtolower(substr($source, -4)) == '.zip';  | 
                                                        
| 337 | 346 | }  | 
                                                        
| 338 | 347 | |
| 348 | + /**  | 
                                                        |
| 349 | + * @param string $source  | 
                                                        |
| 350 | + */  | 
                                                        |
| 339 | 351 | protected static function loadHttpZipSource($source)  | 
                                                        
| 340 | 352 |      { | 
                                                        
| 341 | 353 | $tempfile = tempnam(sys_get_temp_dir(), 'datapackage-php');  | 
                                                        
@@ -347,6 +359,9 @@ discard block  | 
                                                    ||
| 347 | 359 | return self::loadFileZipSource($tempfile);  | 
                                                        
| 348 | 360 | }  | 
                                                        
| 349 | 361 | |
| 362 | + /**  | 
                                                        |
| 363 | + * @param string $source  | 
                                                        |
| 364 | + */  | 
                                                        |
| 350 | 365 | protected static function loadFileZipSource($source)  | 
                                                        
| 351 | 366 |      { | 
                                                        
| 352 | 367 | $zipper = new Zipper();  | 
                                                        
@@ -342,7 +342,7 @@ discard block  | 
                                                    ||
| 342 | 342 | unlink($tempfile);  | 
                                                        
| 343 | 343 | $tempfile .= '.zip';  | 
                                                        
| 344 | 344 | stream_copy_to_stream(fopen($source, 'r'), fopen($tempfile, 'w'));  | 
                                                        
| 345 | -        register_shutdown_function(function () use ($tempfile) {unlink($tempfile); }); | 
                                                        |
| 345 | +        register_shutdown_function(function() use ($tempfile) {unlink($tempfile); }); | 
                                                        |
| 346 | 346 | |
| 347 | 347 | return self::loadFileZipSource($tempfile);  | 
                                                        
| 348 | 348 | }  | 
                                                        
@@ -353,7 +353,7 @@ discard block  | 
                                                    ||
| 353 | 353 | $tempdir = tempnam(sys_get_temp_dir(), 'datapackage-php');  | 
                                                        
| 354 | 354 | unlink($tempdir);  | 
                                                        
| 355 | 355 | mkdir($tempdir);  | 
                                                        
| 356 | -        register_shutdown_function(function () use ($tempdir) {Utils::removeDir($tempdir); }); | 
                                                        |
| 356 | +        register_shutdown_function(function() use ($tempdir) {Utils::removeDir($tempdir); }); | 
                                                        |
| 357 | 357 |          try { | 
                                                        
| 358 | 358 | $zipper->make($source)->extractTo($tempdir);  | 
                                                        
| 359 | 359 |          } catch (\Exception $e) { |