array_key_exists

Supported Versions: PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8
Checks if the given key or index exists in the array
Alias key_exists
<?php array_key_exists(string|int|float|bool|resource|null $key, array $array): bool
<?php     public function has($key)

    {

        return array_key_exists($key, $this->config);

    }
<?php         $repo = $package->getRepository();

        if ($repo instanceof VcsRepository) {

            $repoConfig = $repo->getRepoConfig();

            if (array_key_exists('svn-cache-credentials', $repoConfig)) {

                $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];

            }

        }
<?php             if (isset($installed['versions'][$packageName]['pretty_version'])) {

                $ranges[] = $installed['versions'][$packageName]['pretty_version'];

            }

            if (array_key_exists('aliases', $installed['versions'][$packageName])) {

                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);

            }

            if (array_key_exists('replaced', $installed['versions'][$packageName])) {
<?php             if (array_key_exists('aliases', $installed['versions'][$packageName])) {

                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);

            }

            if (array_key_exists('replaced', $installed['versions'][$packageName])) {

                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);

            }

            if (array_key_exists('provided', $installed['versions'][$packageName])) {
<?php             if (array_key_exists('replaced', $installed['versions'][$packageName])) {

                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);

            }

            if (array_key_exists('provided', $installed['versions'][$packageName])) {

                $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);

            }
<?php         }



        foreach ($gitlabToken as $domain => $token) {

            $username = is_array($token) && array_key_exists("username", $token) ? $token["username"] : $token;

            $password = is_array($token) && array_key_exists("token", $token) ? $token["token"] : 'private-token';

            $this->checkAndSetAuthentication($domain, $username, $password);

        }
<?php         foreach ($gitlabToken as $domain => $token) {

            $username = is_array($token) && array_key_exists("username", $token) ? $token["username"] : $token;

            $password = is_array($token) && array_key_exists("token", $token) ? $token["token"] : 'private-token';

            $this->checkAndSetAuthentication($domain, $username, $password);

        }
<?php     {

        $decoded = JsonFile::parseJson($this->contents);



        if (!array_key_exists($key, $decoded)) {

            return true;

        }
<?php     {

        $decoded = JsonFile::parseJson($this->contents);



        if (!array_key_exists($key, $decoded)) {

            return true;

        }
<?php         }



        if (

            array_key_exists($capability, $capabilities)

            && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))

        ) {

            throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], true));
<?php         $result = array();

        $namesFound = array();

        foreach ($packages as $package) {

            if (array_key_exists($package->getName(), $packageMap)) {

                if (

                    (!$packageMap[$package->getName()] || $packageMap[$package->getName()]->matches(new Constraint('==', $package->getVersion())))

                    && StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, $package->getNames(), $package->getStability())
<?php                         $this->getBranches()

                    ) ?: $identifier;



                    if (array_key_exists($label, $tags = $this->getTags())) {

                        $hash = $tags[$label];

                    } elseif (array_key_exists($label, $branches = $this->getBranches())) {

                        $hash = $branches[$label];
<?php                     if (array_key_exists($label, $tags = $this->getTags())) {

                        $hash = $tags[$label];

                    } elseif (array_key_exists($label, $branches = $this->getBranches())) {

                        $hash = $branches[$label];

                    }
<?php         if (isset($this->repoConfig['tags-path'])) {

            $this->tagsPath = $this->repoConfig['tags-path'];

        }

        if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {

            $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];

        }

        if (isset($this->repoConfig['package-path'])) {
<?php         $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();

        $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();

        foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {

            if (!array_key_exists($scriptName, $scripts)) {

                $warnings[] = sprintf(

                    'Description for non-existent script "%s" found in "scripts-descriptions"',

                    $scriptName