Gush\Helper\StyleHelper::success PHP Method

success() public method

public success ( $message )
    public function success($message)
    {
        $this->getStyle()->success($message);
    }

Usage Example

Example #1
0
 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;
 }