@@ -24,7 +24,7 @@ class Factory
2424 * - JSON encoded object
2525 * - URL (must be in either 'http' or 'https' schemes)
2626 * - local filesystem (POSIX) path.
27- * - local or remote zip file
27+ * - local or remote zip file.
2828 *
2929 * @param mixed $source
3030 * @param null|string $basePath optional, required only if you want to use relative paths
@@ -323,21 +323,22 @@ protected static function loadSource($source, $basePath)
323323
324324 protected static function isHttpZipSource ($ source )
325325 {
326- return ( strtolower (substr ($ source , -4 )) == '.zip ' ) ;
326+ return strtolower (substr ($ source , -4 )) == '.zip ' ;
327327 }
328328
329329 protected static function isFileZipSource ($ source )
330330 {
331- return ( strtolower (substr ($ source , -4 )) == '.zip ' ) ;
331+ return strtolower (substr ($ source , -4 )) == '.zip ' ;
332332 }
333333
334334 protected static function loadHttpZipSource ($ source )
335335 {
336336 $ tempfile = tempnam (sys_get_temp_dir (), 'datapackage-php ' );
337337 unlink ($ tempfile );
338- $ tempfile.= '.zip ' ;
338+ $ tempfile .= '.zip ' ;
339339 stream_copy_to_stream (fopen ($ source , 'r ' ), fopen ($ tempfile , 'w ' ));
340- register_shutdown_function (function () use ($ tempfile ) {unlink ($ tempfile );});
340+ register_shutdown_function (function () use ($ tempfile ) {unlink ($ tempfile ); });
341+
341342 return self ::loadFileZipSource ($ tempfile );
342343 }
343344
@@ -347,11 +348,12 @@ protected static function loadFileZipSource($source)
347348 $ tempdir = tempnam (sys_get_temp_dir (), 'datapackage-php ' );
348349 unlink ($ tempdir );
349350 mkdir ($ tempdir );
350- register_shutdown_function (function () use ($ tempdir ) {Utils::removeDir ($ tempdir );});
351+ register_shutdown_function (function () use ($ tempdir ) {Utils::removeDir ($ tempdir ); });
351352 $ zippy ->open ($ source )->extract ($ tempdir );
352- if (!file_exists ($ tempdir ." /datapackage.json " )) {
353- throw new Exceptions \DatapackageInvalidSourceException (" zip file must contain a datappackage.json file " );
353+ if (!file_exists ($ tempdir .' /datapackage.json ' )) {
354+ throw new Exceptions \DatapackageInvalidSourceException (' zip file must contain a datappackage.json file ' );
354355 }
355- return static ::loadSource ($ tempdir ."/datapackage.json " , $ tempdir );
356+
357+ return static ::loadSource ($ tempdir .'/datapackage.json ' , $ tempdir );
356358 }
357359}
0 commit comments