コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function prepareInstallation(AssetMapping $mapping)
 {
     $glob = $mapping->getGlob();
     $serverName = $mapping->getServerName();
     $resources = $this->repo->find($glob);
     if ($resources->isEmpty()) {
         throw NotInstallableException::noResourceMatches($glob);
     }
     if (!$this->servers->contains($serverName)) {
         throw NotInstallableException::serverNotFound($serverName);
     }
     $server = $this->servers->get($serverName);
     $installerName = $server->getInstallerName();
     if (!$this->installerManager->hasInstallerDescriptor($installerName)) {
         throw NotInstallableException::installerNotFound($installerName);
     }
     $installerDescriptor = $this->installerManager->getInstallerDescriptor($installerName);
     $installer = $this->loadInstaller($installerDescriptor);
     $rootDir = $this->context->getRootDirectory();
     $params = new InstallationParams($installer, $installerDescriptor, $resources, $mapping, $server, $rootDir);
     $installer->validateParams($params);
     return $params;
 }