You are here

private function ServerListBuilder::checkStatus in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_servers/src/ServerListBuilder.php \Drupal\ldap_servers\ServerListBuilder::checkStatus()

Format a server status response.

Parameters

string $server: Server.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The status string.

1 call to ServerListBuilder::checkStatus()
ServerListBuilder::buildRow in ldap_servers/src/ServerListBuilder.php
Builds a row for an entity in the entity listing.

File

ldap_servers/src/ServerListBuilder.php, line 80

Class

ServerListBuilder
Provides a listing of Server entities.

Namespace

Drupal\ldap_servers

Code

private function checkStatus($server) {
  $connection_result = $server
    ->connect();
  if ($server
    ->get('status')) {
    if ($connection_result == Server::LDAP_SUCCESS) {
      $bind_result = $server
        ->bind();
      if ($bind_result == Server::LDAP_SUCCESS) {
        return t('Server available');
      }
      else {
        return t('Configuration valid, bind failed.');
      }
    }
    else {
      return t('Configuration invalid, cannot connect.');
    }
  }
  else {
    return t('Deactivated');
  }
}