_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q241300 | SuggestedPackagesReporter.addPackage | validation | public function addPackage($source, $target, $reason)
{
$this->suggestedPackages[] = array(
'source' => $source,
'target' => $target,
'reason' => $reason,
);
return $this;
} | php | {
"resource": ""
} |
q241301 | SuggestedPackagesReporter.addSuggestionsFromPackage | validation | public function addSuggestionsFromPackage(PackageInterface $package)
{
$source = $package->getPrettyName();
foreach ($package->getSuggests() as $target => $reason) {
$this->addPackage(
$source,
$target,
$reason
);
}
... | php | {
"resource": ""
} |
q241302 | Filesystem.isDirEmpty | validation | public function isDirEmpty($dir)
{
$finder = Finder::create()
->ignoreVCS(false)
->ignoreDotFiles(false)
->depth(0)
->in($dir);
return count($finder) === 0;
} | php | {
"resource": ""
} |
q241303 | Filesystem.unlink | validation | public function unlink($path)
{
$unlinked = @$this->unlinkImplementation($path);
if (!$unlinked) {
// retry after a bit on windows since it tends to be touchy with mass removals
if (Platform::isWindows()) {
usleep(350000);
$unlinked = @$this->u... | php | {
"resource": ""
} |
q241304 | Filesystem.rmdir | validation | public function rmdir($path)
{
$deleted = @rmdir($path);
if (!$deleted) {
// retry after a bit on windows since it tends to be touchy with mass removals
if (Platform::isWindows()) {
usleep(350000);
$deleted = @rmdir($path);
}
... | php | {
"resource": ""
} |
q241305 | Filesystem.size | validation | public function size($path)
{
if (!file_exists($path)) {
throw new \RuntimeException("$path does not exist.");
}
if (is_dir($path)) {
return $this->directorySize($path);
}
return filesize($path);
} | php | {
"resource": ""
} |
q241306 | Filesystem.normalizePath | validation | public function normalizePath($path)
{
$parts = array();
$path = strtr($path, '\\', '/');
$prefix = '';
$absolute = false;
// extract a prefix being a protocol://, protocol:, protocol://drive: or simply drive:
if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )... | php | {
"resource": ""
} |
q241307 | Filesystem.isSymlinkedDirectory | validation | public function isSymlinkedDirectory($directory)
{
if (!is_dir($directory)) {
return false;
}
$resolved = $this->resolveSymlinkedDirectorySymlink($directory);
return is_link($resolved);
} | php | {
"resource": ""
} |
q241308 | Filesystem.resolveSymlinkedDirectorySymlink | validation | private function resolveSymlinkedDirectorySymlink($pathname)
{
if (!is_dir($pathname)) {
return $pathname;
}
$resolved = rtrim($pathname, '/');
if (!strlen($resolved)) {
return $pathname;
}
return $resolved;
} | php | {
"resource": ""
} |
q241309 | Filesystem.junction | validation | public function junction($target, $junction)
{
if (!Platform::isWindows()) {
throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
}
if (!is_dir($target)) {
throw new IOException(sprintf('Cannot junction to "%s" as it i... | php | {
"resource": ""
} |
q241310 | Filesystem.removeJunction | validation | public function removeJunction($junction)
{
if (!Platform::isWindows()) {
return false;
}
$junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
if (!$this->isJunction($junction)) {
throw new IOException(sprintf('%s is not a ... | php | {
"resource": ""
} |
q241311 | AutoloadGenerator.createLoader | validation | public function createLoader(array $autoloads)
{
$loader = new ClassLoader();
if (isset($autoloads['psr-0'])) {
foreach ($autoloads['psr-0'] as $namespace => $path) {
$loader->add($namespace, $path);
}
}
if (isset($autoloads['psr-4'])) {
... | php | {
"resource": ""
} |
q241312 | AutoloadGenerator.filterPackageMap | validation | protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
{
$packages = array();
$include = array();
foreach ($packageMap as $item) {
$package = $item[0];
$name = $package->getName();
$packages[$name] = $package;
}
... | php | {
"resource": ""
} |
q241313 | Bitbucket.authorizeOAuth | validation | public function authorizeOAuth($originUrl)
{
if ($originUrl !== 'bitbucket.org') {
return false;
}
// if available use token from git config
if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
$this->io->setAuthentication($origin... | php | {
"resource": ""
} |
q241314 | Bitbucket.authorizeOAuthInteractively | validation | public function authorizeOAuthInteractively($originUrl, $message = null)
{
if ($message) {
$this->io->writeError($message);
}
$url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
$this->io->writeError(sprintf('Follow the instructio... | php | {
"resource": ""
} |
q241315 | Bitbucket.requestToken | validation | public function requestToken($originUrl, $consumerKey, $consumerSecret)
{
if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
return $this->token['access_token'];
}
$this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
if (!$this->requ... | php | {
"resource": ""
} |
q241316 | RuleWatchChain.seek | validation | public function seek($offset)
{
$this->rewind();
for ($i = 0; $i < $offset; $i++, $this->next());
} | php | {
"resource": ""
} |
q241317 | RuleWatchChain.remove | validation | public function remove()
{
$offset = $this->key();
$this->offsetUnset($offset);
$this->seek($offset);
} | php | {
"resource": ""
} |
q241318 | BaseDependencyCommand.configure | validation | protected function configure()
{
$this->setDefinition(array(
new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
new InputOptio... | php | {
"resource": ""
} |
q241319 | RepositoryManager.findPackage | validation | public function findPackage($name, $constraint)
{
foreach ($this->repositories as $repository) {
/** @var RepositoryInterface $repository */
if ($package = $repository->findPackage($name, $constraint)) {
return $package;
}
}
return null;
... | php | {
"resource": ""
} |
q241320 | RepositoryManager.createRepository | validation | public function createRepository($type, $config, $name = null)
{
if (!isset($this->repositoryClasses[$type])) {
throw new \InvalidArgumentException('Repository type is not registered: '.$type);
}
if (isset($config['packagist']) && false === $config['packagist']) {
$t... | php | {
"resource": ""
} |
q241321 | Silencer.suppress | validation | public static function suppress($mask = null)
{
if (!isset($mask)) {
$mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
}
$old = error_reporting();
self::$stack[] = $old;
error_reporting($old & ~$mask);
... | php | {
"resource": ""
} |
q241322 | Silencer.call | validation | public static function call($callable /*, ...$parameters */)
{
try {
self::suppress();
$result = call_user_func_array($callable, array_slice(func_get_args(), 1));
self::restore();
return $result;
} catch (\Exception $e) {
// Use a finally ... | php | {
"resource": ""
} |
q241323 | PearPackageExtractor.extractTo | validation | public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
{
$extractionPath = $target.'/tarball';
try {
$archive = new \PharData($this->file);
$archive->extractTo($extractionPath, null, true);
if (!is_file($this-... | php | {
"resource": ""
} |
q241324 | PearPackageExtractor.copyFiles | validation | private function copyFiles($files, $source, $target, $roles, $vars)
{
foreach ($files as $file) {
$from = $this->combine($source, $file['from']);
$to = $this->combine($target, $roles[$file['role']]);
$to = $this->combine($to, $file['to']);
$tasks = $file['task... | php | {
"resource": ""
} |
q241325 | Platform.expandPath | validation | public static function expandPath($path)
{
if (preg_match('#^~[\\/]#', $path)) {
return self::getUserDirectory() . substr($path, 1);
}
return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
// Treat HOME as ... | php | {
"resource": ""
} |
q241326 | ArchiveManager.getPackageFilename | validation | public function getPackageFilename(PackageInterface $package)
{
$nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
array_push($nameParts, $package->getDistReference(), $package->getDistType())... | php | {
"resource": ""
} |
q241327 | ArchiveManager.archive | validation | public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
{
if (empty($format)) {
throw new \InvalidArgumentException('Format must be specified');
}
// Search for the most appropriate archiver
$usableArchiver = null... | php | {
"resource": ""
} |
q241328 | StrictConfirmationQuestion.getDefaultNormalizer | validation | private function getDefaultNormalizer()
{
$default = $this->getDefault();
$trueRegex = $this->trueAnswerRegex;
$falseRegex = $this->falseAnswerRegex;
return function ($answer) use ($default, $trueRegex, $falseRegex) {
if (is_bool($answer)) {
return $answe... | php | {
"resource": ""
} |
q241329 | Rule2Literals.equals | validation | public function equals(Rule $rule)
{
// specialized fast-case
if ($rule instanceof self) {
if ($this->literal1 !== $rule->literal1) {
return false;
}
if ($this->literal2 !== $rule->literal2) {
return false;
}
... | php | {
"resource": ""
} |
q241330 | JsonFile.write | validation | public function write(array $hash, $options = 448)
{
$dir = dirname($this->path);
if (!is_dir($dir)) {
if (file_exists($dir)) {
throw new \UnexpectedValueException(
$dir.' exists and is not a directory.'
);
}
if ... | php | {
"resource": ""
} |
q241331 | JsonFile.throwEncodeError | validation | private static function throwEncodeError($code)
{
switch ($code) {
case JSON_ERROR_DEPTH:
$msg = 'Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
$msg = 'Underflow or the modes mismatch';
break;
... | php | {
"resource": ""
} |
q241332 | JsonFile.parseJson | validation | public static function parseJson($json, $file = null)
{
if (null === $json) {
return;
}
$data = json_decode($json, true);
if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
self::validateSyntax($json, $file);
}
return $data;
} | php | {
"resource": ""
} |
q241333 | JsonFile.validateSyntax | validation | protected static function validateSyntax($json, $file = null)
{
$parser = new JsonParser();
$result = $parser->lint($json);
if (null === $result) {
if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
throw new \UnexpectedValueException('"'.$... | php | {
"resource": ""
} |
q241334 | BaseExcludeFilter.filter | validation | public function filter($relativePath, $exclude)
{
foreach ($this->excludePatterns as $patternData) {
list($pattern, $negate, $stripLeadingSlash) = $patternData;
if ($stripLeadingSlash) {
$path = substr($relativePath, 1);
} else {
$path = $... | php | {
"resource": ""
} |
q241335 | InitCommand.hasVendorIgnore | validation | protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
{
if (!file_exists($ignoreFile)) {
return false;
}
$pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
$lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
foreach ($lines as $line) {
... | php | {
"resource": ""
} |
q241336 | InitCommand.findBestVersionAndNameForPackage | validation | private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
{
// find the latest version allowed in this pool
$versionSelector = new VersionSelector($this->getPool($input, $minimumStab... | php | {
"resource": ""
} |
q241337 | ChannelReader.read | validation | public function read($url)
{
$xml = $this->requestXml($url, "/channel.xml");
$channelName = (string) $xml->name;
$channelAlias = (string) $xml->suggestedalias;
$supportedVersions = array_keys($this->readerMap);
$selectedRestVersion = $this->selectRestVersion($xml, $supporte... | php | {
"resource": ""
} |
q241338 | ChannelReader.selectRestVersion | validation | private function selectRestVersion($channelXml, $supportedVersions)
{
$channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
foreach ($supportedVersions as $version) {
$xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
$testResult = $channelXml->xpa... | php | {
"resource": ""
} |
q241339 | ClassLoader.add | validation | public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackD... | php | {
"resource": ""
} |
q241340 | ClassLoader.addPsr4 | validation | public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
... | php | {
"resource": ""
} |
q241341 | ClassLoader.set | validation | public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
} | php | {
"resource": ""
} |
q241342 | ClassLoader.setPsr4 | validation | public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end wit... | php | {
"resource": ""
} |
q241343 | ClassLoader.findFile | validation | public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuP... | php | {
"resource": ""
} |
q241344 | DefaultPolicy.pruneToHighestPriorityOrInstalled | validation | protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
{
$selected = array();
$priority = null;
foreach ($literals as $literal) {
$package = $pool->literalToPackage($literal);
if (isset($installedMap[$package->id])) {... | php | {
"resource": ""
} |
q241345 | GitHub.isRateLimited | validation | public function isRateLimited(array $headers)
{
foreach ($headers as $header) {
if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q241346 | RuleWatchNode.watch2OnHighest | validation | public function watch2OnHighest(Decisions $decisions)
{
$literals = $this->rule->getLiterals();
// if there are only 2 elements, both are being watched anyway
if (count($literals) < 3) {
return;
}
$watchLevel = 0;
foreach ($literals as $literal) {
... | php | {
"resource": ""
} |
q241347 | RuleWatchNode.moveWatch | validation | public function moveWatch($from, $to)
{
if ($this->watch1 == $from) {
$this->watch1 = $to;
} else {
$this->watch2 = $to;
}
} | php | {
"resource": ""
} |
q241348 | Config.prohibitUrlByConfig | validation | public function prohibitUrlByConfig($url, IOInterface $io = null)
{
// Return right away if the URL is malformed or custom (see issue #5173)
if (false === filter_var($url, FILTER_VALIDATE_URL)) {
return;
}
// Extract scheme and throw exception on known insecure protocols... | php | {
"resource": ""
} |
q241349 | PlatformRepository.addExtension | validation | private function addExtension($name, $prettyVersion)
{
$extraDescription = null;
try {
$version = $this->versionParser->normalize($prettyVersion);
} catch (\UnexpectedValueException $e) {
$extraDescription = ' (actual version: '.$prettyVersion.')';
if (pr... | php | {
"resource": ""
} |
q241350 | Git.getVersion | validation | public function getVersion()
{
if (isset(self::$version)) {
return self::$version;
}
if (0 !== $this->process->execute('git --version', $output)) {
return;
}
if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
return sel... | php | {
"resource": ""
} |
q241351 | PluginManager.loadInstalledPlugins | validation | public function loadInstalledPlugins()
{
if ($this->disablePlugins) {
return;
}
$repo = $this->composer->getRepositoryManager()->getLocalRepository();
$globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
... | php | {
"resource": ""
} |
q241352 | PluginManager.addPlugin | validation | public function addPlugin(PluginInterface $plugin)
{
$this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
$this->plugins[] = $plugin;
$plugin->activate($this->composer, $this->io);
if ($plugin instanceof EventSubscriberInterface) {
$this... | php | {
"resource": ""
} |
q241353 | PluginManager.collectDependencies | validation | private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
{
$requires = array_merge(
$package->getRequires(),
$package->getDevRequires()
);
foreach ($requires as $requireLink) {
$requiredPackage = $this->lookupInstalled... | php | {
"resource": ""
} |
q241354 | PluginManager.getInstallPath | validation | private function getInstallPath(PackageInterface $package, $global = false)
{
if (!$global) {
return $this->composer->getInstallationManager()->getInstallPath($package);
}
return $this->globalComposer->getInstallationManager()->getInstallPath($package);
} | php | {
"resource": ""
} |
q241355 | HomeCommand.openBrowser | validation | private function openBrowser($url)
{
$url = ProcessExecutor::escape($url);
$process = new ProcessExecutor($this->getIO());
if (Platform::isWindows()) {
return $process->execute('start "web" explorer "' . $url . '"', $output);
}
$linux = $process->execute('which ... | php | {
"resource": ""
} |
q241356 | Svn.execute | validation | public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
{
// Ensure we are allowed to use this URL by config
$this->config->prohibitUrlByConfig($url, $this->io);
return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
} | php | {
"resource": ""
} |
q241357 | Svn.executeLocal | validation | public function executeLocal($command, $path, $cwd = null, $verbose = false)
{
// A local command has no remote url
return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
} | php | {
"resource": ""
} |
q241358 | Svn.getCommand | validation | protected function getCommand($cmd, $url, $path = null)
{
$cmd = sprintf(
'%s %s%s %s',
$cmd,
'--non-interactive ',
$this->getCredentialString(),
ProcessExecutor::escape($url)
);
if ($path) {
$cmd .= ' ' . ProcessExecut... | php | {
"resource": ""
} |
q241359 | Svn.getCredentialString | validation | protected function getCredentialString()
{
if (!$this->hasAuth()) {
return '';
}
return sprintf(
' %s--username %s --password %s ',
$this->getAuthCache(),
ProcessExecutor::escape($this->getUsername()),
ProcessExecutor::escape($this... | php | {
"resource": ""
} |
q241360 | Svn.getPassword | validation | protected function getPassword()
{
if ($this->credentials === null) {
throw new \LogicException("No svn auth detected.");
}
return isset($this->credentials['password']) ? $this->credentials['password'] : '';
} | php | {
"resource": ""
} |
q241361 | Svn.hasAuth | validation | protected function hasAuth()
{
if (null !== $this->hasAuth) {
return $this->hasAuth;
}
if (false === $this->createAuthFromConfig()) {
$this->createAuthFromUrl();
}
return $this->hasAuth;
} | php | {
"resource": ""
} |
q241362 | Svn.createAuthFromConfig | validation | private function createAuthFromConfig()
{
if (!$this->config->has('http-basic')) {
return $this->hasAuth = false;
}
$authConfig = $this->config->get('http-basic');
$host = parse_url($this->url, PHP_URL_HOST);
if (isset($authConfig[$host])) {
$this->c... | php | {
"resource": ""
} |
q241363 | Svn.createAuthFromUrl | validation | private function createAuthFromUrl()
{
$uri = parse_url($this->url);
if (empty($uri['user'])) {
return $this->hasAuth = false;
}
$this->credentials['username'] = $uri['user'];
if (!empty($uri['pass'])) {
$this->credentials['password'] = $uri['pass'];
... | php | {
"resource": ""
} |
q241364 | Svn.binaryVersion | validation | public function binaryVersion()
{
if (!self::$version) {
if (0 === $this->process->execute('svn --version', $output)) {
if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
self::$version = $match[1];
}
}
}
retur... | php | {
"resource": ""
} |
q241365 | ZipDownloader.getErrorMessage | validation | protected function getErrorMessage($retval, $file)
{
switch ($retval) {
case ZipArchive::ER_EXISTS:
return sprintf("File '%s' already exists.", $file);
case ZipArchive::ER_INCONS:
return sprintf("Zip archive '%s' is inconsistent.", $file);
... | php | {
"resource": ""
} |
q241366 | Pool.whatProvides | validation | public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
{
if ($bypassFilters) {
return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
}
$key = ((int) $mustMatchName).$constraint;
i... | php | {
"resource": ""
} |
q241367 | RuleSetGenerator.createRemoveRule | validation | protected function createRemoveRule(PackageInterface $package, $reason, $job)
{
return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
} | php | {
"resource": ""
} |
q241368 | LibraryInstaller.ensureBinariesPresence | validation | public function ensureBinariesPresence(PackageInterface $package)
{
$this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
} | php | {
"resource": ""
} |
q241369 | LibraryInstaller.getPackageBasePath | validation | protected function getPackageBasePath(PackageInterface $package)
{
$installPath = $this->getInstallPath($package);
$targetDir = $package->getTargetDir();
if ($targetDir) {
return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
... | php | {
"resource": ""
} |
q241370 | BaseChannelReader.requestContent | validation | protected function requestContent($origin, $path)
{
$url = rtrim($origin, '/') . '/' . ltrim($path, '/');
$content = $this->rfs->getContents($origin, $url, false);
if (!$content) {
throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
}... | php | {
"resource": ""
} |
q241371 | BaseChannelReader.requestXml | validation | protected function requestXml($origin, $path)
{
// http://components.ez.no/p/packages.xml is malformed. to read it we must ignore parsing errors.
$xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
if (false === $xml) {
throw ... | php | {
"resource": ""
} |
q241372 | FossilDriver.updateLocalRepo | validation | protected function updateLocalRepo()
{
$fs = new Filesystem();
$fs->ensureDirectoryExists($this->checkoutDir);
if (!is_writable(dirname($this->checkoutDir))) {
throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" d... | php | {
"resource": ""
} |
q241373 | InstallationManager.disablePlugins | validation | public function disablePlugins()
{
foreach ($this->installers as $i => $installer) {
if (!$installer instanceof PluginInstaller) {
continue;
}
unset($this->installers[$i]);
}
} | php | {
"resource": ""
} |
q241374 | InstallationManager.getInstaller | validation | public function getInstaller($type)
{
$type = strtolower($type);
if (isset($this->cache[$type])) {
return $this->cache[$type];
}
foreach ($this->installers as $installer) {
if ($installer->supports($type)) {
return $this->cache[$type] = $inst... | php | {
"resource": ""
} |
q241375 | InstallationManager.isPackageInstalled | validation | public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if ($package instanceof AliasPackage) {
return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
}
return $this->getInstaller($package->getT... | php | {
"resource": ""
} |
q241376 | InstallationManager.ensureBinariesPresence | validation | public function ensureBinariesPresence(PackageInterface $package)
{
try {
$installer = $this->getInstaller($package->getType());
} catch (\InvalidArgumentException $e) {
// no installer found for the current package type (@see `getInstaller()`)
return;
}
... | php | {
"resource": ""
} |
q241377 | InstallationManager.execute | validation | public function execute(RepositoryInterface $repo, OperationInterface $operation)
{
$method = $operation->getJobType();
$this->$method($repo, $operation);
} | php | {
"resource": ""
} |
q241378 | InstallationManager.install | validation | public function install(RepositoryInterface $repo, InstallOperation $operation)
{
$package = $operation->getPackage();
$installer = $this->getInstaller($package->getType());
$installer->install($repo, $package);
$this->markForNotification($package);
} | php | {
"resource": ""
} |
q241379 | InstallationManager.update | validation | public function update(RepositoryInterface $repo, UpdateOperation $operation)
{
$initial = $operation->getInitialPackage();
$target = $operation->getTargetPackage();
$initialType = $initial->getType();
$targetType = $target->getType();
if ($initialType === $targetType) {
... | php | {
"resource": ""
} |
q241380 | InstallationManager.uninstall | validation | public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
{
$package = $operation->getPackage();
$installer = $this->getInstaller($package->getType());
$installer->uninstall($repo, $package);
} | php | {
"resource": ""
} |
q241381 | InstallationManager.markAliasInstalled | validation | public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
{
$package = $operation->getPackage();
if (!$repo->hasPackage($package)) {
$repo->addPackage(clone $package);
}
} | php | {
"resource": ""
} |
q241382 | InstallationManager.markAliasUninstalled | validation | public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
{
$package = $operation->getPackage();
$repo->removePackage($package);
} | php | {
"resource": ""
} |
q241383 | InstallationManager.getInstallPath | validation | public function getInstallPath(PackageInterface $package)
{
$installer = $this->getInstaller($package->getType());
return $installer->getInstallPath($package);
} | php | {
"resource": ""
} |
q241384 | StreamContextFactory.fixHttpHeaderField | validation | private static function fixHttpHeaderField($header)
{
if (!is_array($header)) {
$header = explode("\r\n", $header);
}
uasort($header, function ($el) {
return stripos($el, 'content-type') === 0 ? 1 : -1;
});
return $header;
} | php | {
"resource": ""
} |
q241385 | RuleWatchGraph.insert | validation | public function insert(RuleWatchNode $node)
{
if ($node->getRule()->isAssertion()) {
return;
}
foreach (array($node->watch1, $node->watch2) as $literal) {
if (!isset($this->watchChains[$literal])) {
$this->watchChains[$literal] = new RuleWatchChain;
... | php | {
"resource": ""
} |
q241386 | RuleWatchGraph.propagateLiteral | validation | public function propagateLiteral($decidedLiteral, $level, $decisions)
{
// we invert the decided literal here, example:
// A was decided => (-A|B) now requires B to be true, so we look for
// rules which are fulfilled by -A, rather than A.
$literal = -$decidedLiteral;
if (!i... | php | {
"resource": ""
} |
q241387 | RuleWatchGraph.moveWatch | validation | protected function moveWatch($fromLiteral, $toLiteral, $node)
{
if (!isset($this->watchChains[$toLiteral])) {
$this->watchChains[$toLiteral] = new RuleWatchChain;
}
$node->moveWatch($fromLiteral, $toLiteral);
$this->watchChains[$fromLiteral]->remove();
$this->wat... | php | {
"resource": ""
} |
q241388 | FileDownloader.processUrl | validation | protected function processUrl(PackageInterface $package, $url)
{
if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
throw new \RuntimeException('You must enable the openssl extension to download files via https');
}
if ($package->getDistReference()) {
... | php | {
"resource": ""
} |
q241389 | Validator.createValidator | validation | public static function createValidator($type, $model, $attributes, $params = [])
{
$params['attributes'] = $attributes;
if ($type instanceof \Closure || ($model->hasMethod($type) && !isset(static::$builtInValidators[$type]))) {
// method-based validator
$params['class'] = __... | php | {
"resource": ""
} |
q241390 | Validator.isActive | validation | public function isActive($scenario)
{
return !in_array($scenario, $this->except, true) && (empty($this->on) || in_array($scenario, $this->on, true));
} | php | {
"resource": ""
} |
q241391 | Validator.addError | validation | public function addError($model, $attribute, $message, $params = [])
{
$params['attribute'] = $model->getAttributeLabel($attribute);
if (!isset($params['value'])) {
$value = $model->$attribute;
if (is_array($value)) {
$params['value'] = 'array()';
... | php | {
"resource": ""
} |
q241392 | Query.createCommand | validation | public function createCommand($db = null)
{
if ($db === null) {
$db = Yii::$app->getDb();
}
list($sql, $params) = $db->getQueryBuilder()->build($this);
$command = $db->createCommand($sql, $params);
$this->setCommandCache($command);
return $command;
} | php | {
"resource": ""
} |
q241393 | Query.batch | validation | public function batch($batchSize = 100, $db = null)
{
return Yii::createObject([
'class' => BatchQueryResult::className(),
'query' => $this,
'batchSize' => $batchSize,
'db' => $db,
'each' => false,
]);
} | php | {
"resource": ""
} |
q241394 | Query.each | validation | public function each($batchSize = 100, $db = null)
{
return Yii::createObject([
'class' => BatchQueryResult::className(),
'query' => $this,
'batchSize' => $batchSize,
'db' => $db,
'each' => true,
]);
} | php | {
"resource": ""
} |
q241395 | Query.populate | validation | public function populate($rows)
{
if ($this->indexBy === null) {
return $rows;
}
$result = [];
foreach ($rows as $row) {
$result[ArrayHelper::getValue($row, $this->indexBy)] = $row;
}
return $result;
} | php | {
"resource": ""
} |
q241396 | Query.scalar | validation | public function scalar($db = null)
{
if ($this->emulateExecution) {
return null;
}
return $this->createCommand($db)->queryScalar();
} | php | {
"resource": ""
} |
q241397 | Query.addSelect | validation | public function addSelect($columns)
{
if ($columns instanceof ExpressionInterface) {
$columns = [$columns];
} elseif (!is_array($columns)) {
$columns = preg_split('/\s*,\s*/', trim($columns), -1, PREG_SPLIT_NO_EMPTY);
}
$columns = $this->getUniqueColumns($colu... | php | {
"resource": ""
} |
q241398 | Query.where | validation | public function where($condition, $params = [])
{
$this->where = $condition;
$this->addParams($params);
return $this;
} | php | {
"resource": ""
} |
q241399 | Query.andFilterCompare | validation | public function andFilterCompare($name, $value, $defaultOperator = '=')
{
if (preg_match('/^(<>|>=|>|<=|<|=)/', $value, $matches)) {
$operator = $matches[1];
$value = substr($value, strlen($operator));
} else {
$operator = $defaultOperator;
}
retu... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.