<commit_before><?php

namespace Terminus\Commands;

use Terminus;
use Terminus\Session;
use Terminus\Commands\TerminusCommand;
use Terminus\Helpers\Input;

/**
 * Authenticate to Pantheon and store a local secret token.
 */
class AuthCommand extends TerminusCommand {
  private $auth;

  /**
   * Instantiates object, sets auth property
   */
  public function __construct() {
    parent::__construct();
    $this->auth = new Terminus\Auth();
  }

  /**
   * Log in as a user
   *
   *  ## OPTIONS
   * [<email>]
   * : Email address to log in as.
   *
   * [--password=<value>]
   * : Log in non-interactively with this password. Useful for automation.
   *
   * [--machine-token=<value>]
   * : Authenticate using an Auth0 token
   *
   * [--session=<value>]
   * : Authenticate using an existing session token
   * [--debug]
   * : dump call information when logging in.
   */
  public function login($args, $assoc_args) {
    // Try to login using a machine token, if provided.
    if (isset($assoc_args['machine-token'])
      || (empty($args) && isset($_SERVER['TERMINUS_MACHINE_TOKEN']))
    ) {
      if (isset($assoc_args['machine-token'])) {
        $token = $assoc_args['machine-token'];
      } elseif (isset($_SERVER['TERMINUS_MACHINE_TOKEN'])) {
        $token = $_SERVER['TERMINUS_MACHINE_TOKEN'];
      }
      $this->auth->logInViaMachineToken($token);
    } elseif (isset($assoc_args['session'])) {
      $this->auth->logInViaSessionToken($assoc_args['session']);
    } else {
      // Otherwise, do a normal email/password-based login.<commit_msg>Removed 'Auth0' from auth login machine-token documentation<commit_after><?php

namespace Terminus\Commands;

use Terminus;
use Terminus\Session;
use Terminus\Commands\TerminusCommand;
use Terminus\Helpers\Input;

/**
 * Authenticate to Pantheon and store a local secret token.
 */
class AuthCommand extends TerminusCommand {
  private $auth;

  /**
   * Instantiates object, sets auth property
   */
  public function __construct() {
    parent::__construct();
    $this->auth = new Terminus\Auth();
  }

  /**
   * Log in as a user
   *
   *  ## OPTIONS
   * [<email>]
   * : Email address to log in as.
   *
   * [--password=<value>]
   * : Log in non-interactively with this password. Useful for automation.
   *
   * [--machine-token=<value>]
   * : Authenticates using a machine token from your dashboard. Stores the
   *   token for future use.
   *
   * [--session=<value>]
   * : Authenticate using an existing session token
   *
   * [--debug]
   * : dump call information when logging in.
   */
  public function login($args, $assoc_args) {
    // Try to login using a machine token, if provided.
    if (isset($assoc_args['machine-token'])
      || (empty($args) && isset($_SERVER['TERMINUS_MACHINE_TOKEN']))
    ) {
      if (isset($assoc_args['machine-token'])) {
        $token = $assoc_args['machine-token'];
      } elseif (isset($_SERVER['TERMINUS_MACHINE_TOKEN'])) {
        $token = $_SERVER['TERMINUS_MACHINE_TOKEN'];
      }
      $this->auth->logInViaMachineToken($token);
    } elseif (isset($assoc_args['session'])) {
      $this->auth->logInViaSessionToken($assoc_args['session']);
    } else {
      // Otherwise, do a normal email/password-based login.
{'fraction_non_alphanumeric': 0.14448552064078865, 'fraction_numerical': 0.0006161429451632779, 'mean_word_length': 3.178893178893179, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4922900', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1030, 'n_words': 248}