Gush\ThirdParty\Github\GitHubConfigurator::createAuthorization PHP Метод

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

private createAuthorization ( Github\Client $client, $code = null )
$client Github\Client
    private function createAuthorization(Client $client, $code = null)
    {
        $scopes = ['user:email', 'repo', 'repo:status', 'read:org'];
        // Use a date with time to make sure the name is unique.
        // It's not possible to get existing authorizations, only to create new ones.
        $time = (new \DateTime('now', new \DateTimeZone('UTC')))->format('Y-m-d\\TH:i:s \\U\\T\\C');
        $authorization = $client->api('authorizations')->create(['note' => sprintf('Gush on %s at %s', gethostname(), $time), 'scopes' => $scopes], $code);
        // NB. This message will be only shown when eg. fa2 is disabled or the 2fa code was correct.
        // Else the create() in authorizations will throw an exception.
        $this->styleHelper->success('Successfully authenticated, token note: ' . $authorization['note']);
        return $authorization;
    }