public function download()
 {
     $file = Marketplace::downloadRemoteFile($this->getRemoteFileURL());
     if (empty($file) || $file == Package::E_PACKAGE_DOWNLOAD) {
         return array(Package::E_PACKAGE_DOWNLOAD);
     } else {
         if ($file == Package::E_PACKAGE_SAVE) {
             return array($file);
         } else {
             if ($file == Package::E_PACKAGE_INVALID_APP_VERSION) {
                 return array($file);
             }
         }
     }
     try {
         $am = new PackageArchive($this->getHandle());
         $am->install($file, true);
     } catch (Exception $e) {
         return array($e->getMessage());
     }
     if ($install) {
         $tests = Package::testForInstall($this->getHandle());
         if (is_array($tests)) {
             return $tests;
         } else {
             $p = Loader::package($this->getHandle());
             try {
                 $p->install();
             } catch (Exception $e) {
                 return array(Package::E_PACKAGE_INSTALL);
             }
         }
     }
 }
 public function download()
 {
     $file = Marketplace::downloadRemoteFile($this->getRemoteFileURL());
     if ($file instanceof ErrorList) {
         return $file;
     } else {
         try {
             $am = new PackageArchive($this->getHandle());
             $am->install($file, true);
         } catch (Exception $e) {
             $error = \Core::make('error');
             $error->add($e);
             return $e;
         }
     }
 }