Created
January 15, 2020 19:19
-
-
Save ygerasimov/6a265facfc062528d11b2488e56d59d1 to your computer and use it in GitHub Desktop.
Diffy CLI auth:login command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace DiffyCli\Commands; | |
use Diffy\Diffy; | |
use DiffyCli\Config; | |
class AuthCommand extends \Robo\Tasks | |
{ | |
/** | |
* Logs in to Diffy | |
* | |
* @command auth:login | |
* | |
* @param string $apiKey Your API Key. Obtain your key at https://app.diffy.website/#/keys. | |
* | |
* @usage auth:login <api_key> Saves the API Key <api_key> to configuration for future use. | |
*/ | |
public function logIn($apiKey) | |
{ | |
Diffy::setApiKey($apiKey); | |
// If authentication fail we would get exception already. | |
// So now it is safe to save the key to configuration. | |
Config::saveApiKey($apiKey); | |
$this->io()->success("Key is validated and saved"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment