Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function getComposerInformation($identifier)
 {
     $this->infoCache[$identifier] = Util::readCache($this->infoCache, $this->cache, $this->repoConfig['asset-type'], $identifier, true);
     if (!isset($this->infoCache[$identifier])) {
         $composer = $this->getComposerContent($identifier);
         Util::writeCache($this->cache, $this->repoConfig['asset-type'], $identifier, $composer, true);
         $this->infoCache[$identifier] = $composer;
     }
     return $this->infoCache[$identifier];
 }
Ejemplo n.º 2
0
 /**
  * Get composer information.
  *
  * @param Cache           $cache
  * @param array           $infoCache
  * @param string          $assetType
  * @param ProcessExecutor $process
  * @param string          $identifier
  * @param string          $resource
  * @param string          $cmdGet
  * @param string          $cmdLog
  * @param string          $repoDir
  * @param string          $datetimePrefix
  *
  * @return array The composer
  */
 public static function getComposerInformation(Cache $cache, array &$infoCache, $assetType, ProcessExecutor $process, $identifier, $resource, $cmdGet, $cmdLog, $repoDir, $datetimePrefix = '')
 {
     $infoCache[$identifier] = Util::readCache($infoCache, $cache, $assetType, $identifier);
     if (!isset($infoCache[$identifier])) {
         $composer = static::doGetComposerInformation($resource, $process, $cmdGet, $cmdLog, $repoDir, $datetimePrefix);
         Util::writeCache($cache, $assetType, $identifier, $composer);
         $infoCache[$identifier] = $composer;
     }
     return $infoCache[$identifier];
 }
Ejemplo n.º 3
0
 /**
  * Get composer information.
  *
  * @param Cache              $cache      The cache
  * @param array              $infoCache  The code cache
  * @param string             $scheme     The scheme
  * @param array              $repoConfig The repository config
  * @param string             $identifier The identifier
  * @param string             $owner      The owner of repository
  * @param string             $repository The repository name
  * @param VcsDriverInterface $driver     The vcs driver
  * @param string             $method     The method of vcs driver for get contents
  *
  * @return array The composer
  */
 public static function getComposerInformation(Cache $cache, array &$infoCache, $scheme, array $repoConfig, $identifier, $owner, $repository, VcsDriverInterface $driver, $method = 'getContents')
 {
     $infoCache[$identifier] = Util::readCache($infoCache, $cache, $repoConfig['asset-type'], $identifier);
     if (!isset($infoCache[$identifier])) {
         $resource = $scheme . '://bitbucket.org/' . $owner . '/' . $repository . '/raw/' . $identifier . '/' . $repoConfig['filename'];
         $composer = static::getComposerContent($resource, $identifier, $scheme, $owner, $repository, $driver, $method);
         Util::writeCache($cache, $repoConfig['asset-type'], $identifier, $composer);
         $infoCache[$identifier] = $composer;
     }
     return $infoCache[$identifier];
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function getComposerInformation($identifier)
 {
     $identifier = '/' . trim($identifier, '/') . '/';
     $this->infoCache[$identifier] = Util::readCache($this->infoCache, $this->cache, $this->repoConfig['asset-type'], trim($identifier, '/'), true);
     if (!isset($this->infoCache[$identifier])) {
         list($path, $rev) = $this->getPathRev($identifier);
         $resource = $path . $this->repoConfig['filename'];
         $output = $this->getComposerContent($resource, $rev);
         $composer = $this->parseComposerContent($output, $resource, $path, $rev);
         Util::writeCache($this->cache, $this->repoConfig['asset-type'], trim($identifier, '/'), $composer, true);
         $this->infoCache[$identifier] = $composer;
     }
     return $this->infoCache[$identifier];
 }
Ejemplo n.º 5
0
 /**
  * {@inheritDoc}
  */
 public function getComposerInformation($identifier)
 {
     if ($this->gitDriver) {
         return $this->gitDriver->getComposerInformation($identifier);
     }
     $this->infoCache[$identifier] = Util::readCache($this->infoCache, $this->cache, $this->repoConfig['asset-type'], $identifier);
     if (!isset($this->infoCache[$identifier])) {
         $resource = $this->getApiUrl() . '/repos/' . $this->owner . '/' . $this->repository . '/contents/' . $this->repoConfig['filename'] . '?ref=' . urlencode($identifier);
         $composer = $this->getComposerContent($resource);
         if ($composer) {
             $composer = $this->convertComposerContent($composer, $resource, $identifier);
         } else {
             $composer = array('_nonexistent_package' => true);
         }
         Util::writeCache($this->cache, $this->repoConfig['asset-type'], $identifier, $composer);
         $this->infoCache[$identifier] = $composer;
     }
     return $this->infoCache[$identifier];
 }