Google\Cloud\ClientTrait::getKeyFile PHP Метод

getKeyFile() приватный Метод

Process: 1. If $config['keyFile'] is set, use that. 2. If $config['keyFilePath'] is set, load the file and use that. 3. If GOOGLE_APPLICATION_CREDENTIALS environment variable is set, load from that location and use that. 4. If OS-specific well-known-file is set, load from that location and use that. 5. Exception. :(
private getKeyFile ( array $config = [] ) : array
$config array
Результат array Key data
    private function getKeyFile(array $config = [])
    {
        $config += ['keyFile' => null, 'keyFilePath' => null];
        if ($config['keyFile']) {
            return $config['keyFile'];
        }
        if ($config['keyFilePath']) {
            if (!file_exists($config['keyFilePath'])) {
                throw new GoogleException('Given keyfile path does not exist');
            }
            $keyFileData = json_decode(file_get_contents($config['keyFilePath']), true);
            if (json_last_error() !== JSON_ERROR_NONE) {
                throw new GoogleException('Given keyfile was invalid');
            }
            return $keyFileData;
        }
        return CredentialsLoader::fromEnv() ?: CredentialsLoader::fromWellKnownFile();
    }