Supported Versions: PHP 5, PHP 7, PHP 8
Find the position of the first occurrence of a case-insensitive substring in a string
<?php stripos(string $haystack, string $needle, int $offset = 0): int|false
<?php {
if (PlatformRepository::isPlatformPackage($packageName)) {
if (0 === stripos($packageName, 'php') || $packageName === 'hhvm') {
$version = self::getPlatformPackageVersion($pool, $packageName, phpversion());
$msg = "- Root composer.json requires ".$packageName.self::constraintToText($constraint).' but ';
<?php }
if (0 === stripos($packageName, 'ext-')) {
if (false !== strpos($packageName, ' ')) {
return array('- ', "PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.');
}
<?php }
if (0 === stripos($packageName, 'lib-')) {
if (strtolower($packageName) === 'lib-icu') {
$error = extension_loaded('intl') ? 'it has the wrong version installed, try upgrading the intl extension.' : 'it is missing from your system, make sure the intl extension is loaded.';
<?php $filtered = array();
$byMajor = array();
foreach ($versions as $version => $pretty) {
if (0 === stripos($version, 'dev-')) {
$byMajor['dev'][] = $pretty;
} else {
$byMajor[Preg::replace('{^(\d+)\..*}', '$1', $version)][] = $pretty;
<?php if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
&& ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
&& (stripos($targetPrefix, $sourcePrefix) !== 0)
) {
continue;
}
<?php if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
&& ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
&& (stripos($targetPrefix, $sourcePrefix) !== 0)
) {
$this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
unset($this->config['extra']['branch-alias'][$sourceBranch]);
<?php $composer = $this->getBaseComposerInformation($identifier);
} catch (TransportException $e) {
$message = $e->getMessage();
if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
throw $e;
}
<?php }
if (false !== stripos($process->getErrorOutput(), 'authorization failed:')) {
return true;
<?php }
if (false !== stripos($process->getErrorOutput(), 'Authentication failed')) {
return true;
<?php );
$usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
$ifModified = false !== stripos(implode(',', $options['http']['header']), 'if-modified-since:') ? ' if modified' : '';
if ($attributes['redirects'] === 0 && $attributes['retries'] === 0) {
$this->io->writeError('Downloading ' . Url::sanitize($url) . $usingProxy . $ifModified, true, IOInterface::DEBUG);
}
<?php $origin = $job['origin'];
if ($this->disabled) {
if (isset($job['request']['options']['http']['header']) && false !== stripos(implode('', $job['request']['options']['http']['header']), 'if-modified-since')) {
$resolve(new Response(array('url' => $url), 304, array(), ''));
} else {
$e = new TransportException('Network disabled, request canceled: '.Url::sanitize($url), 499);
<?php } else {
$haystack = substr($url->name, -strlen($rule->name));
$match = stripos($haystack, $rule->name) === 0;
}
if ($match && $rule->port) {
<?php if (
!ini_get('open_basedir')
&& is_readable('/proc/version')
&& false !== stripos(Silencer::call('file_get_contents', '/proc/version'), 'microsoft')
&& !file_exists('/.dockerenv') // docker running inside WSL should not be seen as WSL
) {
return self::$isWindowsSubsystemForLinux = true;
<?php $httpVersion = 'streams';
}
if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
$platformPhpVersion = PlatformRepository::getPlatformPhpVersion();
$options['http']['header'][] = sprintf(
'User-Agent: Composer/%s (%s; %s; %s; %s%s%s)',
<?php $header = explode("\r\n", $header);
}
uasort($header, function ($el) {
return stripos($el, 'content-type') === 0 ? 1 : -1;
});
return $header;