_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q241200
AuthManagerTrait.getPath
train
public function getPath($userId, $permissionName, $params = [], $allowCaching = true) { if ($allowCaching && empty($params) && isset($this->paths[$userId][$permissionName])) { return $this->paths[$userId][$permissionName]; } $this->checkAccess($userId, $permissionName, $params); ...
php
{ "resource": "" }
q241201
Settings.loadFromLocation
train
private function loadFromLocation($location) { Logger::get()->debug('Loading settings...'); // Add the trailing slash to the folder if it is missing. if (substr($location, -1) != DIRECTORY_SEPARATOR) { $location .= DIRECTORY_SEPARATOR; } $settingsLocation = $locat...
php
{ "resource": "" }
q241202
Settings.objectify
train
private static function objectify( array $array ) { foreach ($array as &$item) { if (is_array($item)) { $item = self::objectify($item); } } return (object)$array; }
php
{ "resource": "" }
q241203
Settings.getEnvironment
train
public static function getEnvironment() { if (empty(self::$environment)) { self::$environment = getenv(self::ENV) ?: @$_SERVER[self::ENV] ?: @$_ENV[self::ENV]; // If the environment cannot be inferred, assume production. if (empty(...
php
{ "resource": "" }
q241204
Settings.mergeSettings
train
public static function mergeSettings( $generalSettings, $environmentSettings ) { $mergedSettings = $generalSettings; foreach ($environmentSettings as $key => &$value) { if ( is_array($value) && isset($mergedSettings[$key]) ...
php
{ "resource": "" }
q241205
EqualityUtils.isEqual
train
public static function isEqual( EqualityInterface $first = null, EqualityInterface $second = null ) { $result = false; if (null === $first) { $result = (null === $second) ? true : false; } else { $result = $first->equals($second); } r...
php
{ "resource": "" }
q241206
EqualityUtils.isNotEqual
train
public static function isNotEqual( EqualityInterface $first = null, EqualityInterface $second = null ) { return false === self::isEqual($first, $second); }
php
{ "resource": "" }
q241207
FormController.loadAction
train
public function loadAction(Request $request) { $repository = $this->get('phlexible_media_template.template_manager'); $templateKey = $request->get('template_key'); $template = $repository->find($templateKey); $parameters = $template->getParameters(); if (isset($parameters[...
php
{ "resource": "" }
q241208
FormController.saveAction
train
public function saveAction(Request $request) { $repository = $this->get('phlexible_media_template.template_manager'); $templateKey = $request->get('template_key'); $params = $request->request->all(); unset($params['template_key'], $params['module'], $params['control...
php
{ "resource": "" }
q241209
MongoIdStrategy.hydrate
train
public function hydrate($value) { if ($value instanceof MongoId) { return (string)$value; } if ($this->nullable && $value === null) { return null; } throw new Exception\InvalidArgumentException(sprintf( 'Invalid value: mus...
php
{ "resource": "" }
q241210
MongoIdStrategy.extract
train
public function extract($value) { if (is_string($value)) { return new MongoId($value); } if ($this->nullable && $value === null) { return null; } throw new Exception\InvalidArgumentException(sprintf( 'Invalid value: must b...
php
{ "resource": "" }
q241211
Layout.element
train
public function element($elementName) { if (Configuration::read('mvc.autoload_shared_var') === true && empty($this->variableList) === false) { foreach ($this->variableList as $varName => $varValue) { ${$varName} = $varValue; } } $layoutDirectory = $thi...
php
{ "resource": "" }
q241212
Layout.setVar
train
public function setVar($varName, $varValue, $force = false) { if (isset($this->variableList[$varName]) && $force === false) { trigger_error('Variable "' . $varName . '" is already defined in Layout.', E_USER_WARNING); return false; } $this->variableList[$varName] = $v...
php
{ "resource": "" }
q241213
Arr.except
train
static public function except(array $input, $keys) { $keys = is_array($keys) ? $keys : array_slice(func_get_args(),1); foreach ($keys as $key) { unset($input[$key]); } return $input; }
php
{ "resource": "" }
q241214
Arr.extend
train
static public function extend(array $to, array $from) { foreach ($from as $key => $value) { if (is_array($value)) { $to[$key] = self::extend((array) (isset($to[$key]) ? $to[$key] : []),$value); }else{ $to[$key] = $value; } } ...
php
{ "resource": "" }
q241215
Arr.xmlToArray
train
static public function xmlToArray($xml) { //禁止引用外部xml实体 libxml_disable_entity_loader(true); $values = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $values; }
php
{ "resource": "" }
q241216
Arr.replaceArrayKey
train
static public function replaceArrayKey($arr = [],$field = '') { $newArr = []; if($arr){ foreach ($arr as $value) { $newArr[$value[$field]] = $value; } } return $newArr; }
php
{ "resource": "" }
q241217
Arr.replaceArrayKeyWithArray
train
static public function replaceArrayKeyWithArray($arr = [],$field = '') { $newArr = []; if($arr){ foreach ($arr as $value) { $newArr[$value[$field]][] = $value; } } return $newArr; }
php
{ "resource": "" }
q241218
JsonSerialize.jsonSerialize
train
public function jsonSerialize() { $copy = []; foreach ((array)$this as $key => $value) { if (!is_string($value)) { $element = $value->getElement(); if (is_object($element) and method_exists($element, 'name') and $nam...
php
{ "resource": "" }
q241219
RequestConstructor.register
train
public function register() { $this->singleton( 'validation', function () { return new Validation(); } ); $app = &$this->app; // register the request $this->singleton( 'http.request', function () us...
php
{ "resource": "" }
q241220
SetTask.setName
train
public function setName($name, $build) { $this->_name = (string) $name; if (isset($this->_name) && isset($this->_value)) { $build->getProperties()->set($this->_name, $this->_value); } }
php
{ "resource": "" }
q241221
SetTask.setValue
train
public function setValue($value, $build) { $this->_value = (string) $value; if (isset($this->_name) && isset($this->_value)) { $build->setProperty($this->_name, $this->_value); } }
php
{ "resource": "" }
q241222
SetTask.validate
train
public function validate(&$msg = null) { if (!isset($this->_name) && !isset($this->_value) && !isset($this->_file)) { return false; } elseif (isset($this->_file) && (isset($this->_name) || isset($this->_value))) { return false; } elseif ((isset($this->_name) && !isset...
php
{ "resource": "" }
q241223
UploadableBehavior.beforeMarshal
train
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) { // configuration set? $this->check(); // load validator and add our custom upload validator $validator = $this->_table->getValidator(); $validator->setProvider('upload', UploadValidation::clas...
php
{ "resource": "" }
q241224
PlanController.newAction
train
public function newAction(Request $request) { $entity = new Plan(); $form = $this->createForm('EcommerceBundle\Form\PlanType', $entity); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); ...
php
{ "resource": "" }
q241225
PlanController.showAction
train
public function showAction(Plan $plan) { $deleteForm = $this->createDeleteForm($plan); //get plan $paypalPlan = $this->get('checkout_manager')->getPaypalPlan($plan); return array( 'entity' => $plan, 'delete_form' => $deleteForm->createView(), ...
php
{ "resource": "" }
q241226
PlanController.createDeleteForm
train
private function createDeleteForm(Plan $plan) { return $this->createFormBuilder() ->setAction($this->generateUrl('ecommerce_plan_delete', array('id' => $plan->getId()))) ->setMethod('DELETE') ->getForm() ; }
php
{ "resource": "" }
q241227
ComposerScriptRunner.getEnvFile
train
public function getEnvFile() { $basePath = $this->getBasePath(); $envFile = $this->get('envFile'); $startsWith = substr($envFile, 0, 1); if (!$startsWith !== '/' && $startsWith !== '~' && $startsWith !== '\\') { $envFile = $basePath . DIRECTORY_SEPARATOR . $envFile; ...
php
{ "resource": "" }
q241228
ComposerScriptRunner.verifyExtras
train
protected function verifyExtras(array $extras) { if (!isset($extras['php-env-builder'])) { throw new \InvalidArgumentException( 'The parameter handler needs to be configured through the ' . 'extra.php-env-builder setting.' ); } if (!is...
php
{ "resource": "" }
q241229
ComposerScriptRunner.build
train
public static function build(Event $event, Builder $builder = null) { $runner = new ComposerScriptRunner($event, $builder); $runner->run(); }
php
{ "resource": "" }
q241230
ComposerScriptRunner.askQuestions
train
protected function askQuestions(array $questons) { foreach ($questons as $question) { $this->verifyQuestion($question); $name = $question['name']; $prompt = $question['prompt']; $default = isset($question['default']) ? $question['default'] : ''; $...
php
{ "resource": "" }
q241231
ComposerScriptRunner.shouldCancelOnClobber
train
protected function shouldCancelOnClobber() { $fullPath = $this->getEnvFile(); if (!$this->get('clobber') && file_exists($fullPath)) { $this->event->getIO()->write(sprintf('Env file `%s` already exists, skipping...', $fullPath)); return true; } return false; ...
php
{ "resource": "" }
q241232
TCPConnection.disconnect
train
public function disconnect(): void { if ($this->connected() === true) { fclose($this->connection); $this->connection = false; } }
php
{ "resource": "" }
q241233
TCPConnection.setBlocking
train
public function setBlocking(int $mode): bool { if ($this->connected() === false) { throw new \Exception('Not connected'); } return stream_set_blocking($this->connection, $mode); }
php
{ "resource": "" }
q241234
TCPConnection.read
train
public function read(): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = ''; $continue = true; while ($continue == true) { $data = null; try { $data = $this->readLine(); } catch (\Exception $e) { $continue = false; } ...
php
{ "resource": "" }
q241235
TCPConnection.readLine
train
public function readLine(): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = fgets($this->connection); if ($response === false) { throw new \Exception('Nothing to read'); } return $response; }
php
{ "resource": "" }
q241236
TCPConnection.readBytes
train
public function readBytes(int $bytes): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = fread($this->connection, $bytes); if ($response === false) { throw new \Exception('Nothing to read'); } return $response; }
php
{ "resource": "" }
q241237
TCPConnection.writeLine
train
public function writeLine(string $data): void { try { $this->write($data."\r\n"); } catch (\Exception $e) { throw $e; } }
php
{ "resource": "" }
q241238
Auth.role
train
public function role($src, $value = '') { if (isset($this->_config->config['firewall']['' . $src . ''])) { if ($value == '') { $role = explode('.', $this->_config->config['firewall']['' . $src . '']['roles']['name']); return $this->_getSession($role); } ...
php
{ "resource": "" }
q241239
Auth.logged
train
public function logged($src, $value = '') { if (isset($this->_config->config['firewall']['' . $src . ''])) { if ($value == '') { $logged = explode('.', $this->_config->config['firewall']['' . $src . '']['logged']['name']); $data = $this->_getSession($logged); ...
php
{ "resource": "" }
q241240
DevicesRatioComposer.getDevicesFromSessions
train
protected function getDevicesFromSessions(Carbon $start, Carbon $end) { return $this->getVisitorsFilteredByDateRange($start, $end) ->filter(function (Visitor $session) { return $session->hasDevice(); }) ->transform(function (Visitor $session) { ...
php
{ "resource": "" }
q241241
GitLabDriver.supports
validation
public static function supports(IOInterface $io, Config $config, $url, $deep = false) { if (!preg_match(self::URL_REGEX, $url, $match)) { return false; } $scheme = !empty($match['scheme']) ? $match['scheme'] : null; $guessedDomain = !empty($match['domain']) ? $match['dom...
php
{ "resource": "" }
q241242
PackageDependencyParser.buildDependencyInfo
validation
public function buildDependencyInfo($depArray) { if (!is_array($depArray)) { return new DependencyInfo(array(), array()); } if (!$this->isHash($depArray)) { return new DependencyInfo($this->buildDependency10Info($depArray), array()); } return $this->b...
php
{ "resource": "" }
q241243
PackageDependencyParser.buildDependency10Info
validation
private function buildDependency10Info($depArray) { static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!='); $result = array(); foreach ($depArray as $depItem) { if (empty($depItem['rel']) || !array_ke...
php
{ "resource": "" }
q241244
PackageDependencyParser.buildDependency20Info
validation
private function buildDependency20Info($depArray) { $result = array(); $optionals = array(); $defaultOptionals = array(); foreach ($depArray as $depType => $depTypeGroup) { if (!is_array($depTypeGroup)) { continue; } if ('required' ...
php
{ "resource": "" }
q241245
PackageDependencyParser.buildDepExtensionConstraints
validation
private function buildDepExtensionConstraints($depItem, $depType) { if ($this->isHash($depItem)) { $depItem = array($depItem); } $result = array(); foreach ($depItem as $subDepItem) { $depChannelName = 'ext'; $depPackageName = $subDepItem['name'];...
php
{ "resource": "" }
q241246
PackageDependencyParser.buildDepPackageConstraints
validation
private function buildDepPackageConstraints($depItem, $depType) { if ($this->isHash($depItem)) { $depItem = array($depItem); } $result = array(); foreach ($depItem as $subDepItem) { if (!array_key_exists('channel', $subDepItem)) { $subDepItem[...
php
{ "resource": "" }
q241247
PackageDependencyParser.parse20VersionConstraint
validation
private function parse20VersionConstraint(array $data) { static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!='); $versions = array(); $values = array_intersect_key($data, $dep20toOperatorMap); if (0 == count($values)) { return ...
php
{ "resource": "" }
q241248
PackageDependencyParser.parseVersion
validation
private function parseVersion($version) { if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) { $version = $matches[1] .(!empty($matches[2]) ? $matches[2] : '.0') .(!empty($matches[3]) ? $matches[3] : '.0') .(!empty($matc...
php
{ "resource": "" }
q241249
Request.fix
validation
public function fix($packageName, ConstraintInterface $constraint = null) { $this->addJob($packageName, 'install', $constraint, true); }
php
{ "resource": "" }
q241250
GitLab.authorizeOAuth
validation
public function authorizeOAuth($originUrl) { if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) { return false; } // if available use token from git config if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) { $thi...
php
{ "resource": "" }
q241251
Installer.getCurrentPackages
validation
private function getCurrentPackages($installedRepo) { if ($this->locker->isLocked()) { try { return $this->locker->getLockedRepository(true)->getPackages(); } catch (\RuntimeException $e) { // fetch only non-dev packages from lock if doing a dev update...
php
{ "resource": "" }
q241252
Installer.mockLocalRepositories
validation
private function mockLocalRepositories(RepositoryManager $rm) { $packages = array(); foreach ($rm->getLocalRepository()->getPackages() as $package) { $packages[(string) $package] = clone $package; } foreach ($packages as $key => $package) { if ($package instan...
php
{ "resource": "" }
q241253
Installer.setOptimizeAutoloader
validation
public function setOptimizeAutoloader($optimizeAutoloader = false) { $this->optimizeAutoloader = (bool) $optimizeAutoloader; if (!$this->optimizeAutoloader) { // Force classMapAuthoritative off when not optimizing the // autoloader $this->setClassMapAuthoritative(...
php
{ "resource": "" }
q241254
Installer.setClassMapAuthoritative
validation
public function setClassMapAuthoritative($classMapAuthoritative = false) { $this->classMapAuthoritative = (bool) $classMapAuthoritative; if ($this->classMapAuthoritative) { // Force optimizeAutoloader when classmap is authoritative $this->setOptimizeAutoloader(true); ...
php
{ "resource": "" }
q241255
Cache.copyTo
validation
public function copyTo($file, $target) { if ($this->enabled) { $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file); if (file_exists($this->root . $file)) { try { touch($this->root . $file, filemtime($this->root . $file), time()); ...
php
{ "resource": "" }
q241256
Package.replaceVersion
validation
public function replaceVersion($version, $prettyVersion) { $this->version = $version; $this->prettyVersion = $prettyVersion; $this->stability = VersionParser::parseStability($version); $this->dev = $this->stability === 'dev'; }
php
{ "resource": "" }
q241257
Locker.getContentHash
validation
public static function getContentHash($composerFileContents) { $content = json_decode($composerFileContents, true); $relevantKeys = array( 'name', 'version', 'require', 'require-dev', 'conflict', 'replace', 'provide...
php
{ "resource": "" }
q241258
Locker.getLockedRepository
validation
public function getLockedRepository($withDevReqs = false) { $lockData = $this->getLockData(); $packages = new ArrayRepository(); $lockedPackages = $lockData['packages']; if ($withDevReqs) { if (isset($lockData['packages-dev'])) { $lockedPackages = array_m...
php
{ "resource": "" }
q241259
Locker.getPackageTime
validation
private function getPackageTime(PackageInterface $package) { if (!function_exists('proc_open')) { return null; } $path = realpath($this->installationManager->getInstallPath($package)); $sourceType = $package->getSourceType(); $datetime = null; if ($path ...
php
{ "resource": "" }
q241260
BitbucketDriver.getRepoData
validation
protected function getRepoData() { $resource = sprintf( 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s', $this->owner, $this->repository, http_build_query( array('fields' => '-project,-owner'), null, '&' ...
php
{ "resource": "" }
q241261
Solver.propagate
validation
protected function propagate($level) { while ($this->decisions->validOffset($this->propagateIndex)) { $decision = $this->decisions->atOffset($this->propagateIndex); $conflict = $this->watchGraph->propagateLiteral( $decision[Decisions::DECISION_LITERAL], ...
php
{ "resource": "" }
q241262
Solver.revert
validation
private function revert($level) { while (!$this->decisions->isEmpty()) { $literal = $this->decisions->lastLiteral(); if ($this->decisions->undecided($literal)) { break; } $decisionLevel = $this->decisions->decisionLevel($literal); ...
php
{ "resource": "" }
q241263
ArrayRepository.addPackage
validation
public function addPackage(PackageInterface $package) { if (null === $this->packages) { $this->initialize(); } $package->setRepository($this); $this->packages[] = $package; if ($package instanceof AliasPackage) { $aliasedPackage = $package->getAliasOf...
php
{ "resource": "" }
q241264
ArrayRepository.removePackage
validation
public function removePackage(PackageInterface $package) { $packageId = $package->getUniqueName(); foreach ($this->getPackages() as $key => $repoPackage) { if ($packageId === $repoPackage->getUniqueName()) { array_splice($this->packages, $key, 1); return...
php
{ "resource": "" }
q241265
RemoteFilesystem.copy
validation
public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array()) { return $this->get($originUrl, $fileUrl, $options, $fileName, $progress); }
php
{ "resource": "" }
q241266
RemoteFilesystem.getContents
validation
public function getContents($originUrl, $fileUrl, $progress = true, $options = array()) { return $this->get($originUrl, $fileUrl, $options, null, $progress); }
php
{ "resource": "" }
q241267
RemoteFilesystem.getRemoteContents
validation
protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null) { try { $e = null; $result = file_get_contents($fileUrl, false, $context); } catch (\Throwable $e) { } catch (\Exception $e) { } $responseHeaders = is...
php
{ "resource": "" }
q241268
FilesystemRepository.write
validation
public function write() { $data = array(); $dumper = new ArrayDumper(); foreach ($this->getCanonicalPackages() as $package) { $data[] = $dumper->dump($package); } usort($data, function ($a, $b) { return strcmp($a['name'], $b['name']); }); ...
php
{ "resource": "" }
q241269
ErrorHandler.register
validation
public static function register(IOInterface $io = null) { set_error_handler(array(__CLASS__, 'handle')); error_reporting(E_ALL | E_STRICT); self::$io = $io; }
php
{ "resource": "" }
q241270
LicensesCommand.filterRequiredPackages
validation
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array()) { $requires = array_keys($package->getRequires()); $packageListNames = array_keys($bucket); $packages = array_filter( $repo->getPackages(), function ($pac...
php
{ "resource": "" }
q241271
LicensesCommand.appendPackages
validation
public function appendPackages(array $packages, array $bucket) { foreach ($packages as $package) { $bucket[$package->getName()] = $package; } return $bucket; }
php
{ "resource": "" }
q241272
HgExcludeFilter.parseHgIgnoreLine
validation
public function parseHgIgnoreLine($line) { if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) { if ($matches[1] === 'glob') { $this->patternMode = self::HG_IGNORE_GLOB; } else { $this->patternMode = self::HG_IGNORE_REGEX; } ...
php
{ "resource": "" }
q241273
Problem.addRule
validation
public function addRule(Rule $rule) { $this->addReason(spl_object_hash($rule), array( 'rule' => $rule, 'job' => $rule->getJob(), )); }
php
{ "resource": "" }
q241274
Problem.addReason
validation
protected function addReason($id, $reason) { if (!isset($this->reasonSeen[$id])) { $this->reasonSeen[$id] = true; $this->reasons[$this->section][] = $reason; } }
php
{ "resource": "" }
q241275
Problem.jobToText
validation
protected function jobToText($job) { $packageName = $job['packageName']; $constraint = $job['constraint']; switch ($job['cmd']) { case 'install': $packages = $this->pool->whatProvides($packageName, $constraint); if (!$packages) { ...
php
{ "resource": "" }
q241276
ShowCommand.printVersions
validation
protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo) { uasort($versions, 'version_compare'); $versions = array_keys(array_reverse($versions)); // highlight installed version if ($installedRepo->hasPackage($package))...
php
{ "resource": "" }
q241277
ShowCommand.printLinks
validation
protected function printLinks(CompletePackageInterface $package, $linkType, $title = null) { $title = $title ?: $linkType; $io = $this->getIO(); if ($links = $package->{'get'.ucfirst($linkType)}()) { $io->write("\n<info>" . $title . "</info>"); foreach ($links as $li...
php
{ "resource": "" }
q241278
ShowCommand.printLicenses
validation
protected function printLicenses(CompletePackageInterface $package) { $spdxLicenses = new SpdxLicenses(); $licenses = $package->getLicense(); $io = $this->getIO(); foreach ($licenses as $licenseId) { $license = $spdxLicenses->getLicenseByIdentifier($licenseId); // keys:...
php
{ "resource": "" }
q241279
ShowCommand.initStyles
validation
protected function initStyles(OutputInterface $output) { $this->colors = array( 'green', 'yellow', 'cyan', 'magenta', 'blue', ); foreach ($this->colors as $color) { $style = new OutputFormatterStyle($color); ...
php
{ "resource": "" }
q241280
ShowCommand.generatePackageTree
validation
protected function generatePackageTree( PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos ) { $requires = $package->getRequires(); ksort($requires); $children = array(); foreach ($requires as $requireName => $requ...
php
{ "resource": "" }
q241281
GitHubDriver.fetchRootIdentifier
validation
protected function fetchRootIdentifier() { if ($this->repoData) { return; } $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository; $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl); if (null ==...
php
{ "resource": "" }
q241282
TlsHelper.checkCertificateHost
validation
public static function checkCertificateHost($certificate, $hostname, &$cn = null) { $names = self::getCertificateNames($certificate); if (empty($names)) { return false; } $combinedNames = array_merge($names['san'], array($names['cn'])); $hostname = strtolower($h...
php
{ "resource": "" }
q241283
TlsHelper.getCertificateNames
validation
public static function getCertificateNames($certificate) { if (is_array($certificate)) { $info = $certificate; } elseif (CaBundle::isOpensslParseSafe()) { $info = openssl_x509_parse($certificate, false); } if (!isset($info['subject']['commonName'])) { ...
php
{ "resource": "" }
q241284
ChannelRest11Reader.parsePackage
validation
private function parsePackage($packageInfo) { $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS); $channelName = (string) $packageInfo->p->c; $packageName = (string) $packageInfo->p->n; $license = (string) $packageInfo->p->l; $shortDescription = (stri...
php
{ "resource": "" }
q241285
EventDispatcher.dispatchScript
validation
public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array()) { return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags)); }
php
{ "resource": "" }
q241286
EventDispatcher.dispatchPackageEvent
validation
public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation) { return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool...
php
{ "resource": "" }
q241287
EventDispatcher.dispatchInstallerEvent
validation
public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array()) { return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo,...
php
{ "resource": "" }
q241288
EventDispatcher.addSubscriber
validation
public function addSubscriber(EventSubscriberInterface $subscriber) { foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { if (is_string($params)) { $this->addListener($eventName, array($subscriber, $params)); } elseif (is_string($params[0])) { ...
php
{ "resource": "" }
q241289
EventDispatcher.getListeners
validation
protected function getListeners(Event $event) { $scriptListeners = $this->getScriptListeners($event); if (!isset($this->listeners[$event->getName()][0])) { $this->listeners[$event->getName()][0] = array(); } krsort($this->listeners[$event->getName()]); $listener...
php
{ "resource": "" }
q241290
EventDispatcher.getScriptListeners
validation
protected function getScriptListeners(Event $event) { $package = $this->composer->getPackage(); $scripts = $package->getScripts(); if (empty($scripts[$event->getName()])) { return array(); } if ($this->loader) { $this->loader->unregister(); }...
php
{ "resource": "" }
q241291
EventDispatcher.pushEvent
validation
protected function pushEvent(Event $event) { $eventName = $event->getName(); if (in_array($eventName, $this->eventStack)) { throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName)); } return array_push($this->eventStack, $eventNam...
php
{ "resource": "" }
q241292
CompositeRepository.addRepository
validation
public function addRepository(RepositoryInterface $repository) { if ($repository instanceof self) { foreach ($repository->getRepositories() as $repo) { $this->addRepository($repo); } } else { $this->repositories[] = $repository; } }
php
{ "resource": "" }
q241293
DownloadManager.setOutputProgress
validation
public function setOutputProgress($outputProgress) { foreach ($this->downloaders as $downloader) { $downloader->setOutputProgress($outputProgress); } return $this; }
php
{ "resource": "" }
q241294
DownloadManager.setDownloader
validation
public function setDownloader($type, DownloaderInterface $downloader) { $type = strtolower($type); $this->downloaders[$type] = $downloader; return $this; }
php
{ "resource": "" }
q241295
DownloadManager.getDownloader
validation
public function getDownloader($type) { $type = strtolower($type); if (!isset($this->downloaders[$type])) { throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders)))); } return $t...
php
{ "resource": "" }
q241296
DownloadManager.download
validation
public function download(PackageInterface $package, $targetDir, $preferSource = null) { $preferSource = null !== $preferSource ? $preferSource : $this->preferSource; $sourceType = $package->getSourceType(); $distType = $package->getDistType(); $sources = array(); if ($source...
php
{ "resource": "" }
q241297
DownloadManager.update
validation
public function update(PackageInterface $initial, PackageInterface $target, $targetDir) { $downloader = $this->getDownloaderForInstalledPackage($initial); if (!$downloader) { return; } $installationSource = $initial->getInstallationSource(); if ('dist' === $inst...
php
{ "resource": "" }
q241298
DownloadManager.remove
validation
public function remove(PackageInterface $package, $targetDir) { $downloader = $this->getDownloaderForInstalledPackage($package); if ($downloader) { $downloader->remove($package, $targetDir); } }
php
{ "resource": "" }
q241299
DownloadManager.resolvePackageInstallPreference
validation
protected function resolvePackageInstallPreference(PackageInterface $package) { foreach ($this->packagePreferences as $pattern => $preference) { $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i'; if (preg_match($pattern, $package->getName())) { if (...
php
{ "resource": "" }