original_string: public function import(RemotePackageEntity $remotePackage)
      {
          $temp = $this->download($remotePackage);
          $rootPath = $this->getRootPath($temp);
          $this->translatableImporter->importDirectory($rootPath, $remotePackage->getHandle(), $remotePackage->getVersion(), '');
          $package = $this->packageRepo->findOneBy(['handle' => $remotePackage->getHandle()]);
          if ($package !== null) {
              /* @var \CommunityTranslation\Entity\Package $package */
              $persist = false;
              if ($remotePackage->getName() !== '' && $remotePackage->getName() !== $package->getName()) {
                  $package->setName($remotePackage->getName());
                  $persist = true;
              }
              if ($remotePackage->getUrl() !== '' && $remotePackage->getUrl() !== $package->getUrl()) {
                  $package->setUrl($remotePackage->getUrl());
                  $persist = true;
              }
              if ($persist) {
                  $this->em->persist($package);
                  $this->em->flush($package);
              }
          }
      }
code: public function import(RemotePackageEntity $remotePackage)
      {
          $temp = $this->download($remotePackage);
          $rootPath = $this->getRootPath($temp);
          $this->translatableImporter->importDirectory($rootPath, $remotePackage->getHandle(), $remotePackage->getVersion(), '');
          $package = $this->packageRepo->findOneBy(['handle' => $remotePackage->getHandle()]);
          if ($package !== null) {
              /* @var \CommunityTranslation\Entity\Package $package */
              $persist = false;
              if ($remotePackage->getName() !== '' && $remotePackage->getName() !== $package->getName()) {
                  $package->setName($remotePackage->getName());
                  $persist = true;
              }
              if ($remotePackage->getUrl() !== '' && $remotePackage->getUrl() !== $package->getUrl()) {
                  $package->setUrl($remotePackage->getUrl());
                  $persist = true;
              }
              if ($persist) {
                  $this->em->persist($package);
                  $this->em->flush($package);
              }
          }
      }
code_tokens: public function import ( RemotePackageEntity $ remotePackage ) { $ temp = $ this -> download ( $ remotePackage ) ; $ rootPath = $ this -> getRootPath ( $ temp ) ; $ this -> translatableImporter -> importDirectory ( $ rootPath , $ remotePackage -> getHandle ( ) , $ remotePackage -> getVersion ( ) , '' ) ; $ package = $ this -> packageRepo -> findOneBy ( [ 'handle' => $ remotePackage -> getHandle ( ) ] ) ; if ( $ package !== null ) { /* @var \CommunityTranslation\Entity\Package $package */ $ persist = false ; if ( $ remotePackage -> getName ( ) !== '' && $ remotePackage -> getName ( ) !== $ package -> getName ( ) ) { $ package -> setName ( $ remotePackage -> getName ( ) ) ; $ persist = true ; } if ( $ remotePackage -> getUrl ( ) !== '' && $ remotePackage -> getUrl ( ) !== $ package -> getUrl ( ) ) { $ package -> setUrl ( $ remotePackage -> getUrl ( ) ) ; $ persist = true ; } if ( $ persist ) { $ this -> em -> persist ( $ package ) ; $ this -> em -> flush ( $ package ) ; } } }
docstring: Import a remote package.
  
  
  @param RemotePackageEntity $remotePackage
  
  @throws UserMessageException
docstring_tokens: Import a remote package .