コード例 #1
0
ファイル: ZipRepository.php プロジェクト: balbuf/composer-wp
 function __construct(ZipRepositoryConfig $repoConfig, IOInterface $io)
 {
     // check for some needed commands
     if (!Util::cmdExists('find')) {
         throw new \RuntimeException('The WP Zip repository requires the `find` command');
     }
     if (!Util::cmdExists('unzip')) {
         throw new \RuntimeException('The WP Zip repository requires the `unzip` command');
     }
     if (!Util::cmdExists('grep')) {
         throw new \RuntimeException('The WP Zip repository requires the `grep` command');
     }
     // get the config array
     $repoConfig = $repoConfig->getConfig();
     // are we using ssh?
     if ($repoConfig['ssh']) {
         if (!Util::cmdExists('ssh')) {
             throw new \RuntimeException('The WP Zip repository requires the `ssh` command for remote repositories');
         }
         if (!Util::cmdExists('scp')) {
             throw new \RuntimeException('The WP Zip repository requires the `scp` command for remote repositories');
         }
         $this->ssh = true;
     }
     // @todo URL validation
     $this->io = $io;
     $this->loader = new ArrayLoader();
     $this->repoConfig = $repoConfig;
 }