You are here

public static function Utilities::drupal_is_cli in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 8

1 call to Utilities::drupal_is_cli()
miniorange_oauth_client_uninstall in ./miniorange_oauth_client.install
hook_uninstall not needed. Configure variables are cleared when module is uninstalled.

File

src/Utilities.php, line 245

Class

Utilities

Namespace

Drupal\miniorange_oauth_client

Code

public static function drupal_is_cli() {
  $server = \Drupal::request()->server;
  $server_software = $server
    ->get('SERVER_SOFTWARE');
  $server_argc = $server
    ->get('argc');
  if (!isset($server_software) && (php_sapi_name() == 'cli' || is_numeric($server_argc) && $server_argc > 0)) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}