Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Applies the callback to the elements of the given arrays
<?php array_map(?callable $callback, array $array, array ...$arrays): array
<?php $mainAutoload = $rootPackage->getAutoload();
if ($rootPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
$levels = substr_count($filesystem->normalizePath($rootPackage->getTargetDir()), '/') + 1;
$prefixes = implode(', ', array_map(function ($prefix) {
return var_export($prefix, true);
}, array_keys($mainAutoload['psr-0'])));
$baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
$targetDirLoader = <<<EOF
<?php }
$version = str_replace('-', '.', $bound->getVersion());
$chunks = array_map('intval', explode('.', $version));
return $chunks[0] * 10000 + $chunks[1] * 100 + $chunks[2];
};
<?php if (count($packages) > 1) {
$package = reset($packages);
$io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
$io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
return $p->getPrettyString();
}, $packages)).'.');
$io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
} elseif ($packages) {
$package = reset($packages);
<?php $needles = array($needle);
if ($inverted) {
foreach ($packages as $package) {
$needles = array_merge($needles, array_map(function (Link $link) {
return $link->getTarget();
}, $package->getReplaces()));
}
}
<?php }
if (is_array($value)) {
$value = array_map(function ($val) {
return is_array($val) ? json_encode($val) : $val;
}, $value);
$value = '['.implode(', ', $value).']';
}
<?php $binDir = $composer->getConfig()->get('bin-dir');
if ($input->getOption('list') || !$input->getArgument('binary')) {
$bins = glob($binDir . '/*');
$bins = array_merge($bins, array_map(function ($e) {
return "$e (local)";
}, $composer->getPackage()->getBinaries()));
if (!$bins) {
throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
<?php return null;
}
$namespace = array_map(
function ($part) {
$part = Preg::replace('/[^a-z0-9]/i', ' ', $part);
$part = ucwords($part);
return str_replace(' ', '', $part);
},
explode('/', $packageName)
);
return join('\\', $namespace);
}
<?php protected function execute(InputInterface $input, OutputInterface $output)
{
$packages = $input->getArgument('packages');
$packages = array_map('strtolower', $packages);
$file = Factory::getComposerFile();
<?php throw new \RuntimeException('Failed loading the public key from '.$sigFile);
}
$algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
}
$signature = json_decode($signature, true);
<?php if ($input->getOption('no-dev')) {
$packages = $this->filterRequiredPackages($installedRepo, $rootPkg);
$repos = $installedRepo = new InstalledRepository(array(new InstalledArrayRepository(array_map(function ($pkg) {
return clone $pkg;
}, $packages))));
}
if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
<?php $showAllTypes = $input->getOption('all');
$showLatest = $input->getOption('latest');
$showMinorOnly = $input->getOption('minor-only');
$ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
$indent = $showAllTypes ? ' ' : '';
$latestPackages = array();
<?php {
$rootPackage = $this->getComposer()->getPackage();
return array_map(
'strtolower',
array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
);
}
<?php if ($licenses = $package->getLicense()) {
$spdxLicenses = new SpdxLicenses();
$json['licenses'] = array_map(function ($licenseId) use ($spdxLicenses) {
$license = $spdxLicenses->getLicenseByIdentifier($licenseId); // keys: 0 fullname, 1 osi, 2 url
if (!$license) {
return $licenseId;
}
return array(
'name' => $license[0],
'osi' => $licenseId,
'url' => $license[2],
);
}, $licenses);
}
return $json;
<?php foreach ($errors as $path => $changes) {
if ($input->getOption('verbose')) {
$indentedChanges = implode("\n", array_map(function ($line) {
return ' ' . ltrim($line);
}, explode("\n", $changes)));
$io->write('<info>'.$path.'</info>:');
$io->write($indentedChanges);
} else {
<?php foreach ($unpushedChanges as $path => $changes) {
if ($input->getOption('verbose')) {
$indentedChanges = implode("\n", array_map(function ($line) {
return ' ' . ltrim($line);
}, explode("\n", $changes)));
$io->write('<info>'.$path.'</info>:');
$io->write($indentedChanges);
} else {