repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
fxpio/composer-asset-plugin
Repository/Util.php
Util.addRepositoryInstance
public static function addRepositoryInstance(IOInterface $io, RepositoryManager $rm, array &$repos, $name, RepositoryInterface $repo, Pool $pool = null) { $notAddedRepo = null; if (!isset($repos[$name])) { static::writeAddRepository($io, $name); $notAddedRepo = $repo; $repos[$name] = $repo; $rm->addRepository($repo); if (null !== $pool) { $pool->addRepository($repo); $notAddedRepo = null; } } return $notAddedRepo; }
php
public static function addRepositoryInstance(IOInterface $io, RepositoryManager $rm, array &$repos, $name, RepositoryInterface $repo, Pool $pool = null) { $notAddedRepo = null; if (!isset($repos[$name])) { static::writeAddRepository($io, $name); $notAddedRepo = $repo; $repos[$name] = $repo; $rm->addRepository($repo); if (null !== $pool) { $pool->addRepository($repo); $notAddedRepo = null; } } return $notAddedRepo; }
[ "public", "static", "function", "addRepositoryInstance", "(", "IOInterface", "$", "io", ",", "RepositoryManager", "$", "rm", ",", "array", "&", "$", "repos", ",", "$", "name", ",", "RepositoryInterface", "$", "repo", ",", "Pool", "$", "pool", "=", "null", ...
Add repository instance. The instance of repository is returned if the repository in't added in the pool. @param IOInterface $io The IO instance @param RepositoryManager $rm The repository mamanger @param array $repos The list of already repository added (passed by reference) @param string $name The name of the new repository @param RepositoryInterface $repo The repository instance @param null|Pool $pool The pool @return null|RepositoryInterface
[ "Add", "repository", "instance", ".", "The", "instance", "of", "repository", "is", "returned", "if", "the", "repository", "in", "t", "added", "in", "the", "pool", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Util.php#L60-L77
fxpio/composer-asset-plugin
Repository/Util.php
Util.cleanPackageName
public static function cleanPackageName($name) { if (preg_match('/^[a-z]+\-asset\//', $name, $matches)) { $name = substr($name, \strlen($matches[0])); } return $name; }
php
public static function cleanPackageName($name) { if (preg_match('/^[a-z]+\-asset\//', $name, $matches)) { $name = substr($name, \strlen($matches[0])); } return $name; }
[ "public", "static", "function", "cleanPackageName", "(", "$", "name", ")", "{", "if", "(", "preg_match", "(", "'/^[a-z]+\\-asset\\//'", ",", "$", "name", ",", "$", "matches", ")", ")", "{", "$", "name", "=", "substr", "(", "$", "name", ",", "\\", "strl...
Cleans the package name, removing the Composer prefix if present. @param string $name @return string
[ "Cleans", "the", "package", "name", "removing", "the", "Composer", "prefix", "if", "present", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Util.php#L86-L93
fxpio/composer-asset-plugin
Repository/Vcs/GitHubDriver.php
GitHubDriver.getComposerInformation
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]; }
php
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]; }
[ "public", "function", "getComposerInformation", "(", "$", "identifier", ")", "{", "if", "(", "$", "this", "->", "gitDriver", ")", "{", "return", "$", "this", "->", "gitDriver", "->", "getComposerInformation", "(", "$", "identifier", ")", ";", "}", "$", "th...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitHubDriver.php#L27-L50
fxpio/composer-asset-plugin
Repository/Vcs/GitHubDriver.php
GitHubDriver.getComposerContent
protected function getComposerContent($resource) { $notFoundRetries = 2; $composer = null; while ($notFoundRetries) { try { $composer = $this->parseComposerContent($resource); break; } catch (TransportException $e) { if (404 !== $e->getCode()) { throw $e; } // retry fetching if github returns a 404 since they happen randomly --$notFoundRetries; $composer = false; } } return $composer; }
php
protected function getComposerContent($resource) { $notFoundRetries = 2; $composer = null; while ($notFoundRetries) { try { $composer = $this->parseComposerContent($resource); break; } catch (TransportException $e) { if (404 !== $e->getCode()) { throw $e; } // retry fetching if github returns a 404 since they happen randomly --$notFoundRetries; $composer = false; } } return $composer; }
[ "protected", "function", "getComposerContent", "(", "$", "resource", ")", "{", "$", "notFoundRetries", "=", "2", ";", "$", "composer", "=", "null", ";", "while", "(", "$", "notFoundRetries", ")", "{", "try", "{", "$", "composer", "=", "$", "this", "->", ...
Gets content of composer information. @param string $resource @throws \RuntimeException @throws \Composer\Downloader\TransportException @throws \Exception @return null|array|false
[ "Gets", "content", "of", "composer", "information", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitHubDriver.php#L63-L85
fxpio/composer-asset-plugin
Repository/Vcs/GitHubDriver.php
GitHubDriver.parseComposerContent
protected function parseComposerContent($resource) { $composer = (array) JsonFile::parseJson($this->getContents($resource)); if (empty($composer['content']) || 'base64' !== $composer['encoding'] || !($composer = base64_decode($composer['content'], true))) { throw new \RuntimeException('Could not retrieve '.$this->repoConfig['filename'].' from '.$resource); } return $composer; }
php
protected function parseComposerContent($resource) { $composer = (array) JsonFile::parseJson($this->getContents($resource)); if (empty($composer['content']) || 'base64' !== $composer['encoding'] || !($composer = base64_decode($composer['content'], true))) { throw new \RuntimeException('Could not retrieve '.$this->repoConfig['filename'].' from '.$resource); } return $composer; }
[ "protected", "function", "parseComposerContent", "(", "$", "resource", ")", "{", "$", "composer", "=", "(", "array", ")", "JsonFile", "::", "parseJson", "(", "$", "this", "->", "getContents", "(", "$", "resource", ")", ")", ";", "if", "(", "empty", "(", ...
Parse the composer content. @param string $resource @throws \RuntimeException When the resource could not be retrieved @return array
[ "Parse", "the", "composer", "content", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitHubDriver.php#L96-L104
fxpio/composer-asset-plugin
Repository/Vcs/GitHubDriver.php
GitHubDriver.convertComposerContent
protected function convertComposerContent($composer, $resource, $identifier) { $composer = JsonFile::parseJson($composer, $resource); $resource = $this->getApiUrl().'/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier); $composer = Util::addComposerTime($composer, 'commit.committer.date', $resource, $this); if (!isset($composer['support']['source'])) { $label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier; $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label); } if (!isset($composer['support']['issues']) && $this->hasIssues) { $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository); } return $composer; }
php
protected function convertComposerContent($composer, $resource, $identifier) { $composer = JsonFile::parseJson($composer, $resource); $resource = $this->getApiUrl().'/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier); $composer = Util::addComposerTime($composer, 'commit.committer.date', $resource, $this); if (!isset($composer['support']['source'])) { $label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier; $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label); } if (!isset($composer['support']['issues']) && $this->hasIssues) { $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository); } return $composer; }
[ "protected", "function", "convertComposerContent", "(", "$", "composer", ",", "$", "resource", ",", "$", "identifier", ")", "{", "$", "composer", "=", "JsonFile", "::", "parseJson", "(", "$", "composer", ",", "$", "resource", ")", ";", "$", "resource", "="...
Converts json composer file to array. @param string $composer @param string $resource @param string $identifier @return array
[ "Converts", "json", "composer", "file", "to", "array", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitHubDriver.php#L115-L130
fxpio/composer-asset-plugin
Repository/Vcs/GitHubDriver.php
GitHubDriver.setupGitDriver
protected function setupGitDriver($url) { $this->gitDriver = new GitDriver( array( 'url' => $url, 'asset-type' => $this->repoConfig['asset-type'], 'filename' => $this->repoConfig['filename'], 'asset-repository-manager' => $this->repoConfig['asset-repository-manager'], ), $this->io, $this->config, $this->process, $this->remoteFilesystem ); $this->gitDriver->initialize(); }
php
protected function setupGitDriver($url) { $this->gitDriver = new GitDriver( array( 'url' => $url, 'asset-type' => $this->repoConfig['asset-type'], 'filename' => $this->repoConfig['filename'], 'asset-repository-manager' => $this->repoConfig['asset-repository-manager'], ), $this->io, $this->config, $this->process, $this->remoteFilesystem ); $this->gitDriver->initialize(); }
[ "protected", "function", "setupGitDriver", "(", "$", "url", ")", "{", "$", "this", "->", "gitDriver", "=", "new", "GitDriver", "(", "array", "(", "'url'", "=>", "$", "url", ",", "'asset-type'", "=>", "$", "this", "->", "repoConfig", "[", "'asset-type'", ...
Setup git driver. @param string $url
[ "Setup", "git", "driver", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitHubDriver.php#L137-L152
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.skip
public function skip(AssetTypeInterface $assetType, $name, $version) { try { $cVersion = $assetType->getVersionConverter()->convertVersion($version); $normalizedVersion = $this->versionParser->normalize($cVersion); } catch (\Exception $ex) { return true; } if (false !== $this->skipByPattern() && $this->forceSkipVersion($normalizedVersion)) { return true; } return $this->doSkip($name, $normalizedVersion); }
php
public function skip(AssetTypeInterface $assetType, $name, $version) { try { $cVersion = $assetType->getVersionConverter()->convertVersion($version); $normalizedVersion = $this->versionParser->normalize($cVersion); } catch (\Exception $ex) { return true; } if (false !== $this->skipByPattern() && $this->forceSkipVersion($normalizedVersion)) { return true; } return $this->doSkip($name, $normalizedVersion); }
[ "public", "function", "skip", "(", "AssetTypeInterface", "$", "assetType", ",", "$", "name", ",", "$", "version", ")", "{", "try", "{", "$", "cVersion", "=", "$", "assetType", "->", "getVersionConverter", "(", ")", "->", "convertVersion", "(", "$", "versio...
Check if the version must be skipped. @param AssetTypeInterface $assetType The asset type @param string $name The composer package name @param string $version The version @return bool
[ "Check", "if", "the", "version", "must", "be", "skipped", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L126-L140
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.doSkip
protected function doSkip($name, $normalizedVersion) { if (!isset($this->requires[$name]) || false !== strpos($normalizedVersion, '-p')) { return false; } /** @var Link $require */ $require = $this->requires[$name]; return !$this->satisfy($require, $normalizedVersion) && $this->isEnabled(); }
php
protected function doSkip($name, $normalizedVersion) { if (!isset($this->requires[$name]) || false !== strpos($normalizedVersion, '-p')) { return false; } /** @var Link $require */ $require = $this->requires[$name]; return !$this->satisfy($require, $normalizedVersion) && $this->isEnabled(); }
[ "protected", "function", "doSkip", "(", "$", "name", ",", "$", "normalizedVersion", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "requires", "[", "$", "name", "]", ")", "||", "false", "!==", "strpos", "(", "$", "normalizedVersion", ",", ...
Do check if the version must be skipped. @param string $name The composer package name @param string $normalizedVersion The normalized version @return bool
[ "Do", "check", "if", "the", "version", "must", "be", "skipped", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L150-L160
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.skipByPattern
protected function skipByPattern() { $skip = $this->config->get('pattern-skip-version', false); return \is_string($skip) ? trim($skip, '/') : false; }
php
protected function skipByPattern() { $skip = $this->config->get('pattern-skip-version', false); return \is_string($skip) ? trim($skip, '/') : false; }
[ "protected", "function", "skipByPattern", "(", ")", "{", "$", "skip", "=", "$", "this", "->", "config", "->", "get", "(", "'pattern-skip-version'", ",", "false", ")", ";", "return", "\\", "is_string", "(", "$", "skip", ")", "?", "trim", "(", "$", "skip...
Check if the filter must be skipped the version by pattern or not. @return false|string Return the pattern or FALSE for disable the feature
[ "Check", "if", "the", "filter", "must", "be", "skipped", "the", "version", "by", "pattern", "or", "not", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L181-L188
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.satisfyVersion
protected function satisfyVersion(Link $require, $normalizedVersion) { $constraintSame = $this->versionParser->parseConstraints($normalizedVersion); $sameVersion = (bool) $require->getConstraint()->matches($constraintSame); $consNormalizedVersion = FilterUtil::getVersionConstraint($normalizedVersion, $this->versionParser); $constraint = FilterUtil::getVersionConstraint($consNormalizedVersion->getPrettyString(), $this->versionParser); return (bool) $require->getConstraint()->matches($constraint) || $sameVersion; }
php
protected function satisfyVersion(Link $require, $normalizedVersion) { $constraintSame = $this->versionParser->parseConstraints($normalizedVersion); $sameVersion = (bool) $require->getConstraint()->matches($constraintSame); $consNormalizedVersion = FilterUtil::getVersionConstraint($normalizedVersion, $this->versionParser); $constraint = FilterUtil::getVersionConstraint($consNormalizedVersion->getPrettyString(), $this->versionParser); return (bool) $require->getConstraint()->matches($constraint) || $sameVersion; }
[ "protected", "function", "satisfyVersion", "(", "Link", "$", "require", ",", "$", "normalizedVersion", ")", "{", "$", "constraintSame", "=", "$", "this", "->", "versionParser", "->", "parseConstraints", "(", "$", "normalizedVersion", ")", ";", "$", "sameVersion"...
Check if the require dependency has a satisfactory version. @param Link $require The require link defined in root package @param string $normalizedVersion The normalized version @return bool
[ "Check", "if", "the", "require", "dependency", "has", "a", "satisfactory", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L210-L219
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.satisfyStability
protected function satisfyStability(Link $require, $normalizedVersion) { $requireStability = $this->getRequireStability($require); $stability = $this->versionParser->parseStability($normalizedVersion); return Package::$stabilities[$stability] <= Package::$stabilities[$requireStability]; }
php
protected function satisfyStability(Link $require, $normalizedVersion) { $requireStability = $this->getRequireStability($require); $stability = $this->versionParser->parseStability($normalizedVersion); return Package::$stabilities[$stability] <= Package::$stabilities[$requireStability]; }
[ "protected", "function", "satisfyStability", "(", "Link", "$", "require", ",", "$", "normalizedVersion", ")", "{", "$", "requireStability", "=", "$", "this", "->", "getRequireStability", "(", "$", "require", ")", ";", "$", "stability", "=", "$", "this", "->"...
Check if the require dependency has a satisfactory stability. @param Link $require The require link defined in root package @param string $normalizedVersion The normalized version @return bool
[ "Check", "if", "the", "require", "dependency", "has", "a", "satisfactory", "stability", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L229-L235
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.getRequireStability
protected function getRequireStability(Link $require) { $prettyConstraint = $require->getPrettyConstraint(); $stabilities = Package::$stabilities; if (preg_match_all('/@('.implode('|', array_keys($stabilities)).')/', $prettyConstraint, $matches)) { return FilterUtil::findInlineStabilities($matches[1], $this->versionParser); } return FilterUtil::getMinimumStabilityFlag($this->package, $require); }
php
protected function getRequireStability(Link $require) { $prettyConstraint = $require->getPrettyConstraint(); $stabilities = Package::$stabilities; if (preg_match_all('/@('.implode('|', array_keys($stabilities)).')/', $prettyConstraint, $matches)) { return FilterUtil::findInlineStabilities($matches[1], $this->versionParser); } return FilterUtil::getMinimumStabilityFlag($this->package, $require); }
[ "protected", "function", "getRequireStability", "(", "Link", "$", "require", ")", "{", "$", "prettyConstraint", "=", "$", "require", "->", "getPrettyConstraint", "(", ")", ";", "$", "stabilities", "=", "Package", "::", "$", "stabilities", ";", "if", "(", "pr...
Get the minimum stability for the require dependency defined in root package. @param Link $require The require link defined in root package @return string The minimum stability
[ "Get", "the", "minimum", "stability", "for", "the", "require", "dependency", "defined", "in", "root", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L244-L254
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.initialize
protected function initialize() { $this->requires = array_merge( $this->package->getRequires(), $this->package->getDevRequires() ); if (null !== $this->installedRepository && FilterUtil::checkConfigOption($this->config, 'optimize-with-installed-packages')) { $this->initInstalledPackages(); } }
php
protected function initialize() { $this->requires = array_merge( $this->package->getRequires(), $this->package->getDevRequires() ); if (null !== $this->installedRepository && FilterUtil::checkConfigOption($this->config, 'optimize-with-installed-packages')) { $this->initInstalledPackages(); } }
[ "protected", "function", "initialize", "(", ")", "{", "$", "this", "->", "requires", "=", "array_merge", "(", "$", "this", "->", "package", "->", "getRequires", "(", ")", ",", "$", "this", "->", "package", "->", "getDevRequires", "(", ")", ")", ";", "i...
Initialize.
[ "Initialize", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L259-L270
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.initInstalledPackages
private function initInstalledPackages() { /** @var PackageInterface $package */ foreach ($this->installedRepository->getPackages() as $package) { $operator = $this->getFilterOperator($package); /** @var Link $link */ $link = current($this->arrayLoader->parseLinks($this->package->getName(), $this->package->getVersion(), 'installed', array($package->getName() => $operator.$package->getPrettyVersion()))); $link = $this->includeRootConstraint($package, $link); $this->requires[$package->getName()] = $link; } }
php
private function initInstalledPackages() { /** @var PackageInterface $package */ foreach ($this->installedRepository->getPackages() as $package) { $operator = $this->getFilterOperator($package); /** @var Link $link */ $link = current($this->arrayLoader->parseLinks($this->package->getName(), $this->package->getVersion(), 'installed', array($package->getName() => $operator.$package->getPrettyVersion()))); $link = $this->includeRootConstraint($package, $link); $this->requires[$package->getName()] = $link; } }
[ "private", "function", "initInstalledPackages", "(", ")", "{", "/** @var PackageInterface $package */", "foreach", "(", "$", "this", "->", "installedRepository", "->", "getPackages", "(", ")", "as", "$", "package", ")", "{", "$", "operator", "=", "$", "this", "-...
Initialize the installed package.
[ "Initialize", "the", "installed", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L275-L286
fxpio/composer-asset-plugin
Repository/VcsPackageFilter.php
VcsPackageFilter.includeRootConstraint
private function includeRootConstraint(PackageInterface $package, Link $link) { if (isset($this->requires[$package->getName()])) { /** @var Link $rLink */ $rLink = $this->requires[$package->getName()]; $useConjunctive = FilterUtil::checkConfigOption($this->config, 'optimize-with-conjunctive'); $constraint = new MultiConstraint(array($rLink->getConstraint(), $link->getConstraint()), $useConjunctive); $link = new Link($rLink->getSource(), $rLink->getTarget(), $constraint, 'installed', $constraint->getPrettyString()); } return $link; }
php
private function includeRootConstraint(PackageInterface $package, Link $link) { if (isset($this->requires[$package->getName()])) { /** @var Link $rLink */ $rLink = $this->requires[$package->getName()]; $useConjunctive = FilterUtil::checkConfigOption($this->config, 'optimize-with-conjunctive'); $constraint = new MultiConstraint(array($rLink->getConstraint(), $link->getConstraint()), $useConjunctive); $link = new Link($rLink->getSource(), $rLink->getTarget(), $constraint, 'installed', $constraint->getPrettyString()); } return $link; }
[ "private", "function", "includeRootConstraint", "(", "PackageInterface", "$", "package", ",", "Link", "$", "link", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "requires", "[", "$", "package", "->", "getName", "(", ")", "]", ")", ")", "{", "/*...
Include the constraint of root dependency version in the constraint of installed package. @param PackageInterface $package The installed package @param Link $link The link contained installed constraint @return Link The link with root and installed version constraint
[ "Include", "the", "constraint", "of", "root", "dependency", "version", "in", "the", "constraint", "of", "installed", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/VcsPackageFilter.php#L297-L308
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.getComposerPackageName
public function getComposerPackageName() { if (null === $this->packages) { $this->initialize(); } return $this->assetType->formatComposerName($this->packageName); }
php
public function getComposerPackageName() { if (null === $this->packages) { $this->initialize(); } return $this->assetType->formatComposerName($this->packageName); }
[ "public", "function", "getComposerPackageName", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "packages", ")", "{", "$", "this", "->", "initialize", "(", ")", ";", "}", "return", "$", "this", "->", "assetType", "->", "formatComposerName", "...
Gets the package name of this repository. @return string
[ "Gets", "the", "package", "name", "of", "this", "repository", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L116-L123
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.initLoader
protected function initLoader() { $this->versionParser = new VersionParser(); if (!$this->loader) { $this->loader = new ArrayLoader($this->versionParser); } }
php
protected function initLoader() { $this->versionParser = new VersionParser(); if (!$this->loader) { $this->loader = new ArrayLoader($this->versionParser); } }
[ "protected", "function", "initLoader", "(", ")", "{", "$", "this", "->", "versionParser", "=", "new", "VersionParser", "(", ")", ";", "if", "(", "!", "$", "this", "->", "loader", ")", "{", "$", "this", "->", "loader", "=", "new", "ArrayLoader", "(", ...
Initializes the version parser and loader.
[ "Initializes", "the", "version", "parser", "and", "loader", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L145-L152
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.initRootIdentifier
protected function initRootIdentifier(VcsDriverInterface $driver) { try { if ($driver->hasComposerFile($driver->getRootIdentifier())) { $data = $driver->getComposerInformation($driver->getRootIdentifier()); $sc = new SemverConverter(); $this->rootPackageVersion = !empty($data['version']) ? $sc->convertVersion(ltrim($data['version'], '^~')) : null; $this->rootData = $data; if (null === $this->packageName) { $this->packageName = !empty($data['name']) ? $data['name'] : null; } } } catch (\Exception $e) { if ($this->verbose) { $this->io->write('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>'); } } }
php
protected function initRootIdentifier(VcsDriverInterface $driver) { try { if ($driver->hasComposerFile($driver->getRootIdentifier())) { $data = $driver->getComposerInformation($driver->getRootIdentifier()); $sc = new SemverConverter(); $this->rootPackageVersion = !empty($data['version']) ? $sc->convertVersion(ltrim($data['version'], '^~')) : null; $this->rootData = $data; if (null === $this->packageName) { $this->packageName = !empty($data['name']) ? $data['name'] : null; } } } catch (\Exception $e) { if ($this->verbose) { $this->io->write('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>'); } } }
[ "protected", "function", "initRootIdentifier", "(", "VcsDriverInterface", "$", "driver", ")", "{", "try", "{", "if", "(", "$", "driver", "->", "hasComposerFile", "(", "$", "driver", "->", "getRootIdentifier", "(", ")", ")", ")", "{", "$", "data", "=", "$",...
Initializes the root identifier. @param VcsDriverInterface $driver
[ "Initializes", "the", "root", "identifier", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L159-L178
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.createPackageName
protected function createPackageName() { if (null === $this->packageName) { return $this->url; } return sprintf('%s/%s', $this->assetType->getComposerVendorName(), $this->packageName); }
php
protected function createPackageName() { if (null === $this->packageName) { return $this->url; } return sprintf('%s/%s', $this->assetType->getComposerVendorName(), $this->packageName); }
[ "protected", "function", "createPackageName", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "packageName", ")", "{", "return", "$", "this", "->", "url", ";", "}", "return", "sprintf", "(", "'%s/%s'", ",", "$", "this", "->", "assetType", "...
Creates the package name with the composer prefix and the asset package name, or only with the URL. @return string The package name
[ "Creates", "the", "package", "name", "with", "the", "composer", "prefix", "and", "the", "asset", "package", "name", "or", "only", "with", "the", "URL", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L186-L193
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.createLazyLoader
protected function createLazyLoader($type, $identifier, array $packageData, VcsDriverInterface $driver) { $lazyLoader = new LazyAssetPackageLoader($type, $identifier, $packageData); $lazyLoader->setAssetType($this->assetType); $lazyLoader->setLoader($this->loader); $lazyLoader->setDriver(clone $driver); $lazyLoader->setIO($this->io); $lazyLoader->setAssetRepositoryManager($this->assetRepositoryManager); return $lazyLoader; }
php
protected function createLazyLoader($type, $identifier, array $packageData, VcsDriverInterface $driver) { $lazyLoader = new LazyAssetPackageLoader($type, $identifier, $packageData); $lazyLoader->setAssetType($this->assetType); $lazyLoader->setLoader($this->loader); $lazyLoader->setDriver(clone $driver); $lazyLoader->setIO($this->io); $lazyLoader->setAssetRepositoryManager($this->assetRepositoryManager); return $lazyLoader; }
[ "protected", "function", "createLazyLoader", "(", "$", "type", ",", "$", "identifier", ",", "array", "$", "packageData", ",", "VcsDriverInterface", "$", "driver", ")", "{", "$", "lazyLoader", "=", "new", "LazyAssetPackageLoader", "(", "$", "type", ",", "$", ...
Creates the lazy loader of package. @param string $type @param string $identifier @param array $packageData @param VcsDriverInterface $driver @return LazyAssetPackageLoader
[ "Creates", "the", "lazy", "loader", "of", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L222-L232
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.preProcessAsset
protected function preProcessAsset(array $data) { $vcsRepos = array(); // keep the name of the main identifier for all packages $data['name'] = $this->packageName ?: $data['name']; $data = (array) $this->assetType->getPackageConverter()->convert($data, $vcsRepos); $this->assetRepositoryManager->addRepositories($vcsRepos); return $this->assetRepositoryManager->solveResolutions($data); }
php
protected function preProcessAsset(array $data) { $vcsRepos = array(); // keep the name of the main identifier for all packages $data['name'] = $this->packageName ?: $data['name']; $data = (array) $this->assetType->getPackageConverter()->convert($data, $vcsRepos); $this->assetRepositoryManager->addRepositories($vcsRepos); return $this->assetRepositoryManager->solveResolutions($data); }
[ "protected", "function", "preProcessAsset", "(", "array", "$", "data", ")", "{", "$", "vcsRepos", "=", "array", "(", ")", ";", "// keep the name of the main identifier for all packages", "$", "data", "[", "'name'", "]", "=", "$", "this", "->", "packageName", "?"...
Pre process the data of package before the conversion to Package instance. @param array $data @return array
[ "Pre", "process", "the", "data", "of", "package", "before", "the", "conversion", "to", "Package", "instance", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L241-L251
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.overrideBranchAliasConfig
protected function overrideBranchAliasConfig(PackageInterface $package, $aliasNormalized, $branch) { if ($package instanceof Package && false === strpos('dev-', $aliasNormalized)) { $extra = $package->getExtra(); $extra['branch-alias'] = array( 'dev-'.$branch => $this->rootPackageVersion.'-dev', ); $this->injectExtraConfig($package, $extra); } return $package; }
php
protected function overrideBranchAliasConfig(PackageInterface $package, $aliasNormalized, $branch) { if ($package instanceof Package && false === strpos('dev-', $aliasNormalized)) { $extra = $package->getExtra(); $extra['branch-alias'] = array( 'dev-'.$branch => $this->rootPackageVersion.'-dev', ); $this->injectExtraConfig($package, $extra); } return $package; }
[ "protected", "function", "overrideBranchAliasConfig", "(", "PackageInterface", "$", "package", ",", "$", "aliasNormalized", ",", "$", "branch", ")", "{", "if", "(", "$", "package", "instanceof", "Package", "&&", "false", "===", "strpos", "(", "'dev-'", ",", "$...
Override the branch alias extra config of the current package. @param PackageInterface $package The current package @param string $aliasNormalized The alias version normalizes @param string $branch The branch name @return PackageInterface
[ "Override", "the", "branch", "alias", "extra", "config", "of", "the", "current", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L262-L273
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.addPackageAliases
protected function addPackageAliases(PackageInterface $package, $aliasNormalized) { $alias = new AliasPackage($package, $aliasNormalized, $this->rootPackageVersion); $this->addPackage($alias); if (false === strpos('dev-', $aliasNormalized)) { $alias = new AliasPackage($package, $aliasNormalized.'-dev', $this->rootPackageVersion); $this->addPackage($alias); } return $package; }
php
protected function addPackageAliases(PackageInterface $package, $aliasNormalized) { $alias = new AliasPackage($package, $aliasNormalized, $this->rootPackageVersion); $this->addPackage($alias); if (false === strpos('dev-', $aliasNormalized)) { $alias = new AliasPackage($package, $aliasNormalized.'-dev', $this->rootPackageVersion); $this->addPackage($alias); } return $package; }
[ "protected", "function", "addPackageAliases", "(", "PackageInterface", "$", "package", ",", "$", "aliasNormalized", ")", "{", "$", "alias", "=", "new", "AliasPackage", "(", "$", "package", ",", "$", "aliasNormalized", ",", "$", "this", "->", "rootPackageVersion"...
Add the alias packages. @param PackageInterface $package The current package @param string $aliasNormalized The alias version normalizes @return PackageInterface
[ "Add", "the", "alias", "packages", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L283-L294
fxpio/composer-asset-plugin
Repository/AbstractAssetVcsRepository.php
AbstractAssetVcsRepository.injectExtraConfig
private function injectExtraConfig(PackageInterface $package, array $extra) { $ref = new \ReflectionClass($package); $met = $ref->getProperty('extra'); $met->setAccessible(true); $met->setValue($package, $extra); }
php
private function injectExtraConfig(PackageInterface $package, array $extra) { $ref = new \ReflectionClass($package); $met = $ref->getProperty('extra'); $met->setAccessible(true); $met->setValue($package, $extra); }
[ "private", "function", "injectExtraConfig", "(", "PackageInterface", "$", "package", ",", "array", "$", "extra", ")", "{", "$", "ref", "=", "new", "\\", "ReflectionClass", "(", "$", "package", ")", ";", "$", "met", "=", "$", "ref", "->", "getProperty", "...
Inject the overriding extra config in the current package. @param PackageInterface $package The package @param array $extra The new extra config
[ "Inject", "the", "overriding", "extra", "config", "in", "the", "current", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AbstractAssetVcsRepository.php#L302-L308
fxpio/composer-asset-plugin
Repository/Vcs/BitbucketUtil.php
BitbucketUtil.getComposerInformation
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 = static::getUrlResource($scheme, $repoConfig, $identifier, $owner, $repository, $driver); $composer = static::getComposerContent($resource, $identifier, $scheme, $owner, $repository, $driver, $method); Util::writeCache($cache, $repoConfig['asset-type'], $identifier, $composer); $infoCache[$identifier] = $composer; } return $infoCache[$identifier]; }
php
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 = static::getUrlResource($scheme, $repoConfig, $identifier, $owner, $repository, $driver); $composer = static::getComposerContent($resource, $identifier, $scheme, $owner, $repository, $driver, $method); Util::writeCache($cache, $repoConfig['asset-type'], $identifier, $composer); $infoCache[$identifier] = $composer; } return $infoCache[$identifier]; }
[ "public", "static", "function", "getComposerInformation", "(", "Cache", "$", "cache", ",", "array", "&", "$", "infoCache", ",", "$", "scheme", ",", "array", "$", "repoConfig", ",", "$", "identifier", ",", "$", "owner", ",", "$", "repository", ",", "VcsDriv...
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
[ "Get", "composer", "information", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/BitbucketUtil.php#L40-L62
fxpio/composer-asset-plugin
Repository/Vcs/BitbucketUtil.php
BitbucketUtil.getUrlResource
protected static function getUrlResource( $scheme, array $repoConfig, $identifier, $owner, $repository, VcsDriverInterface $driver ) { if (false === strpos(\get_class($driver), 'Git')) { return $scheme.'://bitbucket.org/'.$owner.'/'.$repository.'/raw/'.$identifier.'/'.$repoConfig['filename']; } return $scheme.'://api.bitbucket.org/1.0/repositories/'.$owner.'/'.$repository.'/src/'.$identifier.'/'.$repoConfig['filename']; }
php
protected static function getUrlResource( $scheme, array $repoConfig, $identifier, $owner, $repository, VcsDriverInterface $driver ) { if (false === strpos(\get_class($driver), 'Git')) { return $scheme.'://bitbucket.org/'.$owner.'/'.$repository.'/raw/'.$identifier.'/'.$repoConfig['filename']; } return $scheme.'://api.bitbucket.org/1.0/repositories/'.$owner.'/'.$repository.'/src/'.$identifier.'/'.$repoConfig['filename']; }
[ "protected", "static", "function", "getUrlResource", "(", "$", "scheme", ",", "array", "$", "repoConfig", ",", "$", "identifier", ",", "$", "owner", ",", "$", "repository", ",", "VcsDriverInterface", "$", "driver", ")", "{", "if", "(", "false", "===", "str...
Get the url of resource. @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 @return string
[ "Get", "the", "url", "of", "resource", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/BitbucketUtil.php#L76-L89
fxpio/composer-asset-plugin
Repository/Vcs/BitbucketUtil.php
BitbucketUtil.getComposerContent
protected static function getComposerContent( $resource, $identifier, $scheme, $owner, $repository, VcsDriverInterface $driver, $method ) { $composer = static::getComposerContentOfFile($resource, $driver, $method); if (false !== $composer) { $composer = (array) JsonFile::parseJson((string) $composer, $resource); $composer = static::formatComposerContent($composer, $identifier, $scheme, $owner, $repository, $driver, $method); return $composer; } return array('_nonexistent_package' => true); }
php
protected static function getComposerContent( $resource, $identifier, $scheme, $owner, $repository, VcsDriverInterface $driver, $method ) { $composer = static::getComposerContentOfFile($resource, $driver, $method); if (false !== $composer) { $composer = (array) JsonFile::parseJson((string) $composer, $resource); $composer = static::formatComposerContent($composer, $identifier, $scheme, $owner, $repository, $driver, $method); return $composer; } return array('_nonexistent_package' => true); }
[ "protected", "static", "function", "getComposerContent", "(", "$", "resource", ",", "$", "identifier", ",", "$", "scheme", ",", "$", "owner", ",", "$", "repository", ",", "VcsDriverInterface", "$", "driver", ",", "$", "method", ")", "{", "$", "composer", "...
Gets content of composer information. @param string $resource The resource @param string $identifier The identifier @param string $scheme The scheme @param string $owner The owner @param string $repository The repository @param VcsDriverInterface $driver The vcs driver @param string $method The method for get content @return array
[ "Gets", "content", "of", "composer", "information", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/BitbucketUtil.php#L104-L123
fxpio/composer-asset-plugin
Repository/Vcs/BitbucketUtil.php
BitbucketUtil.getComposerContentOfFile
protected static function getComposerContentOfFile($resource, VcsDriverInterface $driver, $method) { try { $ref = new \ReflectionClass($driver); $meth = $ref->getMethod($method); $meth->setAccessible(true); $composer = $meth->invoke($driver, $resource); if ('getContents' !== $method) { $file = (array) JsonFile::parseJson((string) $composer, $resource); $composer = empty($file) || !\array_key_exists('data', $file) ? false : $file['data']; } } catch (\Exception $e) { $composer = false; } return $composer; }
php
protected static function getComposerContentOfFile($resource, VcsDriverInterface $driver, $method) { try { $ref = new \ReflectionClass($driver); $meth = $ref->getMethod($method); $meth->setAccessible(true); $composer = $meth->invoke($driver, $resource); if ('getContents' !== $method) { $file = (array) JsonFile::parseJson((string) $composer, $resource); $composer = empty($file) || !\array_key_exists('data', $file) ? false : $file['data']; } } catch (\Exception $e) { $composer = false; } return $composer; }
[ "protected", "static", "function", "getComposerContentOfFile", "(", "$", "resource", ",", "VcsDriverInterface", "$", "driver", ",", "$", "method", ")", "{", "try", "{", "$", "ref", "=", "new", "\\", "ReflectionClass", "(", "$", "driver", ")", ";", "$", "me...
Get the parsed content of composer. @param string $resource The resource @param VcsDriverInterface $driver The vcs driver @param string $method The method for get content @return false|string
[ "Get", "the", "parsed", "content", "of", "composer", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/BitbucketUtil.php#L134-L152
fxpio/composer-asset-plugin
Repository/Vcs/BitbucketUtil.php
BitbucketUtil.formatComposerContent
protected static function formatComposerContent(array $composer, $identifier, $scheme, $owner, $repository, $driver, $method) { $resource = $scheme.'://api.bitbucket.org/1.0/repositories/'.$owner.'/'.$repository.'/changesets/'.$identifier; return Util::addComposerTime($composer, 'timestamp', $resource, $driver, $method); }
php
protected static function formatComposerContent(array $composer, $identifier, $scheme, $owner, $repository, $driver, $method) { $resource = $scheme.'://api.bitbucket.org/1.0/repositories/'.$owner.'/'.$repository.'/changesets/'.$identifier; return Util::addComposerTime($composer, 'timestamp', $resource, $driver, $method); }
[ "protected", "static", "function", "formatComposerContent", "(", "array", "$", "composer", ",", "$", "identifier", ",", "$", "scheme", ",", "$", "owner", ",", "$", "repository", ",", "$", "driver", ",", "$", "method", ")", "{", "$", "resource", "=", "$",...
Format composer content. @param array $composer The composer @param string $identifier The identifier @param string $scheme The scheme @param string $owner The owner @param string $repository The repository @param VcsDriverInterface $driver The vcs driver @param string $method The method for get content @return array
[ "Format", "composer", "content", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/BitbucketUtil.php#L167-L172
fxpio/composer-asset-plugin
Converter/SemverRangeUtil.php
SemverRangeUtil.replaceSpecialRange
public static function replaceSpecialRange(SemverConverter $converter, $match) { $newMatch = $converter->convertVersion($match); $newMatch = '>='.static::standardizeVersion(SemverUtil::replaceAlias($newMatch, '>')).',<'; $exp = static::getSplittedVersion($match); $increase = false; foreach ($exp as $i => $sub) { if (static::analyzeSubVersion($i, $exp, $increase)) { continue; } static::increaseSubVersion($i, $exp, $increase); } $newMatch .= $converter->convertVersion(static::standardizeVersion($exp)); return $newMatch; }
php
public static function replaceSpecialRange(SemverConverter $converter, $match) { $newMatch = $converter->convertVersion($match); $newMatch = '>='.static::standardizeVersion(SemverUtil::replaceAlias($newMatch, '>')).',<'; $exp = static::getSplittedVersion($match); $increase = false; foreach ($exp as $i => $sub) { if (static::analyzeSubVersion($i, $exp, $increase)) { continue; } static::increaseSubVersion($i, $exp, $increase); } $newMatch .= $converter->convertVersion(static::standardizeVersion($exp)); return $newMatch; }
[ "public", "static", "function", "replaceSpecialRange", "(", "SemverConverter", "$", "converter", ",", "$", "match", ")", "{", "$", "newMatch", "=", "$", "converter", "->", "convertVersion", "(", "$", "match", ")", ";", "$", "newMatch", "=", "'>='", ".", "s...
Replaces the special range "^". @param SemverConverter $converter The semver converter @param string $match The match version @return string the new match version
[ "Replaces", "the", "special", "range", "^", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverRangeUtil.php#L29-L47
fxpio/composer-asset-plugin
Converter/SemverRangeUtil.php
SemverRangeUtil.analyzeSubVersion
protected static function analyzeSubVersion($i, array &$exp, &$increase) { $analyzed = false; if ($increase) { $exp[$i] = 0; $analyzed = true; } if (0 === $i && (int) $exp[$i] > 0) { $increase = true; $exp[$i] = (int) $exp[$i] + 1; $analyzed = true; } return $analyzed; }
php
protected static function analyzeSubVersion($i, array &$exp, &$increase) { $analyzed = false; if ($increase) { $exp[$i] = 0; $analyzed = true; } if (0 === $i && (int) $exp[$i] > 0) { $increase = true; $exp[$i] = (int) $exp[$i] + 1; $analyzed = true; } return $analyzed; }
[ "protected", "static", "function", "analyzeSubVersion", "(", "$", "i", ",", "array", "&", "$", "exp", ",", "&", "$", "increase", ")", "{", "$", "analyzed", "=", "false", ";", "if", "(", "$", "increase", ")", "{", "$", "exp", "[", "$", "i", "]", "...
Analyze the sub version of splitted version. @param int $i The position in splitted version @param array $exp The splitted version @param bool $increase Check if the next sub version must be increased @return bool
[ "Analyze", "the", "sub", "version", "of", "splitted", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverRangeUtil.php#L58-L74
fxpio/composer-asset-plugin
Converter/SemverRangeUtil.php
SemverRangeUtil.increaseSubVersion
protected static function increaseSubVersion($i, array &$exp, &$increase) { $iNext = min(min($i + 1, 3), \count($exp) - 1); if (($iNext !== $i && ($exp[$i] > 0 || (int) $exp[$iNext] > 9999998)) || $iNext === $i) { $exp[$i] = (int) $exp[$i] + 1; $increase = true; } }
php
protected static function increaseSubVersion($i, array &$exp, &$increase) { $iNext = min(min($i + 1, 3), \count($exp) - 1); if (($iNext !== $i && ($exp[$i] > 0 || (int) $exp[$iNext] > 9999998)) || $iNext === $i) { $exp[$i] = (int) $exp[$i] + 1; $increase = true; } }
[ "protected", "static", "function", "increaseSubVersion", "(", "$", "i", ",", "array", "&", "$", "exp", ",", "&", "$", "increase", ")", "{", "$", "iNext", "=", "min", "(", "min", "(", "$", "i", "+", "1", ",", "3", ")", ",", "\\", "count", "(", "...
Increase the sub version of splitted version. @param int $i The position in splitted version @param array $exp The splitted version @param bool $increase Check if the next sub version must be increased
[ "Increase", "the", "sub", "version", "of", "splitted", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverRangeUtil.php#L83-L91
fxpio/composer-asset-plugin
Converter/SemverRangeUtil.php
SemverRangeUtil.standardizeVersion
protected static function standardizeVersion($version) { if (\is_string($version)) { $version = explode('.', $version); } while (\count($version) < 3) { $version[] = '0'; } return implode('.', $version); }
php
protected static function standardizeVersion($version) { if (\is_string($version)) { $version = explode('.', $version); } while (\count($version) < 3) { $version[] = '0'; } return implode('.', $version); }
[ "protected", "static", "function", "standardizeVersion", "(", "$", "version", ")", "{", "if", "(", "\\", "is_string", "(", "$", "version", ")", ")", "{", "$", "version", "=", "explode", "(", "'.'", ",", "$", "version", ")", ";", "}", "while", "(", "\...
Standardize the version. @param array|string $version The version or the splitted version @return string
[ "Standardize", "the", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverRangeUtil.php#L100-L111
fxpio/composer-asset-plugin
Converter/SemverRangeUtil.php
SemverRangeUtil.getSplittedVersion
protected static function getSplittedVersion($version) { $version = static::cleanExtraVersion($version); $version = str_replace(array('*', 'x', 'X'), '9999999', $version); $exp = explode('.', $version); return $exp; }
php
protected static function getSplittedVersion($version) { $version = static::cleanExtraVersion($version); $version = str_replace(array('*', 'x', 'X'), '9999999', $version); $exp = explode('.', $version); return $exp; }
[ "protected", "static", "function", "getSplittedVersion", "(", "$", "version", ")", "{", "$", "version", "=", "static", "::", "cleanExtraVersion", "(", "$", "version", ")", ";", "$", "version", "=", "str_replace", "(", "array", "(", "'*'", ",", "'x'", ",", ...
Split the version. @param string $version @return array
[ "Split", "the", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverRangeUtil.php#L120-L127
fxpio/composer-asset-plugin
Converter/SemverRangeUtil.php
SemverRangeUtil.cleanExtraVersion
protected static function cleanExtraVersion($version) { $pos = strpos($version, '-'); if (false !== $pos) { $version = substr($version, 0, $pos); } return $version; }
php
protected static function cleanExtraVersion($version) { $pos = strpos($version, '-'); if (false !== $pos) { $version = substr($version, 0, $pos); } return $version; }
[ "protected", "static", "function", "cleanExtraVersion", "(", "$", "version", ")", "{", "$", "pos", "=", "strpos", "(", "$", "version", ",", "'-'", ")", ";", "if", "(", "false", "!==", "$", "pos", ")", "{", "$", "version", "=", "substr", "(", "$", "...
Remove the extra informations of the version (info after "-"). @param string $version @return string
[ "Remove", "the", "extra", "informations", "of", "the", "version", "(", "info", "after", "-", ")", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverRangeUtil.php#L136-L145
fxpio/composer-asset-plugin
Assets.php
Assets.createType
public static function createType($type) { if (!isset(static::$typeClasses[$type])) { throw new InvalidArgumentException('The asset type "'.$type.'" does not exist, only "'.implode('", "', static::getTypes()).'" are accepted'); } $class = static::$typeClasses[$type]; return new $class(); }
php
public static function createType($type) { if (!isset(static::$typeClasses[$type])) { throw new InvalidArgumentException('The asset type "'.$type.'" does not exist, only "'.implode('", "', static::getTypes()).'" are accepted'); } $class = static::$typeClasses[$type]; return new $class(); }
[ "public", "static", "function", "createType", "(", "$", "type", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "typeClasses", "[", "$", "type", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'The asset type \"'", ".", ...
Creates asset type. @param string $type @throws InvalidArgumentException When the asset type does not exist @return AssetTypeInterface
[ "Creates", "asset", "type", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Assets.php#L85-L94
fxpio/composer-asset-plugin
Installer/BowerInstaller.php
BowerInstaller.addIgnorePatterns
protected function addIgnorePatterns(IgnoreManager $manager, PackageInterface $package) { $extra = $package->getExtra(); if (!empty($extra['bower-asset-ignore'])) { $manager->doAddPattern('!bower.json'); foreach ($extra['bower-asset-ignore'] as $pattern) { $manager->addPattern($pattern); } } }
php
protected function addIgnorePatterns(IgnoreManager $manager, PackageInterface $package) { $extra = $package->getExtra(); if (!empty($extra['bower-asset-ignore'])) { $manager->doAddPattern('!bower.json'); foreach ($extra['bower-asset-ignore'] as $pattern) { $manager->addPattern($pattern); } } }
[ "protected", "function", "addIgnorePatterns", "(", "IgnoreManager", "$", "manager", ",", "PackageInterface", "$", "package", ")", "{", "$", "extra", "=", "$", "package", "->", "getExtra", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "extra", "[", "'...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Installer/BowerInstaller.php#L27-L38
fxpio/composer-asset-plugin
Package/Loader/LazyAssetPackageLoader.php
LazyAssetPackageLoader.setIO
public function setIO(IOInterface $io) { $this->io = $io; $this->verbose = $io->isVerbose(); }
php
public function setIO(IOInterface $io) { $this->io = $io; $this->verbose = $io->isVerbose(); }
[ "public", "function", "setIO", "(", "IOInterface", "$", "io", ")", "{", "$", "this", "->", "io", "=", "$", "io", ";", "$", "this", "->", "verbose", "=", "$", "io", "->", "isVerbose", "(", ")", ";", "}" ]
Sets the IO. @param IOInterface $io
[ "Sets", "the", "IO", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Package/Loader/LazyAssetPackageLoader.php#L132-L136
fxpio/composer-asset-plugin
Package/Loader/LazyAssetPackageLoader.php
LazyAssetPackageLoader.load
public function load(LazyPackageInterface $package) { if (isset($this->cache[$package->getUniqueName()])) { return $this->cache[$package->getUniqueName()]; } $this->validateConfig(); $filename = $this->assetType->getFilename(); $msg = 'Reading '.$filename.' of <info>'.$package->getName().'</info> (<comment>'.$package->getPrettyVersion().'</comment>)'; if ($this->verbose) { $this->io->write($msg); } else { $this->io->overwrite($msg, false); } $realPackage = $this->loadRealPackage($package); $this->cache[$package->getUniqueName()] = $realPackage; if (!$this->verbose) { $this->io->overwrite('', false); } return $realPackage; }
php
public function load(LazyPackageInterface $package) { if (isset($this->cache[$package->getUniqueName()])) { return $this->cache[$package->getUniqueName()]; } $this->validateConfig(); $filename = $this->assetType->getFilename(); $msg = 'Reading '.$filename.' of <info>'.$package->getName().'</info> (<comment>'.$package->getPrettyVersion().'</comment>)'; if ($this->verbose) { $this->io->write($msg); } else { $this->io->overwrite($msg, false); } $realPackage = $this->loadRealPackage($package); $this->cache[$package->getUniqueName()] = $realPackage; if (!$this->verbose) { $this->io->overwrite('', false); } return $realPackage; }
[ "public", "function", "load", "(", "LazyPackageInterface", "$", "package", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "cache", "[", "$", "package", "->", "getUniqueName", "(", ")", "]", ")", ")", "{", "return", "$", "this", "->", "cache", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Package/Loader/LazyAssetPackageLoader.php#L151-L174
fxpio/composer-asset-plugin
Package/Loader/LazyAssetPackageLoader.php
LazyAssetPackageLoader.loadRealPackage
protected function loadRealPackage(LazyPackageInterface $package) { $realPackage = false; try { $data = $this->driver->getComposerInformation($this->identifier); $valid = \is_array($data); $data = $this->preProcess($this->driver, $this->validateData($data), $this->identifier); if ($this->verbose) { $this->io->write('Importing '.($valid ? '' : 'empty ').$this->type.' '.$data['version'].' ('.$data['version_normalized'].')'); } /** @var CompletePackageInterface $realPackage */ $realPackage = $this->loader->load($data); } catch (\Exception $e) { if ($this->verbose) { $filename = $this->assetType->getFilename(); $this->io->write('<'.$this->getIoTag().'>Skipped '.$this->type.' '.$package->getPrettyVersion().', '.($e instanceof TransportException ? 'no '.$filename.' file was found' : $e->getMessage()).'</'.$this->getIoTag().'>'); } } $this->driver->cleanup(); return $realPackage; }
php
protected function loadRealPackage(LazyPackageInterface $package) { $realPackage = false; try { $data = $this->driver->getComposerInformation($this->identifier); $valid = \is_array($data); $data = $this->preProcess($this->driver, $this->validateData($data), $this->identifier); if ($this->verbose) { $this->io->write('Importing '.($valid ? '' : 'empty ').$this->type.' '.$data['version'].' ('.$data['version_normalized'].')'); } /** @var CompletePackageInterface $realPackage */ $realPackage = $this->loader->load($data); } catch (\Exception $e) { if ($this->verbose) { $filename = $this->assetType->getFilename(); $this->io->write('<'.$this->getIoTag().'>Skipped '.$this->type.' '.$package->getPrettyVersion().', '.($e instanceof TransportException ? 'no '.$filename.' file was found' : $e->getMessage()).'</'.$this->getIoTag().'>'); } } $this->driver->cleanup(); return $realPackage; }
[ "protected", "function", "loadRealPackage", "(", "LazyPackageInterface", "$", "package", ")", "{", "$", "realPackage", "=", "false", ";", "try", "{", "$", "data", "=", "$", "this", "->", "driver", "->", "getComposerInformation", "(", "$", "this", "->", "iden...
Loads the real package. @param LazyPackageInterface $package @return CompletePackageInterface|false
[ "Loads", "the", "real", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Package/Loader/LazyAssetPackageLoader.php#L197-L221
fxpio/composer-asset-plugin
Package/Loader/LazyAssetPackageLoader.php
LazyAssetPackageLoader.preProcess
protected function preProcess(VcsDriverInterface $driver, array $data, $identifier) { $vcsRepos = array(); $data = array_merge($data, $this->packageData); $data = $this->assetType->getPackageConverter()->convert($data, $vcsRepos); $this->addRepositories($vcsRepos); if (!isset($data['dist'])) { $data['dist'] = $driver->getDist($identifier); } if (!isset($data['source'])) { $data['source'] = $driver->getSource($identifier); } return $this->assetRepositoryManager->solveResolutions((array) $data); }
php
protected function preProcess(VcsDriverInterface $driver, array $data, $identifier) { $vcsRepos = array(); $data = array_merge($data, $this->packageData); $data = $this->assetType->getPackageConverter()->convert($data, $vcsRepos); $this->addRepositories($vcsRepos); if (!isset($data['dist'])) { $data['dist'] = $driver->getDist($identifier); } if (!isset($data['source'])) { $data['source'] = $driver->getSource($identifier); } return $this->assetRepositoryManager->solveResolutions((array) $data); }
[ "protected", "function", "preProcess", "(", "VcsDriverInterface", "$", "driver", ",", "array", "$", "data", ",", "$", "identifier", ")", "{", "$", "vcsRepos", "=", "array", "(", ")", ";", "$", "data", "=", "array_merge", "(", "$", "data", ",", "$", "th...
Pre process the data of package before the conversion to Package instance. @param VcsDriverInterface $driver @param array $data @param string $identifier @return array
[ "Pre", "process", "the", "data", "of", "package", "before", "the", "conversion", "to", "Package", "instance", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Package/Loader/LazyAssetPackageLoader.php#L252-L268
fxpio/composer-asset-plugin
Converter/SemverUtil.php
SemverUtil.convertDateVersion
public static function convertDateVersion($version) { if (preg_match('/^\d{7,}\./', $version)) { $pos = strpos($version, '.'); $version = substr($version, 0, $pos).self::convertDateMinorVersion(substr($version, $pos + 1)); } return $version; }
php
public static function convertDateVersion($version) { if (preg_match('/^\d{7,}\./', $version)) { $pos = strpos($version, '.'); $version = substr($version, 0, $pos).self::convertDateMinorVersion(substr($version, $pos + 1)); } return $version; }
[ "public", "static", "function", "convertDateVersion", "(", "$", "version", ")", "{", "if", "(", "preg_match", "(", "'/^\\d{7,}\\./'", ",", "$", "version", ")", ")", "{", "$", "pos", "=", "strpos", "(", "$", "version", ",", "'.'", ")", ";", "$", "versio...
Converts the date or datetime version. @param string $version The version @return string
[ "Converts", "the", "date", "or", "datetime", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverUtil.php#L53-L61
fxpio/composer-asset-plugin
Converter/SemverUtil.php
SemverUtil.convertVersionMetadata
public static function convertVersionMetadata($version) { $version = str_replace(self::$cleanPatterns, '', $version); if (preg_match_all( self::createPattern('([a-zA-Z]+|(\-|\+)[a-zA-Z]+|(\-|\+)[0-9]+)'), $version, $matches, PREG_OFFSET_CAPTURE )) { list($type, $version, $end) = self::cleanVersion(strtolower($version), $matches); list($version, $patchVersion) = self::matchVersion($version, $type); $matches = array(); $hasPatchNumber = preg_match('/[0-9]+\.[0-9]+|[0-9]+|\.[0-9]+$/', $end, $matches); $end = $hasPatchNumber ? $matches[0] : '1'; if ($patchVersion) { $version .= $end; } } return static::cleanWildcard($version); }
php
public static function convertVersionMetadata($version) { $version = str_replace(self::$cleanPatterns, '', $version); if (preg_match_all( self::createPattern('([a-zA-Z]+|(\-|\+)[a-zA-Z]+|(\-|\+)[0-9]+)'), $version, $matches, PREG_OFFSET_CAPTURE )) { list($type, $version, $end) = self::cleanVersion(strtolower($version), $matches); list($version, $patchVersion) = self::matchVersion($version, $type); $matches = array(); $hasPatchNumber = preg_match('/[0-9]+\.[0-9]+|[0-9]+|\.[0-9]+$/', $end, $matches); $end = $hasPatchNumber ? $matches[0] : '1'; if ($patchVersion) { $version .= $end; } } return static::cleanWildcard($version); }
[ "public", "static", "function", "convertVersionMetadata", "(", "$", "version", ")", "{", "$", "version", "=", "str_replace", "(", "self", "::", "$", "cleanPatterns", ",", "''", ",", "$", "version", ")", ";", "if", "(", "preg_match_all", "(", "self", "::", ...
Converts the version metadata. @param string $version @return string
[ "Converts", "the", "version", "metadata", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverUtil.php#L70-L93
fxpio/composer-asset-plugin
Converter/SemverUtil.php
SemverUtil.createPattern
public static function createPattern($pattern) { $numVer = '([0-9]+|x|\*)'; $numVer2 = '('.$numVer.'\.'.$numVer.')'; $numVer3 = '('.$numVer.'\.'.$numVer.'\.'.$numVer.')'; return '/^'.'('.$numVer.'|'.$numVer2.'|'.$numVer3.')'.$pattern.'/'; }
php
public static function createPattern($pattern) { $numVer = '([0-9]+|x|\*)'; $numVer2 = '('.$numVer.'\.'.$numVer.')'; $numVer3 = '('.$numVer.'\.'.$numVer.'\.'.$numVer.')'; return '/^'.'('.$numVer.'|'.$numVer2.'|'.$numVer3.')'.$pattern.'/'; }
[ "public", "static", "function", "createPattern", "(", "$", "pattern", ")", "{", "$", "numVer", "=", "'([0-9]+|x|\\*)'", ";", "$", "numVer2", "=", "'('", ".", "$", "numVer", ".", "'\\.'", ".", "$", "numVer", ".", "')'", ";", "$", "numVer3", "=", "'('", ...
Creates a pattern with the version prefix pattern. @param string $pattern The pattern without '/' @return string The full pattern with '/'
[ "Creates", "a", "pattern", "with", "the", "version", "prefix", "pattern", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverUtil.php#L102-L109
fxpio/composer-asset-plugin
Converter/SemverUtil.php
SemverUtil.cleanVersion
protected static function cleanVersion($version, array $matches) { $end = substr($version, \strlen($matches[1][0][0])); $version = $matches[1][0][0].'-'; $matches = array(); if (preg_match('/^(\-|\+)/', $end, $matches)) { $end = substr($end, 1); } $matches = array(); preg_match('/^[a-z]+/', $end, $matches); $type = isset($matches[0]) ? VersionParser::normalizeStability($matches[0]) : null; $end = substr($end, \strlen($type)); return array($type, $version, $end); }
php
protected static function cleanVersion($version, array $matches) { $end = substr($version, \strlen($matches[1][0][0])); $version = $matches[1][0][0].'-'; $matches = array(); if (preg_match('/^(\-|\+)/', $end, $matches)) { $end = substr($end, 1); } $matches = array(); preg_match('/^[a-z]+/', $end, $matches); $type = isset($matches[0]) ? VersionParser::normalizeStability($matches[0]) : null; $end = substr($end, \strlen($type)); return array($type, $version, $end); }
[ "protected", "static", "function", "cleanVersion", "(", "$", "version", ",", "array", "$", "matches", ")", "{", "$", "end", "=", "substr", "(", "$", "version", ",", "\\", "strlen", "(", "$", "matches", "[", "1", "]", "[", "0", "]", "[", "0", "]", ...
Clean the raw version. @param string $version The version @param array $matches The match of pattern asset version @return array The list of $type, $version and $end
[ "Clean", "the", "raw", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverUtil.php#L135-L151
fxpio/composer-asset-plugin
Converter/SemverUtil.php
SemverUtil.matchVersion
protected static function matchVersion($version, $type) { $patchVersion = true; if (\in_array($type, array('dev', 'snapshot'), true)) { $type = 'dev'; $patchVersion = false; } elseif ('a' === $type) { $type = 'alpha'; } elseif (\in_array($type, array('b', 'pre'), true)) { $type = 'beta'; } elseif (!\in_array($type, array('alpha', 'beta', 'RC'), true)) { $type = 'patch'; } $version .= $type; return array($version, $patchVersion); }
php
protected static function matchVersion($version, $type) { $patchVersion = true; if (\in_array($type, array('dev', 'snapshot'), true)) { $type = 'dev'; $patchVersion = false; } elseif ('a' === $type) { $type = 'alpha'; } elseif (\in_array($type, array('b', 'pre'), true)) { $type = 'beta'; } elseif (!\in_array($type, array('alpha', 'beta', 'RC'), true)) { $type = 'patch'; } $version .= $type; return array($version, $patchVersion); }
[ "protected", "static", "function", "matchVersion", "(", "$", "version", ",", "$", "type", ")", "{", "$", "patchVersion", "=", "true", ";", "if", "(", "\\", "in_array", "(", "$", "type", ",", "array", "(", "'dev'", ",", "'snapshot'", ")", ",", "true", ...
Match the version. @param string $version @param string $type @return array The list of $version and $patchVersion
[ "Match", "the", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverUtil.php#L161-L179
fxpio/composer-asset-plugin
Converter/SemverUtil.php
SemverUtil.convertDateMinorVersion
protected static function convertDateMinorVersion($minor) { $split = explode('.', $minor); $minor = (int) $split[0]; $revision = isset($split[1]) ? (int) $split[1] : 0; return '.'.sprintf('%03d', $minor).sprintf('%03d', $revision); }
php
protected static function convertDateMinorVersion($minor) { $split = explode('.', $minor); $minor = (int) $split[0]; $revision = isset($split[1]) ? (int) $split[1] : 0; return '.'.sprintf('%03d', $minor).sprintf('%03d', $revision); }
[ "protected", "static", "function", "convertDateMinorVersion", "(", "$", "minor", ")", "{", "$", "split", "=", "explode", "(", "'.'", ",", "$", "minor", ")", ";", "$", "minor", "=", "(", "int", ")", "$", "split", "[", "0", "]", ";", "$", "revision", ...
Convert the minor version of date. @param string $minor The minor version @return string
[ "Convert", "the", "minor", "version", "of", "date", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverUtil.php#L188-L195
fxpio/composer-asset-plugin
Repository/AssetRepositoryManager.php
AssetRepositoryManager.setPool
public function setPool(Pool $pool) { $this->pool = $pool; foreach ($this->poolRepositories as $repo) { $pool->addRepository($repo); } $this->poolRepositories = array(); return $this; }
php
public function setPool(Pool $pool) { $this->pool = $pool; foreach ($this->poolRepositories as $repo) { $pool->addRepository($repo); } $this->poolRepositories = array(); return $this; }
[ "public", "function", "setPool", "(", "Pool", "$", "pool", ")", "{", "$", "this", "->", "pool", "=", "$", "pool", ";", "foreach", "(", "$", "this", "->", "poolRepositories", "as", "$", "repo", ")", "{", "$", "pool", "->", "addRepository", "(", "$", ...
Set the pool. @param Pool $pool The pool @return self
[ "Set", "the", "pool", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetRepositoryManager.php#L110-L121
fxpio/composer-asset-plugin
Repository/AssetRepositoryManager.php
AssetRepositoryManager.solveResolutions
public function solveResolutions(array $data) { return null !== $this->resolutionManager ? $this->resolutionManager->solveResolutions($data) : $data; }
php
public function solveResolutions(array $data) { return null !== $this->resolutionManager ? $this->resolutionManager->solveResolutions($data) : $data; }
[ "public", "function", "solveResolutions", "(", "array", "$", "data", ")", "{", "return", "null", "!==", "$", "this", "->", "resolutionManager", "?", "$", "this", "->", "resolutionManager", "->", "solveResolutions", "(", "$", "data", ")", ":", "$", "data", ...
Solve the dependency resolutions. @param array $data @return array
[ "Solve", "the", "dependency", "resolutions", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetRepositoryManager.php#L140-L145
fxpio/composer-asset-plugin
Repository/AssetRepositoryManager.php
AssetRepositoryManager.addRepositories
public function addRepositories(array $repositories) { foreach ($repositories as $index => $repo) { $this->validateRepositories($index, $repo); if ('package' === $repo['type']) { $name = $repo['package']['name']; } else { $name = \is_int($index) ? preg_replace('{^https?://}i', '', $repo['url']) : $index; $name = isset($repo['name']) ? $repo['name'] : $name; $repo['asset-repository-manager'] = $this; $repo['vcs-package-filter'] = $this->packageFilter; } $repoInstance = Util::addRepository($this->io, $this->rm, $this->repositories, $name, $repo, $this->pool); if (null === $this->pool && $repoInstance instanceof RepositoryInterface) { $this->poolRepositories[] = $repoInstance; } } }
php
public function addRepositories(array $repositories) { foreach ($repositories as $index => $repo) { $this->validateRepositories($index, $repo); if ('package' === $repo['type']) { $name = $repo['package']['name']; } else { $name = \is_int($index) ? preg_replace('{^https?://}i', '', $repo['url']) : $index; $name = isset($repo['name']) ? $repo['name'] : $name; $repo['asset-repository-manager'] = $this; $repo['vcs-package-filter'] = $this->packageFilter; } $repoInstance = Util::addRepository($this->io, $this->rm, $this->repositories, $name, $repo, $this->pool); if (null === $this->pool && $repoInstance instanceof RepositoryInterface) { $this->poolRepositories[] = $repoInstance; } } }
[ "public", "function", "addRepositories", "(", "array", "$", "repositories", ")", "{", "foreach", "(", "$", "repositories", "as", "$", "index", "=>", "$", "repo", ")", "{", "$", "this", "->", "validateRepositories", "(", "$", "index", ",", "$", "repo", ")...
Adds asset vcs repositories. @param array $repositories The repositories @throws \UnexpectedValueException When config of repository is not an array @throws \UnexpectedValueException When the config of repository has not a type defined @throws \UnexpectedValueException When the config of repository has an invalid type
[ "Adds", "asset", "vcs", "repositories", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetRepositoryManager.php#L156-L176
fxpio/composer-asset-plugin
Repository/AssetRepositoryManager.php
AssetRepositoryManager.validateRepositories
protected function validateRepositories($index, $repo) { if (!\is_array($repo)) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') should be an array, '.\gettype($repo).' given'); } if (!isset($repo['type'])) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a type defined'); } $this->validatePackageRepositories($index, $repo); $this->validateVcsRepositories($index, $repo); }
php
protected function validateRepositories($index, $repo) { if (!\is_array($repo)) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') should be an array, '.\gettype($repo).' given'); } if (!isset($repo['type'])) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a type defined'); } $this->validatePackageRepositories($index, $repo); $this->validateVcsRepositories($index, $repo); }
[ "protected", "function", "validateRepositories", "(", "$", "index", ",", "$", "repo", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "repo", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "'Repository '", ".", "$", "index", ...
Validates the config of repositories. @param int|string $index The index @param array|mixed $repo The config repo @throws \UnexpectedValueException
[ "Validates", "the", "config", "of", "repositories", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetRepositoryManager.php#L186-L197
fxpio/composer-asset-plugin
Repository/AssetRepositoryManager.php
AssetRepositoryManager.validatePackageRepositories
protected function validatePackageRepositories($index, $repo) { if ('package' !== $repo['type']) { return; } if (!isset($repo['package'])) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a package definition"'); } foreach (array('name', 'type', 'version', 'dist') as $key) { if (!isset($repo['package'][$key])) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have the "'.$key.'" key in the package definition"'); } } }
php
protected function validatePackageRepositories($index, $repo) { if ('package' !== $repo['type']) { return; } if (!isset($repo['package'])) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a package definition"'); } foreach (array('name', 'type', 'version', 'dist') as $key) { if (!isset($repo['package'][$key])) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have the "'.$key.'" key in the package definition"'); } } }
[ "protected", "function", "validatePackageRepositories", "(", "$", "index", ",", "$", "repo", ")", "{", "if", "(", "'package'", "!==", "$", "repo", "[", "'type'", "]", ")", "{", "return", ";", "}", "if", "(", "!", "isset", "(", "$", "repo", "[", "'pac...
Validates the config of package repositories. @param int|string $index The index @param array|mixed $repo The config repo @throws \UnexpectedValueException
[ "Validates", "the", "config", "of", "package", "repositories", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetRepositoryManager.php#L207-L222
fxpio/composer-asset-plugin
Repository/AssetRepositoryManager.php
AssetRepositoryManager.validateVcsRepositories
protected function validateVcsRepositories($index, $repo) { if ('package' === $repo['type']) { return; } if (false === strpos($repo['type'], '-')) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a type defined in this way: "%asset-type%-%type%"'); } if (!isset($repo['url'])) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a url defined'); } }
php
protected function validateVcsRepositories($index, $repo) { if ('package' === $repo['type']) { return; } if (false === strpos($repo['type'], '-')) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a type defined in this way: "%asset-type%-%type%"'); } if (!isset($repo['url'])) { throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a url defined'); } }
[ "protected", "function", "validateVcsRepositories", "(", "$", "index", ",", "$", "repo", ")", "{", "if", "(", "'package'", "===", "$", "repo", "[", "'type'", "]", ")", "{", "return", ";", "}", "if", "(", "false", "===", "strpos", "(", "$", "repo", "[...
Validates the config of vcs repositories. @param int|string $index The index @param array|mixed $repo The config repo @throws \UnexpectedValueException
[ "Validates", "the", "config", "of", "vcs", "repositories", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetRepositoryManager.php#L232-L244
fxpio/composer-asset-plugin
Converter/NpmPackageConverter.php
NpmPackageConverter.getMapKeys
protected function getMapKeys() { $assetType = $this->assetType; return array( 'name' => array('name', function ($value) use ($assetType) { return $assetType->formatComposerName(NpmPackageUtil::convertName($value)); }), 'type' => array('type', function () use ($assetType) { return $assetType->getComposerType(); }), 'version' => array('version', function ($value) use ($assetType) { return $assetType->getVersionConverter()->convertVersion($value); }), 'version_normalized' => 'version_normalized', 'description' => 'description', 'keywords' => 'keywords', 'homepage' => 'homepage', 'license' => array('license', function ($value) { return NpmPackageUtil::convertLicenses($value); }), 'time' => 'time', 'author' => array('authors', function ($value) { return NpmPackageUtil::convertAuthor($value); }), 'contributors' => array('authors', function ($value, $prevValue) { return NpmPackageUtil::convertContributors($value, $prevValue); }), 'bin' => array('bin', function ($value) { return (array) $value; }), 'dist' => array('dist', function ($value) { return NpmPackageUtil::convertDist($value); }), ); }
php
protected function getMapKeys() { $assetType = $this->assetType; return array( 'name' => array('name', function ($value) use ($assetType) { return $assetType->formatComposerName(NpmPackageUtil::convertName($value)); }), 'type' => array('type', function () use ($assetType) { return $assetType->getComposerType(); }), 'version' => array('version', function ($value) use ($assetType) { return $assetType->getVersionConverter()->convertVersion($value); }), 'version_normalized' => 'version_normalized', 'description' => 'description', 'keywords' => 'keywords', 'homepage' => 'homepage', 'license' => array('license', function ($value) { return NpmPackageUtil::convertLicenses($value); }), 'time' => 'time', 'author' => array('authors', function ($value) { return NpmPackageUtil::convertAuthor($value); }), 'contributors' => array('authors', function ($value, $prevValue) { return NpmPackageUtil::convertContributors($value, $prevValue); }), 'bin' => array('bin', function ($value) { return (array) $value; }), 'dist' => array('dist', function ($value) { return NpmPackageUtil::convertDist($value); }), ); }
[ "protected", "function", "getMapKeys", "(", ")", "{", "$", "assetType", "=", "$", "this", "->", "assetType", ";", "return", "array", "(", "'name'", "=>", "array", "(", "'name'", ",", "function", "(", "$", "value", ")", "use", "(", "$", "assetType", ")"...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/NpmPackageConverter.php#L24-L59
fxpio/composer-asset-plugin
Converter/NpmPackageConverter.php
NpmPackageConverter.convertDependency
protected function convertDependency($dependency, $version, array &$vcsRepos, array $composer) { $dependency = NpmPackageUtil::convertName($dependency); return parent::convertDependency($dependency, $version, $vcsRepos, $composer); }
php
protected function convertDependency($dependency, $version, array &$vcsRepos, array $composer) { $dependency = NpmPackageUtil::convertName($dependency); return parent::convertDependency($dependency, $version, $vcsRepos, $composer); }
[ "protected", "function", "convertDependency", "(", "$", "dependency", ",", "$", "version", ",", "array", "&", "$", "vcsRepos", ",", "array", "$", "composer", ")", "{", "$", "dependency", "=", "NpmPackageUtil", "::", "convertName", "(", "$", "dependency", ")"...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/NpmPackageConverter.php#L90-L95
fxpio/composer-asset-plugin
Repository/Vcs/Util.php
Util.readCache
public static function readCache(array $cacheCode, Cache $cache, $type, $identifier, $force = false) { if (\array_key_exists($identifier, $cacheCode)) { return $cacheCode[$identifier]; } $data = null; if (self::isSha($identifier) || $force) { $res = $cache->read($type.'-'.$identifier); if ($res) { $data = JsonFile::parseJson($res); } } return $data; }
php
public static function readCache(array $cacheCode, Cache $cache, $type, $identifier, $force = false) { if (\array_key_exists($identifier, $cacheCode)) { return $cacheCode[$identifier]; } $data = null; if (self::isSha($identifier) || $force) { $res = $cache->read($type.'-'.$identifier); if ($res) { $data = JsonFile::parseJson($res); } } return $data; }
[ "public", "static", "function", "readCache", "(", "array", "$", "cacheCode", ",", "Cache", "$", "cache", ",", "$", "type", ",", "$", "identifier", ",", "$", "force", "=", "false", ")", "{", "if", "(", "\\", "array_key_exists", "(", "$", "identifier", "...
@param array $cacheCode The cache code @param Cache $cache The cache filesystem @param string $type The asset type @param string $identifier The identifier @param bool $force Force the read @return null|array
[ "@param", "array", "$cacheCode", "The", "cache", "code", "@param", "Cache", "$cache", "The", "cache", "filesystem", "@param", "string", "$type", "The", "asset", "type", "@param", "string", "$identifier", "The", "identifier", "@param", "bool", "$force", "Force", ...
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/Util.php#L46-L62
fxpio/composer-asset-plugin
Repository/Vcs/Util.php
Util.addComposerTime
public static function addComposerTime(array $composer, $resourceKey, $resource, VcsDriverInterface $driver, $method = 'getContents') { if (!isset($composer['time'])) { $ref = new \ReflectionClass($driver); $meth = $ref->getMethod($method); $meth->setAccessible(true); $commit = JsonFile::parseJson($meth->invoke($driver, $resource), $resource); $keys = explode('.', $resourceKey); while (!empty($keys)) { $commit = $commit[$keys[0]]; array_shift($keys); } $composer['time'] = $commit; } return $composer; }
php
public static function addComposerTime(array $composer, $resourceKey, $resource, VcsDriverInterface $driver, $method = 'getContents') { if (!isset($composer['time'])) { $ref = new \ReflectionClass($driver); $meth = $ref->getMethod($method); $meth->setAccessible(true); $commit = JsonFile::parseJson($meth->invoke($driver, $resource), $resource); $keys = explode('.', $resourceKey); while (!empty($keys)) { $commit = $commit[$keys[0]]; array_shift($keys); } $composer['time'] = $commit; } return $composer; }
[ "public", "static", "function", "addComposerTime", "(", "array", "$", "composer", ",", "$", "resourceKey", ",", "$", "resource", ",", "VcsDriverInterface", "$", "driver", ",", "$", "method", "=", "'getContents'", ")", "{", "if", "(", "!", "isset", "(", "$"...
Add time in composer. @param array $composer The composer @param string $resourceKey The composer key @param string $resource The resource url @param VcsDriverInterface $driver The vcs driver @param string $method The method for get content @return array The composer
[ "Add", "time", "in", "composer", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/Util.php#L89-L108
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.getBranches
public function getBranches() { if ($this->gitDriver) { return $this->gitDriver->getBranches(); } if (null === $this->branches) { $this->branches = array(); $resource = $this->getApiUrl().'/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100'; $branchBlacklist = 'gh-pages' === $this->getRootIdentifier() ? array() : array('gh-pages'); $this->doAddBranches($resource, $branchBlacklist); } return $this->branches; }
php
public function getBranches() { if ($this->gitDriver) { return $this->gitDriver->getBranches(); } if (null === $this->branches) { $this->branches = array(); $resource = $this->getApiUrl().'/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100'; $branchBlacklist = 'gh-pages' === $this->getRootIdentifier() ? array() : array('gh-pages'); $this->doAddBranches($resource, $branchBlacklist); } return $this->branches; }
[ "public", "function", "getBranches", "(", ")", "{", "if", "(", "$", "this", "->", "gitDriver", ")", "{", "return", "$", "this", "->", "gitDriver", "->", "getBranches", "(", ")", ";", "}", "if", "(", "null", "===", "$", "this", "->", "branches", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L49-L64
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.getNoApiOption
protected function getNoApiOption() { $packageName = $this->repoConfig['package-name']; $opts = RepoUtil::getArrayValue($this->repoConfig, 'vcs-driver-options', array()); $noApiOpt = RepoUtil::getArrayValue($opts, 'github-no-api', array()); $defaultValue = false; if (\is_bool($noApiOpt)) { $defaultValue = $noApiOpt; $noApiOpt = array(); } $noApiOpt['default'] = (bool) RepoUtil::getArrayValue($noApiOpt, 'default', $defaultValue); $noApiOpt['packages'] = (array) RepoUtil::getArrayValue($noApiOpt, 'packages', array()); return (bool) RepoUtil::getArrayValue($noApiOpt['packages'], $packageName, $defaultValue); }
php
protected function getNoApiOption() { $packageName = $this->repoConfig['package-name']; $opts = RepoUtil::getArrayValue($this->repoConfig, 'vcs-driver-options', array()); $noApiOpt = RepoUtil::getArrayValue($opts, 'github-no-api', array()); $defaultValue = false; if (\is_bool($noApiOpt)) { $defaultValue = $noApiOpt; $noApiOpt = array(); } $noApiOpt['default'] = (bool) RepoUtil::getArrayValue($noApiOpt, 'default', $defaultValue); $noApiOpt['packages'] = (array) RepoUtil::getArrayValue($noApiOpt, 'packages', array()); return (bool) RepoUtil::getArrayValue($noApiOpt['packages'], $packageName, $defaultValue); }
[ "protected", "function", "getNoApiOption", "(", ")", "{", "$", "packageName", "=", "$", "this", "->", "repoConfig", "[", "'package-name'", "]", ";", "$", "opts", "=", "RepoUtil", "::", "getArrayValue", "(", "$", "this", "->", "repoConfig", ",", "'vcs-driver-...
Get the no-api repository option. @return bool
[ "Get", "the", "no", "-", "api", "repository", "option", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L71-L87
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.getContents
protected function getContents($url, $fetchingRepoData = false) { $url = $this->getValidContentUrl($url); if (null !== $this->redirectApi) { return parent::getContents($url, $fetchingRepoData); } try { $contents = $this->getRemoteContents($url); $this->redirectApi = false; return $contents; } catch (TransportException $e) { if ($this->hasRedirectUrl($url)) { $url = $this->getValidContentUrl($url); } return parent::getContents($url, $fetchingRepoData); } }
php
protected function getContents($url, $fetchingRepoData = false) { $url = $this->getValidContentUrl($url); if (null !== $this->redirectApi) { return parent::getContents($url, $fetchingRepoData); } try { $contents = $this->getRemoteContents($url); $this->redirectApi = false; return $contents; } catch (TransportException $e) { if ($this->hasRedirectUrl($url)) { $url = $this->getValidContentUrl($url); } return parent::getContents($url, $fetchingRepoData); } }
[ "protected", "function", "getContents", "(", "$", "url", ",", "$", "fetchingRepoData", "=", "false", ")", "{", "$", "url", "=", "$", "this", "->", "getValidContentUrl", "(", "$", "url", ")", ";", "if", "(", "null", "!==", "$", "this", "->", "redirectAp...
Get the remote content. @param string $url The URL of content @param bool $fetchingRepoData Fetching the repo data or not @return mixed The result
[ "Get", "the", "remote", "content", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L97-L117
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.getValidContentUrl
protected function getValidContentUrl($url) { if (null === $this->redirectApi && false !== $redirectApi = $this->cache->read('redirect-api')) { $this->redirectApi = $redirectApi; } if (\is_string($this->redirectApi) && 0 === strpos($url, $this->getRepositoryApiUrl())) { $url = $this->redirectApi.substr($url, \strlen($this->getRepositoryApiUrl())); } return $url; }
php
protected function getValidContentUrl($url) { if (null === $this->redirectApi && false !== $redirectApi = $this->cache->read('redirect-api')) { $this->redirectApi = $redirectApi; } if (\is_string($this->redirectApi) && 0 === strpos($url, $this->getRepositoryApiUrl())) { $url = $this->redirectApi.substr($url, \strlen($this->getRepositoryApiUrl())); } return $url; }
[ "protected", "function", "getValidContentUrl", "(", "$", "url", ")", "{", "if", "(", "null", "===", "$", "this", "->", "redirectApi", "&&", "false", "!==", "$", "redirectApi", "=", "$", "this", "->", "cache", "->", "read", "(", "'redirect-api'", ")", ")"...
@param string $url The url @return string The url redirected
[ "@param", "string", "$url", "The", "url" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L124-L135
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.hasRedirectUrl
protected function hasRedirectUrl($url) { if (null === $this->redirectApi && 0 === strpos($url, $this->getRepositoryApiUrl())) { $this->redirectApi = $this->getNewRepositoryUrl(); if (\is_string($this->redirectApi)) { $this->cache->write('redirect-api', $this->redirectApi); } } return \is_string($this->redirectApi); }
php
protected function hasRedirectUrl($url) { if (null === $this->redirectApi && 0 === strpos($url, $this->getRepositoryApiUrl())) { $this->redirectApi = $this->getNewRepositoryUrl(); if (\is_string($this->redirectApi)) { $this->cache->write('redirect-api', $this->redirectApi); } } return \is_string($this->redirectApi); }
[ "protected", "function", "hasRedirectUrl", "(", "$", "url", ")", "{", "if", "(", "null", "===", "$", "this", "->", "redirectApi", "&&", "0", "===", "strpos", "(", "$", "url", ",", "$", "this", "->", "getRepositoryApiUrl", "(", ")", ")", ")", "{", "$"...
Check if the driver must find the new url. @param string $url The url @return bool
[ "Check", "if", "the", "driver", "must", "find", "the", "new", "url", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L144-L155
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.getNewRepositoryUrl
protected function getNewRepositoryUrl() { try { $this->getRemoteContents($this->getRepositoryUrl()); $headers = $this->remoteFilesystem->getLastHeaders(); if (!empty($headers[0]) && preg_match('{^HTTP/\S+ (30[1278])}i', $headers[0], $match)) { array_shift($headers); return $this->findNewLocationInHeader($headers); } return false; } catch (\Exception $ex) { return false; } }
php
protected function getNewRepositoryUrl() { try { $this->getRemoteContents($this->getRepositoryUrl()); $headers = $this->remoteFilesystem->getLastHeaders(); if (!empty($headers[0]) && preg_match('{^HTTP/\S+ (30[1278])}i', $headers[0], $match)) { array_shift($headers); return $this->findNewLocationInHeader($headers); } return false; } catch (\Exception $ex) { return false; } }
[ "protected", "function", "getNewRepositoryUrl", "(", ")", "{", "try", "{", "$", "this", "->", "getRemoteContents", "(", "$", "this", "->", "getRepositoryUrl", "(", ")", ")", ";", "$", "headers", "=", "$", "this", "->", "remoteFilesystem", "->", "getLastHeade...
Get the new url of repository. @return false|string The new url or false if there is not a new url
[ "Get", "the", "new", "url", "of", "repository", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L162-L178
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.findNewLocationInHeader
protected function findNewLocationInHeader(array $headers) { $url = false; foreach ($headers as $header) { if (0 === strpos($header, 'Location:')) { $newUrl = trim(substr($header, 9)); preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $newUrl, $match); $owner = $match[3]; $repository = $match[4]; $paramPos = strpos($repository, '?'); $repository = \is_int($paramPos) ? substr($match[4], 0, $paramPos) : $repository; $url = $this->getRepositoryApiUrl($owner, $repository); break; } } return $url; }
php
protected function findNewLocationInHeader(array $headers) { $url = false; foreach ($headers as $header) { if (0 === strpos($header, 'Location:')) { $newUrl = trim(substr($header, 9)); preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $newUrl, $match); $owner = $match[3]; $repository = $match[4]; $paramPos = strpos($repository, '?'); $repository = \is_int($paramPos) ? substr($match[4], 0, $paramPos) : $repository; $url = $this->getRepositoryApiUrl($owner, $repository); break; } } return $url; }
[ "protected", "function", "findNewLocationInHeader", "(", "array", "$", "headers", ")", "{", "$", "url", "=", "false", ";", "foreach", "(", "$", "headers", "as", "$", "header", ")", "{", "if", "(", "0", "===", "strpos", "(", "$", "header", ",", "'Locati...
Find the new url api in the header. @param array $headers The http header @return false|string
[ "Find", "the", "new", "url", "api", "in", "the", "header", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L187-L206
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.getRepositoryApiUrl
protected function getRepositoryApiUrl($owner = null, $repository = null) { $owner = null !== $owner ? $owner : $this->owner; $repository = null !== $repository ? $repository : $this->repository; return $this->getApiUrl().'/repos/'.$owner.'/'.$repository; }
php
protected function getRepositoryApiUrl($owner = null, $repository = null) { $owner = null !== $owner ? $owner : $this->owner; $repository = null !== $repository ? $repository : $this->repository; return $this->getApiUrl().'/repos/'.$owner.'/'.$repository; }
[ "protected", "function", "getRepositoryApiUrl", "(", "$", "owner", "=", "null", ",", "$", "repository", "=", "null", ")", "{", "$", "owner", "=", "null", "!==", "$", "owner", "?", "$", "owner", ":", "$", "this", "->", "owner", ";", "$", "repository", ...
Get the url API of the repository. @param string $owner @param string $repository @return string
[ "Get", "the", "url", "API", "of", "the", "repository", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L216-L222
fxpio/composer-asset-plugin
Repository/Vcs/AbstractGitHubDriver.php
AbstractGitHubDriver.doAddBranches
protected function doAddBranches($resource, array $branchBlacklist) { do { $branchData = JsonFile::parseJson((string) $this->getContents($resource), $resource); foreach ($branchData as $branch) { $name = substr($branch['ref'], 11); if (!\in_array($name, $branchBlacklist, true)) { $this->branches[$name] = $branch['object']['sha']; } } $resource = $this->getNextPage(); } while ($resource); }
php
protected function doAddBranches($resource, array $branchBlacklist) { do { $branchData = JsonFile::parseJson((string) $this->getContents($resource), $resource); foreach ($branchData as $branch) { $name = substr($branch['ref'], 11); if (!\in_array($name, $branchBlacklist, true)) { $this->branches[$name] = $branch['object']['sha']; } } $resource = $this->getNextPage(); } while ($resource); }
[ "protected", "function", "doAddBranches", "(", "$", "resource", ",", "array", "$", "branchBlacklist", ")", "{", "do", "{", "$", "branchData", "=", "JsonFile", "::", "parseJson", "(", "(", "string", ")", "$", "this", "->", "getContents", "(", "$", "resource...
Push the list of all branch. @param string $resource @param array $branchBlacklist
[ "Push", "the", "list", "of", "all", "branch", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/AbstractGitHubDriver.php#L242-L257
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.convertVersion
public function convertVersion($version) { if (\in_array($version, array(null, '', 'latest'), true)) { return ('latest' === $version ? 'default || ' : '').'*'; } $version = str_replace('–', '-', $version); $prefix = preg_match('/^[a-z]/', $version) && 0 !== strpos($version, 'dev-') ? substr($version, 0, 1) : ''; $version = substr($version, \strlen($prefix)); $version = SemverUtil::convertVersionMetadata($version); $version = SemverUtil::convertDateVersion($version); return $prefix.$version; }
php
public function convertVersion($version) { if (\in_array($version, array(null, '', 'latest'), true)) { return ('latest' === $version ? 'default || ' : '').'*'; } $version = str_replace('–', '-', $version); $prefix = preg_match('/^[a-z]/', $version) && 0 !== strpos($version, 'dev-') ? substr($version, 0, 1) : ''; $version = substr($version, \strlen($prefix)); $version = SemverUtil::convertVersionMetadata($version); $version = SemverUtil::convertDateVersion($version); return $prefix.$version; }
[ "public", "function", "convertVersion", "(", "$", "version", ")", "{", "if", "(", "\\", "in_array", "(", "$", "version", ",", "array", "(", "null", ",", "''", ",", "'latest'", ")", ",", "true", ")", ")", "{", "return", "(", "'latest'", "===", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L24-L37
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.convertRange
public function convertRange($range) { $range = $this->cleanRange(strtolower($range)); return $this->matchRange($range); }
php
public function convertRange($range) { $range = $this->cleanRange(strtolower($range)); return $this->matchRange($range); }
[ "public", "function", "convertRange", "(", "$", "range", ")", "{", "$", "range", "=", "$", "this", "->", "cleanRange", "(", "strtolower", "(", "$", "range", ")", ")", ";", "return", "$", "this", "->", "matchRange", "(", "$", "range", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L42-L47
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.cleanRange
protected function cleanRange($range) { foreach (array('<', '>', '=', '~', '^', '||', '&&') as $character) { $range = str_replace($character.' ', $character, $range); } $range = preg_replace('/(?:[vV])(\d+)/', '${1}', $range); $range = str_replace(' ||', '||', $range); return str_replace(array(' &&', '&&'), ',', $range); }
php
protected function cleanRange($range) { foreach (array('<', '>', '=', '~', '^', '||', '&&') as $character) { $range = str_replace($character.' ', $character, $range); } $range = preg_replace('/(?:[vV])(\d+)/', '${1}', $range); $range = str_replace(' ||', '||', $range); return str_replace(array(' &&', '&&'), ',', $range); }
[ "protected", "function", "cleanRange", "(", "$", "range", ")", "{", "foreach", "(", "array", "(", "'<'", ",", "'>'", ",", "'='", ",", "'~'", ",", "'^'", ",", "'||'", ",", "'&&'", ")", "as", "$", "character", ")", "{", "$", "range", "=", "str_replac...
Clean the raw range. @param string $range @return string
[ "Clean", "the", "raw", "range", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L56-L66
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.matchRange
protected function matchRange($range) { $pattern = '/(\ -\ )|(<)|(>)|(=)|(\|\|)|(\ )|(,)|(\~)|(\^)/'; $matches = preg_split($pattern, $range, -1, PREG_SPLIT_DELIM_CAPTURE); $special = null; $replace = null; $first = true; foreach ($matches as $i => $match) { if ($first && '' !== $match) { $first = false; $match = '=' === $match ? 'EQUAL' : $match; } $this->matchRangeToken($i, $match, $matches, $special, $replace); } return implode('', $matches); }
php
protected function matchRange($range) { $pattern = '/(\ -\ )|(<)|(>)|(=)|(\|\|)|(\ )|(,)|(\~)|(\^)/'; $matches = preg_split($pattern, $range, -1, PREG_SPLIT_DELIM_CAPTURE); $special = null; $replace = null; $first = true; foreach ($matches as $i => $match) { if ($first && '' !== $match) { $first = false; $match = '=' === $match ? 'EQUAL' : $match; } $this->matchRangeToken($i, $match, $matches, $special, $replace); } return implode('', $matches); }
[ "protected", "function", "matchRange", "(", "$", "range", ")", "{", "$", "pattern", "=", "'/(\\ -\\ )|(<)|(>)|(=)|(\\|\\|)|(\\ )|(,)|(\\~)|(\\^)/'", ";", "$", "matches", "=", "preg_split", "(", "$", "pattern", ",", "$", "range", ",", "-", "1", ",", "PREG_SPLIT_D...
Match the range. @param string $range The range cleaned @return string The range
[ "Match", "the", "range", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L75-L93
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.matchRangeToken
protected function matchRangeToken($i, $match, array &$matches, &$special, &$replace) { if (' - ' === $match) { $matches[$i - 1] = '>='.str_replace(array('*', 'x', 'X'), '0', $matches[$i - 1]); if (false !== strpos($matches[$i + 1], '.') && false === strpos($matches[$i + 1], '*') && false === strpos($matches[$i + 1], 'x') && false === strpos($matches[$i + 1], 'X')) { $matches[$i] = ',<='; } else { $matches[$i] = ',<'; $special = ',<~'; } } else { $this->matchRangeTokenStep2($i, $match, $matches, $special, $replace); } }
php
protected function matchRangeToken($i, $match, array &$matches, &$special, &$replace) { if (' - ' === $match) { $matches[$i - 1] = '>='.str_replace(array('*', 'x', 'X'), '0', $matches[$i - 1]); if (false !== strpos($matches[$i + 1], '.') && false === strpos($matches[$i + 1], '*') && false === strpos($matches[$i + 1], 'x') && false === strpos($matches[$i + 1], 'X')) { $matches[$i] = ',<='; } else { $matches[$i] = ',<'; $special = ',<~'; } } else { $this->matchRangeTokenStep2($i, $match, $matches, $special, $replace); } }
[ "protected", "function", "matchRangeToken", "(", "$", "i", ",", "$", "match", ",", "array", "&", "$", "matches", ",", "&", "$", "special", ",", "&", "$", "replace", ")", "{", "if", "(", "' - '", "===", "$", "match", ")", "{", "$", "matches", "[", ...
Converts the token of the matched range. @param int $i @param string $match @param array $matches @param null|string $special @param null|string $replace
[ "Converts", "the", "token", "of", "the", "matched", "range", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L104-L119
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.matchRangeTokenStep2
protected function matchRangeTokenStep2($i, $match, array &$matches, &$special, &$replace) { if (\in_array($match, array('', '<', '>', '=', ','), true)) { $replace = \in_array($match, array('<', '>'), true) ? $match : $replace; $matches[$i] = '~' === $special && \in_array($replace, array('<', '>'), true) ? '' : $matches[$i]; } elseif ('~' === $match) { $special = $match; } elseif (\in_array($match, array('EQUAL', '^'), true)) { $special = $match; $matches[$i] = ''; } else { $this->matchRangeTokenStep3($i, $match, $matches, $special, $replace); } }
php
protected function matchRangeTokenStep2($i, $match, array &$matches, &$special, &$replace) { if (\in_array($match, array('', '<', '>', '=', ','), true)) { $replace = \in_array($match, array('<', '>'), true) ? $match : $replace; $matches[$i] = '~' === $special && \in_array($replace, array('<', '>'), true) ? '' : $matches[$i]; } elseif ('~' === $match) { $special = $match; } elseif (\in_array($match, array('EQUAL', '^'), true)) { $special = $match; $matches[$i] = ''; } else { $this->matchRangeTokenStep3($i, $match, $matches, $special, $replace); } }
[ "protected", "function", "matchRangeTokenStep2", "(", "$", "i", ",", "$", "match", ",", "array", "&", "$", "matches", ",", "&", "$", "special", ",", "&", "$", "replace", ")", "{", "if", "(", "\\", "in_array", "(", "$", "match", ",", "array", "(", "...
Step2: Converts the token of the matched range. @param int $i @param string $match @param array $matches @param null|string $special @param null|string $replace
[ "Step2", ":", "Converts", "the", "token", "of", "the", "matched", "range", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L130-L143
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.matchRangeTokenStep3
protected function matchRangeTokenStep3($i, $match, array &$matches, &$special, &$replace) { if (' ' === $match) { $matches[$i] = ','; } elseif ('||' === $match) { $matches[$i] = '|'; } elseif (\in_array($special, array('^'), true)) { $matches[$i] = SemverRangeUtil::replaceSpecialRange($this, $match); $special = null; } else { $this->matchRangeTokenStep4($i, $match, $matches, $special, $replace); } }
php
protected function matchRangeTokenStep3($i, $match, array &$matches, &$special, &$replace) { if (' ' === $match) { $matches[$i] = ','; } elseif ('||' === $match) { $matches[$i] = '|'; } elseif (\in_array($special, array('^'), true)) { $matches[$i] = SemverRangeUtil::replaceSpecialRange($this, $match); $special = null; } else { $this->matchRangeTokenStep4($i, $match, $matches, $special, $replace); } }
[ "protected", "function", "matchRangeTokenStep3", "(", "$", "i", ",", "$", "match", ",", "array", "&", "$", "matches", ",", "&", "$", "special", ",", "&", "$", "replace", ")", "{", "if", "(", "' '", "===", "$", "match", ")", "{", "$", "matches", "["...
Step3: Converts the token of the matched range. @param int $i @param string $match @param array $matches @param null|string $special @param null|string $replace
[ "Step3", ":", "Converts", "the", "token", "of", "the", "matched", "range", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L154-L166
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.matchRangeTokenStep4
protected function matchRangeTokenStep4($i, $match, array &$matches, &$special, &$replace) { if (',<~' === $special) { // Version range contains x in last place. $match .= (false === strpos($match, '.') ? '.x' : ''); $version = explode('.', $match); $change = \count($version) - 2; $version[$change] = (int) ($version[$change]) + 1; $match = str_replace(array('*', 'x', 'X'), '0', implode('.', $version)); } elseif (null === $special && 0 === $i && false === strpos($match, '.') && is_numeric($match)) { $match = isset($matches[$i + 1]) && (' - ' === $matches[$i + 1] || '-' === $matches[$i + 1]) ? $match : '~'.$match; } else { $match = '~' === $special ? str_replace(array('*', 'x', 'X'), '0', $match) : $match; } $this->matchRangeTokenStep5($i, $match, $matches, $special, $replace); }
php
protected function matchRangeTokenStep4($i, $match, array &$matches, &$special, &$replace) { if (',<~' === $special) { // Version range contains x in last place. $match .= (false === strpos($match, '.') ? '.x' : ''); $version = explode('.', $match); $change = \count($version) - 2; $version[$change] = (int) ($version[$change]) + 1; $match = str_replace(array('*', 'x', 'X'), '0', implode('.', $version)); } elseif (null === $special && 0 === $i && false === strpos($match, '.') && is_numeric($match)) { $match = isset($matches[$i + 1]) && (' - ' === $matches[$i + 1] || '-' === $matches[$i + 1]) ? $match : '~'.$match; } else { $match = '~' === $special ? str_replace(array('*', 'x', 'X'), '0', $match) : $match; } $this->matchRangeTokenStep5($i, $match, $matches, $special, $replace); }
[ "protected", "function", "matchRangeTokenStep4", "(", "$", "i", ",", "$", "match", ",", "array", "&", "$", "matches", ",", "&", "$", "special", ",", "&", "$", "replace", ")", "{", "if", "(", "',<~'", "===", "$", "special", ")", "{", "// Version range c...
Step4: Converts the token of the matched range. @param int $i @param string $match @param array $matches @param null|string $special @param null|string $replace
[ "Step4", ":", "Converts", "the", "token", "of", "the", "matched", "range", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L177-L195
fxpio/composer-asset-plugin
Converter/SemverConverter.php
SemverConverter.matchRangeTokenStep5
protected function matchRangeTokenStep5($i, $match, array &$matches, &$special, &$replace) { $matches[$i] = $this->convertVersion($match); $matches[$i] = $replace ? SemverUtil::replaceAlias($matches[$i], $replace) : $matches[$i]; $matches[$i] .= '~' === $special && \in_array($replace, array('<', '>'), true) ? ','.$replace.$matches[$i] : ''; $special = null; $replace = null; }
php
protected function matchRangeTokenStep5($i, $match, array &$matches, &$special, &$replace) { $matches[$i] = $this->convertVersion($match); $matches[$i] = $replace ? SemverUtil::replaceAlias($matches[$i], $replace) : $matches[$i]; $matches[$i] .= '~' === $special && \in_array($replace, array('<', '>'), true) ? ','.$replace.$matches[$i] : ''; $special = null; $replace = null; }
[ "protected", "function", "matchRangeTokenStep5", "(", "$", "i", ",", "$", "match", ",", "array", "&", "$", "matches", ",", "&", "$", "special", ",", "&", "$", "replace", ")", "{", "$", "matches", "[", "$", "i", "]", "=", "$", "this", "->", "convert...
Step5: Converts the token of the matched range. @param int $i @param string $match @param array $matches @param null|string $special @param null|string $replace
[ "Step5", ":", "Converts", "the", "token", "of", "the", "matched", "range", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/SemverConverter.php#L206-L217
fxpio/composer-asset-plugin
Converter/NpmPackageUtil.php
NpmPackageUtil.convertName
public static function convertName($name) { if (0 === strpos($name, '@') && false !== strpos($name, '/')) { $name = ltrim(str_replace('/', '--', $name), '@'); } return $name; }
php
public static function convertName($name) { if (0 === strpos($name, '@') && false !== strpos($name, '/')) { $name = ltrim(str_replace('/', '--', $name), '@'); } return $name; }
[ "public", "static", "function", "convertName", "(", "$", "name", ")", "{", "if", "(", "0", "===", "strpos", "(", "$", "name", ",", "'@'", ")", "&&", "false", "!==", "strpos", "(", "$", "name", ",", "'/'", ")", ")", "{", "$", "name", "=", "ltrim",...
Convert the npm package name. @param string $name The npm package name @return string
[ "Convert", "the", "npm", "package", "name", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/NpmPackageUtil.php#L28-L35
fxpio/composer-asset-plugin
Converter/NpmPackageUtil.php
NpmPackageUtil.convertLicenses
public static function convertLicenses($licenses) { if (!\is_array($licenses)) { return $licenses; } $result = array(); foreach ($licenses as $license) { if (\is_array($license)) { if (!empty($license['type'])) { $result[] = $license['type']; } elseif (!empty($license['name'])) { $result[] = $license['name']; } } else { $result[] = $license; } } return $result; }
php
public static function convertLicenses($licenses) { if (!\is_array($licenses)) { return $licenses; } $result = array(); foreach ($licenses as $license) { if (\is_array($license)) { if (!empty($license['type'])) { $result[] = $license['type']; } elseif (!empty($license['name'])) { $result[] = $license['name']; } } else { $result[] = $license; } } return $result; }
[ "public", "static", "function", "convertLicenses", "(", "$", "licenses", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "licenses", ")", ")", "{", "return", "$", "licenses", ";", "}", "$", "result", "=", "array", "(", ")", ";", "foreach", "(",...
Convert the npm licenses list. @param array|string $licenses The npm package licenses list @return array|string
[ "Convert", "the", "npm", "licenses", "list", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/NpmPackageUtil.php#L60-L80
fxpio/composer-asset-plugin
Converter/NpmPackageUtil.php
NpmPackageUtil.convertContributors
public static function convertContributors($value, $prevValue) { $mergeValue = \is_array($prevValue) ? $prevValue : array(); $mergeValue = array_merge($mergeValue, \is_array($value) ? $value : array()); if (\count($mergeValue) > 0) { $value = $mergeValue; } return $value; }
php
public static function convertContributors($value, $prevValue) { $mergeValue = \is_array($prevValue) ? $prevValue : array(); $mergeValue = array_merge($mergeValue, \is_array($value) ? $value : array()); if (\count($mergeValue) > 0) { $value = $mergeValue; } return $value; }
[ "public", "static", "function", "convertContributors", "(", "$", "value", ",", "$", "prevValue", ")", "{", "$", "mergeValue", "=", "\\", "is_array", "(", "$", "prevValue", ")", "?", "$", "prevValue", ":", "array", "(", ")", ";", "$", "mergeValue", "=", ...
Convert the contributors section. @param null|string $value The current value @param null|string $prevValue The previous value @return array
[ "Convert", "the", "contributors", "section", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/NpmPackageUtil.php#L106-L116
fxpio/composer-asset-plugin
Converter/NpmPackageUtil.php
NpmPackageUtil.convertDist
public static function convertDist($value) { if (\is_array($value)) { $data = (array) $value; $value = array(); foreach ($data as $type => $url) { if (\is_string($url)) { self::convertDistEntry($value, $type, $url); } } } return $value; }
php
public static function convertDist($value) { if (\is_array($value)) { $data = (array) $value; $value = array(); foreach ($data as $type => $url) { if (\is_string($url)) { self::convertDistEntry($value, $type, $url); } } } return $value; }
[ "public", "static", "function", "convertDist", "(", "$", "value", ")", "{", "if", "(", "\\", "is_array", "(", "$", "value", ")", ")", "{", "$", "data", "=", "(", "array", ")", "$", "value", ";", "$", "value", "=", "array", "(", ")", ";", "foreach...
Convert the dist section. @param null|string $value The current value @return array
[ "Convert", "the", "dist", "section", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/NpmPackageUtil.php#L125-L139
fxpio/composer-asset-plugin
Converter/NpmPackageUtil.php
NpmPackageUtil.convertDistEntry
private static function convertDistEntry(array &$value, $type, $url) { $httpPrefix = 'http://'; if (0 === strpos($url, $httpPrefix)) { $url = 'https://'.substr($url, \strlen($httpPrefix)); } if ('shasum' === $type) { $value[$type] = $url; } elseif ('tarball' === $type) { $value['type'] = 'tar'; $value['url'] = $url; } elseif (\in_array($type, self::getDownloaderTypes(), true)) { $value['type'] = $type; $value['url'] = $url; } }
php
private static function convertDistEntry(array &$value, $type, $url) { $httpPrefix = 'http://'; if (0 === strpos($url, $httpPrefix)) { $url = 'https://'.substr($url, \strlen($httpPrefix)); } if ('shasum' === $type) { $value[$type] = $url; } elseif ('tarball' === $type) { $value['type'] = 'tar'; $value['url'] = $url; } elseif (\in_array($type, self::getDownloaderTypes(), true)) { $value['type'] = $type; $value['url'] = $url; } }
[ "private", "static", "function", "convertDistEntry", "(", "array", "&", "$", "value", ",", "$", "type", ",", "$", "url", ")", "{", "$", "httpPrefix", "=", "'http://'", ";", "if", "(", "0", "===", "strpos", "(", "$", "url", ",", "$", "httpPrefix", ")"...
Convert the each entry of dist section. @param array $value The result @param string $type The dist type @param string $url The dist url
[ "Convert", "the", "each", "entry", "of", "dist", "section", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/NpmPackageUtil.php#L148-L165
fxpio/composer-asset-plugin
Repository/Vcs/ProcessUtil.php
ProcessUtil.getComposerInformation
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]; }
php
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]; }
[ "public", "static", "function", "getComposerInformation", "(", "Cache", "$", "cache", ",", "array", "&", "$", "infoCache", ",", "$", "assetType", ",", "ProcessExecutor", "$", "process", ",", "$", "identifier", ",", "$", "resource", ",", "$", "cmdGet", ",", ...
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
[ "Get", "composer", "information", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/ProcessUtil.php#L41-L63
fxpio/composer-asset-plugin
Repository/Vcs/ProcessUtil.php
ProcessUtil.doGetComposerInformation
protected static function doGetComposerInformation($resource, ProcessExecutor $process, $cmdGet, $cmdLog, $repoDir, $datetimePrefix = '') { $process->execute($cmdGet, $composer, $repoDir); if (!trim($composer)) { return array('_nonexistent_package' => true); } $composer = JsonFile::parseJson($composer, $resource); return static::addComposerTime($composer, $process, $cmdLog, $repoDir, $datetimePrefix); }
php
protected static function doGetComposerInformation($resource, ProcessExecutor $process, $cmdGet, $cmdLog, $repoDir, $datetimePrefix = '') { $process->execute($cmdGet, $composer, $repoDir); if (!trim($composer)) { return array('_nonexistent_package' => true); } $composer = JsonFile::parseJson($composer, $resource); return static::addComposerTime($composer, $process, $cmdLog, $repoDir, $datetimePrefix); }
[ "protected", "static", "function", "doGetComposerInformation", "(", "$", "resource", ",", "ProcessExecutor", "$", "process", ",", "$", "cmdGet", ",", "$", "cmdLog", ",", "$", "repoDir", ",", "$", "datetimePrefix", "=", "''", ")", "{", "$", "process", "->", ...
Get composer information. @param string $resource @param ProcessExecutor $process @param string $cmdGet @param string $cmdLog @param string $repoDir @param string $datetimePrefix @return array The composer
[ "Get", "composer", "information", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/ProcessUtil.php#L77-L88
fxpio/composer-asset-plugin
Repository/Vcs/ProcessUtil.php
ProcessUtil.addComposerTime
protected static function addComposerTime(array $composer, ProcessExecutor $process, $cmd, $repoDir, $datetimePrefix = '') { if (!isset($composer['time'])) { $process->execute($cmd, $output, $repoDir); $date = new \DateTime($datetimePrefix.trim($output), new \DateTimeZone('UTC')); $composer['time'] = $date->format('Y-m-d H:i:s'); } return $composer; }
php
protected static function addComposerTime(array $composer, ProcessExecutor $process, $cmd, $repoDir, $datetimePrefix = '') { if (!isset($composer['time'])) { $process->execute($cmd, $output, $repoDir); $date = new \DateTime($datetimePrefix.trim($output), new \DateTimeZone('UTC')); $composer['time'] = $date->format('Y-m-d H:i:s'); } return $composer; }
[ "protected", "static", "function", "addComposerTime", "(", "array", "$", "composer", ",", "ProcessExecutor", "$", "process", ",", "$", "cmd", ",", "$", "repoDir", ",", "$", "datetimePrefix", "=", "''", ")", "{", "if", "(", "!", "isset", "(", "$", "compos...
Add time in composer. @param array $composer @param ProcessExecutor $process @param string $cmd @param string $repoDir @param string $datetimePrefix @return array The composer
[ "Add", "time", "in", "composer", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/ProcessUtil.php#L101-L110
fxpio/composer-asset-plugin
Installer/IgnoreFactory.php
IgnoreFactory.create
public static function create(Config $config, Composer $composer, PackageInterface $package, $installDir = null, $section = 'ignore-files') { $installDir = static::getInstallDir($composer, $package, $installDir); $manager = new IgnoreManager($installDir); $config = $config->getArray($section); foreach ($config as $packageName => $patterns) { if ($packageName === $package->getName()) { static::addPatterns($manager, $patterns); break; } } return $manager; }
php
public static function create(Config $config, Composer $composer, PackageInterface $package, $installDir = null, $section = 'ignore-files') { $installDir = static::getInstallDir($composer, $package, $installDir); $manager = new IgnoreManager($installDir); $config = $config->getArray($section); foreach ($config as $packageName => $patterns) { if ($packageName === $package->getName()) { static::addPatterns($manager, $patterns); break; } } return $manager; }
[ "public", "static", "function", "create", "(", "Config", "$", "config", ",", "Composer", "$", "composer", ",", "PackageInterface", "$", "package", ",", "$", "installDir", "=", "null", ",", "$", "section", "=", "'ignore-files'", ")", "{", "$", "installDir", ...
Create a ignore manager. @param Config $config The plugin config @param Composer $composer The composer instance @param PackageInterface $package The package instance @param null|string $installDir The custom installation directory @param null|string $section The config section of ignore patterns @return IgnoreManager
[ "Create", "a", "ignore", "manager", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Installer/IgnoreFactory.php#L36-L51
fxpio/composer-asset-plugin
Installer/IgnoreFactory.php
IgnoreFactory.getInstallDir
protected static function getInstallDir(Composer $composer, PackageInterface $package, $installDir = null) { if (null === $installDir) { $installDir = rtrim($composer->getConfig()->get('vendor-dir'), '/').'/'.$package->getName(); } return rtrim($installDir, '/'); }
php
protected static function getInstallDir(Composer $composer, PackageInterface $package, $installDir = null) { if (null === $installDir) { $installDir = rtrim($composer->getConfig()->get('vendor-dir'), '/').'/'.$package->getName(); } return rtrim($installDir, '/'); }
[ "protected", "static", "function", "getInstallDir", "(", "Composer", "$", "composer", ",", "PackageInterface", "$", "package", ",", "$", "installDir", "=", "null", ")", "{", "if", "(", "null", "===", "$", "installDir", ")", "{", "$", "installDir", "=", "rt...
Get the installation directory of the package. @param Composer $composer The composer instance @param PackageInterface $package The package instance @param null|string $installDir The custom installation directory @return string The installation directory
[ "Get", "the", "installation", "directory", "of", "the", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Installer/IgnoreFactory.php#L62-L69
fxpio/composer-asset-plugin
Installer/IgnoreFactory.php
IgnoreFactory.addPatterns
protected static function addPatterns(IgnoreManager $manager, $patterns) { $enabled = false === $patterns ? false : true; $manager->setEnabled($enabled); if (\is_array($patterns)) { foreach ($patterns as $pattern) { $manager->addPattern($pattern); } } }
php
protected static function addPatterns(IgnoreManager $manager, $patterns) { $enabled = false === $patterns ? false : true; $manager->setEnabled($enabled); if (\is_array($patterns)) { foreach ($patterns as $pattern) { $manager->addPattern($pattern); } } }
[ "protected", "static", "function", "addPatterns", "(", "IgnoreManager", "$", "manager", ",", "$", "patterns", ")", "{", "$", "enabled", "=", "false", "===", "$", "patterns", "?", "false", ":", "true", ";", "$", "manager", "->", "setEnabled", "(", "$", "e...
Add ignore file patterns in the ignore manager. @param IgnoreManager $manager The ignore files manager @param array|bool $patterns The patterns for ignore files
[ "Add", "ignore", "file", "patterns", "in", "the", "ignore", "manager", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Installer/IgnoreFactory.php#L77-L87
fxpio/composer-asset-plugin
Package/AbstractLazyCompletePackage.php
AbstractLazyCompletePackage.initialize
protected function initialize() { if (!$this->lazyLoader) { return; } $real = $this->lazyLoader->load($this); $this->lazyLoader = null; if (false === $real) { $this->version = '-9999999.9999999.9999999.9999999'; return; } $this->type = $real->getType(); $this->transportOptions = $real->getTransportOptions(); $this->targetDir = $real->getTargetDir(); $this->extra = $real->getExtra(); $this->binaries = $real->getBinaries(); $this->installationSource = $real->getInstallationSource(); $this->sourceType = $real->getSourceType(); $this->sourceUrl = $real->getSourceUrl(); $this->sourceReference = $real->getSourceReference(); $this->sourceMirrors = $real->getSourceMirrors(); $this->distType = $real->getDistType(); $this->distUrl = $real->getDistUrl(); $this->distReference = $real->getDistReference(); $this->distSha1Checksum = $real->getDistSha1Checksum(); $this->distMirrors = $real->getDistMirrors(); $this->releaseDate = $real->getReleaseDate(); $this->requires = $real->getRequires(); $this->conflicts = $real->getConflicts(); $this->provides = $real->getProvides(); $this->replaces = $real->getReplaces(); $this->devRequires = $real->getDevRequires(); $this->suggests = $real->getSuggests(); $this->autoload = $real->getAutoload(); $this->devAutoload = $real->getDevAutoload(); $this->includePaths = $real->getIncludePaths(); $this->notificationUrl = $real->getNotificationUrl(); $this->archiveExcludes = $real->getArchiveExcludes(); $this->scripts = $real->getScripts(); $this->repositories = $real->getRepositories(); $this->license = $real->getLicense(); $this->keywords = $real->getKeywords(); $this->authors = $real->getAuthors(); $this->description = $real->getDescription(); $this->homepage = $real->getHomepage(); $this->support = $real->getSupport(); }
php
protected function initialize() { if (!$this->lazyLoader) { return; } $real = $this->lazyLoader->load($this); $this->lazyLoader = null; if (false === $real) { $this->version = '-9999999.9999999.9999999.9999999'; return; } $this->type = $real->getType(); $this->transportOptions = $real->getTransportOptions(); $this->targetDir = $real->getTargetDir(); $this->extra = $real->getExtra(); $this->binaries = $real->getBinaries(); $this->installationSource = $real->getInstallationSource(); $this->sourceType = $real->getSourceType(); $this->sourceUrl = $real->getSourceUrl(); $this->sourceReference = $real->getSourceReference(); $this->sourceMirrors = $real->getSourceMirrors(); $this->distType = $real->getDistType(); $this->distUrl = $real->getDistUrl(); $this->distReference = $real->getDistReference(); $this->distSha1Checksum = $real->getDistSha1Checksum(); $this->distMirrors = $real->getDistMirrors(); $this->releaseDate = $real->getReleaseDate(); $this->requires = $real->getRequires(); $this->conflicts = $real->getConflicts(); $this->provides = $real->getProvides(); $this->replaces = $real->getReplaces(); $this->devRequires = $real->getDevRequires(); $this->suggests = $real->getSuggests(); $this->autoload = $real->getAutoload(); $this->devAutoload = $real->getDevAutoload(); $this->includePaths = $real->getIncludePaths(); $this->notificationUrl = $real->getNotificationUrl(); $this->archiveExcludes = $real->getArchiveExcludes(); $this->scripts = $real->getScripts(); $this->repositories = $real->getRepositories(); $this->license = $real->getLicense(); $this->keywords = $real->getKeywords(); $this->authors = $real->getAuthors(); $this->description = $real->getDescription(); $this->homepage = $real->getHomepage(); $this->support = $real->getSupport(); }
[ "protected", "function", "initialize", "(", ")", "{", "if", "(", "!", "$", "this", "->", "lazyLoader", ")", "{", "return", ";", "}", "$", "real", "=", "$", "this", "->", "lazyLoader", "->", "load", "(", "$", "this", ")", ";", "$", "this", "->", "...
Initialize the package.
[ "Initialize", "the", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Package/AbstractLazyCompletePackage.php#L170-L220
fxpio/composer-asset-plugin
Repository/BowerPrivateRegistryFactory.php
BowerPrivateRegistryFactory.create
public static function create(AssetRepositoryManager $arm, VcsPackageFilter $filter, Config $config) { $rm = $arm->getRepositoryManager(); $registries = $config->getArray('private-bower-registries'); foreach ($registries as $registryName => $registryUrl) { $repoConfig = AssetPlugin::createRepositoryConfig($arm, $filter, $config, $registryName); $repoConfig['private-registry-url'] = $registryUrl; $rm->setRepositoryClass($registryName, 'Fxp\Composer\AssetPlugin\Repository\BowerPrivateRepository'); $rm->addRepository($rm->createRepository($registryName, $repoConfig)); } }
php
public static function create(AssetRepositoryManager $arm, VcsPackageFilter $filter, Config $config) { $rm = $arm->getRepositoryManager(); $registries = $config->getArray('private-bower-registries'); foreach ($registries as $registryName => $registryUrl) { $repoConfig = AssetPlugin::createRepositoryConfig($arm, $filter, $config, $registryName); $repoConfig['private-registry-url'] = $registryUrl; $rm->setRepositoryClass($registryName, 'Fxp\Composer\AssetPlugin\Repository\BowerPrivateRepository'); $rm->addRepository($rm->createRepository($registryName, $repoConfig)); } }
[ "public", "static", "function", "create", "(", "AssetRepositoryManager", "$", "arm", ",", "VcsPackageFilter", "$", "filter", ",", "Config", "$", "config", ")", "{", "$", "rm", "=", "$", "arm", "->", "getRepositoryManager", "(", ")", ";", "$", "registries", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/BowerPrivateRegistryFactory.php#L27-L39
fxpio/composer-asset-plugin
Installer/AssetInstaller.php
AssetInstaller.getInstallPath
public function getInstallPath(PackageInterface $package) { $this->initializeVendorDir(); $targetDir = $package->getTargetDir(); list(, $name) = explode('/', $package->getPrettyName(), 2); return ($this->vendorDir ? $this->vendorDir.'/' : '').$name.($targetDir ? '/'.$targetDir : ''); }
php
public function getInstallPath(PackageInterface $package) { $this->initializeVendorDir(); $targetDir = $package->getTargetDir(); list(, $name) = explode('/', $package->getPrettyName(), 2); return ($this->vendorDir ? $this->vendorDir.'/' : '').$name.($targetDir ? '/'.$targetDir : ''); }
[ "public", "function", "getInstallPath", "(", "PackageInterface", "$", "package", ")", "{", "$", "this", "->", "initializeVendorDir", "(", ")", ";", "$", "targetDir", "=", "$", "package", "->", "getTargetDir", "(", ")", ";", "list", "(", ",", "$", "name", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Installer/AssetInstaller.php#L70-L79
fxpio/composer-asset-plugin
Installer/AssetInstaller.php
AssetInstaller.installCode
protected function installCode(PackageInterface $package) { $package = AssetPlugin::addMainFiles($this->config, $package); parent::installCode($package); $this->deleteIgnoredFiles($package); }
php
protected function installCode(PackageInterface $package) { $package = AssetPlugin::addMainFiles($this->config, $package); parent::installCode($package); $this->deleteIgnoredFiles($package); }
[ "protected", "function", "installCode", "(", "PackageInterface", "$", "package", ")", "{", "$", "package", "=", "AssetPlugin", "::", "addMainFiles", "(", "$", "this", "->", "config", ",", "$", "package", ")", ";", "parent", "::", "installCode", "(", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Installer/AssetInstaller.php#L92-L99
fxpio/composer-asset-plugin
Installer/AssetInstaller.php
AssetInstaller.updateCode
protected function updateCode(PackageInterface $initial, PackageInterface $target) { $target = AssetPlugin::addMainFiles($this->config, $target); parent::updateCode($initial, $target); $this->deleteIgnoredFiles($target); }
php
protected function updateCode(PackageInterface $initial, PackageInterface $target) { $target = AssetPlugin::addMainFiles($this->config, $target); parent::updateCode($initial, $target); $this->deleteIgnoredFiles($target); }
[ "protected", "function", "updateCode", "(", "PackageInterface", "$", "initial", ",", "PackageInterface", "$", "target", ")", "{", "$", "target", "=", "AssetPlugin", "::", "addMainFiles", "(", "$", "this", "->", "config", ",", "$", "target", ")", ";", "parent...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Installer/AssetInstaller.php#L104-L111
fxpio/composer-asset-plugin
Installer/AssetInstaller.php
AssetInstaller.deleteIgnoredFiles
protected function deleteIgnoredFiles(PackageInterface $package) { $manager = IgnoreFactory::create($this->config, $this->composer, $package, $this->getInstallPath($package)); if ($manager->isEnabled() && !$manager->hasPattern()) { $this->addIgnorePatterns($manager, $package); } $manager->cleanup(); }
php
protected function deleteIgnoredFiles(PackageInterface $package) { $manager = IgnoreFactory::create($this->config, $this->composer, $package, $this->getInstallPath($package)); if ($manager->isEnabled() && !$manager->hasPattern()) { $this->addIgnorePatterns($manager, $package); } $manager->cleanup(); }
[ "protected", "function", "deleteIgnoredFiles", "(", "PackageInterface", "$", "package", ")", "{", "$", "manager", "=", "IgnoreFactory", "::", "create", "(", "$", "this", "->", "config", ",", "$", "this", "->", "composer", ",", "$", "package", ",", "$", "th...
Deletes files defined in bower.json in section "ignore". @param PackageInterface $package
[ "Deletes", "files", "defined", "in", "bower", ".", "json", "in", "section", "ignore", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Installer/AssetInstaller.php#L118-L127
fxpio/composer-asset-plugin
Type/AbstractAssetType.php
AbstractAssetType.formatComposerName
public function formatComposerName($name) { $prefix = $this->getComposerVendorName().'/'; if (preg_match('/(\:\/\/)|\@/', $name) || 0 === strpos($name, $prefix)) { return $name; } return $prefix.$name; }
php
public function formatComposerName($name) { $prefix = $this->getComposerVendorName().'/'; if (preg_match('/(\:\/\/)|\@/', $name) || 0 === strpos($name, $prefix)) { return $name; } return $prefix.$name; }
[ "public", "function", "formatComposerName", "(", "$", "name", ")", "{", "$", "prefix", "=", "$", "this", "->", "getComposerVendorName", "(", ")", ".", "'/'", ";", "if", "(", "preg_match", "(", "'/(\\:\\/\\/)|\\@/'", ",", "$", "name", ")", "||", "0", "===...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Type/AbstractAssetType.php#L90-L99
fxpio/composer-asset-plugin
Repository/NpmRepository.php
NpmRepository.buildPackageUrl
protected function buildPackageUrl($packageName) { $packageName = urlencode(NpmPackageUtil::revertName($packageName)); $packageName = str_replace('%40', '@', $packageName); return parent::buildPackageUrl($packageName); }
php
protected function buildPackageUrl($packageName) { $packageName = urlencode(NpmPackageUtil::revertName($packageName)); $packageName = str_replace('%40', '@', $packageName); return parent::buildPackageUrl($packageName); }
[ "protected", "function", "buildPackageUrl", "(", "$", "packageName", ")", "{", "$", "packageName", "=", "urlencode", "(", "NpmPackageUtil", "::", "revertName", "(", "$", "packageName", ")", ")", ";", "$", "packageName", "=", "str_replace", "(", "'%40'", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/NpmRepository.php#L73-L79
fxpio/composer-asset-plugin
Repository/NpmRepository.php
NpmRepository.createVcsRepositoryConfig
protected function createVcsRepositoryConfig(array $data, $registryName = null) { $type = isset($data['repository']['type']) ? $data['repository']['type'] : 'vcs'; // Add release date in $packageConfigs if (isset($data['versions'], $data['time'])) { $time = $data['time']; array_walk($data['versions'], function (&$packageConfigs, $version) use ($time) { PackageUtil::convertStringKey($time, $version, $packageConfigs, 'time'); }); } return array( 'type' => $this->assetType->getName().'-'.$type, 'url' => $this->getVcsRepositoryUrl($data, $registryName), 'name' => $registryName, 'registry-versions' => isset($data['versions']) ? $this->createArrayRepositoryConfig($data['versions']) : array(), ); }
php
protected function createVcsRepositoryConfig(array $data, $registryName = null) { $type = isset($data['repository']['type']) ? $data['repository']['type'] : 'vcs'; // Add release date in $packageConfigs if (isset($data['versions'], $data['time'])) { $time = $data['time']; array_walk($data['versions'], function (&$packageConfigs, $version) use ($time) { PackageUtil::convertStringKey($time, $version, $packageConfigs, 'time'); }); } return array( 'type' => $this->assetType->getName().'-'.$type, 'url' => $this->getVcsRepositoryUrl($data, $registryName), 'name' => $registryName, 'registry-versions' => isset($data['versions']) ? $this->createArrayRepositoryConfig($data['versions']) : array(), ); }
[ "protected", "function", "createVcsRepositoryConfig", "(", "array", "$", "data", ",", "$", "registryName", "=", "null", ")", "{", "$", "type", "=", "isset", "(", "$", "data", "[", "'repository'", "]", "[", "'type'", "]", ")", "?", "$", "data", "[", "'r...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/NpmRepository.php#L84-L102
fxpio/composer-asset-plugin
Repository/NpmRepository.php
NpmRepository.whatProvidesManageException
protected function whatProvidesManageException(Pool $pool, $name, \Exception $exception) { if ($exception instanceof InvalidCreateRepositoryException) { $data = $exception->getData(); if (isset($data['versions']) && !empty($data['versions'])) { $this->putArrayRepositoryConfig($data['versions'], $name, $pool); return; } } parent::whatProvidesManageException($pool, $name, $exception); }
php
protected function whatProvidesManageException(Pool $pool, $name, \Exception $exception) { if ($exception instanceof InvalidCreateRepositoryException) { $data = $exception->getData(); if (isset($data['versions']) && !empty($data['versions'])) { $this->putArrayRepositoryConfig($data['versions'], $name, $pool); return; } } parent::whatProvidesManageException($pool, $name, $exception); }
[ "protected", "function", "whatProvidesManageException", "(", "Pool", "$", "pool", ",", "$", "name", ",", "\\", "Exception", "$", "exception", ")", "{", "if", "(", "$", "exception", "instanceof", "InvalidCreateRepositoryException", ")", "{", "$", "data", "=", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/NpmRepository.php#L107-L120
fxpio/composer-asset-plugin
Repository/NpmRepository.php
NpmRepository.putArrayRepositoryConfig
protected function putArrayRepositoryConfig(array $packageConfigs, $name, Pool $pool) { $packages = $this->createArrayRepositoryConfig($packageConfigs); $repo = new ArrayRepository($packages); Util::addRepositoryInstance($this->io, $this->repositoryManager, $this->repos, $name, $repo, $pool); $this->providers[$name] = array(); }
php
protected function putArrayRepositoryConfig(array $packageConfigs, $name, Pool $pool) { $packages = $this->createArrayRepositoryConfig($packageConfigs); $repo = new ArrayRepository($packages); Util::addRepositoryInstance($this->io, $this->repositoryManager, $this->repos, $name, $repo, $pool); $this->providers[$name] = array(); }
[ "protected", "function", "putArrayRepositoryConfig", "(", "array", "$", "packageConfigs", ",", "$", "name", ",", "Pool", "$", "pool", ")", "{", "$", "packages", "=", "$", "this", "->", "createArrayRepositoryConfig", "(", "$", "packageConfigs", ")", ";", "$", ...
Create and put the array repository with the asset configs. @param array $packageConfigs The configs of assets package versions @param string $name The asset package name @param Pool $pool The pool
[ "Create", "and", "put", "the", "array", "repository", "with", "the", "asset", "configs", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/NpmRepository.php#L129-L136
fxpio/composer-asset-plugin
Repository/NpmRepository.php
NpmRepository.createArrayRepositoryConfig
protected function createArrayRepositoryConfig(array $packageConfigs) { $packages = array(); $loader = new ArrayLoader(); foreach ($packageConfigs as $version => $config) { try { $config['version'] = $version; $config = $this->assetType->getPackageConverter()->convert($config); $config = $this->assetRepositoryManager->solveResolutions($config); $packages[] = $loader->load($config); } catch (\UnexpectedValueException $exception) { $this->io->write("<warning>Skipped {$config['name']} version {$version}: {$exception->getMessage()}</warning>", IOInterface::VERBOSE); } } return $packages; }
php
protected function createArrayRepositoryConfig(array $packageConfigs) { $packages = array(); $loader = new ArrayLoader(); foreach ($packageConfigs as $version => $config) { try { $config['version'] = $version; $config = $this->assetType->getPackageConverter()->convert($config); $config = $this->assetRepositoryManager->solveResolutions($config); $packages[] = $loader->load($config); } catch (\UnexpectedValueException $exception) { $this->io->write("<warning>Skipped {$config['name']} version {$version}: {$exception->getMessage()}</warning>", IOInterface::VERBOSE); } } return $packages; }
[ "protected", "function", "createArrayRepositoryConfig", "(", "array", "$", "packageConfigs", ")", "{", "$", "packages", "=", "array", "(", ")", ";", "$", "loader", "=", "new", "ArrayLoader", "(", ")", ";", "foreach", "(", "$", "packageConfigs", "as", "$", ...
Create the array repository with the asset configs. A warning message is displayed if the constraint versions of packages are broken. These versions are skipped and the plugin hope that other versions will be OK. @param array $packageConfigs The configs of assets package versions @return CompletePackageInterface[]
[ "Create", "the", "array", "repository", "with", "the", "asset", "configs", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/NpmRepository.php#L149-L166
fxpio/composer-asset-plugin
Util/Perforce.php
Perforce.getComposerInformation
public function getComposerInformation($identifier) { $composerFileContent = $this->getFileContent($this->filename, $identifier); return !$composerFileContent ? null : json_decode($composerFileContent, true); }
php
public function getComposerInformation($identifier) { $composerFileContent = $this->getFileContent($this->filename, $identifier); return !$composerFileContent ? null : json_decode($composerFileContent, true); }
[ "public", "function", "getComposerInformation", "(", "$", "identifier", ")", "{", "$", "composerFileContent", "=", "$", "this", "->", "getFileContent", "(", "$", "this", "->", "filename", ",", "$", "identifier", ")", ";", "return", "!", "$", "composerFileConte...
@param string $identifier @return array|string
[ "@param", "string", "$identifier" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/Perforce.php#L45-L52