Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return all the keys or a subset of the keys of an array
<?php array_keys(array $array): array
<?php             $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             );

        }



        self::$restPattern = '{[^?"\'</'.implode('', array_keys(self::$typeConfig)).']+}A';

    }
<?php             $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));

        } else {

            $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());

            $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));

            $repo = new CompositeRepository($defaultRepos);

        }
<?php         if (null === $stability) {

            if (null === $packageVersion) {

                $stability = 'stable';

            } elseif (Preg::isMatch('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {

                $stability = $match[1];

            } else {

                $stability = VersionParser::parseStability($packageVersion);
<?php         $stability = VersionParser::normalizeStability($stability);



        if (!isset(BasePackage::$stabilities[$stability])) {

            throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));

        }



        $composer = Factory::create($io, $config->all(), $disablePlugins);
<?php                 new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),

                new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),

                new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),

                new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),

                new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),

                new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),

                new InputOption('autoload', 'a', InputOption::VALUE_REQUIRED, 'Add PSR-4 autoload mapping. Maps your package\'s namespace to the provided directory. (Expects a relative path, e.g. src/)'),
<?php                 if (!isset(BasePackage::$stabilities[$value])) {

                    throw new \InvalidArgumentException(

                        'Invalid minimum stability "'.$value.'". Must be empty or one of: '.

                        implode(', ', array_keys(BasePackage::$stabilities))

                    );

                }
<?php         }

        asort($similarPackages);



        return array_keys(array_slice($similarPackages, 0, 5));

    }
<?php     private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())

    {

        $requires = array_keys($package->getRequires());



        $packageListNames = array_keys($bucket);

        $packages = array_filter(
<?php     {

        $requires = array_keys($package->getRequires());



        $packageListNames = array_keys($bucket);

        $packages = array_filter(

            $repo->getPackages(),

            function ($package) use ($requires, $packageListNames) {
<?php                         }

                    }

                }

            } elseif (isset($composer[$type]) && $matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {

                foreach ($matches as $matchedPackage) {

                    if ($dryRun) {

                        $toRemove[$type][] = $matchedPackage;
<?php                         $json->removeLink($type, $matchedPackage);

                    }

                }

            } elseif (isset($composer[$altType]) && $matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {

                foreach ($matches as $matchedPackage) {

                    $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');

                    if ($io->isInteractive()) {
<?php         }



        return array_merge(

            array_fill_keys(array_keys($require), 'require'),

            array_fill_keys(array_keys($requireDev), 'require-dev')

        );

    }
<?php         return array_merge(

            array_fill_keys(array_keys($require), 'require'),

            array_fill_keys(array_keys($requireDev), 'require-dev')

        );

    }
<?php             $flags .= ' --with-dependencies';

        }



        $io->writeError('<info>Running composer update '.implode(' ', array_keys($requirements)).$flags.'</info>');



        $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);

        $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);