当前位置: 首页>>代码示例>>PHP>>正文


PHP IOInterface::overwriteError方法代码示例

本文整理汇总了PHP中Composer\IO\IOInterface::overwriteError方法的典型用法代码示例。如果您正苦于以下问题:PHP IOInterface::overwriteError方法的具体用法?PHP IOInterface::overwriteError怎么用?PHP IOInterface::overwriteError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\IO\IOInterface的用法示例。


在下文中一共展示了IOInterface::overwriteError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetch

 /**
  * @return string[]
  */
 private function fetch()
 {
     $this->io->write(sprintf('  - Updating <info>%s</info> tag list', $this->package));
     if (isset($_ENV['HRDNS_PHANTOMJS_VERSION']) && !empty($_ENV['HRDNS_PHANTOMJS_VERSION'])) {
         $this->cache = [$_ENV['HRDNS_PHANTOMJS_VERSION']];
     }
     if ($this->cache === null) {
         $this->cache = [];
         $this->io->writeError("    Downloading: <comment>Connecting...</comment>", false);
         $repo = new VcsRepository(['url' => $this->url, 'type' => $this->type], $this->io, $this->config);
         $this->cache = array_keys($repo->getDriver()->getTags());
         $this->io->overwriteError('', false);
         $this->io->overwriteError(sprintf("\r    Found <comment>%d</comment> versions\n", count($this->cache)));
     }
     return $this->cache;
 }
开发者ID:sgc-fireball,项目名称:selenium-server-standalone-installer,代码行数:19,代码来源:PhantomJSVersionRepository.php

示例2: fetch

 /**
  * @return string[]
  */
 private function fetch()
 {
     $this->io->write(sprintf('  - Updating <info>%s</info> tag list', $this->package));
     if (isset($_ENV['HRDNS_SELENIUM_VERSION']) && !empty($_ENV['HRDNS_SELENIUM_VERSION'])) {
         $this->cache = [$_ENV['HRDNS_SELENIUM_VERSION']];
     }
     if ($this->cache === null) {
         $this->cache = [];
         $this->io->writeError("    Downloading: <comment>Connecting...</comment>", false);
         $repo = new VcsRepository(['url' => $this->url, 'type' => $this->type], $this->io, $this->config);
         $this->cache = array_keys($repo->getDriver()->getTags());
         $this->io->overwriteError("    Downloading: <comment>100%</comment>", false);
         $this->cache = array_filter($this->cache, function ($version) {
             return strpos($version, 'selenium-') === 0;
         });
         array_walk($this->cache, function (&$value) {
             $value = substr($value, 9);
         });
         $this->io->overwriteError(sprintf("\r    Found <comment>%d</comment> versions\n", count($this->cache)));
     }
     return $this->cache;
 }
开发者ID:sgc-fireball,项目名称:selenium-server-standalone-installer,代码行数:25,代码来源:SeleniumVersionRepository.php

示例3: referencePackages

 public function referencePackages(PackageSet $packageSet, IOInterface $io, $apiUrl = null)
 {
     if (!$apiUrl) {
         $apiUrl = 'https://php-bach.org';
     }
     $apiUrlFormat = $apiUrl . '/p/%s.json';
     //cURL
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, true);
     /** @var Package $package */
     foreach ($packageSet as $package) {
         $packageName = $package->getPackageName();
         $versionName = $package->getVersion();
         $url = sprintf($apiUrlFormat, $packageName);
         curl_setopt($ch, CURLOPT_URL, $url);
         $response = curl_exec($ch);
         $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
         $message = '<info>Checking:</info> ' . $packageName . ' (' . $versionName . ') ...';
         $io->write($message);
         if ('200' === (string) $code) {
             $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
             // ヘッダサイズ取得
             $body = substr($response, $header_size);
             // bodyだけ切り出し
             if ($this->parseResponse($package, $body)) {
                 $io->overwrite('<info>Done.</info>');
             } else {
                 $io->overwrite('<fg=white;bg=magenta>Version not found.</>');
             }
         } elseif ('404' === (string) $code) {
             $io->overwrite('<fg=white;bg=magenta>Package not found.</>');
         } else {
             $io->overwriteError($message . '<error>Connection error.</error>');
         }
     }
     curl_close($ch);
 }
开发者ID:tisayama,项目名称:composer-vuln-handler,代码行数:38,代码来源:Reference.php


注:本文中的Composer\IO\IOInterface::overwriteError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。