/**
  * {@inheritdoc}
  */
 public function prepareInstallation(AssetMapping $mapping)
 {
     $glob = $mapping->getGlob();
     $targetName = $mapping->getTargetName();
     $resources = $this->repo->find($glob);
     if ($resources->isEmpty()) {
         throw NotInstallableException::noResourceMatches($glob);
     }
     if (!$this->installTargets->contains($targetName)) {
         throw NotInstallableException::targetNotFound($targetName);
     }
     $target = $this->installTargets->get($targetName);
     $installerName = $target->getInstallerName();
     if (!$this->installerManager->hasInstallerDescriptor($installerName)) {
         throw NotInstallableException::installerNotFound($installerName);
     }
     $installerDescriptor = $this->installerManager->getInstallerDescriptor($installerName);
     $installer = $this->loadInstaller($installerDescriptor);
     $rootDir = $this->environment->getRootDirectory();
     $params = new InstallationParams($installer, $installerDescriptor, $resources, $mapping, $target, $rootDir);
     $installer->validateParams($params);
     return $params;
 }