private function findJwk(array $jwks, $kid = null)
    {
        if ($this->subArrayHasEmptyFirstItem($jwks, 'keys')) {
            return null;
        }

        if (! $kid) {
            return $jwks['keys'][0];
        }

        foreach ($jwks['keys'] as $key) {
            if (isset($key['kid']) && $key['kid'] === $kid) {
                return $key;
            }
        }

        return null;
    }
private function findJwk(array $jwks, $kid = null)
    {
        if ($this->subArrayHasEmptyFirstItem($jwks, 'keys')) {
            return null;
        }

        if (! $kid) {
            return $jwks['keys'][0];
        }

        foreach ($jwks['keys'] as $key) {
            if (isset($key['kid']) && $key['kid'] === $kid) {
                return $key;
            }
        }

        return null;
    }
private function findJwk ( array $ jwks , $ kid = null ) { if ( $ this -> subArrayHasEmptyFirstItem ( $ jwks , 'keys' ) ) { return null ; } if ( ! $ kid ) { return $ jwks [ 'keys' ] [ 0 ] ; } foreach ( $ jwks [ 'keys' ] as $ key ) { if ( isset ( $ key [ 'kid' ] ) && $ key [ 'kid' ] === $ kid ) { return $ key ; } } return null ; }
Get a JWK from a JWKS using a key ID, if provided.

@param array       $jwks JWKS to parse.
@param null|string $kid  Key ID to return; returns first JWK if $kid is null or empty.

@return array|null Null if the keys array is empty or if the key ID is not found.

@codeCoverageIgnore
Get a JWK from a JWKS using a key ID if provided .