commit 32700c5792ed296e7e0724a8ebc85dee3f731d53
Author: Assos Assos <assos+forge@centrale-marseille.fr>
Date:   Wed Apr 24 23:38:52 2019 +0200

    Weekly update of contrib modules

diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/LdapAuthenticationConf.class.php b/drupal7/sites/all/modules/ldap/ldap_authentication/LdapAuthenticationConf.class.php
index 4b3bc321..95d3ace6 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/LdapAuthenticationConf.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/LdapAuthenticationConf.class.php
@@ -3,67 +3,72 @@
 /**
  * @file
  * This class represents an ldap_authentication module's configuration
- * It is extended by LdapAuthenticationConfAdmin for configuration and other admin functions
+ * It is extended by LdapAuthenticationConfAdmin for configuration and other admin functions.
  */
 
 module_load_include('php', 'ldap_user', 'LdapUserConf.class');
-
+/**
+ *
+ */
 class LdapAuthenticationConf {
 
   /**
-   * server configuration ids being used for authentication
+   * Server configuration ids being used for authentication.
    *
    * @var array
    *
    * @see LdapServer->sid()
    */
-  public $sids = array();
+  public $sids = [];
 
   /**
-   * server configuration ids being used for authentication
+   * Server configuration ids being used for authentication.
    *
-   * @var associative array of LdapServer objects keyed on sids
+   * @var associativearrayofLdapServerobjectskeyedonsids
    *
    * @see LdapServer->sid()
    * @see LdapServer
    */
-  public $enabledAuthenticationServers = array();
+  public $enabledAuthenticationServers = [];
 
 
   /**
-   * LdapUser configuration object
+   * LdapUser configuration object.
    *
-   * @var LdapUser object
+   * @var LdapUserobject
    */
-  public $ldapUser = NULL; // ldap_user configuration object
+  /**
+   * Ldap_user configuration object.
+   */
+  public $ldapUser = NULL;
 
   /**
    * Has current object been saved to the database?
    *
-   * @var boolean
+   * @var bool
    */
   public $inDatabase = FALSE;
 
   /**
-    * Choice of authentication modes
-    *
-    * @var integer
-    *   LDAP_AUTHENTICATION_MODE_DEFAULT (LDAP_AUTHENTICATION_MIXED)
-    *   LDAP_AUTHENTICATION_MIXED - signifies both LDAP and Drupal authentication are allowed
-    *     Drupal authentication is attempted first.
-    *   LDAP_AUTHENTICATION_EXCLUSIVE - signifies only LDAP authenication is allowed
-    */
+   * Choice of authentication modes.
+   *
+   * @var int
+   *   LDAP_AUTHENTICATION_MODE_DEFAULT (LDAP_AUTHENTICATION_MIXED)
+   *   LDAP_AUTHENTICATION_MIXED - signifies both LDAP and Drupal authentication are allowed
+   *     Drupal authentication is attempted first.
+   *   LDAP_AUTHENTICATION_EXCLUSIVE - signifies only LDAP authenication is allowed
+   */
   public $authenticationMode = LDAP_AUTHENTICATION_MODE_DEFAULT;
 
   /**
    * The following are used to alter the logon interface to direct users
-   * to local LDAP specific authentication help
+   * to local LDAP specific authentication help.
    */
 
   /**
    * Text describing username to use, such as "Hogwarts Username"
    *  which will be inserted on logon forms to help users figure out which
-   *  username to use
+   *  username to use.
    *
    * @var string
    */
@@ -72,7 +77,7 @@ class LdapAuthenticationConf {
   /**
    * Text describing password to use, such as "Hogwards LDAP Password"
    *  which will be inserted on logon forms.  Useful in organizations with
-   *  multiple account types for authentication
+   *  multiple account types for authentication.
    *
    * @var string
    */
@@ -81,7 +86,7 @@ class LdapAuthenticationConf {
   /**
    * Text and Url to provide help link for password such as:
    *   ldapUserHelpLinkUrl:    https://passwords.hogwarts.edu
-   *   ldapUserHelpLinkText:  Hogwarts IT Password Support Page
+   *   ldapUserHelpLinkText:  Hogwarts IT Password Support Page.
    *
    * @var string
    */
@@ -92,95 +97,95 @@ class LdapAuthenticationConf {
    * Email handling option
    *   LDAP_AUTHENTICATION_EMAIL_FIELD_REMOVE -- don't show email on user forms
    *   LDAP_AUTHENTICATION_EMAIL_FIELD_DISABLE (default) -- disable email on user forms
-   *   LDAP_AUTHENTICATION_EMAIL_FIELD_ALLOW -- allow editing of email on user forms
+   *   LDAP_AUTHENTICATION_EMAIL_FIELD_ALLOW -- allow editing of email on user forms.
    *
    * @var int
    */
   public $emailOption = LDAP_AUTHENTICATION_EMAIL_FIELD_DEFAULT;
 
-   /**
+  /**
    * Email handling option
    *   LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE_NOTIFY -- (default) Update stored email if LDAP email differs at login and notify user
    *   LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE  -- Update stored email if LDAP email differs at login but don\'t notify user
-   *   LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_DISABLE -- Don\'t update stored email if LDAP email differs at login
+   *   LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_DISABLE -- Don\'t update stored email if LDAP email differs at login.
    *
    * @var int
    */
   public $emailUpdate = LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_DEFAULT;
-  
+
   /**
-   * Email default handling option
-   * 
-   * This affects how email addresses that are empty are handled by 
+   * Email default handling option.
+   *
+   * This affects how email addresses that are empty are handled by
    * the authentication process.
-   * 
+   *
    *   LDAP_AUTHENTICATION_EMAIL_TEMPLATE_NONE -- leaves the email empty
    *   LDAP_AUTHENTICATION_EMAIL_TEMPLATE_IF_EMPTY (default) -- if the email is empty, it will be replaced
    *   LDAP_AUTHENTICATION_EMAIL_TEMPLATE_ALWAYS -- always use the template
-   * 
+   *
    * @var int
    */
   public $emailTemplateHandling = LDAP_AUTHENTICATION_EMAIL_TEMPLATE_DEFAULT;
-  
+
   /**
    * Email template.
-   * 
+   *
    * @var string
    */
   public $emailTemplate = LDAP_AUTHENTICATION_DEFAULT_TEMPLATE;
-      
+
   /**
-   * Whether or not to display a notification to the user on login, prompting 
+   * Whether or not to display a notification to the user on login, prompting
    * them to change their email.
-   * 
-   * @var boolean
+   *
+   * @var bool
    */
   public $templateUsagePromptUser = LDAP_AUTHENTICATION_TEMPLATE_USAGE_PROMPT_USER_DEFAULT;
-  
+
   /**
    * Whether or not to avoid updating the email address of the user if the
    * template was used to generate it.
-   * 
-   * @var boolean
+   *
+   * @var bool
    */
   public $templateUsageNeverUpdate = LDAP_AUTHENTICATION_TEMPLATE_USAGE_NEVER_UPDATE_DEFAULT;
-  
+
   /**
    * Whether or not to use the email template if there is a user with a different
    * login name but same email address in the system.
-   * 
-   * @var boolean
+   *
+   * @var bool
    */
   public $templateUsageResolveConflict = LDAP_AUTHENTICATION_TEMPLATE_USAGE_RESOLVE_CONFLICT_DEFAULT;
-  
+
   /**
    * A PCRE regular expression (minus the delimiter and flags) that will be used
-   * if $templateUsagePromptUser is set to true to determine if the email 
-   * address is a fake one or not. 
-   * 
+   * if $templateUsagePromptUser is set to true to determine if the email
+   * address is a fake one or not.
+   *
    * By allowing this to be customized, we let the administrators handle older
    * patterns should they decide to change the existing one, as well as avoiding
    * the complexity of determining a proper regex from the template.
-   * 
+   *
    * @var string
    */
   public $templateUsagePromptRegex = LDAP_AUTHENTICATION_DEFAULT_TEMPLATE_REGEX;
-  
+
   /**
    * Controls whether or not we should check on login if the email template was
    * used and redirect the user if needed.
-   * 
-   * @var boolean
+   *
+   * @var bool
    */
   public $templateUsageRedirectOnLogin = LDAP_AUTHENTICATION_REDIRECT_ON_LOGIN_DEFAULT;
-  
 
 
-   /**
+
+  /**
    * Password handling option
    *   LDAP_AUTHENTICATION_PASSWORD_FIELD_SHOW -- show field disabled on user forms
    *   LDAP_AUTHENTICATION_PASSWORD_FIELD_HIDE (default) -- disable password on user forms
-   *   LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW -- allow editing of password on user forms
+   *   LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW -- allow editing of password on user forms.
    *
    * @var int
    */
@@ -194,50 +199,52 @@ class LdapAuthenticationConf {
   public $ssoNotifyAuthentication = FALSE;
   public $ldapImplementation = FALSE;
   public $cookieExpire = LDAP_AUTHENTICATION_COOKIE_EXPIRE;
-  public $apiPrefs = array();
+  public $apiPrefs = [];
 
   /**
-   * Advanced options.   whitelist / blacklist options
-   *
-   * these are on the fuzzy line between authentication and authorization
-   * and determine if a user is allowed to authenticate with ldap
+   * Advanced options.   whitelist / blacklist options.
    *
+   * These are on the fuzzy line between authentication and authorization
+   * and determine if a user is allowed to authenticate with ldap.
    */
 
   /**
-   * text which must be present in user's LDAP entry's DN for user to authenticate with LDAP
-   *   e.g. "ou=people"
+   * Text which must be present in user's LDAP entry's DN for user to authenticate with LDAP
+   *   e.g. "ou=people".
    *
    * @var string
    */
-  public $allowOnlyIfTextInDn = array(); // eg ou=education that must be met to allow ldap authentication
+  /**
+   * Eg ou=education that must be met to allow ldap authentication.
+   */
+  public $allowOnlyIfTextInDn = [];
 
   /**
-   * text which prohibits logon if found in user's LDAP entry's DN for user to authenticate with LDAP
-   *   e.g. "ou=guest accounts"
+   * Text which prohibits logon if found in user's LDAP entry's DN for user to authenticate with LDAP
+   *   e.g. "ou=guest accounts".
    *
    * @var string
    */
-  public $excludeIfTextInDn = array();
+  public $excludeIfTextInDn = [];
 
   /**
-   * code that prints 1 or 0 signifying if user is allowed
-   *   should not start with <?php
+   * Code that prints 1 or 0 signifying if user is allowed
+   *   should not start with <?php.
    *
-   * @var string of php
+   * @var stringofphp
    */
   public $allowTestPhp = NULL;
 
   /**
-   * if at least 1 ldap authorization must exist for user to be allowed
+   * If at least 1 ldap authorization must exist for user to be allowed
    *   True signfies disallow if no authorizations.
    *   False signifies don't consider authorizations.
    *
-   * @var boolean.
+   * @var bool
    */
   public $excludeIfNoAuthorizations = LDAP_AUTHENTICATION_EXCL_IF_NO_AUTHZ_DEFAULT;
 
-  public $saveable = array(
+  public $saveable = [
     'sids',
     'authenticationMode',
     'loginUIUsernameTxt',
@@ -265,21 +272,33 @@ class LdapAuthenticationConf {
     'templateUsageResolveConflict',
     'templateUsagePromptRegex',
     'templateUsageRedirectOnLogin',
-  );
+  ];
 
+  /**
+   *
+   */
   public function hasEnabledAuthenticationServers() {
     return !(count($this->enabledAuthenticationServers) == 0);
   }
 
+  /**
+   *
+   */
   public function enabled_servers() {
     return $this->hasEnabledAuthenticationServers();
   }
 
-  function __construct() {
+  /**
+   *
+   */
+  public function __construct() {
     $this->load();
   }
 
-  function load() {
+  /**
+   *
+   */
+  public function load() {
 
     if ($saved = variable_get("ldap_authentication_conf", FALSE)) {
       $this->inDatabase = TRUE;
@@ -288,7 +307,8 @@ class LdapAuthenticationConf {
           $this->{$property} = $saved[$property];
         }
       }
-      $this->enabledAuthenticationServers = array(); // reset in case reloading instantiated object
+      // Reset in case reloading instantiated object.
+      $this->enabledAuthenticationServers = [];
       $enabled_ldap_servers = ldap_servers_get_servers(NULL, 'enabled');
       foreach ($this->sids as $sid => $enabled) {
         if ($enabled && isset($enabled_ldap_servers[$sid])) {
@@ -309,19 +329,21 @@ class LdapAuthenticationConf {
   }
 
   /**
-   * Destructor Method
+   * Destructor Method.
    */
-  function __destruct() { }
-
+  public function __destruct() {}
 
- /**
-   * decide if a username is excluded or not
+  /**
+   * Decide if a username is excluded or not.
+   *
+   * @param string $name
+   *   as proposed drupal username.
+   * @param array $ldap_user
+   *   where top level keys are 'dn','attr','mail'.
    *
-   * @param string $name as proposed drupal username
-   * @param array $ldap_user where top level keys are 'dn','attr','mail'
    * @return boolean FALSE means NOT allow; TRUE means allow
    *
-   * @todo.  this function should simply invoke hook_ldap_authentication_allowuser_results_alter
+   * @todo. this function should simply invoke hook_ldap_authentication_allowuser_results_alter
    *   and most of this function should go in ldap_authentication_allowuser_results_alter
    */
   public function allowUser($name, $ldap_user) {
@@ -330,12 +352,13 @@ class LdapAuthenticationConf {
      * do one of the exclude attribute pairs match
      */
     $ldap_user_conf = ldap_user_conf();
-    // if user does not already exists and deferring to user settings AND user settings only allow
+    // If user does not already exists and deferring to user settings AND user settings only allow.
     $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
 
     foreach ($this->excludeIfTextInDn as $test) {
       if (stripos($ldap_user['dn'], $test) !== FALSE) {
-        return FALSE;//  if a match, return FALSE;
+        // Match.
+        return FALSE;
       }
     }
 
@@ -352,13 +375,13 @@ class LdapAuthenticationConf {
         $code_result = php_eval($code);
         $_name = NULL;
         $_ldap_user_entry = NULL;
-        if ((boolean)($code_result) == FALSE) {
+        if ((boolean) ($code_result) == FALSE) {
           return FALSE;
         }
       }
       else {
         drupal_set_message(t(LDAP_AUTHENTICATION_DISABLED_FOR_BAD_CONF_MSG), 'warning');
-        $tokens = array('!ldap_authentication_config' => l(t('LDAP Authentication Configuration'), 'admin/config/people/ldap/authentication'));
+        $tokens = ['!ldap_authentication_config' => l(t('LDAP Authentication Configuration'), 'admin/config/people/ldap/authentication')];
         watchdog('ldap_authentication', 'LDAP Authentication is configured to deny users based on php execution with php_eval function, but php module is not enabled. Please enable php module or remove php code at !ldap_authentication_config .', $tokens);
         return FALSE;
       }
@@ -387,14 +410,15 @@ class LdapAuthenticationConf {
 
       if (!module_exists('ldap_authorization')) {
         drupal_set_message(t(LDAP_AUTHENTICATION_DISABLED_FOR_BAD_CONF_MSG), 'warning');
-        $tokens = array('!ldap_authentication_config' => l(t('LDAP Authentication Configuration'), 'admin/config/people/ldap/authentication'));
+        $tokens = ['!ldap_authentication_config' => l(t('LDAP Authentication Configuration'), 'admin/config/people/ldap/authentication')];
         watchdog('ldap_authentication', 'LDAP Authentication is configured to deny users without LDAP Authorization mappings, but LDAP Authorization module is not enabled.  Please enable and configure LDAP Authorization or disable this option at !ldap_authentication_config .', $tokens);
         return FALSE;
       }
 
       $user = new stdClass();
       $user->name = $name;
-      $user->ldap_authenticated = TRUE; // fake user property added for query
+      // Fake user property added for query.
+      $user->ldap_authenticated = TRUE;
       $consumers = ldap_authorization_get_consumers();
       $has_enabled_consumers = FALSE;
       $has_ldap_authorizations = FALSE;
@@ -415,7 +439,7 @@ class LdapAuthenticationConf {
 
       if (!$has_enabled_consumers) {
         drupal_set_message(t(LDAP_AUTHENTICATION_DISABLED_FOR_BAD_CONF_MSG), 'warning');
-        $tokens = array('!ldap_consumer_config' => l(t('LDAP Authorization Configuration'), 'admin/config/people/ldap/authorization'));
+        $tokens = ['!ldap_consumer_config' => l(t('LDAP Authorization Configuration'), 'admin/config/people/ldap/authorization')];
         watchdog('ldap_authentication', 'LDAP Authentication is configured to deny users without LDAP Authorization mappings, but 0 LDAP Authorization consumers are configured:  !ldap_consumer_config .', $tokens);
         return FALSE;
       }
@@ -425,12 +449,12 @@ class LdapAuthenticationConf {
 
     }
 
-    // allow other modules to hook in and refuse if they like
+    // Allow other modules to hook in and refuse if they like.
     $hook_result = TRUE;
     drupal_alter('ldap_authentication_allowuser_results', $ldap_user, $name, $hook_result);
 
     if ($hook_result === FALSE) {
-      watchdog('ldap_authentication', "Authentication Allow User Result=refused for %name", array('%name' => $name), WATCHDOG_NOTICE);
+      watchdog('ldap_authentication', "Authentication Allow User Result=refused for %name", ['%name' => $name], WATCHDOG_NOTICE);
       return FALSE;
     }
 
@@ -440,5 +464,4 @@ class LdapAuthenticationConf {
     return TRUE;
   }
 
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/LdapAuthenticationConfAdmin.class.php b/drupal7/sites/all/modules/ldap/ldap_authentication/LdapAuthenticationConfAdmin.class.php
index 5c43c51d..3adf2b1a 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/LdapAuthenticationConfAdmin.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/LdapAuthenticationConfAdmin.class.php
@@ -2,27 +2,32 @@
 
 /**
  * @file
- * This classextends by LdapAuthenticationConf for configuration and other admin functions
+ * This classextends by LdapAuthenticationConf for configuration and other admin functions.
  */
 
 ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConf.class');
-
+/**
+ *
+ */
 class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
 
+  /**
+   *
+   */
   protected function setTranslatableProperties() {
 
     /**
      * 0.  Logon Options
      */
 
-    $values['authenticationModeOptions']  = array(
+    $values['authenticationModeOptions'] = [
       LDAP_AUTHENTICATION_MIXED => t('Mixed mode. Drupal authentication is tried first.  On failure, LDAP authentication is performed.'),
       LDAP_AUTHENTICATION_EXCLUSIVE => t('Only LDAP Authentication is allowed except for user 1.
         If selected, (1) reset password links will be replaced with links to ldap end user documentation below.
         (2) The reset password form will be left available at user/password for user 1; but no links to it
         will be provided to anonymous users.
         (3) Password fields in user profile form will be removed except for user 1.'),
-      );
+    ];
 
     $values['authenticationServersDescription'] = t('Check all LDAP server configurations to use in authentication.
      Each will be tested for authentication until successful or
@@ -41,8 +46,7 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
      passwords etc. Should be of form http://domain.com/. Could be the institutions ldap password support page
      or a page within this drupal site that is available to anonymous users.');
 
-    $values['ldapUserHelpLinkTextDescription']  = t('Text for above link e.g. Account Help or Campus Password Help Page');
-
+    $values['ldapUserHelpLinkTextDescription'] = t('Text for above link e.g. Account Help or Campus Password Help Page');
 
     /**
      * LDAP User Restrictions
@@ -68,100 +72,99 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
     * Email
     */
 
-    $values['emailOptionOptions'] = array(
+    $values['emailOptionOptions'] = [
       LDAP_AUTHENTICATION_EMAIL_FIELD_REMOVE => t('Don\'t show an email field on user forms. LDAP derived email will be used for user and cannot be changed by user.'),
       LDAP_AUTHENTICATION_EMAIL_FIELD_DISABLE => t('Show disabled email field on user forms with LDAP derived email. LDAP derived email will be used for user and cannot be changed by user.'),
       LDAP_AUTHENTICATION_EMAIL_FIELD_ALLOW => t('Leave email field on user forms enabled. Generally used when provisioning to LDAP or not using email derived from LDAP.'),
-      );
+    ];
 
-    $values['emailUpdateOptions'] = array(
+    $values['emailUpdateOptions'] = [
       LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE_NOTIFY => t('Update stored email if LDAP email differs at login and notify user.'),
       LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE => t('Update stored email if LDAP email differs at login but don\'t notify user.'),
       LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_DISABLE => t('Don\'t update stored email if LDAP email differs at login.'),
-      );
-    $values['emailTemplateHandlingOptions'] = array(
+    ];
+    $values['emailTemplateHandlingOptions'] = [
       LDAP_AUTHENTICATION_EMAIL_TEMPLATE_NONE => t('Never use the template.'),
       LDAP_AUTHENTICATION_EMAIL_TEMPLATE_IF_EMPTY => t('Use the template if no email address was provided by the LDAP server.'),
       LDAP_AUTHENTICATION_EMAIL_TEMPLATE_ALWAYS => t('Always use the template.'),
-    );
-
+    ];
 
     /**
     * Password
     */
 
-    $values['passwordUpdateOptions'] = array(
+    $values['passwordUpdateOptions'] = [
       LDAP_AUTHENTICATION_PASSWORD_FIELD_SHOW => t('Display password field disabled (Prevents password updates).'),
       LDAP_AUTHENTICATION_PASSWORD_FIELD_HIDE => t('Don\'t show password field on user forms except login form.'),
       LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW => t('Display password field and allow updating it. In order to change password in LDAP, LDAP provisioning for this field must be enabled.'),
-      );
+    ];
 
     /**
      *  Single Sign-On / Seamless Sign-On
      */
 
-      $values['ldapImplementationOptions'] = array(
-        'mod_auth_sspi' => t('mod_auth_sspi'),
-        'mod_auth_kerb' => t('mod_auth_kerb'),
-        );
+    $values['ldapImplementationOptions'] = [
+      'mod_auth_sspi' => t('mod_auth_sspi'),
+      'mod_auth_kerb' => t('mod_auth_kerb'),
+    ];
 
-      $values['cookieExpirePeriod'] = array(-1 => t('Session'), 0 => t('Immediately')) +
-        drupal_map_assoc(array(3600, 86400, 604800, 2592000, 31536000, 315360000, 630720000), 'format_interval');
+    $values['cookieExpirePeriod'] = [-1 => t('Session'), 0 => t('Immediately')] +
+        drupal_map_assoc([3600, 86400, 604800, 2592000, 31536000, 315360000, 630720000], 'format_interval');
 
-      $values['ssoEnabledDescription'] = '<strong>' . t('Single Sign on is enabled.') .
+    $values['ssoEnabledDescription'] = '<strong>' . t('Single Sign on is enabled.') .
         '</strong> ' . t('To disable it, disable the LDAP SSO Module on the') . ' ' . l(t('Modules Form'), 'admin/modules') . '.<p>' .
         t('Single Sign-On enables ' .
         'users of this site to be authenticated by visiting the URL ' .
         '"user/login/sso, or automatically if selecting "automated ' .
         'single sign-on" below. Set up of LDAP authentication must be ' .
-        'performed on the web server. Please review the readme file of the '.
+        'performed on the web server. Please review the readme file of the ' .
         'ldap_sso module for more information.')
         . '</p>';
 
-      $values['ssoExcludedPathsDescription'] = '<p>' .
+    $values['ssoExcludedPathsDescription'] = '<p>' .
         t("Which paths will not check for SSO? cron.php is common example.  Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard.
           Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.",
-          array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
-        '</p>';
+          ['%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>']);
+    '</p>';
 
-      $values['ssoExcludedHostsDescription'] = '<p>' .
+    $values['ssoExcludedHostsDescription'] = '<p>' .
         t('If your site is accessible via multiple hostnames, you may only want
           the LDAP SSO module to authenticate against some of them. To exclude
           any hostnames from SSO, enter them here. Enter one host per line.');
-        '</p>';
+    '</p>';
 
-      $values['ssoRemoteUserStripDomainNameDescription'] = t('Useful when the ' .
+    $values['ssoRemoteUserStripDomainNameDescription'] = t('Useful when the ' .
         'WWW server provides authentication in the form of user@realm and you ' .
         'want to have both SSO and regular forms based authentication ' .
         'available. Otherwise duplicate accounts with conflicting e-mail ' .
         'addresses may be created.');
-      $values['ssoNotifyAuthenticationDescription'] = t('This displays a message to the ' .
+    $values['ssoNotifyAuthenticationDescription'] = t('This displays a message to the ' .
         'user after they have succesfully authenticated using single sign on');
-      $values['seamlessLogInDescription'] = t('This requires that you ' .
+    $values['seamlessLogInDescription'] = t('This requires that you ' .
         'have operational NTLM or Kerberos authentication turned on for at least ' .
         'the path user/login/sso, or for the whole domain.');
-      $values['cookieExpireDescription'] = t('If using the automated/seamless login, a ' .
+    $values['cookieExpireDescription'] = t('If using the automated/seamless login, a ' .
         'cookie is necessary to prevent automatic login after a user ' .
         'manually logs out. Select the lifetime of the cookie.');
-      $values['ldapImplementationDescription'] = t('Select the type of ' .
+    $values['ldapImplementationDescription'] = t('Select the type of ' .
         'authentication mechanism you are using.');
 
-      foreach ($values as $property => $default_value) {
-        $this->$property = $default_value;
-      }
+    foreach ($values as $property => $default_value) {
+      $this->$property = $default_value;
     }
+  }
 
   /**
-   * 0.  Logon Options
+   * 0.  Logon Options.
    */
   public $authenticationModeDefault = LDAP_AUTHENTICATION_MIXED;
   public $authenticationModeOptions;
 
   protected $authenticationServersDescription;
-  protected $authenticationServersOptions = array();
+  protected $authenticationServersOptions = [];
 
   /**
-   * 1.  User Login Interface
+   * 1.  User Login Interface.
    */
   protected $loginUIUsernameTxtDescription;
   protected $loginUIPasswordTxtDescription;
@@ -170,15 +173,15 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
 
 
   /**
-   * 2.  LDAP User Restrictions
+   * 2.  LDAP User Restrictions.
    */
 
   protected $allowOnlyIfTextInDnDescription;
   protected $excludeIfTextInDnDescription;
   protected $allowTestPhpDescription;
 
-   /**
-   * 4. Email
+  /**
+   * 4. Email.
    */
 
   public $emailOptionDefault = LDAP_AUTHENTICATION_EMAIL_FIELD_REMOVE;
@@ -186,20 +189,20 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
 
   public $emailUpdateDefault = LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE_NOTIFY;
   public $emailUpdateOptions;
-  
+
   public $emailTemplateHandlingDefault = LDAP_AUTHENTICATION_EMAIL_TEMPLATE_DEFAULT;
   public $emailTemplateHandlingOptions;
-  
+
   public $emailTemplateDefault = LDAP_AUTHENTICATION_DEFAULT_TEMPLATE;
-  
+
   public $templateUsagePromptUserDefault = LDAP_AUTHENTICATION_TEMPLATE_USAGE_PROMPT_USER_DEFAULT;
-  
+
   public $templateUsagePromptRegexDefault = LDAP_AUTHENTICATION_DEFAULT_TEMPLATE_REGEX;
-  
+
   public $templateUsageNeverUpdateDefault = LDAP_AUTHENTICATION_TEMPLATE_USAGE_NEVER_UPDATE_DEFAULT;
 
-   /**
-   * 5. Single Sign-On / Seamless Sign-On
+  /**
+   * 5. Single Sign-On / Seamless Sign-On.
    */
 
   public $ssoEnabledDescription;
@@ -215,12 +218,18 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
   public $hasError = FALSE;
   public $errorName = NULL;
 
+  /**
+   *
+   */
   public function clearError() {
     $this->hasError = FALSE;
     $this->errorMsg = NULL;
     $this->errorName = NULL;
   }
 
+  /**
+   *
+   */
   public function save() {
     foreach ($this->saveable as $property) {
       $save[$property] = $this->{$property};
@@ -229,16 +238,25 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
     $this->load();
   }
 
-  static public function getSaveableProperty($property) {
-    $ldap_authentication_conf = variable_get('ldap_authentication_conf', array());
+  /**
+   *
+   */
+  public static function getSaveableProperty($property) {
+    $ldap_authentication_conf = variable_get('ldap_authentication_conf', []);
     return isset($ldap_authentication_conf[$property]) ? $ldap_authentication_conf[$property] : FALSE;
 
   }
 
-  static public function uninstall() {
+  /**
+   *
+   */
+  public static function uninstall() {
     variable_del('ldap_authentication_conf');
   }
 
+  /**
+   *
+   */
   public function __construct() {
     parent::__construct();
     $this->setTranslatableProperties();
@@ -250,331 +268,331 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
     }
   }
 
-
+  /**
+   *
+   */
   public function drupalForm() {
 
     if (count($this->authenticationServersOptions) == 0) {
       $message = ldap_servers_no_enabled_servers_msg('configure LDAP Authentication');
-      $form['intro'] = array(
+      $form['intro'] = [
         '#type' => 'item',
         '#markup' => t('<h1>LDAP Authentication Settings</h1>') . $message,
-      );
+      ];
       return $form;
     }
 
-    $tokens = array();  // not sure what the tokens would be for this form?
+    // Not sure what the tokens would be for this form?
+    $tokens = [];
 
-    $form['intro'] = array(
-        '#type' => 'item',
-        '#markup' => t('<h1>LDAP Authentication Settings</h1>'),
-    );
+    $form['intro'] = [
+      '#type' => 'item',
+      '#markup' => t('<h1>LDAP Authentication Settings</h1>'),
+    ];
 
-    $form['logon'] = array(
+    $form['logon'] = [
       '#type' => 'fieldset',
       '#title' => t('Logon Options'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-    $form['logon']['authenticationMode'] = array(
+    $form['logon']['authenticationMode'] = [
       '#type' => 'radios',
       '#title' => t('Allowable Authentications'),
       '#required' => 1,
       '#default_value' => $this->authenticationMode,
       '#options' => $this->authenticationModeOptions,
-    );
+    ];
 
-    $form['logon']['authenticationServers'] = array(
+    $form['logon']['authenticationServers'] = [
       '#type' => 'checkboxes',
       '#title' => t('Authentication LDAP Server Configurations'),
       '#required' => FALSE,
       '#default_value' => $this->sids,
       '#options' => $this->authenticationServersOptions,
-      '#description' => $this->authenticationServersDescription
-    );
+      '#description' => $this->authenticationServersDescription,
+    ];
 
-    $form['login_UI'] = array(
+    $form['login_UI'] = [
       '#type' => 'fieldset',
       '#title' => t('User Login Interface'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-    $form['login_UI']['loginUIUsernameTxt'] = array(
+    $form['login_UI']['loginUIUsernameTxt'] = [
       '#type' => 'textfield',
       '#title' => t('Username Description Text'),
       '#required' => 0,
       '#default_value' => $this->loginUIUsernameTxt,
       '#description' => $this->loginUIUsernameTxtDescription,
-    );
+    ];
 
-    $form['login_UI']['loginUIPasswordTxt'] = array(
+    $form['login_UI']['loginUIPasswordTxt'] = [
       '#type' => 'textfield',
       '#title' => t('Password Description Text'),
       '#required' => 0,
       '#default_value' => $this->loginUIPasswordTxt,
       '#description' => $this->loginUIPasswordTxtDescription,
-    );
+    ];
 
-    $form['login_UI']['ldapUserHelpLinkUrl'] = array(
+    $form['login_UI']['ldapUserHelpLinkUrl'] = [
       '#type' => 'textfield',
       '#title' => t('LDAP Account User Help URL'),
       '#required' => 0,
       '#default_value' => $this->ldapUserHelpLinkUrl,
       '#description' => $this->ldapUserHelpLinkUrlDescription,
-    );
-
+    ];
 
-    $form['login_UI']['ldapUserHelpLinkText'] = array(
+    $form['login_UI']['ldapUserHelpLinkText'] = [
       '#type' => 'textfield',
       '#title' => t('LDAP Account User Help Link Text'),
       '#required' => 0,
       '#default_value' => $this->ldapUserHelpLinkText,
       '#description' => $this->ldapUserHelpLinkTextDescription,
-    );
+    ];
 
-    $form['restrictions'] = array(
+    $form['restrictions'] = [
       '#type' => 'fieldset',
       '#title' => t('LDAP User "Whitelists" and Restrictions'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-
-    $form['restrictions']['allowOnlyIfTextInDn'] = array(
+    $form['restrictions']['allowOnlyIfTextInDn'] = [
       '#type' => 'textarea',
       '#title' => t('Allow Only Text Test'),
       '#default_value' => $this->arrayToLines($this->allowOnlyIfTextInDn),
       '#cols' => 50,
       '#rows' => 3,
       '#description' => t($this->allowOnlyIfTextInDnDescription, $tokens),
-    );
+    ];
 
-    $form['restrictions']['excludeIfTextInDn'] = array(
+    $form['restrictions']['excludeIfTextInDn'] = [
       '#type' => 'textarea',
       '#title' => t('Excluded Text Test'),
       '#default_value' => $this->arrayToLines($this->excludeIfTextInDn),
       '#cols' => 50,
       '#rows' => 3,
       '#description' => t($this->excludeIfTextInDnDescription, $tokens),
-    );
+    ];
 
-    $form['restrictions']['allowTestPhp'] = array(
+    $form['restrictions']['allowTestPhp'] = [
       '#type' => 'textarea',
       '#title' => t('PHP to Test for Allowed LDAP Users'),
       '#default_value' => $this->allowTestPhp,
       '#cols' => 50,
       '#rows' => 3,
       '#description' => t($this->allowTestPhpDescription, $tokens),
-      '#disabled' => (boolean)(!module_exists('php')),
-    );
+      '#disabled' => (boolean) (!module_exists('php')),
+    ];
 
     if (!module_exists('php')) {
       $form['restrictions']['allowTestPhp']['#title'] .= ' <em>' . t('php module currently disabled') . '</em>';
     }
 
-    $form['restrictions']['excludeIfNoAuthorizations'] = array(
+    $form['restrictions']['excludeIfNoAuthorizations'] = [
       '#type' => 'checkbox',
       '#title' => t('Deny access to users without Ldap Authorization Module
         authorization mappings such as Drupal roles.
         Requires LDAP Authorization to be enabled and configured!'),
       '#default_value' => $this->excludeIfNoAuthorizations,
       '#description' => t($this->excludeIfNoAuthorizationsDescription, $tokens),
-      '#disabled' => (boolean)(!module_exists('ldap_authorization')),
-    );
+      '#disabled' => (boolean) (!module_exists('ldap_authorization')),
+    ];
 
-    $form['email'] = array(
+    $form['email'] = [
       '#type' => 'fieldset',
       '#title' => t('Email'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-    $form['email']['emailOption'] = array(
+    $form['email']['emailOption'] = [
       '#type' => 'radios',
       '#title' => t('Email Behavior'),
       '#required' => 1,
       '#default_value' => $this->emailOption,
       '#options' => $this->emailOptionOptions,
-    );
+    ];
 
-    $form['email']['emailUpdate'] = array(
+    $form['email']['emailUpdate'] = [
       '#type' => 'radios',
       '#title' => t('Email Update'),
       '#required' => 1,
       '#default_value' => $this->emailUpdate,
       '#options' => $this->emailUpdateOptions,
-      );
-    
-    $form['email']['template'] = array(
+    ];
+
+    $form['email']['template'] = [
       '#type' => 'fieldset',
       '#collapsible' => TRUE,
       '#title' => t('Email Templates'),
-    );
-    
-    $form['email']['template']['emailTemplateHandling'] = array(
+    ];
+
+    $form['email']['template']['emailTemplateHandling'] = [
       '#type' => 'radios',
       '#title' => t('Email Template Handling'),
       '#required' => 1,
       '#default_value' => $this->emailTemplateHandling,
-      '#options' => $this->emailTemplateHandlingOptions
-    );
-    
-    $form['email']['template']['emailTemplate'] = array(
+      '#options' => $this->emailTemplateHandlingOptions,
+    ];
+
+    $form['email']['template']['emailTemplate'] = [
       '#type' => 'textfield',
       '#title' => t('Email Template'),
       '#required' => 0,
       '#default_value' => $this->emailTemplate,
-    );
-    
-    $form['email']['template']['templateUsageResolveConflict'] = array(
+    ];
+
+    $form['email']['template']['templateUsageResolveConflict'] = [
       '#type' => 'checkbox',
       '#title' => t('If a Drupal account already exists with the same email, but different account name, use the email template instead of the LDAP email.'),
       '#default_value' => $this->templateUsageResolveConflict,
-    );
-    
-    $form['email']['template']['templateUsageNeverUpdate'] = array(
+    ];
+
+    $form['email']['template']['templateUsageNeverUpdate'] = [
       '#type' => 'checkbox',
       '#title' => t('Ignore the Email Update settings and never update the stored email if the template is used.'),
       '#default_value' => $this->templateUsageNeverUpdate,
-    );
-    
-    $form['email']['prompts'] = array(
+    ];
+
+    $form['email']['prompts'] = [
       '#type' => 'fieldset',
       '#collapsible' => TRUE,
       '#title' => t('User Email Prompt'),
-      '#description' => t('These settings allow the user to fill in their email address after logging in if the template was used to generate their email address.'),      
-    );
-    
-    $form['email']['prompts']['templateUsagePromptUser'] = array(
+      '#description' => t('These settings allow the user to fill in their email address after logging in if the template was used to generate their email address.'),
+    ];
+
+    $form['email']['prompts']['templateUsagePromptUser'] = [
       '#type' => 'checkbox',
       '#title' => t('Prompt user for email on every page load.'),
       '#default_value' => $this->templateUsagePromptUser,
-    );
-    
-    $form['email']['prompts']['templateUsageRedirectOnLogin'] = array(
+    ];
+
+    $form['email']['prompts']['templateUsageRedirectOnLogin'] = [
       '#type' => 'checkbox',
       '#title' => t('Redirect the user to the form after logging in.'),
       '#default_value' => $this->templateUsageRedirectOnLogin,
-    );
-    
-    $form['email']['prompts']['templateUsagePromptRegex'] = array(
+    ];
+
+    $form['email']['prompts']['templateUsagePromptRegex'] = [
       '#type' => 'textfield',
       '#default_value' => $this->templateUsagePromptRegex,
       '#title' => t('Template Regex'),
       '#description' => t('This regex will be used to determine if the template was used to create an account.'),
-    );
-    
+    ];
 
-    $form['password'] = array(
+    $form['password'] = [
       '#type' => 'fieldset',
       '#title' => t('Password'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
-    $form['password']['passwordOption'] = array(
+    ];
+    $form['password']['passwordOption'] = [
       '#type' => 'radios',
       '#title' => t('Password Behavior'),
       '#required' => 1,
       '#default_value' => $this->passwordOption,
       '#options' => $this->passwordUpdateOptions,
-    );
+    ];
 
     /**
      * Begin single sign-on settings
      */
-    $form['sso'] = array(
+    $form['sso'] = [
       '#type' => 'fieldset',
       '#title' => t('Single Sign-On'),
       '#collapsible' => TRUE,
-      '#collapsed' => (boolean)(!$this->ssoEnabled),
-    );
+      '#collapsed' => (boolean) (!$this->ssoEnabled),
+    ];
 
     if ($this->ssoEnabled) {
-      $form['sso']['enabled'] = array(
+      $form['sso']['enabled'] = [
         '#type' => 'markup',
         '#markup' => $this->ssoEnabledDescription,
-      );
+      ];
     }
     else {
-      $form['sso']['disabled'] = array(
+      $form['sso']['disabled'] = [
         '#type' => 'markup',
         '#markup' => '<p><em>' . t('LDAP Single Sign-On module must be enabled for options below to work.')
         . ' ' . t('It is currently disabled.')
         . ' ' . l(t('See modules form'), 'admin/modules') . '</p></em>',
-      );
+      ];
     }
 
-    $form['sso']['ssoRemoteUserStripDomainName'] = array(
+    $form['sso']['ssoRemoteUserStripDomainName'] = [
       '#type' => 'checkbox',
       '#title' => t('Strip REMOTE_USER domain name'),
       '#description' => t($this->ssoRemoteUserStripDomainNameDescription),
       '#default_value' => $this->ssoRemoteUserStripDomainName,
-      '#disabled' => (boolean)(!$this->ssoEnabled),
-    );
+      '#disabled' => (boolean) (!$this->ssoEnabled),
+    ];
 
-    $form['sso']['seamlessLogin'] = array(
+    $form['sso']['seamlessLogin'] = [
       '#type' => 'checkbox',
       '#title' => t('Turn on automated/seamless single sign-on'),
       '#description' => t($this->seamlessLogInDescription),
       '#default_value' => $this->seamlessLogin,
-      '#disabled' => (boolean)(!$this->ssoEnabled),
-      );
+      '#disabled' => (boolean) (!$this->ssoEnabled),
+    ];
 
-    $form['sso']['ssoNotifyAuthentication'] = array(
+    $form['sso']['ssoNotifyAuthentication'] = [
       '#type' => 'checkbox',
       '#title' => t('Notify user of successful authentication'),
       '#description' => t($this->ssoNotifyAuthenticationDescription),
       '#default_value' => $this->ssoNotifyAuthentication,
-      '#disabled' => (boolean)(!$this->ssoEnabled),
-      );
+      '#disabled' => (boolean) (!$this->ssoEnabled),
+    ];
 
-    $form['sso']['cookieExpire'] = array(
+    $form['sso']['cookieExpire'] = [
       '#type' => 'select',
       '#title' => t('Cookie Lifetime'),
       '#description' => t($this->cookieExpireDescription),
       '#default_value' => $this->cookieExpire,
       '#options' => $this->cookieExpirePeriod,
-      '#disabled' => (boolean)(!$this->ssoEnabled),
-    );
+      '#disabled' => (boolean) (!$this->ssoEnabled),
+    ];
 
-    $form['sso']['ldapImplementation'] = array(
+    $form['sso']['ldapImplementation'] = [
       '#type' => 'select',
       '#title' => t('Authentication Mechanism'),
       '#description' => t($this->ldapImplementationDescription),
       '#default_value' => $this->ldapImplementation,
       '#options' => $this->ldapImplementationOptions,
-      '#disabled' => (boolean)(!$this->ssoEnabled),
-    );
+      '#disabled' => (boolean) (!$this->ssoEnabled),
+    ];
 
-    $form['sso']['ssoExcludedPaths'] = array(
+    $form['sso']['ssoExcludedPaths'] = [
       '#type' => 'textarea',
       '#title' => t('SSO Excluded Paths'),
       '#description' => t($this->ssoExcludedPathsDescription),
       '#default_value' => $this->arrayToLines($this->ssoExcludedPaths),
-      '#disabled' => (boolean)(!$this->ssoEnabled),
-    );
+      '#disabled' => (boolean) (!$this->ssoEnabled),
+    ];
 
-    $form['sso']['ssoExcludedHosts'] = array(
+    $form['sso']['ssoExcludedHosts'] = [
       '#type' => 'textarea',
       '#title' => t('SSO Excluded Hosts'),
       '#description' => t($this->ssoExcludedHostsDescription),
       '#default_value' => $this->arrayToLines($this->ssoExcludedHosts),
-      '#disabled' => (boolean)(!$this->ssoEnabled),
-    );
+      '#disabled' => (boolean) (!$this->ssoEnabled),
+    ];
 
-    $form['submit'] = array(
+    $form['submit'] = [
       '#type' => 'submit',
       '#value' => 'Save',
-    );
+    ];
 
-  return $form;
-}
+    return $form;
+  }
 
-/**
- * validate form, not object
- */
-  public function drupalFormValidate($values)  {
+  /**
+   * Validate form, not object.
+   */
+  public function drupalFormValidate($values) {
 
     $this->populateFromDrupalForm($values);
 
@@ -583,25 +601,25 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
     return $errors;
   }
 
-/**
- * validate object, not form
- */
+  /**
+   * Validate object, not form.
+   */
   public function validate() {
-    $errors = array();
+    $errors = [];
 
     $enabled_servers = ldap_servers_get_servers(NULL, 'enabled');
     if ($this->ssoEnabled) {
       foreach ($this->sids as $sid => $discard) {
         if ($enabled_servers[$sid]->bind_method == LDAP_SERVERS_BIND_METHOD_USER || $enabled_servers[$sid]->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
-          $methods = array(
+          $methods = [
             LDAP_SERVERS_BIND_METHOD_USER => 'Bind with Users Credentials',
             LDAP_SERVERS_BIND_METHOD_ANON_USER => 'Anonymous Bind for search, then Bind with Users Credentials',
-          );
-          $tokens = array(
+          ];
+          $tokens = [
             '!edit' => l($enabled_servers[$sid]->name, LDAP_SERVERS_INDEX_BASE_PATH . '/edit/' . $sid),
             '%sid' => $sid,
             '%bind_method' => $methods[$enabled_servers[$sid]->bind_method],
-          );
+          ];
 
           $errors['ssoEnabled'] = t('Single Sign On is not valid with the server !edit (id=%sid) because that server configuration uses %bind_method.  Since the user\'s credentials are never available to this module with single sign on enabled, there is no way for the ldap module to bind to the ldap server with credentials.', $tokens);
         }
@@ -610,28 +628,31 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
     return $errors;
   }
 
+  /**
+   *
+   */
   protected function populateFromDrupalForm($values) {
 
-    $this->authenticationMode = ($values['authenticationMode']) ? (int)$values['authenticationMode'] : NULL;
+    $this->authenticationMode = ($values['authenticationMode']) ? (int) $values['authenticationMode'] : NULL;
     $this->sids = $values['authenticationServers'];
     $this->allowOnlyIfTextInDn = $this->linesToArray($values['allowOnlyIfTextInDn']);
     $this->excludeIfTextInDn = $this->linesToArray($values['excludeIfTextInDn']);
     $this->allowTestPhp = $values['allowTestPhp'];
-    $this->loginUIUsernameTxt = ($values['loginUIUsernameTxt']) ? (string)$values['loginUIUsernameTxt'] : NULL;
-    $this->loginUIPasswordTxt = ($values['loginUIPasswordTxt']) ? (string)$values['loginUIPasswordTxt'] : NULL;
-    $this->ldapUserHelpLinkUrl = ($values['ldapUserHelpLinkUrl']) ? (string)$values['ldapUserHelpLinkUrl'] : NULL;
-    $this->ldapUserHelpLinkText = ($values['ldapUserHelpLinkText']) ? (string)$values['ldapUserHelpLinkText'] : NULL;
-    $this->excludeIfNoAuthorizations = ($values['excludeIfNoAuthorizations']) ? (int)$values['excludeIfNoAuthorizations'] : NULL;
-    $this->emailOption  = ($values['emailOption']) ? (int)$values['emailOption'] : NULL;
-    $this->emailUpdate  = ($values['emailUpdate']) ? (int)$values['emailUpdate'] : NULL;
-    $this->passwordOption  = ($values['passwordOption']) ? (int)$values['passwordOption'] : NULL;
+    $this->loginUIUsernameTxt = ($values['loginUIUsernameTxt']) ? (string) $values['loginUIUsernameTxt'] : NULL;
+    $this->loginUIPasswordTxt = ($values['loginUIPasswordTxt']) ? (string) $values['loginUIPasswordTxt'] : NULL;
+    $this->ldapUserHelpLinkUrl = ($values['ldapUserHelpLinkUrl']) ? (string) $values['ldapUserHelpLinkUrl'] : NULL;
+    $this->ldapUserHelpLinkText = ($values['ldapUserHelpLinkText']) ? (string) $values['ldapUserHelpLinkText'] : NULL;
+    $this->excludeIfNoAuthorizations = ($values['excludeIfNoAuthorizations']) ? (int) $values['excludeIfNoAuthorizations'] : NULL;
+    $this->emailOption = ($values['emailOption']) ? (int) $values['emailOption'] : NULL;
+    $this->emailUpdate = ($values['emailUpdate']) ? (int) $values['emailUpdate'] : NULL;
+    $this->passwordOption = ($values['passwordOption']) ? (int) $values['passwordOption'] : NULL;
     $this->ssoExcludedPaths = $this->linesToArray($values['ssoExcludedPaths']);
     $this->ssoExcludedHosts = $this->linesToArray($values['ssoExcludedHosts']);
-    $this->ssoRemoteUserStripDomainName = ($values['ssoRemoteUserStripDomainName']) ? (int)$values['ssoRemoteUserStripDomainName'] : NULL;
-    $this->seamlessLogin = ($values['seamlessLogin']) ? (int)$values['seamlessLogin'] : NULL;
-    $this->ssoNotifyAuthentication = ($values['ssoNotifyAuthentication']) ? (int)$values['ssoNotifyAuthentication'] : NULL;
-    $this->cookieExpire = ($values['cookieExpire']) ? (int)$values['cookieExpire'] : NULL;
-    $this->ldapImplementation = ($values['ldapImplementation']) ? (string)$values['ldapImplementation'] : NULL;
+    $this->ssoRemoteUserStripDomainName = ($values['ssoRemoteUserStripDomainName']) ? (int) $values['ssoRemoteUserStripDomainName'] : NULL;
+    $this->seamlessLogin = ($values['seamlessLogin']) ? (int) $values['seamlessLogin'] : NULL;
+    $this->ssoNotifyAuthentication = ($values['ssoNotifyAuthentication']) ? (int) $values['ssoNotifyAuthentication'] : NULL;
+    $this->cookieExpire = ($values['cookieExpire']) ? (int) $values['cookieExpire'] : NULL;
+    $this->ldapImplementation = ($values['ldapImplementation']) ? (string) $values['ldapImplementation'] : NULL;
     $this->emailTemplateHandling = ($values['emailTemplateHandling']) ? (int) $values['emailTemplateHandling'] : NULL;
     $this->emailTemplate = ($values['emailTemplate']) ? $values['emailTemplate'] : '';
     $this->templateUsagePromptUser = ($values['templateUsagePromptUser']) ? 1 : 0;
@@ -641,6 +662,9 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
     $this->templateUsageNeverUpdate = ($values['templateUsageNeverUpdate']) ? 1 : 0;
   }
 
+  /**
+   *
+   */
   public function drupalFormSubmit($values) {
 
     $this->populateFromDrupalForm($values);
@@ -655,17 +679,23 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
 
   }
 
+  /**
+   *
+   */
   protected function arrayToLines($array) {
-        $lines = "";
-        if (is_array($array)) {
-          $lines = join("\n", $array);
-        }
-        elseif (is_array(@unserialize($array))) {
-          $lines = join("\n", unserialize($array));
-        }
-        return $lines;
-      }
+    $lines = "";
+    if (is_array($array)) {
+      $lines = join("\n", $array);
+    }
+    elseif (is_array(@unserialize($array))) {
+      $lines = join("\n", unserialize($array));
+    }
+    return $lines;
+  }
 
+  /**
+   *
+   */
   protected function linesToArray($lines) {
     $lines = trim($lines);
 
@@ -676,7 +706,7 @@ class LdapAuthenticationConfAdmin extends LdapAuthenticationConf {
       }
     }
     else {
-      $array = array();
+      $array = [];
     }
     return $array;
   }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc
index a9164cb0..b8a5f615 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc
@@ -6,21 +6,21 @@
  */
 
 /**
- * form for adding, updating, and deleting a single ldap authorization mapping
+ * Form for adding, updating, and deleting a single ldap authorization mapping.
+ *
+ * @param mixed $form
+ * @param mixed $form_state
  *
- * @param <type> $form
- * @param <type> $form_state
  * @return array drupal form array
  */
 function ldap_authentication_admin_form($form, &$form_state) {
-    ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
-    $auth_conf = new LdapAuthenticationConfAdmin();
-    return $auth_conf->drupalForm();
+  ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
+  $auth_conf = new LdapAuthenticationConfAdmin();
+  return $auth_conf->drupalForm();
 }
 
-
 /**
- * validate handler for the ldap_authentication_admin_form
+ * Validate handler for the ldap_authentication_admin_form.
  */
 function ldap_authentication_admin_form_validate($form, &$form_state) {
 
@@ -33,16 +33,15 @@ function ldap_authentication_admin_form_validate($form, &$form_state) {
 
 }
 
-
 /**
- * submit handler function for ldap_authentication_admin_form
+ * Submit handler function for ldap_authentication_admin_form.
  */
-
 function ldap_authentication_admin_form_submit($form, &$form_state) {
 
   ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
   $auth_conf = new LdapAuthenticationConfAdmin();
-  $auth_conf->drupalFormSubmit($form_state['values']);  // add form data to object and save or create
+  // Add form data to object and save or create.
+  $auth_conf->drupalFormSubmit($form_state['values']);
   if (!$auth_conf->hasEnabledAuthenticationServers()) {
     drupal_set_message(t('No LDAP servers are enabled for authentication,
       so no LDAP Authentication can take place.  This essentially disables
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc
index 58187df0..0ccca6f6 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc
@@ -2,14 +2,14 @@
 
 /**
  * @file
- * ldap_authentication helper functions
+ * Ldap_authentication helper functions.
  */
 
 /**
-  * helper function for ldap_authn_form_user_login_block_alter and ldap_authn_form_user_login_alter
-  *
-  * @todo if form is being generated on non https and is set in preferences, set warning and end form development
-  */
+ * Helper function for ldap_authn_form_user_login_block_alter and ldap_authn_form_user_login_alter.
+ *
+ * @todo if form is being generated on non https and is set in preferences, set warning and end form development
+ */
 function _ldap_authentication_login_form_alter(&$form, &$form_state, $form_id) {
 
   if (!$auth_conf = ldap_authentication_get_valid_conf()) {
@@ -42,15 +42,15 @@ function _ldap_authentication_login_form_alter(&$form, &$form_state, $form_id) {
 
   if ($form_id == 'user_login_block') {
     $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
-    $vars = array(
+    $vars = [
       'show_reset_pwd' => ldap_authentication_show_reset_pwd(),
       'auth_conf' => $auth_conf,
-      );
+    ];
 
     $form['links']['#markup'] = theme('ldap_authentication_user_login_block_links', $vars);
   }
 
-  // Add help information for entering in username/password
+  // Add help information for entering in username/password.
   $auth_conf = ldap_authentication_get_valid_conf();
   if ($auth_conf) {
     if (isset($auth_conf->loginUIUsernameTxt)) {
@@ -65,18 +65,18 @@ function _ldap_authentication_login_form_alter(&$form, &$form_state, $form_id) {
   }
 }
 
-
-
 /**
-  * alter user editing form (profile form) based on ldap authentication configuration
-  *
-  * @param array $form array from user profile
-  * @param array $form_state from user profile
-  *
-  * @return NULL (alters $form by reference)
-  */
+ * Alter user editing form (profile form) based on ldap authentication configuration.
+ *
+ * @param array $form
+ *   array from user profile.
+ * @param array $form_state
+ *   from user profile.
+ *
+ * @return NULL (alters $form by reference)
+ */
 function _ldap_authentication_form_user_profile_form_alter(&$form, $form_state) {
-  // keep in mind admin may be editing another users profile form.  don't assume current global $user
+  // Keep in mind admin may be editing another users profile form.  don't assume current global $user.
   $auth_conf = ldap_authentication_get_valid_conf();
   if ($auth_conf && ldap_authentication_ldap_authenticated($form['#user'])) {
     if ($auth_conf->emailOption == LDAP_AUTHENTICATION_EMAIL_FIELD_REMOVE) {
@@ -87,31 +87,31 @@ function _ldap_authentication_form_user_profile_form_alter(&$form, $form_state)
       $form['account']['mail']['#description'] = t('This email address is automatically set and may not be changed.');
     }
     elseif ($auth_conf->emailOption == LDAP_AUTHENTICATION_EMAIL_FIELD_ALLOW) {
-      // email field is functional
+      // Email field is functional.
     }
 
     if (!ldap_authentication_show_reset_pwd($form['#user'])) {
       /**  If passwordOption = LDAP_AUTHENTICATION_PASSWORD_FIELD_HIDE then don't show the password fields,
-        otherwise show the fields but in a disabled state.
+       * otherwise show the fields but in a disabled state.
        */
-        switch ($auth_conf->passwordOption) {
-
-          case LDAP_AUTHENTICATION_PASSWORD_FIELD_HIDE:
-            $form['account']['current_pass']['#access'] = FALSE;
-            $form['account']['pass']['#access'] = FALSE;
-            break;
-
-          case LDAP_AUTHENTICATION_PASSWORD_FIELD_SHOW:
-                    // Show in a disabled state since ldap_authentication_show_reset_pwd() has returned FALSE
-            $form['account']['current_pass']['#disabled'] = TRUE;
-            if ($auth_conf->ldapUserHelpLinkUrl) {
-              $form['account']['current_pass']['#description'] = l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl);
-            }
-            else {
-              $form['account']['current_pass']['#description'] = t('The password cannot be changed using this website');
-            }
-            $form['account']['pass']['#disabled'] = TRUE;
-            break;
+      switch ($auth_conf->passwordOption) {
+
+        case LDAP_AUTHENTICATION_PASSWORD_FIELD_HIDE:
+          $form['account']['current_pass']['#access'] = FALSE;
+          $form['account']['pass']['#access'] = FALSE;
+          break;
+
+        case LDAP_AUTHENTICATION_PASSWORD_FIELD_SHOW:
+          // Show in a disabled state since ldap_authentication_show_reset_pwd() has returned FALSE.
+          $form['account']['current_pass']['#disabled'] = TRUE;
+          if ($auth_conf->ldapUserHelpLinkUrl) {
+            $form['account']['current_pass']['#description'] = l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl);
+          }
+          else {
+            $form['account']['current_pass']['#description'] = t('The password cannot be changed using this website');
+          }
+          $form['account']['pass']['#disabled'] = TRUE;
+          break;
       }
     }
   }
@@ -122,12 +122,12 @@ function _ldap_authentication_form_user_profile_form_alter(&$form, $form_state)
  * $auth_conf.
  *
  * @param array $ldap_user
- *   LDAP user entry
+ *   LDAP user entry.
  * @param LdapAuthenticationConf $auth_conf
  *   LDAP authentication configuration class.
  */
 function _ldap_authentication_replace_user_email(&$ldap_user, $auth_conf, $tokens) {
-  // fallback template in case one was not specified.
+  // Fallback template in case one was not specified.
   $template = '@username@localhost';
   if (!empty($auth_conf->emailTemplate)) {
     $template = $auth_conf->emailTemplate;
@@ -136,38 +136,40 @@ function _ldap_authentication_replace_user_email(&$ldap_user, $auth_conf, $token
 }
 
 /**
-  * user form validation will take care of username, pwd fields
-  * this function validates ldap authentication specific
-  *
-  * @param array $form_state array from user logon form
-  * @return null, but success or failure is indicated by:
-  * -- form_set_error() to invalidate authentication process
-  * -- setting $form_state['uid'] to indicate successful authentication
-  */
+ * User form validation will take care of username, pwd fields
+ * this function validates ldap authentication specific.
+ *
+ * @param array $form_state
+ *   array from user logon form.
+ *
+ * @return null, but success or failure is indicated by:
+ *   -- form_set_error() to invalidate authentication process
+ *   -- setting $form_state['uid'] to indicate successful authentication
+ */
 function _ldap_authentication_user_login_authenticate_validate(&$form_state, $return_user) {
 
-  // Check if Flood control was triggered; if so, don't authenticate
+  // Check if Flood control was triggered; if so, don't authenticate.
   if (isset($form_state['flood_control_triggered'])) {
     return;
   }
 
   $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
 
-  // Default to name
+  // Default to name.
   $entered_name = $form_state['values']['name'];
   $authname_drupal_property = $form_field_name = 'name';
 
-  // Email registration module populates name even though user entered email
+  // Email registration module populates name even though user entered email.
   if (!empty($form_state['values']['email'])) {
     $entered_name = $form_state['values']['email'];
     $authname_drupal_property = 'mail';
     $form_field_name = 'email';
   }
 
-  // $authname is the name the user is authenticated with from the logon form // patch 1599632
+  // $authname is the name the user is authenticated with from the logon form // patch 1599632.
   $authname = $entered_name;
 
-  if (empty($form_state['values']['pass']) || empty ($form_state['values'][$form_field_name])) {
+  if (empty($form_state['values']['pass']) || empty($form_state['values'][$form_field_name])) {
     return FALSE;
   }
   /*
@@ -179,18 +181,19 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
    */
   $sso_login = (isset($form_state['sso_login']) && $form_state['sso_login']) ? TRUE : FALSE;
 
-  $watchdog_tokens = array('%username' => $authname, '%authname' => $authname); // $watchdog_tokens = array('%username' => $name); // patch 1599632
+  // Patch 1599632.
+  $watchdog_tokens = ['%username' => $authname, '%authname' => $authname];
   if ($detailed_watchdog_log) {
     watchdog('ldap_authentication', '%username : Beginning authentification....', $watchdog_tokens, WATCHDOG_DEBUG);
   }
 
   if (!$auth_conf = ldap_authentication_get_valid_conf()) {
-    watchdog('ldap_authentication', 'Failed to get valid ldap authentication configuration.', array(), WATCHDOG_ERROR);
-    form_set_error('name', 'Server Error: Failed to get valid ldap authentication configuration.' . $error);
+    watchdog('ldap_authentication', 'Failed to get valid ldap authentication configuration.', [], WATCHDOG_ERROR);
+    form_set_error('name', 'Server Error: Failed to get valid ldap authentication configuration.');
     return;
   }
 
- /**
+  /**
   * I. Test for previous module authentication success.
   *
   * if already succeeded at authentication, $form_state['uid'] will be set by other authentication module.
@@ -200,24 +203,26 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
   if (isset($form_state['uid']) && is_numeric($form_state['uid'])) {
     if ($auth_conf->authenticationMode == LDAP_AUTHENTICATION_MIXED || $form_state['uid'] == 1) {
       if ($detailed_watchdog_log) {
-      watchdog('ldap_authentication', '%username : Previously authenticated in mixed mode or uid=1', $watchdog_tokens, WATCHDOG_DEBUG);
+        watchdog('ldap_authentication', '%username : Previously authenticated in mixed mode or uid=1', $watchdog_tokens, WATCHDOG_DEBUG);
       }
-      return;  // already passed a previous module's authentication validation
+      // Already passed a previous module's authentication validation.
+      return;
     }
     elseif ($auth_conf->authenticationMode == LDAP_AUTHENTICATION_EXCLUSIVE) {
       if ($detailed_watchdog_log) {
         watchdog('ldap_authentication', '%username : Previously authenticated in exclusive mode or uid is not 1.  Clear uid
         in form_state and attempt ldap authentication.', $watchdog_tokens, WATCHDOG_DEBUG);
       }
-      $form_state['uid'] = NULL;  // passed previous authentication, but only ldap should be used so override
+      // Passed previous authentication, but only ldap should be used so override.
+      $form_state['uid'] = NULL;
     }
   }
 
- /**
-  * II. Exit if no authentication servers.
-  */
+  /**
+   * II. Exit if no authentication servers.
+   */
   if (!$auth_conf->hasEnabledAuthenticationServers()) {
-    watchdog('ldap_authentication', 'No LDAP servers configured.', array(), WATCHDOG_ERROR);
+    watchdog('ldap_authentication', 'No LDAP servers configured.', [], WATCHDOG_ERROR);
     form_set_error('name', 'Server Error:  No LDAP servers configured.');
     return;
   }
@@ -229,7 +234,8 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
   list($drupal_account, $drupal_account_is_authmapped) = ldap_authentication_corresponding_drupal_user($authname, $auth_conf, $watchdog_tokens);
   $drupal_account_exists = is_object($drupal_account);
   if ($drupal_account_exists && $drupal_account->uid == 1) {
-    return; // user 1 is not allowed to ldap authenticate
+    // User 1 is not allowed to ldap authenticate.
+    return;
   }
 
   /**
@@ -243,7 +249,7 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
     return;
   }
 
-  /*
+  /**
    * IV.a Workaround for the provisioning server not always getting saved in
    *      the user object.  So we save it in a session variable as a backup.
    */
@@ -268,9 +274,9 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
   $watchdog_tokens['%drupal_accountname'] = $drupal_accountname;
 
   // @todo maybe we can add more tokens?
-  $email_template_tokens = array(
+  $email_template_tokens = [
     '@username' => $drupal_accountname,
-  );
+  ];
 
   $email_template_used = FALSE;
 
@@ -283,7 +289,7 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
         if (!empty($ldap_user['mail'])) {
           break;
         }
-        // deliberate fallthrough
+        // Deliberate fallthrough.
       case LDAP_AUTHENTICATION_EMAIL_TEMPLATE_ALWAYS:
         _ldap_authentication_replace_user_email($ldap_user, $auth_conf, $email_template_tokens);
         if ($detailed_watchdog_log) {
@@ -304,7 +310,6 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
    *
    */
 
-
   /**
    * VI.A: Drupal account doesn't exist with $authname used to logon,
    *  but puid exists in another Drupal account; this means username has changed
@@ -318,13 +323,13 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
       if ($drupal_account) {
         $drupal_account_exists = TRUE;
         if ($drupal_accountname == $authname) {
-          $user_edit = array($authname_drupal_property => $drupal_accountname);
+          $user_edit = [$authname_drupal_property => $drupal_accountname];
         }
         else {
-          $user_edit = array('name' => $drupal_accountname);
+          $user_edit = ['name' => $drupal_accountname];
         }
         $drupal_account = user_save($drupal_account, $user_edit, 'ldap_user');
-        user_set_authmaps($drupal_account, array("authname_ldap_user" => $authname));
+        user_set_authmaps($drupal_account, ["authname_ldap_user" => $authname]);
         $drupal_account_is_authmapped = TRUE;
       }
     }
@@ -332,11 +337,10 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
 
   /**
    * VI.B: existing Drupal account but not authmapped to ldap modules,
-   *   ldap authmap or disallow
-   *
+   * ldap authmap or disallow.
    */
-
-  if ($drupal_account_exists && !$drupal_account_is_authmapped) {  // account already exists
+  // Account already exists.
+  if ($drupal_account_exists && !$drupal_account_is_authmapped) {
     if ($auth_conf->ldapUser->loginConflictResolve == LDAP_USER_CONFLICT_LOG) {
       if ($account_with_same_email = user_load_by_mail($ldap_user['mail'])) {
         $watchdog_tokens['%conflict_name'] = $account_with_same_email->name;
@@ -345,9 +349,10 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
       drupal_set_message(t('Another user already exists in the system with the same login name. You should contact the system administrator in order to solve this conflict.'), 'error');
       return;
     }
-    else { // LDAP_authen.AC.disallow.ldap.drupal
-    // add ldap_authentication authmap to user.  account name is fine here, though cn could be used
-      user_set_authmaps($drupal_account, array('authname_ldap_user' => $authname));
+    // LDAP_authen.AC.disallow.ldap.drupal.
+    else {
+      // Add ldap_authentication authmap to user.  account name is fine here, though cn could be used.
+      user_set_authmaps($drupal_account, ['authname_ldap_user' => $authname]);
       $drupal_account_is_authmapped = TRUE;
       if ($detailed_watchdog_log) {
         watchdog('ldap_authentication', 'set authmap for %username authname_ldap_user', $watchdog_tokens, WATCHDOG_DEBUG);
@@ -356,8 +361,8 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
   }
 
   /**
-   * VI.C: existing Drupal account with incorrect email.  fix email if appropriate
-   *
+   * VI.C: existing Drupal account with incorrect email.
+   * Fix email if appropriate.
    */
   if ((!($auth_conf->templateUsageNeverUpdate && $email_template_used)) &&
       $drupal_account_exists &&
@@ -366,13 +371,13 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
         $auth_conf->emailUpdate == LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE_NOTIFY ||
         $auth_conf->emailUpdate == LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE
       )) {
-    $user_edit = array('mail' => $ldap_user['mail']);
+    $user_edit = ['mail' => $ldap_user['mail']];
 
     $watchdog_tokens['%username'] = $drupal_account->name;
     if (!$updated_account = user_save($drupal_account, $user_edit)) {
       watchdog('ldap_authentication', 'Failed to make changes to user %username updated %changed.', $watchdog_tokens, WATCHDOG_ERROR);
     }
-    elseif ($auth_conf->emailUpdate == LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE_NOTIFY ) {
+    elseif ($auth_conf->emailUpdate == LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE_NOTIFY) {
       if (isset($user_edit['mail'])) {
         $watchdog_tokens['%mail'] = $user_edit['mail'];
         drupal_set_message(t('Your e-mail has been updated to match your current account (%mail).', $watchdog_tokens), 'status');
@@ -386,7 +391,6 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
 
   /**
    * VI.C: no existing Drupal account.  consider provisioning Drupal account.
-   *
    */
   if (!$drupal_account_exists) {
 
@@ -394,8 +398,10 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
     if (($auth_conf->ldapUser->acctCreation == LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED) && ($account_with_same_email = user_load_by_mail($ldap_user['mail']))) {
       $error = TRUE;
       /**
-       * username does not exist but email does.  Since user_external_login_register does not deal with
-       * mail attribute and the email conflict error needs to be caught beforehand, need to throw error here
+       * username does not exist but email does.
+       * Since user_external_login_register does not deal with mail attribute
+       * and the email conflict error needs to be caught beforehand, need to
+       * throw error here.
        */
       if ($auth_conf->templateUsageResolveConflict && (!$email_template_used)) {
         if ($detailed_watchdog_log) {
@@ -403,7 +409,7 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
         }
         _ldap_authentication_replace_user_email($ldap_user, $auth_conf, $email_template_tokens);
         $email_template_used = TRUE;
-        // recheck with the template email to make sure it doesn't also exist.
+        // Recheck with the template email to make sure it doesn't also exist.
         if ($account_with_same_email = user_load_by_mail($ldap_user['mail'])) {
           $error = TRUE;
         }
@@ -417,41 +423,43 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
       }
     }
 
-    // VI.C.2 Do not provision Drupal account if provisioning disabled
+    // VI.C.2 Do not provision Drupal account if provisioning disabled.
     if (!$auth_conf->ldapUser->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE)) {
       watchdog('ldap_user', 'Drupal account for authname=%authname account name=%account_name_attr does not exist and provisioning of Drupal accounts on authentication is not enabled', $watchdog_tokens, WATCHDOG_INFO);
       return;
     }
 
-    // VI.C.3 Provision Drupal account
     /**
-     *
-     * new ldap_authentication provisioned account could let user_external_login_register create the account and set authmaps, but would need
-     * to add mail and any other user->data data in hook_user_presave which would mean requerying ldap
-     * or having a global variable.  At this point the account does not exist, so there is no
+     * VI.C.3 Provision Drupal account.
+     * New ldap_authentication provisioned account could
+     * letuser_external_login_register create the account and set authmaps, but
+     * would need to add mail and any other user->data data in
+     * hook_user_presave which would mean requerying ldap or having a global
+     * variable.  At this point the account does not exist, so there is no
      * reason not to create it here.
      *
-     * @todo create patch for core user module's user_external_login_register to deal with new external accounts
-     *       a little tweak to add user->data and mail etc as parameters would make it more useful
-     *       for external authentication modules
+     * @todo create patch for core user module's user_external_login_register
+     * to deal with new external accounts a little tweak to add user->data and
+     * mail etc as parameters would make it more useful for external
+     * authentication modules.
      */
-
-      $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
-      if ($auth_conf->ldapUser->acctCreation == LDAP_USER_ACCT_CREATION_USER_SETTINGS_FOR_LDAP &&
+    $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
+    if ($auth_conf->ldapUser->acctCreation == LDAP_USER_ACCT_CREATION_USER_SETTINGS_FOR_LDAP &&
             $user_register == USER_REGISTER_ADMINISTRATORS_ONLY) {
-          watchdog('ldap_user', 'Failed to create account for %drupal_accountname. Administrative user must create user.',
-              $watchdog_tokens, WATCHDOG_ERROR);
-          form_set_error('name', t('Server Error: Attempt to create account for %drupal_accountname failed. Administrative user must create user.',
-              $watchdog_tokens));
-          return;
+      watchdog('ldap_user', 'Failed to create account for %drupal_accountname. Administrative user must create user.',
+          $watchdog_tokens, WATCHDOG_ERROR);
+      form_set_error('name', t('Server Error: Attempt to create account for %drupal_accountname failed. Administrative user must create user.',
+          $watchdog_tokens));
+      return;
     }
 
     if ($auth_conf->ldapUser->acctCreation == LDAP_AUTHENTICATION_ACCT_CREATION_USER_SETTINGS_FOR_LDAP &&
         variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) == USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) {
-      $user_edit = array('name' => $drupal_accountname, 'status' => 0); // if admin approval required, set status to 0.
+      // If admin approval required, set status to 0.
+      $user_edit = ['name' => $drupal_accountname, 'status' => 0];
     }
     else {
-      $user_edit = array('name' => $drupal_accountname, 'status' => 1);
+      $user_edit = ['name' => $drupal_accountname, 'status' => 1];
     }
 
     // If the email template was used, we want to pass in the email that was
@@ -461,7 +469,7 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
     }
 
     // don't pass in ldap user to provisionDrupalAccount, because want to requery with correct attributes needed
-    // this may be a case where efficiency dictates querying for all attributes
+    // this may be a case where efficiency dictates querying for all attributes.
     $drupal_account = $auth_conf->ldapUser->provisionDrupalAccount(NULL, $user_edit, $ldap_user, TRUE);
 
     if ($drupal_account === FALSE) {
@@ -470,7 +478,7 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
       return;
     }
     else {
-      user_set_authmaps($drupal_account, array('authname_ldap_user' => $authname));
+      user_set_authmaps($drupal_account, ['authname_ldap_user' => $authname]);
       // Using Rules allows emails to be fired and many other possible reactions
       // to the creation of a user.
       if (module_exists('rules')) {
@@ -489,28 +497,22 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
   */
 
   $form_state['uid'] = $drupal_account->uid;
- // $fake_form_state = array('uid' => $drupal_account->uid);
- // user_login_submit(array(), $fake_form_state);
- // global $user;
- // $form_state['uid'] = $user->uid;
-
-
-  // the uid is returned so that special login modules, namely ldap sso, can manually call this function.
   return ($return_user) ? $drupal_account : NULL;
 }
 
 /**
- * given authname, determine if corresponding drupal account exists and is authmapped
+ * Given authname, determine if corresponding drupal account exists and is authmapped.
  */
 function ldap_authentication_corresponding_drupal_user($authname, $auth_conf, &$watchdog_tokens) {
   $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
   if (!($drupal_account = user_load_by_name($authname)) && !($drupal_account = user_load_by_mail($authname))) {
-    $uid = db_query("SELECT uid FROM {authmap} WHERE authname = :authname AND module = 'ldap_user'", array(':authname' => $authname))->fetchColumn();
+    $uid = db_query("SELECT uid FROM {authmap} WHERE authname = :authname AND module = 'ldap_user'", [':authname' => $authname])->fetchColumn();
     $drupal_account = $uid ? user_load($uid) : FALSE;
   }
 
   if (is_object($drupal_account)) {
-    $authmaps = user_get_authmaps($authname); // $authmaps = user_get_authmaps($name); // patch 1599632
+    // Patch 1599632.
+    $authmaps = user_get_authmaps($authname);
     $drupal_account_is_authmapped = isset($authmaps['ldap_user']);
     $user_data = $drupal_account->data;
     if ($drupal_account->uid == 1 && $detailed_watchdog_log) {
@@ -520,7 +522,8 @@ function ldap_authentication_corresponding_drupal_user($authname, $auth_conf, &$
       watchdog('ldap_authentication', '%username : Drupal User Account found.  Continuing on to attempt ldap authentication', $watchdog_tokens, WATCHDOG_DEBUG);
     }
   }
-  else {  // account does not exist
+  // Account does not exist.
+  else {
     $drupal_account_is_authmapped = FALSE;
     if ($auth_conf->ldapUser->createLDAPAccounts == FALSE) {
       if ($detailed_watchdog_log) {
@@ -531,9 +534,12 @@ function ldap_authentication_corresponding_drupal_user($authname, $auth_conf, &$
       watchdog('ldap_authentication', '%username : Existing Drupal User Account not found.  Continuing on to attempt ldap authentication', $watchdog_tokens, WATCHDOG_DEBUG);
     }
   }
-  return array($drupal_account, $drupal_account_is_authmapped);
+  return [$drupal_account, $drupal_account_is_authmapped];
 }
 
+/**
+ *
+ */
 function ldap_authentication_test_credentials($auth_conf, $sso_login, $authname, $password, &$watchdog_tokens) {
   $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
   $authentication_result = LDAP_AUTHENTICATION_RESULT_FAIL_GENERIC;
@@ -546,7 +552,7 @@ function ldap_authentication_test_credentials($auth_conf, $sso_login, $authname,
       watchdog('ldap_authentication', '%username : Trying server %sid where bind_method = %bind_method', $watchdog_tokens, WATCHDOG_DEBUG);
     }
 
-    // #1 CONNECT TO SERVER
+    // #1 CONNECT TO SERVER.
     $authentication_result = LDAP_AUTHENTICATION_RESULT_FAIL_GENERIC;
     $result = $ldap_server->connect();
     if ($result != LDAP_SUCCESS) {
@@ -556,7 +562,8 @@ function ldap_authentication_test_credentials($auth_conf, $sso_login, $authname,
         watchdog('ldap_authentication', '%username : Failed connecting to %sid.  Error: %err_msg', $watchdog_tokens, WATCHDOG_DEBUG);
       }
       $watchdog_tokens['%err_msg'] = NULL;
-      continue; // next server, please
+      // Next server, please.
+      continue;
     }
     elseif ($detailed_watchdog_log) {
       watchdog('ldap_authentication', '%username : Success at connecting to %sid', $watchdog_tokens, WATCHDOG_DEBUG);
@@ -574,11 +581,11 @@ function ldap_authentication_test_credentials($auth_conf, $sso_login, $authname,
       watchdog('ldap_authentication', 'Trying to use SSO with LDAP_SERVERS_BIND_METHOD_USER bind method.', $watchdog_tokens, WATCHDOG_ERROR);
     }
     elseif ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_USER && $sso_login == FALSE) {
-      // with sso enabled this method of binding isn't valid
+      // With sso enabled this method of binding isn't valid.
       foreach ($ldap_server->basedn as $basedn) {
-        $search = array('%basedn', '%username');
+        $search = ['%basedn', '%username'];
         $transformname = $ldap_server->userUsernameToLdapNameTransform($authname, $watchdog_tokens);
-        $replace = array($basedn, $transformname);
+        $replace = [$basedn, $transformname];
         $userdn = str_replace($search, $replace, $ldap_server->user_dn_expression);
         $bind_success = ($ldap_server->bind($userdn, $password, FALSE) == LDAP_SUCCESS);
         if ($bind_success) {
@@ -597,10 +604,11 @@ function ldap_authentication_test_credentials($auth_conf, $sso_login, $authname,
         $watchdog_tokens['%err_text'] = NULL;
       }
       $authentication_result = ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_USER) ? LDAP_AUTHENTICATION_RESULT_FAIL_CREDENTIALS : LDAP_AUTHENTICATION_RESULT_FAIL_BIND;
-      continue; // if bind fails, onto next server
+      // If bind fails, onto next server.
+      continue;
     }
 
-    // #3 DOES USER EXIST IN SERVER'S LDAP
+    // #3 DOES USER EXIST IN SERVER'S LDAP.
     if ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
       $ldap_user = $ldap_server->userUserNameToExistingLdapEntry($authname);
     }
@@ -628,24 +636,25 @@ function ldap_authentication_test_credentials($auth_conf, $sso_login, $authname,
         break;
       }
       $authentication_result = LDAP_AUTHENTICATION_RESULT_FAIL_FIND;
-      continue; // next server, please
+      // Next server, please.
+      continue;
     }
 
     $watchdog_tokens['%dn'] = $ldap_user['dn'];
     $watchdog_tokens['%mail'] = $ldap_user['mail'];
 
     /**
-    * #4 CHECK ALLOWED AND EXCLUDED LIST AND PHP FOR ALLOWED USERS
-    */
-
+     * #4 CHECK ALLOWED AND EXCLUDED LIST AND PHP FOR ALLOWED USERS
+     */
     if (!$auth_conf->allowUser($authname, $ldap_user)) {
       $authentication_result = LDAP_AUTHENTICATION_RESULT_FAIL_DISALLOWED;
-      break;  // regardless of how many servers, disallowed user fails
+      // Regardless of how many servers, disallowed user fails.
+      break;
     }
 
     /**
-    * #5 TEST PASSWORD
-    */
+     * #5 TEST PASSWORD
+     */
     $credentials_pass = FALSE;
     if ($sso_login) {
       /** If we have $sso_login passed in as true from the fake form state in
@@ -658,15 +667,15 @@ function ldap_authentication_test_credentials($auth_conf, $sso_login, $authname,
         * what is contained in the global $_SERVER array populated by the web
         * server authentication.
         */
-      $credentials_pass = (boolean)($ldap_user);
+      $credentials_pass = (boolean) ($ldap_user);
     }
     elseif ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_USER) {
-       /**
+      /**
         * With user bind method, the only way we can reach this part of the
         * code is when the pw has already been checked and $ldap_user could be
         * loaded, so we're good to go.
         */
-      $credentials_pass = true;
+      $credentials_pass = TRUE;
     }
     else {
       $credentials_pass = ($ldap_server->bind($ldap_user['dn'], $password, FALSE) == LDAP_SUCCESS);
@@ -678,41 +687,46 @@ function ldap_authentication_test_credentials($auth_conf, $sso_login, $authname,
         $watchdog_tokens['%err_text'] = NULL;
       }
       $authentication_result = LDAP_AUTHENTICATION_RESULT_FAIL_CREDENTIALS;
-      continue; // next server, please
+      // Next server, please.
+      continue;
     }
     else {
       $authentication_result = LDAP_AUTHENTICATION_RESULT_SUCCESS;
       if ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
-        $ldap_user = $ldap_server->userUserNameToExistingLdapEntry($authname); // after successful bind, lookup user again to get private attributes
+        // After successful bind, lookup user again to get private attributes.
+        $ldap_user = $ldap_server->userUserNameToExistingLdapEntry($authname);
         $watchdog_tokens['%mail'] = $ldap_user['mail'];
       }
       if ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT ||
           $ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
-          $ldap_server->disconnect();
+        $ldap_server->disconnect();
       }
       // Update ldapUser with the sid of the server that the user authenticated
       // on if that option was enabled in the LDAP user configuration.
       if ($auth_conf->ldapUser->drupalAcctProvisionServer == LDAP_USER_AUTH_SERVER_SID) {
         $auth_conf->ldapUser->drupalAcctProvisionServer = $ldap_server->sid;
       }
-      break; //success
+      // Success.
+      break;
     }
-
-  }  // end loop through servers
-
+  }
+  // End loop through servers.
   $watchdog_tokens['%result'] = $result;
   $watchdog_tokens['%auth_result'] = $authentication_result;
-  $watchdog_tokens['%err_text'] = _ldap_authentication_err_text($authentication_result) ;
+  $watchdog_tokens['%err_text'] = _ldap_authentication_err_text($authentication_result);
   if ($detailed_watchdog_log) {
     watchdog('ldap_authentication', '%username : Authentication result id=%result auth_result=%auth_result (%err_text)', $watchdog_tokens, WATCHDOG_DEBUG);
   }
 
-  return array($authentication_result, $ldap_user, $ldap_server);
+  return [$authentication_result, $ldap_user, $ldap_server];
 }
 
+/**
+ *
+ */
 function ldap_authentication_fail_response($authentication_result, $auth_conf, $detailed_watchdog_log, &$watchdog_tokens) {
   $watchdog_tokens['%err_text'] = _ldap_authentication_err_text($authentication_result);
- // fail scenario 1.  ldap auth exclusive and failed  throw error so no other authentication methods are allowed
+  // Fail scenario 1.  ldap auth exclusive and failed  throw error so no other authentication methods are allowed.
   if ($auth_conf->authenticationMode == LDAP_AUTHENTICATION_EXCLUSIVE) {
     if ($detailed_watchdog_log) {
       watchdog('ldap_authentication', '%username : setting error because failed at ldap and
@@ -722,8 +736,8 @@ function ldap_authentication_fail_response($authentication_result, $auth_conf, $
     form_set_error('name', $watchdog_tokens['%err_text']);
   }
   else {
- // fail scenario 2.  simply fails ldap.  return false, but don't throw form error
- // don't show user message, may be using other authentication after this that may succeed.
+    // Fail scenario 2.  simply fails ldap.  return false, but don't throw form error
+    // don't show user message, may be using other authentication after this that may succeed.
     if ($detailed_watchdog_log) {
       watchdog('ldap_authentication',
         '%username : Failed ldap authentication.
@@ -737,9 +751,12 @@ function ldap_authentication_fail_response($authentication_result, $auth_conf, $
 }
 
 /**
- * get human readable authentication error string
+ * Get human readable authentication error string.
+ *
+ * @param int $error
+ *   as LDAP_AUTHENTICATION_RESULT_* constant defined in
+ *   ldap_authentication.module.
  *
- * @param int $error as LDAP_AUTHENTICATION_RESULT_* constant defined in ldap_authentication.module
  * @return string human readable error text
  */
 function _ldap_authentication_err_text($error) {
@@ -747,32 +764,32 @@ function _ldap_authentication_err_text($error) {
   $msg = t('unknown error: ' . $error);
   switch ($error) {
     case LDAP_AUTHENTICATION_RESULT_FAIL_CONNECT:
-    $msg = t('Failed to connect to ldap server');
-    break;
+      $msg = t('Failed to connect to ldap server');
+      break;
 
     case LDAP_AUTHENTICATION_RESULT_FAIL_BIND:
-    $msg = t('Failed to bind to ldap server');
-    break;
+      $msg = t('Failed to bind to ldap server');
+      break;
 
     case LDAP_AUTHENTICATION_RESULT_FAIL_FIND:
-    $msg = t('Sorry, unrecognized username or password.');
-    break;
+      $msg = t('Sorry, unrecognized username or password.');
+      break;
 
     case LDAP_AUTHENTICATION_RESULT_FAIL_DISALLOWED:
-    $msg = t('User disallowed');
-    break;
+      $msg = t('User disallowed');
+      break;
 
     case LDAP_AUTHENTICATION_RESULT_FAIL_CREDENTIALS:
-    $msg = t('Sorry, unrecognized username or password.');
-    break;
+      $msg = t('Sorry, unrecognized username or password.');
+      break;
 
     case LDAP_AUTHENTICATION_RESULT_FAIL_GENERIC:
-    $msg = t('Sorry, unrecognized username or password.');
-    break;
+      $msg = t('Sorry, unrecognized username or password.');
+      break;
 
     case LDAP_AUTHENTICATION_RESULT_FAIL_SERVER:
-    $msg = t('Authentication Server or Configuration Error.');
-    break;
+      $msg = t('Authentication Server or Configuration Error.');
+      break;
 
   }
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info
index 53fd0491..fd7d87b4 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info
@@ -4,6 +4,8 @@ package = Lightweight Directory Access Protocol
 dependencies[] = ldap_servers
 dependencies[] = ldap_user
 core = 7.x
+php = 5.4
+
 configure = admin/config/people/ldap/authentication
 files[] = LdapAuthenticationConf.class.php
 files[] = LdapAuthenticationConfAdmin.class.php
@@ -16,8 +18,8 @@ files[] = tests/ldap_authentication.test
 
 test_dependencies[] = ldap_sso:ldap_sso
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.install b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.install
index 1adba41f..d39cd3c7 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.install
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.install
@@ -10,7 +10,7 @@
  */
 function ldap_authentication_requirements($phase) {
 
-  $requirements = array();
+  $requirements = [];
   if ($phase != "install" && db_table_exists('ldapauth')) {
     $requirements['ldap_authentication_ldap_integration']['title'] = t('LDAP Integration LDAP Auth Upgrade Concern');
     $requirements['ldap_authentication_ldap_integration']['severity'] = REQUIREMENT_WARNING;
@@ -40,61 +40,15 @@ function ldap_authentication_uninstall() {
 }
 
 /**
- * ldap_authentication and ldap_sso.  enable ldap_sso if sso was enabled in ldap_authentication previously
+ * Ldap_authentication and ldap_sso.  enable ldap_sso if sso was enabled in ldap_authentication previously.
  */
 function ldap_authentication_update_7100() {
-  // if sso is enabled in ldap authentication, enable module ldap_sso
+  // If sso is enabled in ldap authentication, enable module ldap_sso.
   module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
   ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
   $sso_enabled = LdapAuthenticationConfAdmin::getSaveableProperty('ssoEnabled');
   if ($sso_enabled) {
-    module_enable(array('ldap_sso'));
+    module_enable(['ldap_sso']);
     return t('Enabled new LDAP SSO module if Single Sign on was previously enabled.  Code for LDAP Single Sign On was moved to new "LDAP SSO" included module.');
   }
 }
-
-
-function ldap_authentication_ldap_integration6_to_ldap7() {
-
- // fix authmaps
- // UPDATE {authmap} SET module = 'ldap_authentication' WHERE module = 'ldapauth'
-
- // load all users and setup user data array
-
-/**
- * CREATE TABLE `ldapauth` (
-	`sid` TINYINT(4) NOT NULL AUTO_INCREMENT,
-	`name` VARCHAR(255) NOT NULL,
-	`status` TINYINT(4) NOT NULL DEFAULT '0',
-	`server` VARCHAR(255) NOT NULL,
-	`port` INT(11) NOT NULL DEFAULT '389',
-	`tls` TINYINT(4) NOT NULL DEFAULT '0',
-	`encrypted` TINYINT(4) NOT NULL DEFAULT '0',
-	`basedn` TEXT NULL,
-	`user_attr` VARCHAR(255) NULL DEFAULT NULL,
-	`mail_attr` VARCHAR(255) NULL DEFAULT NULL,
-	`binddn` VARCHAR(255) NULL DEFAULT NULL,
-	`bindpw` VARCHAR(255) NULL DEFAULT NULL,
-	`login_php` TEXT NULL,
-	`filter_php` TEXT NULL,
-	`weight` INT(11) NOT NULL DEFAULT '0',
-	`ldapgroups_in_dn` TINYINT(4) NOT NULL DEFAULT '0',
-	`ldapgroups_dn_attribute` VARCHAR(255) NULL DEFAULT NULL,
-	`ldapgroups_attr` VARCHAR(255) NULL DEFAULT NULL,
-	`ldapgroups_in_attr` TINYINT(4) NOT NULL DEFAULT '0',
-	`ldapgroups_as_entries` TINYINT(4) NOT NULL DEFAULT '0',
-	`ldapgroups_entries` TEXT NULL,
-	`ldapgroups_entries_attribute` VARCHAR(255) NULL DEFAULT NULL,
-	`ldapgroups_mappings` TEXT NULL,
-	`ldapgroups_mappings_filter` TINYINT(4) NOT NULL DEFAULT '0',
-	`ldapgroups_filter_php` TEXT NULL,
-	`ldapgroups_groups` TEXT NULL,
-	PRIMARY KEY (`name`),
-	INDEX `sid` (`sid`)
-)
-COLLATE='utf8_general_ci'
-ENGINE=InnoDB
-ROW_FORMAT=DEFAULT
-AUTO_INCREMENT=2
- */
-}
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.module b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.module
index d816a425..1539226f 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.module
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.module
@@ -54,7 +54,7 @@ define('LDAP_AUTHENTICATION_RESULT_FAIL_DISALLOWED', 4);
 define('LDAP_AUTHENTICATION_RESULT_FAIL_CREDENTIALS', 5);
 define('LDAP_AUTHENTICATION_RESULT_SUCCESS', 6);
 define('LDAP_AUTHENTICATION_RESULT_FAIL_GENERIC', 7);
-define('LDAP_AUTHENTICATION_RESULT_FAIL_SERVER'      , 8);
+define('LDAP_AUTHENTICATION_RESULT_FAIL_SERVER', 8);
 
 define('LDAP_AUTHENTICATION_ACCT_CREATION_DEFAULT', 4);
 define('LDAP_AUTHENTICATION_ACCT_CREATION_USER_SETTINGS_FOR_LDAP', 1);
@@ -62,7 +62,7 @@ define('LDAP_AUTHENTICATION_ACCT_CREATION_LDAP_BEHAVIOR', 4);
 
 define('LDAP_AUTHENTICATION_HELP_LINK_TEXT_DEFAULT', 'Logon Help');
 
-define('LDAP_AUTHENTICATION_DISABLED_FOR_BAD_CONF_MSG' , 'The site logon is currently not working due to a configuration error.  Please see logs for additional details.');
+define('LDAP_AUTHENTICATION_DISABLED_FOR_BAD_CONF_MSG', 'The site logon is currently not working due to a configuration error.  Please see logs for additional details.');
 define('LDAP_AUTHENTICATION_COOKIE_EXPIRE', 0);
 
 define('LDAP_AUTHENTICATION_REDIRECT_ON_LOGIN_DEFAULT', 0);
@@ -71,49 +71,48 @@ define('LDAP_AUTHENTICATION_REDIRECT_ON_LOGIN_DEFAULT', 0);
  * Implements hook_menu().
  */
 function ldap_authentication_menu() {
-  $items = array();
+  $items = [];
 
-  $items['user/ldap-profile-update'] = array(
+  $items['user/ldap-profile-update'] = [
     'title' => 'Update Profile',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_authentication_profile_update_form'),
+    'page arguments' => ['ldap_authentication_profile_update_form'],
     'access callback' => TRUE,
     'type' => MENU_CALLBACK,
     'file' => 'ldap_authentication.pages.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/authentication'] = array(
+  $items['admin/config/people/ldap/authentication'] = [
     'title' => 'Authentication',
     'description' => 'Configure LDAP Authentication',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_authentication_admin_form'),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_authentication_admin_form'],
+    'access arguments' => ['administer site configuration'],
     'type' => MENU_LOCAL_TASK,
     'weight' => 3,
     'file' => 'ldap_authentication.admin.inc',
-  );
+  ];
 
   return $items;
 }
 
- /**
+/**
  * Implements hook_menu_alter().
  * since menu items are cached, only useful to add or alter callbacks
  * for ldap authentication driven menu items.
- *
  */
 function ldap_authentication_menu_alter(&$items) {
   ldap_servers_module_load_include('inc', 'ldap_authentication', 'ldap_authentication');
   $items['user/password']['access callback'] = 'ldap_authentication_show_reset_pwd';
   $auth_conf = ldap_authentication_get_valid_conf();
   if (@$auth_conf->ldapUserHelpLinkUrl) {
-    $items['user/ldaphelp'] = array(
+    $items['user/ldaphelp'] = [
       'title' => $auth_conf->ldapUserHelpLinkText,
       'page callback' => 'drupal_goto',
-      'page arguments' => array($auth_conf->ldapUserHelpLinkUrl),
+      'page arguments' => [$auth_conf->ldapUserHelpLinkUrl],
       'access callback' => 'ldap_authentication_show_ldap_help_link',
       'type' => MENU_LOCAL_TASK,
-    );
+    ];
   }
 }
 
@@ -121,53 +120,51 @@ function ldap_authentication_menu_alter(&$items) {
  * Implements hook_theme().
  */
 function ldap_authentication_theme() {
-  return array(
-    'ldap_authentication_user_login_block_links' => array(
-      'variables' => array('ldap_user_help_link' => NULL, 'user_register' => TRUE),
+  return [
+    'ldap_authentication_user_login_block_links' => [
+      'variables' => ['ldap_user_help_link' => NULL, 'user_register' => TRUE],
       'render element' => 'element',
-      'file' => 'ldap_authentication.theme.inc'
-    ),
-    'ldap_authentication_user_pass_message' => array(
-      'variables' => array('show_reset_pwd' => NULL, 'auth_conf' => TRUE),
+      'file' => 'ldap_authentication.theme.inc',
+    ],
+    'ldap_authentication_user_pass_message' => [
+      'variables' => ['show_reset_pwd' => NULL, 'auth_conf' => TRUE],
       'render element' => 'element',
-      'file' => 'ldap_authentication.theme.inc'
-    ),
-    'ldap_authentication_user_pass_validate_ldap_authenticated' => array(
-      'variables' => array('account' => NULL, 'auth_conf' => TRUE),
+      'file' => 'ldap_authentication.theme.inc',
+    ],
+    'ldap_authentication_user_pass_validate_ldap_authenticated' => [
+      'variables' => ['account' => NULL, 'auth_conf' => TRUE],
       'render element' => 'element',
-      'file' => 'ldap_authentication.theme.inc'
-    ),
-    'ldap_authentication_login_message' => array(
+      'file' => 'ldap_authentication.theme.inc',
+    ],
+    'ldap_authentication_login_message' => [
       'render element' => 'element',
-      'variables' => array('message' => NULL),
-      'file' => 'ldap_authentication.theme.inc'
-    ),
-    'ldap_authentication_message_not_found' => array(
+      'variables' => ['message' => NULL],
+      'file' => 'ldap_authentication.theme.inc',
+    ],
+    'ldap_authentication_message_not_found' => [
       'render element' => 'element',
-      'variables' => array('message' => NULL),
-      'file' => 'ldap_authentication.theme.inc'
-    ),
-    'ldap_authentication_message_not_authenticated' => array(
+      'variables' => ['message' => NULL],
+      'file' => 'ldap_authentication.theme.inc',
+    ],
+    'ldap_authentication_message_not_authenticated' => [
       'render element' => 'element',
-      'variables' => array('message' => NULL),
-      'file' => 'ldap_authentication.theme.inc'
-    ),
-  );
+      'variables' => ['message' => NULL],
+      'file' => 'ldap_authentication.theme.inc',
+    ],
+  ];
 }
 
-
 /**
  * Implements hook_help().
  */
-
 function ldap_authentication_help($path, $arg) {
 
   $authentication_help = t('LDAP authentication allows authentication against an LDAP server.  It
         may be used alongside other authentication means such as built in Drupal authentication,
         open id, etc.  More detailed help is available on drupal.org at !helplink.',
-          array(
+          [
             '!helplink' => l(LDAP_SERVERS_DRUPAL_HELP_URL, LDAP_SERVERS_DRUPAL_HELP_URL),
-          ));
+          ]);
 
   switch ($path) {
     case 'admin/config/people/ldap/authentication':
@@ -187,16 +184,15 @@ function ldap_authentication_help($path, $arg) {
  * Currently this only checks if mail is valid or not according to the
  * authentication settings.
  *
- * @return boolean
+ * @return bool
  *   TRUE if the user's profile is valid, otherwise FALSE.
- *
  */
 function _ldap_authentication_verify_user_profile() {
   global $user;
   $result = TRUE;
   // We only want non-anonymous and non-1 users.
   if ($user->uid > 1) {
-    // we store the value in the session for speed.
+    // We store the value in the session for speed.
     if (isset($_SESSION['ldap_authentication_template']) &&
             isset($_SESSION['ldap_authentication_template']['verify_user_profile'])) {
       return $_SESSION['ldap_authentication_template']['verify_user_profile'];
@@ -207,9 +203,9 @@ function _ldap_authentication_verify_user_profile() {
       if (preg_match($regex, $user->mail)) {
         $result = FALSE;
       }
-      $_SESSION['ldap_authentication_template'] = array(
+      $_SESSION['ldap_authentication_template'] = [
         'verify_user_profile' => $result,
-      );
+      ];
     }
   }
   return $result;
@@ -232,16 +228,16 @@ function ldap_authentication_check_for_email_template() {
   if (!_ldap_authentication_verify_user_profile()) {
     $url = 'user/ldap-profile-update';
     $cp = current_path();
-    // avoid redirects on these two pages.
+    // Avoid redirects on these two pages.
     if ($cp != $url && $cp != 'user/logout') {
       if (isset($_GET['destination'])) {
         unset($_GET['destination']);
       }
-      drupal_goto($url, array(
-        'query' => array(
+      drupal_goto($url, [
+        'query' => [
           'next' => current_path(),
-        ),
-      ));
+        ],
+      ]);
     }
   }
 }
@@ -260,15 +256,14 @@ function ldap_authentication_info($field = 0) {
   return $info;
 }
 
-
 /**
  * Determines if the passed user has a valid authmap record.
  *
  * @param object $user
  *   A drupal user account.
  *
- * @return boolean
- *    true if user is recorded as ldap authenticated and identified (ldap_authentified)
+ * @return bool
+ *   true if user is recorded as ldap authenticated and identified (ldap_authentified)
  */
 function ldap_authentication_ldap_authenticated($user) {
   if (!is_object($user) || $user->uid == 0) {
@@ -284,21 +279,16 @@ function ldap_authentication_ldap_authenticated($user) {
  * A user access callback for using the single sign-on URL, denying access to
  * authenticated users, and granting access to anonymous users and menu
  * administrators viewing the menu item.
- *
  */
 function _ldap_authentication_user_access() {
-  return (boolean)(!$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']));
+  return (boolean) (!$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']));
 }
 
-
-
 /**
- * get LdapAuthenticationConf object
+ * Get LdapAuthenticationConf object.
  *
  * @return object LdapAuthenticationConf object if configured, otherwise FALSE
- *
  */
-
 function ldap_authentication_get_valid_conf($reset = FALSE) {
 
   static $auth_conf;
@@ -317,16 +307,19 @@ function ldap_authentication_get_valid_conf($reset = FALSE) {
  */
 function ldap_authentication_ldap_server_in_use($sid, $server_name) {
 
-  $use_warnings = array();
+  $use_warnings = [];
   $auth_conf = ldap_authentication_get_valid_conf();
   if ($auth_conf && in_array($sid, array_keys($auth_conf->sids)) && !empty($auth_conf->sids[$sid])) {
     $use_warnings[] = t('This server (%server_name) may not be deleted or
       disabled because it is being used for ldap authentication.',
-      array('%server_name' => $server_name));
+      ['%server_name' => $server_name]);
   }
   return $use_warnings;
 }
 
+/**
+ *
+ */
 function ldap_authentication_show_reset_pwd($user = NULL) {
 
   if (!$user) {
@@ -334,14 +327,14 @@ function ldap_authentication_show_reset_pwd($user = NULL) {
   }
   $auth_conf = ldap_authentication_get_valid_conf();
   // Hide user/password form if ldap authentication is required and deny access
-  // to users without ldap authorizations is enabled
+  // to users without ldap authorizations is enabled.
   if ($user->uid == 1 || !$auth_conf || (current_path() == 'user/password' && $auth_conf->authenticationMode != LDAP_AUTHENTICATION_EXCLUSIVE)) {
     return TRUE;
-   // always show at user/passwordurl. otherwise user 1 will not be able to reset password.
+    // Always show at user/passwordurl. otherwise user 1 will not be able to reset password.
   }
 
   if ($user->uid == 0) {
-    // hide reset password for anonymous users if ldap only authentication and password updates are disabled, otherwise show
+    // Hide reset password for anonymous users if ldap only authentication and password updates are disabled, otherwise show.
     if ($auth_conf->authenticationMode == LDAP_AUTHENTICATION_EXCLUSIVE) {
       if ($auth_conf->passwordOption == LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW) {
         return TRUE;
@@ -351,7 +344,7 @@ function ldap_authentication_show_reset_pwd($user = NULL) {
     return TRUE;
   }
   else {
-    // authenticated user.  hide if ldap authenticated and updating password is
+    // Authenticated user.  hide if ldap authenticated and updating password is
     // not allowed, otherwise show.
     if (ldap_authentication_ldap_authenticated($user)) {
       if ($auth_conf->passwordOption == LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW) {
@@ -364,25 +357,22 @@ function ldap_authentication_show_reset_pwd($user = NULL) {
 
 }
 
-
 /**
  * Implements hook_form_FORM_ID_alter().
  */
-
 function ldap_authentication_form_user_pass_alter(&$form, $form_state) {
-  // the following could be in a theme preproces function
+  // The following could be in a theme preproces function.
   $auth_conf = ldap_authentication_get_valid_conf();
-  $form['ldap_warning'] = array(
-     '#type' => 'item',
-     '#markup' => theme('ldap_authentication_user_pass_message', array('auth_conf' => $auth_conf)),
-     '#weight' => 10,
-      );
+  $form['ldap_warning'] = [
+    '#type' => 'item',
+    '#markup' => theme('ldap_authentication_user_pass_message', ['auth_conf' => $auth_conf]),
+    '#weight' => 10,
+  ];
 
-  // need to insert before user_pass_validate
+  // Need to insert before user_pass_validate.
   array_unshift($form['#validate'], 'ldap_authentication_user_pass_validate');
 }
 
-
 /**
  * A validate handler on the login form. Check supplied username/password
  * against local users table. If successful, $form_state['uid']
@@ -397,7 +387,9 @@ function ldap_authentication_core_override_user_login_authenticate_validate($for
   user_login_authenticate_validate($form, $form_state);
 }
 
-
+/**
+ *
+ */
 function ldap_authentication_user_pass_validate(&$form_state) {
   $name_or_mail = trim($form_state['name']['#value']);
   if ($account = user_load_by_mail($name_or_mail)) {
@@ -408,10 +400,10 @@ function ldap_authentication_user_pass_validate(&$form_state) {
   }
 
   if (ldap_authentication_ldap_authenticated($account)) {
-    $vars = array(
+    $vars = [
       'account' => $account,
       'auth_conf' => ldap_authentication_get_valid_conf(),
-    );
+    ];
     $error = TRUE;
     if (is_object($vars['auth_conf'])) {
       if ($vars['auth_conf']->passwordOption == LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW) {
@@ -424,9 +416,8 @@ function ldap_authentication_user_pass_validate(&$form_state) {
   }
 }
 
-
 /**
- * Implements hook_form_FORM_ID_alter(). for user_profile_form
+ * Implements hook_form_FORM_ID_alter(). for user_profile_form.
  */
 function ldap_authentication_form_user_profile_form_alter(&$form, $form_state) {
   ldap_servers_module_load_include('inc', 'ldap_authentication', 'ldap_authentication');
@@ -434,9 +425,8 @@ function ldap_authentication_form_user_profile_form_alter(&$form, $form_state) {
 
 }
 
-
 /**
- * Implements hook_form_FORM_ID_alter(). for user_login
+ * Implements hook_form_FORM_ID_alter(). for user_login.
  */
 function ldap_authentication_form_user_login_alter(&$form, &$form_state) {
   ldap_servers_module_load_include('inc', 'ldap_authentication', 'ldap_authentication');
@@ -445,7 +435,7 @@ function ldap_authentication_form_user_login_alter(&$form, &$form_state) {
 }
 
 /**
- * Implements hook_form_FORM_ID_alter(). for user_login_block
+ * Implements hook_form_FORM_ID_alter(). for user_login_block.
  */
 function ldap_authentication_form_user_login_block_alter(&$form, &$form_state) {
   ldap_servers_module_load_include('inc', 'ldap_authentication', 'ldap_authentication');
@@ -454,48 +444,44 @@ function ldap_authentication_form_user_login_block_alter(&$form, &$form_state) {
 }
 
 /**
- * validate function for user logon forms.
+ * Validate function for user logon forms.
  */
 function ldap_authentication_user_login_authenticate_validate($form, &$form_state, $return_user = FALSE) {
   ldap_servers_module_load_include('inc', 'ldap_authentication', 'ldap_authentication');
   return _ldap_authentication_user_login_authenticate_validate($form_state, $return_user);
 }
 
-
 /**
  * Implements hook_user_presave().
  *  A user account is about to be created or updated.
  */
-
 function ldap_authentication_user_presave(&$edit, $account, $category = NULL) {
 
 }
 
-
 /**
  * Implements hook_user_insert().
  *
  * A user account was created.
  * The module should save its custom additions to the user object into the database.
  */
-
 function ldap_authentication_user_insert(&$edit, $account, $category) {
 
 }
 
-
 /**
  * Implements hook_user_update().
  *
  *  A user account was updated.
  *  Modules may use this hook to update their user data in a custom storage after a user account has been updated.
  */
-
-
 function ldap_authentication_user_update($edit, $user, $category) {
 
 }
 
+/**
+ *
+ */
 function ldap_authentication_show_ldap_help_link($user = NULL) {
   global $user;
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.pages.inc b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.pages.inc
index 06678fa5..9bacc57b 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.pages.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.pages.inc
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * User-facing page callbacks for the LDAP Authentication module.
@@ -6,27 +7,27 @@
 
 /**
  * Form constructor for updating the profile.
- * 
- * @see ldap_authentication_profile_update_form_validate().
- * @see ldap_authentication_profile_update_form_submit().
+ *
+ * @see ldap_authentication_profile_update_form_validate()
+ * @see ldap_authentication_profile_update_form_submit()
  */
 function ldap_authentication_profile_update_form($form, &$form_state) {
-  $form['mail'] = array(
+  $form['mail'] = [
     '#type' => 'textfield',
     '#required' => TRUE,
     '#title' => t('Email Address'),
-  );
-  $form['submit'] = array(
+  ];
+  $form['submit'] = [
     '#type' => 'submit',
     '#value' => t('Update Profile'),
-  );
+  ];
   return $form;
 }
 
 /**
  * Form validator for updating the profile.
- * 
- * @see ldap_authentication_profile_update_form().
+ *
+ * @see ldap_authentication_profile_update_form()
  */
 function ldap_authentication_profile_update_form_validate($form, &$form_state) {
   if (!filter_var($form_state['values']['mail'], FILTER_VALIDATE_EMAIL)) {
@@ -45,15 +46,15 @@ function ldap_authentication_profile_update_form_validate($form, &$form_state) {
 
 /**
  * Form submit handler for updating the profile.
- * 
- * @see ldap_authentication_profile_update_form().
+ *
+ * @see ldap_authentication_profile_update_form()
  */
 function ldap_authentication_profile_update_form_submit($form, &$form_state) {
   global $user;
-  if (user_save($user, array(
+  if (user_save($user, [
     'mail' => $form_state['values']['mail'],
-  ))) {
-    // prevents the cached setting from being used again.
+  ])) {
+    // Prevents the cached setting from being used again.
     unset($_SESSION['ldap_authentication_template']);
     $form_state['redirect'] = isset($_GET['next']) ? $_GET['next'] : '<front>';
     drupal_set_message(t('Your profile has been updated.'));
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.rules.inc b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.rules.inc
index aa127ca3..7decb526 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.rules.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.rules.inc
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Rule implementations for the LDAP Authentication module.
@@ -8,21 +9,21 @@
  * Implements hook_rules_event_info().
  */
 function ldap_authentication_rules_event_info() {
-  return array(
-    'ldap_user_created' => array(
+  return [
+    'ldap_user_created' => [
       'label' => t('User created from LDAP entry'),
       'module' => 'ldap_authentication',
       'group' => t('User'),
-      'variables' => array(
-        'user' => array(
+      'variables' => [
+        'user' => [
           'type' => 'user',
           'label' => t('The user created.'),
-        ),
-        'email_template_used' => array(
+        ],
+        'email_template_used' => [
           'type' => 'boolean',
           'label' => t('Whether or not the email template was used to create the user.'),
-        ),
-      ),
-    ),
-  );
+        ],
+      ],
+    ],
+  ];
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.theme.inc b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.theme.inc
index 7f604769..cdcdceb6 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.theme.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.theme.inc
@@ -2,47 +2,55 @@
 
 /**
  * @file
- * theming functions for ldap_authentication module
- *
+ * Theming functions for ldap_authentication module.
  */
 
 /**
  * Returns HTML for user login block links.
+ *
  * @param $variables
  *   An associative array containing:
- *   - hide_reset_pwd (boolean) whether reset password link should be visible
+ *   - $show_reset_pwd (boolean) whether reset password link should be visible
  *   - auth_conf: object with ldap authentication configuration data
  *
  * @ingroup themeable
+ *
+ * @return string
  */
 function theme_ldap_authentication_user_login_block_links($variables) {
+  /** @var bool $show_reset_pwd */
+  /** @var object $auth_conf */
   extract($variables);
 
- // the code below modified from user.module user_login_block function
-  $items = array();
+  // The code below modified from user.module user_login_block function.
+  $items = [];
   if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
-    $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
+    $items[] = l(t('Create new account'), 'user/register', ['attributes' => ['title' => t('Create a new user account.')]]);
   }
   if ($show_reset_pwd) {
-    $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
+    $items[] = l(t('Request new password'), 'user/password', ['attributes' => ['title' => t('Request new password via e-mail.')]]);
   }
   elseif ($auth_conf->ldapUserHelpLinkUrl) {
     $items[] = l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl);
   }
 
-  $output = theme('item_list', array('items' => $items));
+  $output = theme('item_list', ['items' => $items]);
   return $output;
 }
 
 /**
  * Returns HTML warning text for request new password/password reset form.
+ *
  * @param $variables
  *   An associative array containing:
  *   - auth_conf: object with ldap authentication configuration data
  *
  * @ingroup themeable
+ *
+ * @return string|null
  */
 function theme_ldap_authentication_user_pass_message($variables) {
+  /** @var object $auth_conf */
   extract($variables);
   if ($auth_conf->authenticationMode == LDAP_AUTHENTICATION_EXCLUSIVE && $auth_conf->passwordOption != LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW) {
     $msg = t('This page is only useful for the site administrator.  All other users
@@ -54,26 +62,32 @@ function theme_ldap_authentication_user_pass_message($variables) {
       $msg .= ' ' . t('with one of your organizations password management sites.');
     }
   }
-  else { // mixed mode
-    $msg = ""; // warning will come up on validation.  we do not know if the user is ldap authenticated or not until they submit form.
+  // Mixed mode.
+  else {
+    // Warning will come up on validation.  we do not know if the user is ldap authenticated or not until they submit form.
+    $msg = "";
   }
 
   return $msg;
 }
 
 /**
- * Returns HTML warning text when an ldap authenticated user tries to reset their password.
+ * Returns HTML warning text when an ldap authenticated user tries to reset
+ * their password.
+ *
  * @param $variables
  *   An associative array containing:
  *   - auth_conf: object with ldap authentication configuration data
  *   - account: user object
  *
  * @ingroup themeable
+ *
+ * @return string|null
  */
 function theme_ldap_authentication_user_pass_validate_ldap_authenticated($variables) {
+  /** @var object $auth_conf */
   extract($variables);
-  // already know user exists and is ldap authenticated
-
+  // Already know user exists and is ldap authenticated.
   if ($auth_conf->ldapUserHelpLinkUrl) {
     $msg = t('You may not reset your password here.  You must reset your password via the directions at')
     . ' ' . l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl);
@@ -85,7 +99,6 @@ function theme_ldap_authentication_user_pass_validate_ldap_authenticated($variab
   return $msg;
 }
 
-
 /**
  * The following three functions are theme callbacks for various messages
  * from NTLM/seamless login integration.
@@ -95,36 +108,48 @@ function theme_ldap_authentication_user_pass_validate_ldap_authenticated($variab
  * ability to have more complex message handling performed; an example would
  * be to use the Real Name module to say "Welcome, User Name" upon successful
  * login.
- * @param $message
- *   A text string containing a translatable success message
+ *
+ * @param string $message
+ *   A text string containing a translatable success message.
  *
  * @ingroup themeable
+ *
+ * @return mixed
  */
 function theme_ldap_authentication_login_message($variables) {
+  /** @var string $message */
   extract($variables);
   return $message;
 }
 
 /**
  * Provides a theme callback for user not found messages.
- * @param $message
- *   A text string containing a translatable "user not found" message
+ *
+ * @param string $message
+ *   A text string containing a translatable "user not found" message.
  *
  * @ingroup themeable
+ *
+ * @return mixed
  */
 function theme_ldap_authentication_message_not_found($variables) {
+  /** @var string $message */
   extract($variables);
   return $message;
 }
 
 /**
  * Provides a theme callback for authentication failure messages.
- * @param $message
- *   A text string containing a translatable "authentication failure" message
+ *
+ * @param string $message
+ *   A text string containing a translatable "authentication failure" message.
  *
  * @ingroup themeable
+ *
+ * @return string
  */
 function theme_ldap_authentication_message_not_authenticated($variables) {
+  /** @var string $message */
   extract($variables);
   return $message;
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/tests/ldap_authentication.test b/drupal7/sites/all/modules/ldap/ldap_authentication/tests/ldap_authentication.test
index a78aa9ea..1c2d2207 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/tests/ldap_authentication.test
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/tests/ldap_authentication.test
@@ -2,49 +2,65 @@
 
 /**
  * @file
- * ldap_authentication simpletests
- *
+ * Ldap_authentication simpletests.
  */
 
 module_load_include('php', 'ldap_test', 'LdapTestCase.class');
 module_load_include('module', 'ldap_authentication');
 
+/**
+ * LdapAuthenticationTestCase.
+ */
 class LdapAuthenticationTestCase extends LdapTestCase {
+
+  public $module_name = 'ldap_authentication';
+  protected $ldap_test_data;
+
+  /**
+   * Get info.
+   */
   public static function getInfo() {
-    return array(
+    return [
       'name' => 'LDAP Authentication Tests',
       'description' => 'Test ldap authentication.',
-      'group' => 'LDAP Authentication'
-    );
+      'group' => 'LDAP Authentication',
+    ];
   }
 
-  function __construct($test_id = NULL) {
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct($test_id = NULL) {
     parent::__construct($test_id);
   }
 
-  public $module_name = 'ldap_authentication';
-  protected $ldap_test_data;
-
-  function setUp() {
-    parent::setUp(array(
+  /**
+   *
+   */
+  public function setUp() {
+    parent::setUp([
       'ldap_authentication',
       'ldap_authorization',
       'ldap_authorization_drupal_role',
       'ldap_test',
-      )); // don't need any real servers, configured, just ldap_servers code base
+    // don't need any real servers, configured, just ldap_servers code base.
+    ]);
     variable_set('ldap_simpletest', 2);
   }
 
-  function tearDown() {
+  /**
+   *
+   */
+  public function tearDown() {
     parent::tearDown();
     variable_del('ldap_help_watchdog_detail');
     variable_del('ldap_simpletest');
   }
 
   /**
-   * difficult to test install and uninstall since setUp does module enabling and installing.
+   * Difficult to test install and uninstall since setUp does module enabling and installing.
    */
-  function testInstall() {
+  public function testInstall() {
     $testid = $this->module_name . ': setup success';
     $setup_success = (
         module_exists('ldap_authentication') &&
@@ -54,16 +70,13 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     $this->assertTrue($setup_success, ' ldap_authentication setup successful', $testid);
   }
 
-
-/**
- *  LDAP Authentication Mixed Mode User Logon Test (ids = LDAP_authen.MM.ULT.*)
- */
-
-
-  function testMixedModeUserLogon() {
+  /**
+   * LDAP Authentication Mixed Mode User Logon Test (ids = LDAP_authen.MM.ULT.*)
+   */
+  public function testMixedModeUserLogon() {
     $sid = 'activedirectory1';
     $testid = 'MixedModeUserLogon3';
-    $sids = array($sid);
+    $sids = [$sid];
     $this->prepTestData(
       LDAP_TEST_LDAP_NAME,
       $sids,
@@ -81,20 +94,20 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     $user1 = user_load(1);
     $password = $this->randomString(20);
-    require_once(DRUPAL_ROOT . '/includes/password.inc');
-    $account = array(
+    require_once DRUPAL_ROOT . '/includes/password.inc';
+    $account = [
       'name' => $user1->name,
       'pass' => user_hash_password(trim($password)),
-    );
+    ];
     db_update('users')
       ->fields($account)
       ->condition('uid', 1)
       ->execute();
 
-    $edit = array(
+    $edit = [
       'name' => $user1->name,
       'pass' => $password,
-    );
+    ];
 
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'User 1 successfully authenticated', $testid);
@@ -102,10 +115,10 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     /** LDAP_authen.MM.ULT.user1.badpwd  -- result: Drupal logon error message. **/
 
-    $edit = array(
+    $edit = [
       'name' => $user1->name,
       'pass' => 'mydabpassword',
-    );
+    ];
 
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Sorry, unrecognized username or password'), 'User 1 failed with bad password', $testid);
@@ -115,57 +128,56 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     $drupal_user = $this->drupalCreateUser();
     $raw_pass = $drupal_user->pass_raw;
-    $edit = array(
+    $edit = [
       'name' => $drupal_user->name,
       'pass' => $raw_pass,
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'Drupal user (not ldap associated) successfully authenticated', $testid);
     $this->drupalGet('user/logout');
 
     /** LDAP_authen.MM.ULT.drupal.badpwd - result: Drupal logon error message. **/
-    $edit = array(
+    $edit = [
       'name' => $drupal_user->name,
       'pass' => 'mydabpassword',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Sorry, unrecognized username or password'), 'Drupal user  (not ldap associated) with bad password failed to authenticate.', $testid);
     $this->drupalGet('user/logout');
 
     /** LDAP_authen.MM.ULT.ldap.newaccount.badpwd - result: Drupal logon error message. **/
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'mydabpassword',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Sorry, unrecognized username or password'), 'New Ldap user with bad password failed to authenticate.', $testid);
     $this->drupalGet('user/logout');
 
-
     /** LDAP_authen.MM.ULT.ldap.newaccount.goodpwd - result: Successful logon, with user record created and authmapped to ldap **/
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'New Ldap user with good password authenticated.');
     $this->assertTrue($this->testFunctions->ldapUserIsAuthmapped('hpotter'), 'Ldap user properly authmapped.', $testid);
     $this->drupalGet('user/logout');
 
     /** LDAP_authen.MM.ULT.existingacct.badpwd - result: Drupal logon error message. **/
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'mydabpassword',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Sorry, unrecognized username or password'), 'Existing Ldap user with bad password failed to authenticate.', $testid);
     $this->drupalGet('user/logout');
 
     /** LDAP_authen.MM.ULT.existingacct.goodpwd - result: Successful logon. **/
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'Existing Ldap user with good password authenticated.');
     $this->assertTrue($this->testFunctions->ldapUserIsAuthmapped('hpotter'), 'Existing Ldap user still properly authmapped.', $testid);
@@ -173,15 +185,14 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
   }
 
-
-/**
- *  LDAP Authentication Exclusive Mode User Logon Test (ids = LDAP_authen.EM.ULT.*)
- */
-  function testExclusiveModeUserLogon() {
+  /**
+   * LDAP Authentication Exclusive Mode User Logon Test (ids = LDAP_authen.EM.ULT.*)
+   */
+  public function testExclusiveModeUserLogon() {
 
     $sid = 'activedirectory1';
     $testid = 'ExclusiveModeUserLogon3';
-    $sids = array($sid);
+    $sids = [$sid];
     $this->prepTestData(
       LDAP_TEST_LDAP_NAME,
       $sids,
@@ -199,20 +210,20 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     $user1 = user_load(1);
     $password = $this->randomString(20);
-    require_once(DRUPAL_ROOT . '/includes/password.inc');
-    $account = array(
+    require_once DRUPAL_ROOT . '/includes/password.inc';
+    $account = [
       'name' => $user1->name,
       'pass' => user_hash_password(trim($password)),
-    );
+    ];
     db_update('users')
       ->fields($account)
       ->condition('uid', 1)
       ->execute();
 
-    $edit = array(
+    $edit = [
       'name' => $user1->name,
       'pass' => $password,
-    );
+    ];
 
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'User 1 successfully authenticated', $testid);
@@ -220,87 +231,85 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     /** LDAP_authen.EM.ULT.user1.badpwd  -- result: Drupal logon error message. **/
 
-    $edit = array(
+    $edit = [
       'name' => $user1->name,
       'pass' => 'mydabpassword',
-    );
+    ];
 
     $this->drupalPost('user', $edit, t('Log in'));
-    $this->assertText(t('Sorry, unrecognized username or password'), 'User 1 failed with bad password', $testid );
+    $this->assertText(t('Sorry, unrecognized username or password'), 'User 1 failed with bad password', $testid);
     $this->drupalLogout();
 
     /** LDAP_authen.EM.ULT.drupal.goodpwd - result: failed logon **/
 
     $drupal_user = $this->drupalCreateUser();
     $raw_pass = $drupal_user->pass_raw;
-    $edit = array(
+    $edit = [
       'name' => $drupal_user->name,
       'pass' => $raw_pass,
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
-    $this->assertText(t('Sorry, unrecognized username or password'), 'Drupal user successfully authenticated', $testid );
+    $this->assertText(t('Sorry, unrecognized username or password'), 'Drupal user successfully authenticated', $testid);
     $this->drupalGet('user/logout');
 
     /** LDAP_authen.EM.ULT.drupal.badpwd - result: Drupal logon error message. **/
-    $edit = array(
+    $edit = [
       'name' => $drupal_user->name,
       'pass' => 'mydabpassword',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
-    $this->assertText(t('Sorry, unrecognized username or password'), 'Drupal user with bad password failed to authenticate.', $testid );
+    $this->assertText(t('Sorry, unrecognized username or password'), 'Drupal user with bad password failed to authenticate.', $testid);
     $this->drupalGet('user/logout');
 
-
     /** LDAP_authen.EM.ULT.ldap.newaccount.badpwd - result: Drupal logon error message. **/
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'mydabpassword',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
-    $this->assertText(t('Sorry, unrecognized username or password'), 'New Ldap user with bad password failed to authenticate.', $testid );
+    $this->assertText(t('Sorry, unrecognized username or password'), 'New Ldap user with bad password failed to authenticate.', $testid);
     $this->drupalGet('user/logout');
 
-
-
     /** LDAP_authen.EM.ULT.ldap.newaccount.goodpwd - result: Successful logon, with user record created and authmapped to ldap **/
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'New Ldap user with good password authenticated.');
-    $this->assertTrue($this->testFunctions->ldapUserIsAuthmapped('hpotter'), 'Ldap user properly authmapped.', $testid );
+    $this->assertTrue($this->testFunctions->ldapUserIsAuthmapped('hpotter'), 'Ldap user properly authmapped.', $testid);
     $this->drupalGet('user/logout');
 
-
     /** LDAP_authen.EM.ULT.existingacct.badpwd - result: Drupal logon error message. **/
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'mydabpassword',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
-    $this->assertText(t('Sorry, unrecognized username or password'), 'Existing Ldap user with bad password failed to authenticate.', $testid );
+    $this->assertText(t('Sorry, unrecognized username or password'), 'Existing Ldap user with bad password failed to authenticate.', $testid);
     $this->drupalGet('user/logout');
 
     /** LDAP_authen.MM.ULT.existingacct.goodpwd - result: Successful logon. **/
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'Existing Ldap user with good password authenticated.');
-    $this->assertTrue($this->testFunctions->ldapUserIsAuthmapped('hpotter'), 'Existing Ldap user still properly authmapped.', $testid );
+    $this->assertTrue($this->testFunctions->ldapUserIsAuthmapped('hpotter'), 'Existing Ldap user still properly authmapped.', $testid);
     $this->drupalGet('user/logout');
 
   }
 
   /**
-   * set mock server variables for sso tests
+   * Set mock server variables for sso tests.
    *
-   * @param object $drupal_user in drupal stdClass format
-   * @param array $ldap_user array
-   * @param enum ldap implementation type
+   * @param string $server_var_key
+   * @param string $sso_name
+   * @param string $ldapImplementation
+   * @param bool $seamlessLogin
    *
+   * @return object
    */
   private function setSsoServerEnvironment(
     $server_var_key = 'REMOTE_USER',
@@ -309,7 +318,7 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     $seamlessLogin = TRUE
   ) {
 
-    // clear past environment
+    // Clear past environment.
     ldap_servers_delete_globals('_SERVER', 'REMOTE_USER', TRUE);
     ldap_servers_delete_globals('_SERVER', 'REDIRECT_REMOTE_USER', TRUE);
 
@@ -317,13 +326,13 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     $authenticationConf->ssoEnabled = TRUE;
     $authenticationConf->ssoRemoteUserStripDomainName = FALSE;
-    $authenticationConf->ssoExcludedPaths = array();
-    $authenticationConf->ssoExcludedHosts = array();
+    $authenticationConf->ssoExcludedPaths = [];
+    $authenticationConf->ssoExcludedHosts = [];
     $authenticationConf->seamlessLogin = $seamlessLogin;
     $authenticationConf->ldapImplementation = $ldapImplementation;
 
     if ($sso_name !== FALSE) {
-      if (strpos($sso_name, '@'))  {
+      if (strpos($sso_name, '@')) {
         $sso_name_parts = explode('@', $sso_name);
         $sso_name = $sso_name_parts[0];
         $authenticationConf->ssoRemoteUserStripDomainName = TRUE;
@@ -334,16 +343,17 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     return ldap_authentication_get_valid_conf(TRUE);
 
   }
-/**
- *  LDAP Authentication Exclusive Mode User Logon Test (ids = LDAP_authen.EM.ULT.*)
- */
-  function testSSOUserLogon() {
 
-    module_enable(array('ldap_sso', 'ldap_help'));
+  /**
+   * LDAP Authentication Exclusive Mode User Logon Test (ids = LDAP_authen.EM.ULT.*)
+   */
+  public function testSSOUserLogon() {
+
+    module_enable(['ldap_sso', 'ldap_help']);
 
     $sid = 'activedirectory1';
     $testid = 'SSOUserLogon3';
-    $sids = array($sid);
+    $sids = [$sid];
     $this->prepTestData(
       LDAP_TEST_LDAP_NAME,
       $sids,
@@ -355,7 +365,7 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     $this->drupalGet('user/logout');
     $this->drupalGet('user');
 
-    // just test that the setup works
+    // Just test that the setup works.
     $authenticationConf = new LdapAuthenticationConfAdmin();
     $this->assertTrue(ldap_servers_get_globals('_SERVER', 'REMOTE_USER', TRUE) == 'hpotter',
        '$_SERVER[REMOTE_USER] and $_SERVER[REDIRECT_REMOTE_USER] set properly for test with remote server ' . ldap_servers_get_globals('_SERVER', 'REMOTE_ADDR'), $testid);
@@ -377,17 +387,20 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     $hpotter_ldap = $ldap_user_conf->getProvisionRelatedLdapEntry($hpotter_drupal);
     debug('hpotter ldap entry'); debug($hpotter_drupal);
 
-    $tests = array(
-      'dontstripnames' => array('sso_name' => 'hpotter'),
-      'stripnames' => array('sso_name' => 'hpotter@hogwarts'),
+    $tests = [
+      'dontstripnames' => ['sso_name' => 'hpotter'],
+      'stripnames' => ['sso_name' => 'hpotter@hogwarts'],
 
-    );
+    ];
 
     foreach ($tests as $testid => $conf) {
-      foreach (array('REMOTE_USER') as $server_var_key) {
-        foreach (array('user') as $test_path) { // ,'user/login/sso'
-          foreach (array('mod_auth_sspi', 'mod_auth_kerb') as $ldapImplementation) {  // , 'mod_auth_kerb'
-            foreach (array(TRUE, FALSE) as $seamlessLogin ) {  // , FALSE
+      foreach (['REMOTE_USER'] as $server_var_key) {
+        // ,'user/login/sso'.
+        foreach (['user'] as $test_path) {
+          // , 'mod_auth_kerb'.
+          foreach (['mod_auth_sspi', 'mod_auth_kerb'] as $ldapImplementation) {
+            // , FALSE.
+            foreach ([TRUE, FALSE] as $seamlessLogin) {
               $sso_name = $conf['sso_name'];
               $this->ldapTestId = "testSSO._SERVER-key=$server_var_key sso_name=$sso_name path=$test_path ldapImplementation=$ldapImplementation seamlessLogin=$seamlessLogin";
               $ldapAuthenticationConf = $this->setSsoServerEnvironment($server_var_key, $sso_name, $ldapImplementation, $seamlessLogin);
@@ -402,16 +415,18 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     }
   }
 
-
-  function testAuthenticationWhitelistTests() {
-    require_once(drupal_get_path('module', 'ldap_authentication') . '/LdapAuthenticationConfAdmin.class.php');
+  /**
+   *
+   */
+  public function testAuthenticationWhitelistTests() {
+    require_once drupal_get_path('module', 'ldap_authentication') . '/LdapAuthenticationConfAdmin.class.php';
 
     $sid = 'activedirectory1';
     $testid = 'WL3';
-    $sids = array($sid);
+    $sids = [$sid];
     $this->prepTestData(
       'hogwarts',
-      array($sid),
+      [$sid],
       'provisionToDrupal',
       'WL3',
       'drupal_role_authentication_test'
@@ -420,8 +435,8 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     $ldap_servers = ldap_servers_get_servers($sid, 'enabled');
     $this->assertTrue(count($ldap_servers) == 1, ' ldap_authentication test server setup successful', $testid);
 
-    // these 2 modules are configured in setup, but disabled for most authentication tests
-    module_disable(array('ldap_authorization_drupal_role', 'ldap_authorization'));
+    // These 2 modules are configured in setup, but disabled for most authentication tests.
+    module_disable(['ldap_authorization_drupal_role', 'ldap_authorization']);
 
     /**
      * LDAP_authen.WL.user1  test for user 1 being excluded from white and black list tests
@@ -429,77 +444,74 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     $user1 = user_load(1);
     $password = $this->randomString(20);
-    require_once(DRUPAL_ROOT . '/includes/password.inc');
-    $account = array(
+    require_once DRUPAL_ROOT . '/includes/password.inc';
+    $account = [
       'name' => $user1->name,
       'pass' => user_hash_password(trim($password)),
-    );
+    ];
     db_update('users')
       ->fields($account)
       ->condition('uid', 1)
       ->execute();
 
-    $edit = array(
+    $edit = [
       'name' => $user1->name,
       'pass' => $password,
-    );
+    ];
 
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'User 1 successfully authenticated in LDAP_authen.WL.user1', $testid);
     $this->drupalGet('user/logout');
 
-
-    module_enable(array('ldap_authorization'));
-    module_enable(array('ldap_authorization_drupal_role'));
-
+    module_enable(['ldap_authorization']);
+    module_enable(['ldap_authorization_drupal_role']);
 
     /**
      * prep LDAP_authen.WL.allow
      */
     $authenticationConf = new LdapAuthenticationConfAdmin();
-    $authenticationConf->allowOnlyIfTextInDn = array('pot');
+    $authenticationConf->allowOnlyIfTextInDn = ['pot'];
     $authenticationConf->save();
     $authenticationConf = ldap_authentication_get_valid_conf(TRUE);
 
-   /**
+    /**
     * LDAP_authen.WL.allow.match -- desirect_result: authenticate success
     */
 
     $this->AttemptLogonNewUser('hpotter');
     $this->assertText(t('Member for'), 'User able to authenticate because in white list (allowOnlyIfTextInDn).', $testid);
 
-   /**
+    /**
     *  LDAP_authen.WL.allow.miss -- desirect_result: authenticate fail
     */
 
     $this->AttemptLogonNewUser('ssnape');
     $this->assertText(t('User disallowed'), 'User unable to authenticate because not in white list (allowOnlyIfTextInDn).', $testid);
 
-
     /**
     * undo LDAP_authen.WL.allow settings
     */
 
     $authenticationConf = new LdapAuthenticationConfAdmin();
-    $authenticationConf->allowOnlyIfTextInDn = array();
+    $authenticationConf->allowOnlyIfTextInDn = [];
     $authenticationConf->save();
     $authenticationConf = ldap_authentication_get_valid_conf(TRUE);
     /**
     * prep LDAP_authen.WL.exclude
     */
     $authenticationConf = new LdapAuthenticationConfAdmin();
-    $authenticationConf->excludeIfTextInDn = array('cn=ssnape');
+    $authenticationConf->excludeIfTextInDn = ['cn=ssnape'];
     $authenticationConf->save();
     $authenticationConf = ldap_authentication_get_valid_conf(TRUE);
 
-   /**
+    /**
     * LDAP_authen.WL.exclude.match -- desirect_result: authenticate fail
     */
 
     $this->AttemptLogonNewUser('ssnape');
     $this->assertText(t('User disallowed'), 'User unable to authenticate in exclude list (excludeIfTextInDn).', $testid);
 
-   /**
+    /**
     *  LDAP_authen.WL.exclude.miss-- desirect_result: authenticate success
     */
 
@@ -511,7 +523,7 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     */
 
     $authenticationConf = new LdapAuthenticationConfAdmin();
-    $authenticationConf->excludeIfTextInDn = array();
+    $authenticationConf->excludeIfTextInDn = [];
     $authenticationConf->save();
     $authenticationConf = ldap_authentication_get_valid_conf(TRUE);
 
@@ -531,26 +543,25 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     $authenticationConf->save();
     $authenticationConf = ldap_authentication_get_valid_conf(TRUE);
-   /**
+    /**
     * LDAP_authen.WL.php.php disabled -- desired result: authenticate fail with warning the authentication disabled
     */
-    module_disable(array('php'));
+    module_disable(['php']);
     $this->AttemptLogonNewUser('adumbledore');
     $this->assertText(
       LDAP_AUTHENTICATION_DISABLED_FOR_BAD_CONF_MSG,
       'With php disabled and php code in whitelist, refuse authentication. (allowTestPhp).',
       $testid
     );
-    module_enable(array('php'));
+    module_enable(['php']);
 
-
-   /**
+    /**
     * LDAP_authen.WL.php.true -- desired result: authenticate success
     */
     $this->AttemptLogonNewUser('hpotter');
     $this->assertText(t('Member for'), 'Able to authenticate because php returned true (allowTestPhp).', $testid);
 
-   /**
+    /**
     *  LDAP_authen.WL.php.false-- desired result: authenticate fail
     */
 
@@ -561,8 +572,7 @@ class LdapAuthenticationTestCase extends LdapTestCase {
       $testid
     );
 
-
-  /**
+    /**
     * clear LDAP_authen.WL.php
     */
     $authenticationConf = new LdapAuthenticationConfAdmin();
@@ -570,7 +580,7 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     $authenticationConf->save();
     $authenticationConf = ldap_authentication_get_valid_conf(TRUE);
 
-  /**
+    /**
    * need to test username changes with PUID
    *   - given a user exists
    *   - change samaccountname in ldap server
@@ -579,40 +589,31 @@ class LdapAuthenticationTestCase extends LdapTestCase {
    *
    */
 
+    /***  multiple options used in whitelist **/
 
-  /***  multiple options used in whitelist **/
-
-
-
-   /**
+    /**
     * LDAP_authen.WL.allow[match].exclude[match] -- desired result: authenticate fail
     */
 
-
-
-   /**
+    /**
     *  LDAP_authen.WL.allow[match].exclude[miss] -- desired result: authenticate success
     */
 
-
     /**
     * LDAP_authen.WL.exclude[match].*-- desirect_result: authenticate fail
     */
 
-
-
-   /**
+    /**
     *  LDAP_authen.WL.exclude[match].php[false] -- desired result: authenticate fail
     */
 
-
-  /**
+    /**
      * LDAP_authen.WL1.excludeIfNoAuthorizations.hasAuthorizations
      * test for excludeIfNoAuthorizations set to true and consumer granted authorizations
      */
 
-   // these 2 modules are configured in setup, but disabled for most authentication tests
-    module_disable(array('ldap_authorization_drupal_role', 'ldap_authorization'));
+    // These 2 modules are configured in setup, but disabled for most authentication tests.
+    module_disable(['ldap_authorization_drupal_role', 'ldap_authorization']);
     $authenticationConf = new LdapAuthenticationConfAdmin();
     $authenticationConf->excludeIfNoAuthorizations = 1;
     $authenticationConf->save();
@@ -623,7 +624,6 @@ class LdapAuthenticationTestCase extends LdapTestCase {
      * to make sure authentication fails completely
      */
 
-
     $this->AttemptLogonNewUser('hpotter');
     $this->assertText(
       LDAP_AUTHENTICATION_DISABLED_FOR_BAD_CONF_MSG,
@@ -633,9 +633,10 @@ class LdapAuthenticationTestCase extends LdapTestCase {
       $testid
     );
 
-    module_enable(array('ldap_authorization'), TRUE);
-    module_enable(array('ldap_authorization_drupal_role'), TRUE);
-    $consumer = ldap_authorization_get_consumers('drupal_role', TRUE, TRUE); // clear static cache
+    module_enable(['ldap_authorization'], TRUE);
+    module_enable(['ldap_authorization_drupal_role'], TRUE);
+    // Clear static cache.
+    $consumer = ldap_authorization_get_consumers('drupal_role', TRUE, TRUE);
 
     $this->AttemptLogonNewUser('hpotter');
     $this->assertText(
@@ -661,17 +662,16 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     $authenticationConf->excludeIfNoAuthorizations = 0;
     $authenticationConf->save();
     $authenticationConf = ldap_authentication_get_valid_conf(TRUE);
-    module_disable(array('ldap_authorization_drupal_role', 'ldap_authorization'));
-
+    module_disable(['ldap_authorization_drupal_role', 'ldap_authorization']);
 
   }
 
   /**
-   * make sure user admin interface works.
+   * Make sure user admin interface works.
    */
-  function testUI() {
+  public function testUI() {
 
-    // just to give warning if setup doesn't succeed.  may want to take these out at some point.
+    // Just to give warning if setup doesn't succeed.  may want to take these out at some point.
     $setup_success = (
         module_exists('ldap_user') &&
         module_exists('ldap_servers') &&
@@ -681,12 +681,12 @@ class LdapAuthenticationTestCase extends LdapTestCase {
     $this->assertTrue($setup_success, ' ldap_authentication UI setup successful', $this->testId('user interface tests'));
 
     $sid = 'activedirectory1';
-    $sids = array('activedirectory1');
+    $sids = ['activedirectory1'];
     $this->prepTestData(LDAP_TEST_LDAP_NAME, $sids, 'provisionToDrupal', 'default');
 
-    $this->privileged_user = $this->drupalCreateUser(array(
+    $this->privileged_user = $this->drupalCreateUser([
       'administer site configuration',
-      ));
+    ]);
 
     $this->drupalLogin($this->privileged_user);
 
@@ -694,115 +694,111 @@ class LdapAuthenticationTestCase extends LdapTestCase {
 
     $this->drupalGet('admin/config/people/ldap/authentication');
 
-    $form_tests = array(
-      'authenticationMode' => array(
+    $form_tests = [
+      'authenticationMode' => [
         'property' => 'authenticationMode',
-        'values' => array(
+        'values' => [
           LDAP_AUTHENTICATION_MIXED,
-          LDAP_AUTHENTICATION_EXCLUSIVE
-        ),
+          LDAP_AUTHENTICATION_EXCLUSIVE,
+        ],
         'required' => TRUE,
-      ),
-      'authenticationServers[' . $sid . ']' => array(
+      ],
+      'authenticationServers[' . $sid . ']' => [
         'property' => 'enabledAuthenticationServers',
-        'values' => array(
+        'values' => [
           TRUE,
           TRUE,
-        ),
-        'desired_result' => array(
-          array($sid),
-          array($sid),
-        )
-      ),
-      'loginUIUsernameTxt' =>
-        array(
-          'property' => 'loginUIUsernameTxt',
-          'values' => array(
-            '',
-            'Hogwarts UserID',
-          ),
-        ),
-      'loginUIPasswordTxt' =>
-        array(
-          'property' => 'loginUIPasswordTxt',
-          'values' => array(
-            '',
-            'Hogwarts UserID Password',
-          ),
-        ),
-      'ldapUserHelpLinkUrl' =>
-        array(
-          'property' => 'ldapUserHelpLinkUrl',
-          'values' => array(
-            '',
-            'http://passwords.hogwarts.edu',
-          ),
-        ),
-      'ldapUserHelpLinkText' =>
-        array(
-          'property' => 'ldapUserHelpLinkText',
-          'values' => array(
-            'Hogwarts Password Management Page',
-            'Hogwarts Password Management Page'
-          ),
-        ),
-      'allowOnlyIfTextInDn' => array(
+        ],
+        'desired_result' => [
+          [$sid],
+          [$sid],
+        ],
+      ],
+      'loginUIUsernameTxt' => [
+        'property' => 'loginUIUsernameTxt',
+        'values' => [
+          '',
+          'Hogwarts UserID',
+        ],
+      ],
+      'loginUIPasswordTxt' => [
+        'property' => 'loginUIPasswordTxt',
+        'values' => [
+          '',
+          'Hogwarts UserID Password',
+        ],
+      ],
+      'ldapUserHelpLinkUrl' => [
+        'property' => 'ldapUserHelpLinkUrl',
+        'values' => [
+          '',
+          'http://passwords.hogwarts.edu',
+        ],
+      ],
+      'ldapUserHelpLinkText' => [
+        'property' => 'ldapUserHelpLinkText',
+        'values' => [
+          'Hogwarts Password Management Page',
+          'Hogwarts Password Management Page',
+        ],
+      ],
+      'allowOnlyIfTextInDn' => [
         'property' => 'allowOnlyIfTextInDn',
-        'values' => array(
+        'values' => [
           'witch\nwarlord\nwisecracker',
-          "witch\nwarlord\nwisecracker"
-        ),
-        'desired_result' => array(
-          array('witch', 'warlord', 'wisecracker'),
-          array('witch', 'warlord', 'wisecracker'),
-        )
-      ),
-      'excludeIfTextInDn' => array(
+          "witch\nwarlord\nwisecracker",
+        ],
+        'desired_result' => [
+          ['witch', 'warlord', 'wisecracker'],
+          ['witch', 'warlord', 'wisecracker'],
+        ],
+      ],
+      'excludeIfTextInDn' => [
         'property' => 'excludeIfTextInDn',
-        'values' => array(
+        'values' => [
+          "muggle\nmuddle\nmummy",
           "muggle\nmuddle\nmummy",
-          "muggle\nmuddle\nmummy"
-        ),
-        'desired_result' => array(
-          array('muggle', 'muddle', 'mummy'),
-          array('muggle', 'muddle', 'mummy'),
-        )
-      ),
-      'excludeIfNoAuthorizations' => array(
+        ],
+        'desired_result' => [
+          ['muggle', 'muddle', 'mummy'],
+          ['muggle', 'muddle', 'mummy'],
+        ],
+      ],
+      'excludeIfNoAuthorizations' => [
         'property' => 'excludeIfNoAuthorizations',
-        'values' => array(
-          array(TRUE),
-          array(TRUE),
-        ),
-      ),
-      'emailOption' => array(
+        'values' => [
+          [TRUE],
+          [TRUE],
+        ],
+      ],
+      'emailOption' => [
         'property' => 'emailOption',
-        'values' => array(
+        'values' => [
           LDAP_AUTHENTICATION_EMAIL_FIELD_REMOVE,
           LDAP_AUTHENTICATION_EMAIL_FIELD_DISABLE,
-        ),
+        ],
         'required' => TRUE,
-      ),
-      'emailUpdate' => array(
+      ],
+      'emailUpdate' => [
         'property' => 'emailUpdate',
-        'values' => array(
+        'values' => [
           LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_ENABLE,
           LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_DISABLE,
-        ),
+        ],
         'required' => TRUE,
-      ),
-      'allowTestPhp' => array(
+      ],
+      'allowTestPhp' => [
         'property' => 'allowTestPhp',
-        'values' => array(
+        'values' => [
           'pretend php',
           'pretend php',
-        ),
-      ),
-    );
+        ],
+      ],
+    ];
 
-    module_enable(array('php'));
-    foreach (array(0, 1) as $i) {
-      $edit = array();
+    module_enable(['php']);
+    foreach ([0, 1] as $i) {
+      $edit = [];
       foreach ($form_tests as $field_name => $conf) {
         $value = $conf['values'][$i];
         $property = isset($conf['property']) ? $conf['property'] : $field_name;
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerAbstract.class.php b/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerAbstract.class.php
index c3895b92..04b906d9 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerAbstract.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerAbstract.class.php
@@ -66,12 +66,12 @@ class LdapAuthorizationConsumerAbstract {
    */
   public $editLink;
 
-  public $emptyConsumer = array(
+  public $emptyConsumer = [
     'exists' => TRUE,
     'value' => NULL,
     'name' => NULL,
     'map_to_string' => NULL,
-  );
+  ];
 
   /**
    * @property boolean $allowConsumerObjectCreation
@@ -95,14 +95,14 @@ class LdapAuthorizationConsumerAbstract {
    * @property array $defaultConsumerConfProperties
    * default properties for consumer admin UI form
    */
-  public $defaultConsumerConfProperties = array(
+  public $defaultConsumerConfProperties = [
     'onlyApplyToLdapAuthenticated' => TRUE,
     'useMappingsAsFilter' => TRUE,
     'synchOnLogon' => TRUE,
     'revokeLdapProvisioned' => TRUE,
     'regrantLdapProvisioned' => TRUE,
     'createConsumers' => TRUE,
-  );
+  ];
 
   /**
    * Constructor Method.
@@ -127,44 +127,41 @@ class LdapAuthorizationConsumerAbstract {
   }
 
   /**
-   * Function to normalize mappings
-   * should be overridden when mappings are not stored as map|authorization_id format
+   * Function to normalize mappings.
+   *
+   * Should be overridden when mappings are not stored as map|authorization_id format
    * where authorization_id is the format returned by
-   *   LdapAuthorizationConsumerAbstract::usersAuthorizations()
+   * LdapAuthorizationConsumerAbstract::usersAuthorizations()
    *
    * For example ldap_authorization_og may store mapping target as:
-   *   Campus Accounts|group-name=knitters,role-name=administrator member.
+   * Campus Accounts|group-name=knitters,role-name=administrator member
+   * normalized mappings are of form such as for organic groups:
+   * [
+   *   [
+   *     'from' => 'students',
+   *     'normalized' => 'node:21:1',
+   *     'simplified' => 'node:students:member',
+   *     'user_entered' => 'students'
+   *     'valid' => TRUE,
+   *     'error_message' => '',
+   *   ],
+   * ...
+   * ]
    *
-   *   normalized mappings are of form such as for organic groups:
+   * Or for Drupal role where rid 3 is moderator and rid 2 is admin:
+   * [
+   *   [
+   *     'from' => 'students',
+   *     'normalized' => '2',
+   *     'simplified' => 'admin',
+   *     'user_entered' => 'admin',
+   *     'valid' => TRUE,
+   *     'error_message' => '',
+   *   ],
+   * ...
+   * ]
    *
-   *   array(
-         array(
-           'from' => 'students',
-           'normalized' => 'node:21:1',
-           'simplified' => 'node:students:member',
-           'user_entered' => 'students'
-           'valid' => TRUE,
-           'error_message' => '',
-           ),
-
-         ...
-        )
-
-   *   or for drupal role where rid 3 is moderator and rid 2 is admin:
-   *   array(
-         array(
-           'from' => 'students',
-           'normalized' => '2',
-           'simplified' => 'admin',
-           'user_entered' => 'admin',
-           'valid' => TRUE,
-           'error_message' => '',
-           ),
-         ...
-        )
-
-        where 'normalized' is in id format and 'simplified' is user shorthand
-   )
+   * Where 'normalized' is in id format and 'simplified' is user shorthand.
    */
   public function normalizeMappings($mappings) {
     return $mappings;
@@ -321,17 +318,17 @@ class LdapAuthorizationConsumerAbstract {
   protected function grantsAndRevokes($op, &$user, &$user_auth_data, $consumers, &$ldap_entry = NULL, $user_save = TRUE) {
 
     if (!is_array($user_auth_data)) {
-      $user_auth_data = array();
+      $user_auth_data = [];
     }
 
     $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
     $this->sortConsumerIds($op, $consumers);
-    $results = array();
-    $watchdog_tokens = array();
+    $results = [];
+    $watchdog_tokens = [];
     $watchdog_tokens['%username'] = $user->name;
     $watchdog_tokens['%action'] = $op;
     $watchdog_tokens['%user_save'] = $user_save;
-    $consumer_ids_log = array();
+    $consumer_ids_log = [];
     $users_authorization_ids = $this->usersAuthorizations($user);
     $watchdog_tokens['%users_authorization_ids'] = join(', ', $users_authorization_ids);
     if ($detailed_watchdog_log) {
@@ -351,20 +348,20 @@ class LdapAuthorizationConsumerAbstract {
         if ($user_has_authorization && !$user_has_authorization_recorded) {
           // Grant case 1: authorization id already exists for user, but is not ldap provisioned.  mark as ldap provisioned, but don't regrant.
           $results[$consumer_id] = TRUE;
-          $user_auth_data[$consumer_id] = array(
+          $user_auth_data[$consumer_id] = [
             'date_granted' => time(),
             'consumer_id_mixed_case' => $consumer_id,
-          );
+          ];
         }
         elseif (!$user_has_authorization && $consumer['exists']) {
           // Grant case 2: consumer exists, but user is not member. grant authorization
           // allow consuming module to add additional data to $user_auth_data.
           $results[$consumer_id] = $this->grantSingleAuthorization($user, $consumer_id, $consumer, $user_auth_data, $user_save);
-          $existing = empty($user_auth_data[$consumer_id]) ? array() : $user_auth_data[$consumer_id];
-          $user_auth_data[$consumer_id] = $existing + array(
+          $existing = empty($user_auth_data[$consumer_id]) ? [] : $user_auth_data[$consumer_id];
+          $user_auth_data[$consumer_id] = $existing + [
             'date_granted' => time(),
             'consumer_id_mixed_case' => $consumer_id,
-          );
+          ];
         }
         elseif ($consumer['exists'] !== TRUE) {
           // Grant case 3: something is wrong. consumers should have been created before calling grantsAndRevokes.
@@ -544,7 +541,7 @@ class LdapAuthorizationConsumerAbstract {
   public function validateAuthorizationMappingTarget($mapping, $form_values = NULL, $clear_cache = FALSE) {
     $message_type = NULL;
     $message_text = NULL;
-    return array($message_type, $message_text);
+    return [$message_type, $message_text];
   }
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConf.class.php b/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConf.class.php
index f466a90b..c5b7c6bd 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConf.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConf.class.php
@@ -28,7 +28,7 @@ class LdapAuthorizationConsumerConf {
 
   public $useFirstAttrAsGroupId = FALSE;
 
-  public $mappings = array();
+  public $mappings = [];
   public $useMappingsAsFilter = TRUE;
 
   public $synchToLdap = FALSE;
@@ -65,7 +65,7 @@ class LdapAuthorizationConsumerConf {
       $this->inDatabase = TRUE;
       $exists = $this->loadFromDb();
       if (!$exists) {
-        watchdog('ldap_authorization', 'failed to load existing %consumer object', array('%consumer' => $consumer->consumerType), WATCHDOG_ERROR);
+        watchdog('ldap_authorization', 'failed to load existing %consumer object', ['%consumer' => $consumer->consumerType], WATCHDOG_ERROR);
       }
     }
     // Default value for deriveFromEntryAttrMatchingUserAttr set up this way for backward compatibility in 1.0 branch,
@@ -78,7 +78,7 @@ class LdapAuthorizationConsumerConf {
   protected function loadFromDb() {
     if (module_exists('ctools')) {
       ctools_include('export');
-      $result = ctools_export_load_object('ldap_authorization', 'names', array($this->consumerType));
+      $result = ctools_export_load_object('ldap_authorization', 'names', [$this->consumerType]);
 
       // @todo, this is technically wrong, but I don't quite grok what we're doing in the non-ctools case - justintime
       $server_record = array_pop($result);
@@ -117,10 +117,10 @@ class LdapAuthorizationConsumerConf {
    * Direct mapping of db to object properties.
    */
   public static function field_to_properties_map() {
-    return array(
+    return [
       'sid' => 'sid',
       'consumer_type' => 'consumerType',
-      'numeric_consumer_conf_id'  => 'numericConsumerConfId' ,
+      'numeric_consumer_conf_id'  => 'numericConsumerConfId',
       'status'  => 'status',
       'only_ldap_authenticated'  => 'onlyApplyToLdapAuthenticated',
       'use_first_attr_as_groupid'  => 'useFirstAttrAsGroupId',
@@ -131,14 +131,14 @@ class LdapAuthorizationConsumerConf {
       'regrant_ldap_provisioned'  => 'regrantLdapProvisioned',
       'revoke_ldap_provisioned' => 'revokeLdapProvisioned',
       'create_consumers'  => 'createConsumers',
-    );
+    ];
   }
 
   /**
    *
    */
   public static function field_to_properties_serialized() {
-    return array('mappings');
+    return ['mappings'];
   }
 
   /**
@@ -164,7 +164,7 @@ class LdapAuthorizationConsumerConf {
       }
     }
     else {
-      $array = array();
+      $array = [];
     }
     return $array;
   }
@@ -173,12 +173,12 @@ class LdapAuthorizationConsumerConf {
    *
    */
   protected function pipeListToArray($mapping_list_txt, $make_item0_lowercase = FALSE) {
-    $result_array = array();
+    $result_array = [];
     $mappings = preg_split('/[\n\r]+/', $mapping_list_txt);
     foreach ($mappings as $line) {
       if (count($mapping = explode('|', trim($line))) == 2) {
         $item_0 = ($make_item0_lowercase) ? drupal_strtolower(trim($mapping[0])) : trim($mapping[0]);
-        $result_array[] = array($item_0, trim($mapping[1]));
+        $result_array[] = [$item_0, trim($mapping[1])];
       }
     }
     return $result_array;
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php b/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php
index 22366976..24315b0b 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php
@@ -17,7 +17,6 @@ class LdapAuthorizationConsumerConfAdmin extends LdapAuthorizationConsumerConf {
   public function save() {
 
     $op = $this->inDatabase ? 'edit' : 'insert';
-    // $this;.
     $values = new stdClass();
     $values->sid = $this->sid;
     $values->numeric_consumer_conf_id = $this->numericConsumerConfId;
@@ -113,43 +112,43 @@ class LdapAuthorizationConsumerConfAdmin extends LdapAuthorizationConsumerConf {
   public function drupalForm($server_options, $op) {
 
     $consumer_tokens = ldap_authorization_tokens($this->consumer);
-    $form['intro'] = array(
+    $form['intro'] = [
       '#type' => 'item',
       '#markup' => t('<h1>LDAP to !consumer_name Configuration</h1>', $consumer_tokens),
-    );
+    ];
 
-    $form['status'] = array(
+    $form['status'] = [
       '#type' => 'fieldset',
       '#title' => t('I.  Basics', $consumer_tokens),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-    $form['status']['sid'] = array(
+    $form['status']['sid'] = [
       '#type' => 'radios',
       '#title' => t('LDAP Server used in !consumer_name configuration.', $consumer_tokens),
       '#required' => 1,
       '#default_value' => $this->sid,
       '#options' => $server_options,
-    );
+    ];
 
-    $form['status']['consumer_type'] = array(
+    $form['status']['consumer_type'] = [
       '#type' => 'hidden',
       '#value' => $this->consumerType,
       '#required' => 1,
-    );
+    ];
 
-    $form['status']['status'] = array(
+    $form['status']['status'] = [
       '#type' => 'checkbox',
       '#title' => t('Enable this configuration', $consumer_tokens),
       '#default_value' => $this->status,
-    );
+    ];
 
-    $form['status']['only_ldap_authenticated'] = array(
+    $form['status']['only_ldap_authenticated'] = [
       '#type' => 'checkbox',
       '#title' => t('Only apply the following LDAP to !consumer_name configuration to users authenticated via LDAP.  One uncommon reason for disabling this is when you are using Drupal authentication, but want to leverage LDAP for authorization; for this to work the Drupal username still has to map to an LDAP entry.', $consumer_tokens),
       '#default_value' => $this->onlyApplyToLdapAuthenticated,
-    );
+    ];
 
     if (method_exists($this->consumer, 'mappingExamples')) {
       $consumer_tokens['!examples'] = '<fieldset class="collapsible collapsed form-wrapper" id="authorization-mappings">
@@ -160,7 +159,7 @@ class LdapAuthorizationConsumerConfAdmin extends LdapAuthorizationConsumerConf {
     else {
       $consumer_tokens['!examples'] = '';
     }
-    $form['filter_and_mappings'] = array(
+    $form['filter_and_mappings'] = [
       '#type' => 'fieldset',
       '#title' => t('II. LDAP to !consumer_name mapping and filtering', $consumer_tokens),
       '#description' => t('
@@ -181,51 +180,51 @@ Representations of groups derived from LDAP might initially look like:
 ', $consumer_tokens),
       '#collapsible' => TRUE,
       '#collapsed' => !($this->mappings || $this->useMappingsAsFilter || $this->useFirstAttrAsGroupId),
-    );
+    ];
 
-    $form['filter_and_mappings']['use_first_attr_as_groupid'] = array(
+    $form['filter_and_mappings']['use_first_attr_as_groupid'] = [
       '#type' => 'checkbox',
       '#title' => t('Convert full dn to value of first attribute before mapping.  e.g.  <code>cn=students,ou=groups,dc=hogwarts,dc=edu</code> would be converted to <code>students</code>', $consumer_tokens),
       '#default_value' => $this->useFirstAttrAsGroupId,
-    );
-    $form['filter_and_mappings']['mappings'] = array(
+    ];
+    $form['filter_and_mappings']['mappings'] = [
       '#type' => 'textarea',
       '#title' => t('Mapping of LDAP to !consumer_name (one per line)', $consumer_tokens),
       '#default_value' => $this->mappingsToPipeList($this->mappings),
       '#cols' => 50,
       '#rows' => 5,
-    );
-    $form['filter_and_mappings']['use_filter'] = array(
+    ];
+    $form['filter_and_mappings']['use_filter'] = [
       '#type' => 'checkbox',
       '#title' => t('Only grant !consumer_namePlural that match a filter above.', $consumer_tokens),
       '#default_value' => $this->useMappingsAsFilter,
       '#description' => t('If enabled, only above mapped !consumer_namePlural will be assigned (e.g. students and administrator).
         <strong>If not checked, !consumer_namePlural not mapped above also may be created and granted (e.g. gryffindor and probation students).  In some LDAPs this can lead to hundreds of !consumer_namePlural being created if "Create !consumer_namePlural if they do not exist" is enabled below.
         </strong>', $consumer_tokens),
-    );
+    ];
 
-    $form['more'] = array(
+    $form['more'] = [
       '#type' => 'fieldset',
       '#title' => t('Part III.  Even More Settings.'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-    $synchronization_modes = array();
+    $synchronization_modes = [];
     if ($this->synchOnLogon) {
       $synchronization_modes[] = 'user_logon';
     }
-    $form['more']['synchronization_modes'] = array(
+    $form['more']['synchronization_modes'] = [
       '#type' => 'checkboxes',
       '#title' => t('When should !consumer_namePlural be granted/revoked from user?', $consumer_tokens),
-      '#options' => array(
+      '#options' => [
         'user_logon' => t('When a user logs on.'),
-      ),
+      ],
       '#default_value' => $synchronization_modes,
       '#description' => '',
-    );
+    ];
 
-    $synchronization_actions = array();
+    $synchronization_actions = [];
     if ($this->revokeLdapProvisioned) {
       $synchronization_actions[] = 'revoke_ldap_provisioned';
     }
@@ -236,20 +235,20 @@ Representations of groups derived from LDAP might initially look like:
       $synchronization_actions[] = 'regrant_ldap_provisioned';
     }
 
-    $options = array(
+    $options = [
       'revoke_ldap_provisioned' => t('Revoke !consumer_namePlural previously granted by LDAP Authorization but no longer valid.', $consumer_tokens),
       'regrant_ldap_provisioned' => t('Re grant !consumer_namePlural previously granted by LDAP Authorization but removed manually.', $consumer_tokens),
-    );
+    ];
     if ($this->consumer->allowConsumerObjectCreation) {
       $options['create_consumers'] = t('Create !consumer_namePlural if they do not exist.', $consumer_tokens);
     }
 
-    $form['more']['synchronization_actions'] = array(
+    $form['more']['synchronization_actions'] = [
       '#type' => 'checkboxes',
       '#title' => t('What actions would you like performed when !consumer_namePlural are granted/revoked from user?', $consumer_tokens),
       '#options' => $options,
       '#default_value' => $synchronization_actions,
-    );
+    ];
     /**
      * @todo  some general options for an individual mapping (perhaps in an advance tab).
      *
@@ -272,10 +271,10 @@ Representations of groups derived from LDAP might initially look like:
         break;
     }
 
-    $form['submit'] = array(
+    $form['submit'] = [
       '#type' => 'submit',
       '#value' => $action,
-    );
+    ];
 
     return $form;
   }
@@ -291,7 +290,7 @@ Representations of groups derived from LDAP might initially look like:
    *
    */
   public function getLdapAuthorizationConsumerActions() {
-    $actions = array();
+    $actions = [];
     $actions[] = l(t('edit'), LDAP_SERVERS_MENU_BASE_PATH . '/authorization/edit/' . $this->consumerType);
     if (property_exists($this, 'type')) {
       if ($this->type == 'Overridden') {
@@ -312,7 +311,7 @@ Representations of groups derived from LDAP might initially look like:
    *
    */
   public function drupalFormValidate($op, $values) {
-    $errors = array();
+    $errors = [];
 
     if ($op == 'delete') {
       if (!$this->consumerType) {
@@ -334,8 +333,8 @@ Representations of groups derived from LDAP might initially look like:
   /**
    *
    */
-  public function validate($form_values = array()) {
-    $errors = array();
+  public function validate($form_values = []) {
+    $errors = [];
 
     if (!$this->consumerType) {
       $errors['consumer_type'] = t('Consumer type is missing.');
@@ -418,136 +417,136 @@ Representations of groups derived from LDAP might initially look like:
      * consumer_type is tag (unique alphanumeric id) of consuming authorization such as
      *   drupal_roles, og_groups, civicrm_memberships
      */
-    $fields = array(
-      'numeric_consumer_conf_id' => array(
-        'schema' => array(
+    $fields = [
+      'numeric_consumer_conf_id' => [
+        'schema' => [
           'type' => 'serial',
           'unsigned' => TRUE,
           'not null' => TRUE,
           'description' => 'Primary ID field for the table.  Only used internally.',
           'no export' => TRUE,
-        ),
-      ),
-      'sid' => array(
-        'schema' => array(
+        ],
+      ],
+      'sid' => [
+        'schema' => [
           'type' => 'varchar',
           'length' => 20,
           'not null' => TRUE,
-        ),
-      ),
-      'consumer_type' => array(
-        'schema' => array(
+        ],
+      ],
+      'consumer_type' => [
+        'schema' => [
           'type' => 'varchar',
           'length' => 20,
           'not null' => TRUE,
-        ),
-      ),
-      'consumer_module' => array(
-        'schema' => array(
+        ],
+      ],
+      'consumer_module' => [
+        'schema' => [
           'type' => 'varchar',
           'length' => 30,
           'not null' => TRUE,
-        ),
-      ),
+        ],
+      ],
 
-      'status' => array(
-        'schema' => array(
+      'status' => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 0,
-        ),
-      ),
-      'only_ldap_authenticated' => array(
-        'schema' => array(
+        ],
+      ],
+      'only_ldap_authenticated' => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 1,
-        ),
-      ),
+        ],
+      ],
 
-      'use_first_attr_as_groupid' => array(
-        'schema' => array(
+      'use_first_attr_as_groupid' => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'mappings'  => array(
-        'form_default' => array(),
-        'schema' => array(
+      'mappings'  => [
+        'form_default' => [],
+        'schema' => [
           'type' => 'text',
           'size' => 'medium',
           'not null' => FALSE,
           'default' => NULL,
-        ),
-      ),
+        ],
+      ],
 
-      'use_filter' => array(
-        'schema' => array(
+      'use_filter' => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 1,
-        ),
-      ),
+        ],
+      ],
 
-      'synchronization_modes' => array(
-        'form_default' => array('user_logon'),
-      ),
+      'synchronization_modes' => [
+        'form_default' => ['user_logon'],
+      ],
 
-      'synchronization_actions' => array(
-        'form_default' => array('revoke_ldap_provisioned', 'create_consumers'),
-      ),
+      'synchronization_actions' => [
+        'form_default' => ['revoke_ldap_provisioned', 'create_consumers'],
+      ],
 
-      'synch_to_ldap'  => array(
-        'schema' => array(
+      'synch_to_ldap'  => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'synch_on_logon'  => array(
-        'schema' => array(
+      'synch_on_logon'  => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'revoke_ldap_provisioned'  => array(
-        'schema' => array(
+      'revoke_ldap_provisioned'  => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'create_consumers'  => array(
-        'schema' => array(
+      'create_consumers'  => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'regrant_ldap_provisioned'  => array(
-        'schema' => array(
+      'regrant_ldap_provisioned'  => [
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 0,
-        ),
-      ),
-    );
+        ],
+      ],
+    ];
     return $fields;
   }
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.inc b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.inc
index 59acfea6..4b2c75e8 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.inc
@@ -27,21 +27,21 @@ function ldap_authorizations_admin_index() {
   foreach ($consumers as $consumer_type => $consumer) {
     $consumers[$consumer_type] = ldap_authorization_get_consumer_object($consumer_type);
   }
-  return theme('ldap_authorization_admin_index', array('consumers' => $consumers));
+  return theme('ldap_authorization_admin_index', ['consumers' => $consumers]);
 
 }
 
 /**
  * Form for adding, updating, and deleting a single ldap authorization configuration.
  *
- * @param form array $form
- * @param form state array $form_state
+ * @param array $form
+ * @param array $form_state
  * @param string $op
  *   (add, edit, or delete)
  * @param string $consumer_type
  *   e.g. drupal_roles, og_group, etc.  Only needed for adds.
  *
- * @return drupal form array
+ * @return array
  */
 function ldap_authorization_admin_form($form, &$form_state, $consumer_type, $op = NULL) {
   ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class');
@@ -50,7 +50,7 @@ function ldap_authorization_admin_form($form, &$form_state, $consumer_type, $op
   if ($op == 'add' && is_object($consumer->consumerConf) && $consumer->consumerConf->inDatabase) {
     drupal_set_message(t('Only one configuration is allowed per consumer type.
       Configuration already exists for the cosumer type %consumer_type.  Please edit that configuration.',
-      array('%consumer_type' => $consumer_type)), 'warning');
+      ['%consumer_type' => $consumer_type]), 'warning');
     drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/authorization');
   }
 
@@ -105,7 +105,7 @@ function ldap_authorization_admin_form_submit($form, &$form_state) {
   $consumer_conf->drupalFormSubmit($op, $values);
 
   if ($consumer_conf->hasError == FALSE) {
-    drupal_set_message(t('LDAP Authorization %name !verb', array('!verb' => $op_past_tense, '%name' => $consumer->name)), 'status');
+    drupal_set_message(t('LDAP Authorization %name !verb', ['!verb' => $op_past_tense, '%name' => $consumer->name]), 'status');
     drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/authorization');
   }
 
@@ -148,6 +148,6 @@ function _ldap_authorization_admin_parse_form($form, &$form_state) {
       break;
   }
 
-  return array($consumer, $op, $op_past_tense, $new);
+  return [$consumer, $op, $op_past_tense, $new];
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.test.inc b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.test.inc
index 8042c8d3..31ab2480 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.test.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.admin.test.inc
@@ -18,85 +18,85 @@ function ldap_authorization_test_form($form, &$form_state, $consumer_type) {
   $consumer_tokens = ldap_authorization_tokens($consumer);
 
   if (isset($_SESSION['ldap_authorization_test_query']['result'])) {
-    $form['result'] = array(
+    $form['result'] = [
       '#type' => 'item',
       '#markup' => $_SESSION['ldap_authorization_test_query']['result'],
-    );
+    ];
 
-    $form['pre-filtered'] = array(
+    $form['pre-filtered'] = [
       '#type' => 'fieldset',
       '#title' => t('Prefiltered and Final Mappings'),
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
-    );
-    $form['pre-filtered']['overview'] = array(
+    ];
+    $form['pre-filtered']['overview'] = [
       '#type' => 'item',
       '#markup' => t('Below are the "raw authorizations" and which strategy they are derived from.  If enabled, the mapping filter is applied to these.'),
-    );
+    ];
 
     if (isset($_SESSION['ldap_authorization_test_query']['maps'])) {
       $i = 0;
       foreach ($_SESSION['ldap_authorization_test_query']['maps'] as $map => $data) {
         $i++;
-        $form['pre-filtered']['map' . $i] = array(
+        $form['pre-filtered']['map' . $i] = [
           '#type' => 'item',
-          '#markup' => is_scalar($data) ? "<h2>$map (without filter)</h2>" . $data : theme('item_list', array('items' => $data, 'type' => 'ul', 'title' => "$map (without filter)")),
-        );
+          '#markup' => is_scalar($data) ? "<h2>$map (without filter)</h2>" . $data : theme('item_list', ['items' => $data, 'type' => 'ul', 'title' => "$map (without filter)"]),
+        ];
       }
     }
 
-    $form['use_first_attr_as_groupid'] = array(
+    $form['use_first_attr_as_groupid'] = [
       '#type' => 'fieldset',
       '#title' => t('After "Convert full dn to value of first attribute before mapping"'),
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
-    );
+    ];
 
     if ($consumer->consumerConf->useFirstAttrAsGroupId) {
       if (isset($_SESSION['ldap_authorization_test_query']['useFirstAttrAsGroupId'])) {
-        $form['use_first_attr_as_groupid']['data'] = array(
+        $form['use_first_attr_as_groupid']['data'] = [
           '#type' => 'item',
-          '#markup' => theme('item_list', array('items' => $_SESSION['ldap_authorization_test_query']['useFirstAttrAsGroupId'], 'type' => 'ul', 'title' => "Convert full dn to value of first attribute before mapping")),
-        );
+          '#markup' => theme('item_list', ['items' => $_SESSION['ldap_authorization_test_query']['useFirstAttrAsGroupId'], 'type' => 'ul', 'title' => "Convert full dn to value of first attribute before mapping"]),
+        ];
       }
     }
     else {
-      $form['use_first_attr_as_groupid']['data'] = array(
+      $form['use_first_attr_as_groupid']['data'] = [
         '#type' => 'item',
         '#markup' => "Convert full dn to value of first attribute before mapping. NOT enabled",
-      );
+      ];
     }
 
-    $form['post mappings'] = array(
+    $form['post mappings'] = [
       '#type' => 'fieldset',
       '#title' => t('After Mappings and Filters Applied'),
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
-    );
+    ];
 
-    $maps = array();
+    $maps = [];
     foreach ($consumer->consumerConf->mappings as $i => $mapping) {
       $maps[] = $mapping['from'] . '|' . $mapping['user_entered'];
     }
 
-    $form['post mappings']['conf'] = array(
+    $form['post mappings']['conf'] = [
       '#type' => 'item',
       '#markup' => 'Use Mappings as Filter = ' . (int) $consumer->consumerConf->useMappingsAsFilter .
-      theme('item_list', array(
+      theme('item_list', [
         'items' => $maps,
         'type' => 'ul',
         'title' => 'Configured Mappings',
-      )
+      ]
       ),
-    );
+    ];
     if ($consumer->consumerConf->mappings) {
       $form['post mappings']['conf']['#markup'] =
       'Use Mappings as Filter = ' . (int) $consumer->consumerConf->useMappingsAsFilter .
-          theme('item_list', array(
+          theme('item_list', [
             'items' => $maps,
             'type' => 'ul',
             'title' => 'Configured Mappings',
-          )
+          ]
       );
     }
     else {
@@ -107,75 +107,75 @@ function ldap_authorization_test_form($form, &$form_state, $consumer_type) {
     }
 
     if (isset($_SESSION['ldap_authorization_test_query']['post mappings'])) {
-      $form['post mappings']['data'] = array(
+      $form['post mappings']['data'] = [
         '#type' => 'item',
-        '#markup' => theme('item_list', array('items' => $_SESSION['ldap_authorization_test_query']['post mappings'], 'type' => 'ul', 'title' => "Results after any filtering and mappings applied")),
-      );
+        '#markup' => theme('item_list', ['items' => $_SESSION['ldap_authorization_test_query']['post mappings'], 'type' => 'ul', 'title' => "Results after any filtering and mappings applied"]),
+      ];
     }
 
   }
 
   if (isset($_SESSION['ldap_authorization_test_query']['setting_data'])) {
     foreach ($_SESSION['ldap_authorization_test_query']['setting_data'] as $title => $data) {
-      $form[$title] = array(
+      $form[$title] = [
         '#type' => 'fieldset',
         '#title' => $title,
         '#collapsible' => TRUE,
         '#collapsed' => TRUE,
-      );
-      $form[$title]['overview'] = array(
+      ];
+      $form[$title]['overview'] = [
         '#type' => 'item',
         '#markup' => "<pre>" . print_r($data, TRUE) . "</pre>",
-      );
+      ];
     }
   }
 
-  $form['intro'] = array(
+  $form['intro'] = [
     '#type' => 'item',
     '#markup' => t('<h1>Test LDAP to !consumer_name Configuration</h1>
       <p>This form will not actually grant any authorizations, its just to show
       what authorizations would be granted with this configuration.</p>', $consumer_tokens),
-  );
+  ];
 
-  $form['consumer_type'] = array(
+  $form['consumer_type'] = [
     '#type' => 'hidden',
     '#default_value' => $consumer_type,
-  );
+  ];
 
-  $form['usernames'] = array(
+  $form['usernames'] = [
     '#type' => 'textarea',
     '#title' => t('Drupal usernames to test !consumer_shortName authorizations results for.  One per line.', $consumer_tokens),
-    '#default_value' => @$_SESSION['ldap_authorization_test_query']['usernames'] ,
+    '#default_value' => @$_SESSION['ldap_authorization_test_query']['usernames'],
     '#cols' => 50,
     '#rows' => 6,
     '#description' => '',
-  );
+  ];
 
-  $form['random_users'] = array(
+  $form['random_users'] = [
     '#type' => 'checkbox',
     '#default_value' => @$_SESSION['ldap_authorization_test_form']['random_users'],
     '#title' => t('Use 10 random users', $consumer_tokens),
-  );
+  ];
 
-  $form['execute_authorizations'] = array(
+  $form['execute_authorizations'] = [
     '#type' => 'checkbox',
     '#default_value' => @$_SESSION['ldap_authorization_test_form']['execute_authorizations'],
     '#title' => t('Actually grant or revoke example authorizations.
       This will grant and revoke based on the ldap authorization configuration
       options such as whether to revoke or regrant manually applied authorizations.
       Try with this unchecked first, then check to see how authorizations are applied.', $consumer_tokens),
-  );
+  ];
 
-  $form['user_data_clear'] = array(
+  $form['user_data_clear'] = [
     '#type' => 'checkbox',
     '#default_value' => @$_SESSION['ldap_authorization_test_form']['user_data_clear'],
     '#title' => t('Clear <pre>$user->data[ldap_authorization][<consumer type>]</pre> data for test users.', $consumer_tokens),
-  );
+  ];
 
-  $form['submit'] = array(
+  $form['submit'] = [
     '#type' => 'submit',
     '#value' => 'test',
-  );
+  ];
   unset($_SESSION['ldap_authorization_test_query']);
   return $form;
 }
@@ -200,9 +200,9 @@ function ldap_authorization_test_form_submit($form, &$form_state) {
   $consumer = ldap_authorization_get_consumer_object($consumer_type);
   $consumer_tokens = ldap_authorization_tokens($consumer);
 
-  $results = array();
+  $results = [];
   $users_listed = $array = preg_split('/[\n\r]+/', $form_state['values']['usernames']);
-  $random_users = array();
+  $random_users = [];
   $_SESSION['ldap_authorization_test_query']['random_users'] = $form_state['values']['random_users'];
   $_SESSION['ldap_authorization_test_query']['usernames'] = $form_state['values']['usernames'];
   // Add 10 random usernames to test.
@@ -216,7 +216,7 @@ function ldap_authorization_test_form_submit($form, &$form_state) {
     }
     catch (Exception $e) {
       drupal_set_message(t('db users query failed. Message = %message, query= %query',
-        array('%message' => $e->getMessage(), '%query' => $e->query_string)), 'error');
+        ['%message' => $e->getMessage(), '%query' => $e->query_string]), 'error');
       return "";
     }
 
@@ -241,13 +241,13 @@ function ldap_authorization_test_form_submit($form, &$form_state) {
       if ($form_state['values']['user_data_clear'] == 1) {
         $user_data = $user->data;
         unset($user_data['ldap_authorizations'][$consumer_type]);
-        $user = user_save($user, array('data' => $user_data));
+        $user = user_save($user, ['data' => $user_data]);
       }
 
       $action = ($form_state['values']['execute_authorizations'] == 1) ? "test_query_set" : 'test_query';
       list($results[$username], $notifications[$username]) = ldap_authorizations_user_authorizations($user, $action, $consumer_type, 'logon');
       // Remove authorizations from other consumer types.
-      $results[$username] = array($consumer_type => $results[$username][$consumer_type]);
+      $results[$username] = [$consumer_type => $results[$username][$consumer_type]];
       $i++;
       if ($i == 10) {
         break;
@@ -255,7 +255,7 @@ function ldap_authorization_test_form_submit($form, &$form_state) {
     }
   }
 
-  $table = theme('ldap_authorization_test_results', array('results' => $results, 'consumer' => $consumer, 'notifications' => $notifications));
+  $table = theme('ldap_authorization_test_results', ['results' => $results, 'consumer' => $consumer, 'notifications' => $notifications]);
   $_SESSION['ldap_authorization_test_query']['result'] = $table;
   $form_state['redirect'] = LDAP_SERVERS_MENU_BASE_PATH . '/authorization/test/' . $consumer->consumerType;
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.inc b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.inc
index e9fc4c37..51b13bb4 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.inc
@@ -5,18 +5,16 @@
  * Bulk of authorization code executed to determine a users authorizations.
  */
 
-// Remove after testing.
 /**
- *
+ * Unclear.
  */
-
 function ldap_authorization_help_watchdog() {
 
   $path = drupal_get_path("module", "ldap_help");
   $_content = "";
   if (module_exists('dblog')) {
     include_once drupal_get_path('module', 'dblog') . '/dblog.admin.inc';
-    $_SESSION['dblog_overview_filter']['type'] = array('ldap' => 'ldap');
+    $_SESSION['dblog_overview_filter']['type'] = ['ldap' => 'ldap'];
     $_content .= "<h3>" . t('LDAP Watchdog Errors and Notifications') . "</h3>";
     $overview = dblog_overview();
     $_content .= render($overview);
@@ -63,9 +61,9 @@ function ldap_authorization_help_watchdog() {
 function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $context) {
   $debug = FALSE;
   $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
-  $authorizations = array();
-  $notifications = array();
-  $watchdog_tokens = array('%username' => $user->name);
+  $authorizations = [];
+  $notifications = [];
+  $watchdog_tokens = ['%username' => $user->name];
   $consumers = ldap_authorization_get_consumers($consumer_type, TRUE, FALSE);
 
   $servers = ldap_servers_get_servers(NULL, 'enabled', TRUE);
@@ -79,9 +77,9 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
     }
     $notifications['all'] = LDAP_AUTHORIZATION_NOT_APPLY_USER_1;
     foreach ($consumers as $consumer_type => $consumer) {
-      $authorizations[$consumer_type] = array();
+      $authorizations[$consumer_type] = [];
     }
-    return array($authorizations, $notifications);
+    return [$authorizations, $notifications];
   }
 
   /**
@@ -97,7 +95,7 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
   $watchdog_tokens['%ldap_authenticated'] = ($ldap_authenticated) ? 'yes' : 'no';
 
   foreach ($consumers as $consumer_type => $consumer) {
-    $authorizations[$consumer_type] = array();
+    $authorizations[$consumer_type] = [];
     /**
     * each consumer type has only one consumer conf and each consumer conf has only one ldap server id (sid)
     * so there is a one-to-one-to-one relationship between:
@@ -111,7 +109,7 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
     if (!$consumer->consumerConf->status) {
       continue;
     }
-    $proposed_ldap_authorizations = array();
+    $proposed_ldap_authorizations = [];
     $watchdog_tokens['%consumer_type'] = $consumer_type;
     $watchdog_tokens['%sid'] = $consumer->consumerConf->sid;
 
@@ -189,7 +187,7 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
     foreach ($proposed_ldap_authorizations as $key => $authorization_id) {
       if ($consumer->consumerConf->useFirstAttrAsGroupId) {
         $attr_parts = ldap_explode_dn($authorization_id, 0);
-        if (count($attr_parts) > 0) {
+        if (!empty($attr_parts) && count($attr_parts) > 0) {
           $first_part = explode('=', $attr_parts[0]);
           if (count($first_part) > 1) {
             $authorization_id = ldap_pear_unescape_dn_value(trim($first_part[1]));
@@ -211,7 +209,7 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
     }
 
     if ($detailed_watchdog_log || $debug) {
-      $_proposed_ldap_authorizations = is_array($proposed_ldap_authorizations) ? $proposed_ldap_authorizations : array();
+      $_proposed_ldap_authorizations = is_array($proposed_ldap_authorizations) ? $proposed_ldap_authorizations : [];
       $watchdog_tokens['%proposed_authorizations'] = join(', ', $_proposed_ldap_authorizations);
     }
     if ($detailed_watchdog_log) {
@@ -229,14 +227,14 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
      * an array of filtered and mapped authorization ids
      */
 
-    $filtered_ldap_authorizations = array();
+    $filtered_ldap_authorizations = [];
     // Filter + map.
     if ($consumer->consumerConf->useMappingsAsFilter) {
       foreach ($consumer->consumerConf->mappings as $mapping_filter) {
         $map_from = $mapping_filter['from'];
         $map_to = $mapping_filter['normalized'];
         if (isset($proposed_ldap_authorizations[drupal_strtolower($map_from)])) {
-          $filtered_ldap_authorizations[drupal_strtolower($map_to)] = array('map_to_string' => $map_to, 'exists' => NULL);
+          $filtered_ldap_authorizations[drupal_strtolower($map_to)] = ['map_to_string' => $map_to, 'exists' => NULL];
         }
       }
     }
@@ -250,20 +248,19 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
           $map_from_key = array_search(drupal_strtolower($map_from), array_keys($proposed_ldap_authorizations));
           if ($map_from_key !== FALSE) {
             // Remove non mapped authorization.
-            $_authorizations = array_diff($_authorizations, array($map_from));
-            $_authorizations = array_diff($_authorizations, array(drupal_strtolower($map_from)));
+            $_authorizations = array_diff($_authorizations, [$map_from]);
+            $_authorizations = array_diff($_authorizations, [drupal_strtolower($map_from)]);
             // Add mapped authorization.
             $_authorizations[] = $map_to;
-            // Remove map from;.
           }
         }
       }
       foreach ($_authorizations as $i => $authorization_id) {
-        $filtered_ldap_authorizations[drupal_strtolower($authorization_id)] = array(
+        $filtered_ldap_authorizations[drupal_strtolower($authorization_id)] = [
           'map_to_string' => $authorization_id,
           'exists' => NULL,
           'value' => $authorization_id,
-        );
+        ];
       }
     }
 
@@ -274,12 +271,12 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
      *
      * @see ldap_authorization.api.php hook_ldap_authorization_authorizations_alter() notes
      */
-    $params = array(
+    $params = [
       'user' => $user,
       'ldap_user' => $ldap_user,
       'ldap_server' => $ldap_server,
       'consumer' => $consumer,
-    );
+    ];
 
     drupal_alter('ldap_authorization_authorizations', $filtered_ldap_authorizations, $params);
 
@@ -294,7 +291,7 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
     }
 
     if ($op == 'test_query' || $op == 'test_query_set') {
-      $display_authorizations = array();
+      $display_authorizations = [];
       foreach ($filtered_ldap_authorizations as $consumer_id => $_consumer) {
         $display_authorizations[] = $_consumer['map_to_string'];
       }
@@ -324,7 +321,7 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
     $authorizations[$consumer_type] = $filtered_ldap_authorizations;
   } //  end foreach $consumers
 
-  return array($authorizations, $notifications);
+  return [$authorizations, $notifications];
 
 }
 
@@ -334,7 +331,7 @@ function _ldap_authorizations_user_authorizations(&$user, $op, $consumer_type, $
  * @param object $consumer
  *   is instance of an authorization consumer class
  *   such as LdapAuthorizationConsumerDrupalRole.
- * @param associative array of lower case authorization ids as keys and
+ * @param array of lower case authorization ids as keys and
  *   mixed case strings as values $filtered_ldap_authorizations
  *   all authorization ids a user is granted via ldap authorization configuration
  * @param object $ldap_entry
@@ -358,8 +355,8 @@ function _ldap_authorizations_user_authorizations_set(&$user, $consumer, $filter
     $initial_existing_ldap_authorizations = array_keys($user_auth_data);
   }
   else {
-    $user_auth_data = array();
-    $initial_existing_ldap_authorizations = array();
+    $user_auth_data = [];
+    $initial_existing_ldap_authorizations = [];
   }
 
   if ($test) {
@@ -391,7 +388,7 @@ function _ldap_authorizations_user_authorizations_set(&$user, $consumer, $filter
    */
 
   // Keys are lcase, values are mixed case.
-  $existing_grants = array();
+  $existing_grants = [];
   foreach ($grants as $i => $grant) {
     if (!empty($filtered_ldap_authorizations[$grant]['exists'])) {
       $existing_grants[$grant] = $filtered_ldap_authorizations[$grant];
@@ -415,13 +412,13 @@ function _ldap_authorizations_user_authorizations_set(&$user, $consumer, $filter
     $revokes_lcase = $consumer->authorizationDiff($initial_existing_ldap_authorizations, array_keys($filtered_ldap_authorizations));
     if (count($revokes_lcase)) {
       // Keys are lcase, values are mixed case.
-      $revokes = array();
+      $revokes = [];
       foreach ($revokes_lcase as $i => $revoke_lcase) {
-        $revokes[$revoke_lcase] = array(
+        $revokes[$revoke_lcase] = [
           'value' => NULL,
           'map_to_string' => NULL,
           'exists' => TRUE,
-        );
+        ];
       }
       if ($test) {
         $_SESSION['ldap_authorization_test_query']['setting_data']['Revokes'] = $revokes;
@@ -440,8 +437,8 @@ function _ldap_authorizations_user_authorizations_set(&$user, $consumer, $filter
    */
 
   $uid = $user->uid;
-  $user_edit = array('data' => $user->data);
-  $user_edit['data']['ldap_authorizations'] = empty($user->data['ldap_authorizations']) ? array() : $user->data['ldap_authorizations'];
+  $user_edit = ['data' => $user->data];
+  $user_edit['data']['ldap_authorizations'] = empty($user->data['ldap_authorizations']) ? [] : $user->data['ldap_authorizations'];
   // Keep in good display order.
   $consumer->sortConsumerIds('grant', $user_auth_data);
   $user_edit['data']['ldap_authorizations'][$consumer->consumerType] = $user_auth_data;
@@ -491,15 +488,15 @@ function _ldap_authorizations_user_authorizations_set(&$user, $consumer, $filter
 function _ldap_authorization_ldap_authorization_maps_alter(&$user, &$user_ldap_entry, &$ldap_server, &$consumer_conf, &$authz_ids, $op) {
 
   $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
-  $watchdog_tokens = array();
+  $watchdog_tokens = [];
 
   // Groups extracted from user's DN. such as ou=IT => group = "IT".
-  $derive_from_dn_authorizations = array();
+  $derive_from_dn_authorizations = [];
   if ($rdn_values = $consumer_conf->server->groupUserMembershipsFromDn($user)) {
     $derive_from_dn_authorizations = array_combine($rdn_values, $rdn_values);
   }
   else {
-    $derive_from_dn_authorizations = array();
+    $derive_from_dn_authorizations = [];
   }
   if ($op == 'test_query' || $op == 'test_query_set') {
     $_SESSION['ldap_authorization_test_query']['maps']['Derive from DN'] = ($rdn_values) ? $derive_from_dn_authorizations : t('disabled');
@@ -508,7 +505,7 @@ function _ldap_authorization_ldap_authorization_maps_alter(&$user, &$user_ldap_e
   // Traditional groups (dns)
   $group_dns = $consumer_conf->server->groupMembershipsFromUser($user, 'group_dns');
   if (!$group_dns) {
-    $group_dns = array();
+    $group_dns = [];
   }
   elseif (count($group_dns)) {
     $group_dns = array_unique($group_dns);
@@ -519,7 +516,7 @@ function _ldap_authorization_ldap_authorization_maps_alter(&$user, &$user_ldap_e
 
   $values = array_merge($derive_from_dn_authorizations, $group_dns);
   $values = array_unique($values);
-  $authz_ids = (count($values)) ? array_combine($values, $values) : array();
+  $authz_ids = (count($values)) ? array_combine($values, $values) : [];
   if ($detailed_watchdog_log) {
     $watchdog_tokens['%username'] = $user->name;
     $watchdog_tokens['%ldap_server'] = $ldap_server->sid;
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info
index 775c0791..567d7211 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info
@@ -4,6 +4,7 @@ package = Lightweight Directory Access Protocol
 dependencies[] = ldap_servers
 dependencies[] = ldap_user
 core = 7.x
+php = 5.4
 
 files[] = LdapAuthorizationConsumerAbstract.class.php
 files[] = LdapAuthorizationConsumer.class.php
@@ -19,8 +20,8 @@ configure = admin/config/people/ldap/authorization
 
 test_dependencies[] = ldap_sso:ldap_sso
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.install b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.install
index 2be53ed9..9425c3f8 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.install
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.install
@@ -9,7 +9,7 @@
  * Implements hook_requirements().
  */
 function ldap_authorization_requirements($phase) {
-  $requirements = array();
+  $requirements = [];
 
   if ($phase != "install" && db_field_exists('ldapauth', 'ldapgroups_in_dn')) {
     $requirements['ldap_authorization_ldap_integration']['title'] = t('LDAP Integration LDAP Groups Upgrade Concern');
@@ -68,7 +68,7 @@ function ldap_authorization_uninstall() {
  */
 function ldap_authorization_user_entity_fields() {
 
-  $fields = array();
+  $fields = [];
 
   return $fields;
 }
@@ -78,29 +78,29 @@ function ldap_authorization_user_entity_fields() {
  */
 function ldap_authorization_schema() {
 
-  $schema['ldap_authorization'] = array(
-    'export' => array(
+  $schema['ldap_authorization'] = [
+    'export' => [
       'key' => 'consumer_type',
       'key name' => 'Mapping ID',
       'identifier' => 'consumer_type',
       'primary key' => 'numeric_consumer_conf_id',
-      'api' => array(
+      'api' => [
         'owner' => 'ldap_authorization',
         'api' => 'ldap_authorization',
         'minimum_version' => 1,
         'current_version' => 1,
-      ),
-    ),
+      ],
+    ],
 
     'description' => "Data used to map users ldap entry to authorization rights.",
-    'primary key' => array('numeric_consumer_conf_id'),
-    'foreign keys' => array(
-      'sid' => array(
+    'primary key' => ['numeric_consumer_conf_id'],
+    'foreign keys' => [
+      'sid' => [
         'table' => 'ldap_servers',
-        'columns' => array('sid' => 'sid'),
-      ),
-    ),
-  );
+        'columns' => ['sid' => 'sid'],
+      ],
+    ],
+  ];
 
   module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
   module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class');
@@ -121,12 +121,12 @@ function ldap_authorization_schema() {
 function ldap_authorization_update_7100() {
 
   if (!db_field_exists('ldap_authorization', 'create_consumers')) {
-    db_add_field('ldap_authorization', 'create_consumers', array(
+    db_add_field('ldap_authorization', 'create_consumers', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     return t('"create_consumers" field added to ldap_authorization table');
   }
   else {
@@ -141,12 +141,12 @@ function ldap_authorization_update_7100() {
 function ldap_authorization_update_7101() {
 
   if (!db_field_exists('ldap_authorization', 'derive_from_attr_use_first_attr')) {
-    db_add_field('ldap_authorization', 'derive_from_attr_use_first_attr', array(
+    db_add_field('ldap_authorization', 'derive_from_attr_use_first_attr', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     return t('"derive_from_attr_use_first_attr" field added to ldap_authorization table');
   }
   else {
@@ -161,12 +161,12 @@ function ldap_authorization_update_7101() {
 function ldap_authorization_update_7102() {
 
   if (!db_field_exists('ldap_authorization', 'derive_from_entry_search_all')) {
-    db_add_field('ldap_authorization', 'derive_from_entry_search_all', array(
+    db_add_field('ldap_authorization', 'derive_from_entry_search_all', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     return t('"derive_from_entry_search_all" field added to ldap_authorization table');
   }
   else {
@@ -180,11 +180,11 @@ function ldap_authorization_update_7102() {
  */
 function ldap_authorization_update_7103() {
 
-  foreach (array('derive_from_dn_attr', 'derive_from_attr_attr', 'derive_from_entry_entries') as $field_name) {
-    db_change_field('ldap_authorization', $field_name, $field_name, array(
+  foreach (['derive_from_dn_attr', 'derive_from_attr_attr', 'derive_from_entry_entries'] as $field_name) {
+    db_change_field('ldap_authorization', $field_name, $field_name, [
       'type' => 'text',
       'not null' => FALSE,
-    ));
+    ]);
   }
 
 }
@@ -195,11 +195,11 @@ function ldap_authorization_update_7103() {
  */
 function ldap_authorization_update_7104() {
 
-  foreach (array('derive_from_dn_attr', 'derive_from_attr_attr', 'derive_from_entry_entries') as $field_name) {
-    db_change_field('ldap_authorization', $field_name, $field_name, array(
+  foreach (['derive_from_dn_attr', 'derive_from_attr_attr', 'derive_from_entry_entries'] as $field_name) {
+    db_change_field('ldap_authorization', $field_name, $field_name, [
       'type' => 'text',
       'not null' => FALSE,
-    ));
+    ]);
   }
 
 }
@@ -210,11 +210,11 @@ function ldap_authorization_update_7104() {
 function ldap_authorization_update_7105() {
 
   if (!db_field_exists('ldap_authorization', 'derive_from_entry_user_ldap_attr')) {
-    db_add_field('ldap_authorization', 'derive_from_entry_user_ldap_attr', array(
+    db_add_field('ldap_authorization', 'derive_from_entry_user_ldap_attr', [
       'type' => 'varchar',
       'length' => 255,
       'default' => NULL,
-    ));
+    ]);
     return t('"derive_from_entry_user_ldap_attr" field added to ldap_authorization table');
   }
   else {
@@ -229,22 +229,22 @@ function ldap_authorization_update_7105() {
 function ldap_authorization_update_7106() {
 
   if (!db_field_exists('ldap_authorization', 'derive_from_attr_nested')) {
-    db_add_field('ldap_authorization', 'derive_from_attr_nested', array(
+    db_add_field('ldap_authorization', 'derive_from_attr_nested', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"derive_from_attr_nested" field added to ldap_authorization table');
   }
 
   if (!db_field_exists('ldap_authorization', 'derive_from_entry_nested')) {
-    db_add_field('ldap_authorization', 'derive_from_entry_nested', array(
+    db_add_field('ldap_authorization', 'derive_from_entry_nested', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     $msg .= t('"derive_from_entry_nested" field added to ldap_authorization table');
   }
 
@@ -259,12 +259,12 @@ function ldap_authorization_update_7107() {
   $changes = '';
 
   if (!db_field_exists('ldap_authorization', 'derive_from_entry_use_first_attr')) {
-    db_add_field('ldap_authorization', 'derive_from_entry_use_first_attr', array(
+    db_add_field('ldap_authorization', 'derive_from_entry_use_first_attr', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     $changes .= t('"derive_from_entry_use_first_attr" field added to ldap_authorization table');
   }
 
@@ -283,11 +283,11 @@ function ldap_authorization_update_7107() {
 function ldap_authorization_update_7108() {
 
   if (!db_field_exists('ldap_authorization', 'derive_from_entry_entries_attr')) {
-    db_add_field('ldap_authorization', 'derive_from_entry_entries_attr', array(
+    db_add_field('ldap_authorization', 'derive_from_entry_entries_attr', [
       'type' => 'varchar',
       'length' => 255,
       'default' => NULL,
-    ));
+    ]);
     return t('"derive_from_entry_entries_attr" field added to ldap_authorization table');
   }
   else {
@@ -306,22 +306,22 @@ function ldap_authorization_update_7201() {
   $results = '';
 
   if (!db_field_exists('ldap_authorization', 'useFirstAttrAsGroupId')) {
-    db_add_field('ldap_authorization', 'useFirstAttrAsGroupId', array(
+    db_add_field('ldap_authorization', 'useFirstAttrAsGroupId', [
       'type' => 'int',
       'size' => tiny,
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     $results .= t('"useFirstAttrAsGroupId" field added to ldap_authorization table');
   }
 
   if (!db_field_exists('ldap_authorization', 'searchAll')) {
-    db_add_field('ldap_authorization', 'searchAll', array(
+    db_add_field('ldap_authorization', 'searchAll', [
       'type' => 'int',
       'size' => tiny,
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     $results .= t('"searchAll" field added to ldap_authorization table');
   }
 }
@@ -331,11 +331,11 @@ function ldap_authorization_update_7201() {
  */
 function ldap_authorization_update_7202() {
 
-  $instance = array(
+  $instance = [
     'field_name' => 'ldap_authorizations',
     'entity_type' => 'user',
     'bundle' => 'user',
-  );
+  ];
   field_delete_instance($instance, TRUE);
   field_delete_field('ldap_authorizations');
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.module b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.module
index cdcd4dd8..7522e6bf 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.module
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.module
@@ -31,54 +31,54 @@ function ldap_authorization_cleanse_empty_og_fields(&$user) {
  */
 function ldap_authorization_menu() {
 
-  $items['admin/config/people/ldap/authorization'] = array(
+  $items['admin/config/people/ldap/authorization'] = [
     'title' => 'Authorization',
     'page callback' => 'ldap_authorizations_admin_index',
-    'page arguments' => array(),
+    'page arguments' => [],
     'type' => MENU_LOCAL_TASK,
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_authorization.admin.inc',
     'weight' => 3,
-  );
+  ];
 
-  $items['admin/config/people/ldap/authorization/list'] = array(
+  $items['admin/config/people/ldap/authorization/list'] = [
     'title' => 'List',
     'type' => MENU_DEFAULT_LOCAL_TASK,
-  );
+  ];
 
-  $items['admin/config/people/ldap/authorization/edit/%'] = array(
+  $items['admin/config/people/ldap/authorization/edit/%'] = [
     'title' => 'Edit LDAP Authorization Configuration',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_authorization_admin_form', 6, 'edit'),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_authorization_admin_form', 6, 'edit'],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_authorization.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/authorization/delete/%'] = array(
+  $items['admin/config/people/ldap/authorization/delete/%'] = [
     'title' => 'Delete LDAP Authorization Configuration',
     'description' => 'Delete an ldap authorization configuration',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_authorization_admin_form', 6, 'delete'),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_authorization_admin_form', 6, 'delete'],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_authorization.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/authorization/test/%'] = array(
+  $items['admin/config/people/ldap/authorization/test/%'] = [
     'title' => 'Test LDAP Authorization Configuration',
     'description' => 'Test an ldap authorization configuration',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_authorization_test_form', 6, 'test'),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_authorization_test_form', 6, 'test'],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_authorization.admin.test.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/authorization/add/%'] = array(
+  $items['admin/config/people/ldap/authorization/add/%'] = [
     'title' => 'Add Authorization Configuration',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_authorization_admin_form', 6, 'add'),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_authorization_admin_form', 6, 'add'],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_authorization.admin.inc',
-  );
+  ];
 
   return $items;
 }
@@ -90,8 +90,8 @@ function ldap_authorization_user_login(&$edit, $user) {
   list($authorizations, $notifications) = ldap_authorizations_user_authorizations($user, 'set', NULL, 'logon');
   if (variable_get('ldap_help_watchdog_detail', FALSE)) {
     foreach ($authorizations as $consumer_type => $authorization_ids) {
-      $ul = theme('item_list', array('title' => $consumer_type, 'items' => array_keys($authorization_ids), 'type' => 'ul'));
-      watchdog('ldap_authentication', 'ldap_authorization_user_login.authorizations' . $ul, array(), WATCHDOG_DEBUG);
+      $ul = theme('item_list', ['title' => $consumer_type, 'items' => array_keys($authorization_ids), 'type' => 'ul']);
+      watchdog('ldap_authentication', 'ldap_authorization_user_login.authorizations' . $ul, [], WATCHDOG_DEBUG);
     }
   }
 }
@@ -114,7 +114,7 @@ function ldap_authorization_maps_alter_invoke(&$user, &$user_ldap_entry, &$ldap_
  */
 function ldap_authorization_ldap_server_in_use($sid, $server_name) {
 
-  $use_warnings = array();
+  $use_warnings = [];
   $consumers = ldap_authorization_get_consumers();
   foreach (ldap_authorization_get_consumers() as $consumer_type => $consumer_conf) {
     $consumer_conf['%server_name'] = $server_name;
@@ -141,7 +141,6 @@ function ldap_authorization_ldap_attributes_needed_alter(&$attribute_maps, $para
       if ($consumer_conf->server->groupUserMembershipsAttrExists) {
         $attribute_name = $consumer_conf->server->groupUserMembershipsAttr;
         if ($attribute_name) {
-          // array($attribute_name, 0, NULL);.
           $attribute_maps[$attribute_name] = ldap_servers_set_attribute_map($attribute_name);
         }
       }
@@ -182,24 +181,24 @@ function ldap_authorization_ldap_authorization_maps_alter(&$user, &$user_ldap_en
  *
  */
 function ldap_authorization_theme() {
-  return array(
-    'ldap_authorization_test_results' => array(
-      'variables' => array('data' => NULL),
+  return [
+    'ldap_authorization_test_results' => [
+      'variables' => ['data' => NULL],
       'render element' => 'element',
       'file' => 'ldap_authorization.theme.inc',
-    ),
-    'ldap_authorization_admin_index' => array(
-      'variables' => array('consumers' => NULL),
+    ],
+    'ldap_authorization_admin_index' => [
+      'variables' => ['consumers' => NULL],
       'render element' => 'element',
       'file' => 'ldap_authorization.theme.inc',
-    ),
-  );
+    ],
+  ];
 }
 
 /**
  * Param string $consumer_type is machine name of consumer such as drupal_role.
  *
- * @return consumer object
+ * @return object
  */
 function ldap_authorization_get_consumer_object($consumer_type) {
 
@@ -240,7 +239,7 @@ function ldap_authorization_get_consumers($consumer_type = NULL, $reset = FALSE,
     return isset($consumers[$consumer_type]) ? $consumers[$consumer_type] : FALSE;
   }
   else {
-    return isset($consumers[$consumer_type]) ? array($consumer_type => $consumers[$consumer_type]) : array();
+    return isset($consumers[$consumer_type]) ? [$consumer_type => $consumers[$consumer_type]] : [];
   }
 
 }
@@ -249,7 +248,7 @@ function ldap_authorization_get_consumers($consumer_type = NULL, $reset = FALSE,
  * @rationale: need not be called from hook_user, so this function separated out
  * so it can be called from a batch synchronization process for example
  *
- * @param drupal user object $user
+ * @param object $user
  * @param string $op
  *   indicating operation such as query, set, test_query, etc.
  * @param string $consumer_type
@@ -266,8 +265,8 @@ function ldap_authorizations_user_authorizations(&$user, $op = 'query', $consume
   }
   else {
     $consumers = ldap_authorization_get_consumers();
-    $new_authorizations = array();
-    $notifications = array();
+    $new_authorizations = [];
+    $notifications = [];
     foreach ($consumers as $consumer_type => $consumer) {
       list($new_authorizations_i, $notifications_i) = _ldap_authorizations_user_authorizations($user, $op, $consumer_type, $context);
       $new_authorizations = $new_authorizations + $new_authorizations_i;
@@ -275,7 +274,7 @@ function ldap_authorizations_user_authorizations(&$user, $op = 'query', $consume
     }
 
   }
-  return array($new_authorizations, $notifications);
+  return [$new_authorizations, $notifications];
 }
 
 /**
@@ -287,9 +286,9 @@ function ldap_authorization_help($path, $arg) {
     user attributes, etc to determine user authorization (Drupal roles, organic group memberships,
     etc.)
     More detailed help is available on drupal.org at !helplink.',
-          array(
+          [
             '!helplink' => l(LDAP_SERVERS_DRUPAL_HELP_URL, LDAP_SERVERS_DRUPAL_HELP_URL),
-          ));
+          ]);
 
   switch ($path) {
     case 'admin/config/people/ldap/authorization':
@@ -305,15 +304,15 @@ function ldap_authorization_help($path, $arg) {
 /**
  * Just tokens for better watchdog and drupal_set_message arguments .**/
 function ldap_authorization_tokens($consumer) {
-  $tokens = array();
+  $tokens = [];
 
   if (is_object($consumer)) {
-    foreach (array('%', '!', '@') as $symbol) {
-      foreach (array('name', 'namePlural', 'shortName', 'shortNamePlural', 'consumerModule', 'consumerType', 'mappingDirections', 'testLink', 'editLink') as $property) {
+    foreach (['%', '!', '@'] as $symbol) {
+      foreach (['name', 'namePlural', 'shortName', 'shortNamePlural', 'consumerModule', 'consumerType', 'mappingDirections', 'testLink', 'editLink'] as $property) {
         $tokens[$symbol . 'consumer_' . $property] = $consumer->$property;
       }
       if (is_object($consumer->consumerConf)) {
-        foreach (array('sid', 'status') as $property) {
+        foreach (['sid', 'status'] as $property) {
           $tokens[$symbol . 'consumer_' . $property] = $consumer->consumerConf->$property;
         }
       }
@@ -354,7 +353,7 @@ function ldap_authorization_get_consumer_conf($consumer_type, $type = 'default',
 function ldap_authorization_ldap_user_attrs_list_alter(&$available_user_attrs, &$params) {
 
   // This is a case where a field is being denied synching configuration because its not meant to be used by other modules.
-  $available_user_attrs['[field.ldap_authorizations]'] = array(
+  $available_user_attrs['[field.ldap_authorizations]'] = [
     'name' => 'Field: LDAP Authorizations',
     'source' => 'LDAP Authorization modules',
     'configurable_to_drupal' => 0,
@@ -363,9 +362,9 @@ function ldap_authorization_ldap_user_attrs_list_alter(&$available_user_attrs, &
     'direction' => NULL,
     'enabled' => FALSE,
     'config_module' => 'ldap_authorization',
-    'prov_events' => array(),
+    'prov_events' => [],
     'prov_module' => 'ldap_authorization',
     'exclude_from_mapping_ui' => TRUE,
-  );
+  ];
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.theme.inc b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.theme.inc
index c82ea62d..c20cd011 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.theme.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.theme.inc
@@ -11,15 +11,15 @@
 function theme_ldap_authorization_admin_index(&$variables) {
   $consumers = $variables['consumers'];
 
-  $table = array(
-    'header' => array(t('LDAP Server ID'), t('Description'), t('Module'), t('Consumer Type'), t('Enabled'), t('Operations')),
-    'attributes' => array('id' => 'ldap_consumer_confs', 'class' => 'data'),
-    'colgroups' => array(),
+  $table = [
+    'header' => [t('LDAP Server ID'), t('Description'), t('Module'), t('Consumer Type'), t('Enabled'), t('Operations')],
+    'attributes' => ['id' => 'ldap_consumer_confs', 'class' => 'data'],
+    'colgroups' => [],
     'sticky' => FALSE,
     'empty' => '',
     'caption' => t('LDAP Authorization Configurations'),
-    'rows' => array(),
-  );
+    'rows' => [],
+  ];
 
   foreach ($consumers as $consumer_type => $consumer) {
 
@@ -31,14 +31,14 @@ function theme_ldap_authorization_admin_index(&$variables) {
       $actions = l(t('add'), LDAP_SERVERS_MENU_BASE_PATH . '/authorization/add/' . $consumer->consumerType);
     }
 
-    $table['rows'][] = array(
+    $table['rows'][] = [
       $consumer->consumerConf->sid,
       $consumer->name,
       $consumer->consumerModule,
       $consumer_type,
       ($consumer->consumerConf->status) ? t('Yes') : t('No'),
       $actions,
-    );
+    ];
   }
   return theme('table', $table);
 
@@ -55,31 +55,31 @@ function theme_ldap_authorization_test_results($variables) {
   $consumer_conf_link = l($consumer->consumerType, LDAP_SERVERS_MENU_BASE_PATH . '/authorization/edit/' . $consumer->consumerType);
   $server_link = l($consumer->consumerConf->sid, LDAP_SERVERS_MENU_BASE_PATH . '/servers/edit/' . $consumer->consumerConf->sid);
 
-  $table = array(
-    'header' => array(t('Drupal Username'), t('Authorization Type'), t('Authorization IDs'), t('Configuration'), t('LDAP Server Configuration')),
-    'attributes' => array('id' => 'ldap_authorization_authorizations', 'class' => 'data'),
-    'colgroups' => array(),
+  $table = [
+    'header' => [t('Drupal Username'), t('Authorization Type'), t('Authorization IDs'), t('Configuration'), t('LDAP Server Configuration')],
+    'attributes' => ['id' => 'ldap_authorization_authorizations', 'class' => 'data'],
+    'colgroups' => [],
     'sticky' => FALSE,
     'empty' => '',
-    'caption' => t('LDAP Authorizations Test Results for consumer %consumer', array('%consumer' => $consumer->name)),
-    'rows' => array(),
-  );
+    'caption' => t('LDAP Authorizations Test Results for consumer %consumer', ['%consumer' => $consumer->name]),
+    'rows' => [],
+  ];
 
   if (count($results)) {
     foreach ($results as $username => $user_results) {
-      $row = array();
+      $row = [];
       if ($user = user_load_by_name($username)) {
         $username_link = l($username, 'user/' . $user->uid . '/edit');
       }
       foreach ($user_results as $consumer_type => $authorizations) {
         if (is_array($authorizations) && count($authorizations) > 0) {
           $authorizations = $consumer->convertToFriendlyAuthorizationIds($authorizations);
-          $authorizations_text = theme('item_list', array('items' => array_values($authorizations), 'title' => NULL, 'type' => 'ul', 'attributes' => array()));
+          $authorizations_text = theme('item_list', ['items' => array_values($authorizations), 'title' => NULL, 'type' => 'ul', 'attributes' => []]);
         }
         else {
           $authorizations_text = "";
         }
-        $row = array($username, $consumer->name, $authorizations_text, $consumer_conf_link, $server_link);
+        $row = [$username, $consumer->name, $authorizations_text, $consumer_conf_link, $server_link];
         $table['rows'][] = $row;
       }
 
@@ -93,7 +93,7 @@ function theme_ldap_authorization_test_results($variables) {
             $authorizations_text .= ldap_authorization_map_errors($notification, $consumer_conf_link);
           }
         }
-        $row = array($username_link, $consumer->name, $authorizations_text, $consumer_conf_link, $server_link);
+        $row = [$username_link, $consumer->name, $authorizations_text, $consumer_conf_link, $server_link];
         $table['rows'][] = $row;
       }
     }
@@ -110,7 +110,7 @@ function theme_ldap_authorization_test_results($variables) {
  */
 function ldap_authorization_map_errors($err_id, $consumer_conf_link) {
 
-  $tokens = array('%consumer_conf_link' => $consumer_conf_link);
+  $tokens = ['%consumer_conf_link' => $consumer_conf_link];
   switch ($err_id) {
 
     case  LDAP_AUTHORIZATION_USER_LDAP_NOT_FOUND:
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/LdapAuthorizationConsumerRole.class.php b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/LdapAuthorizationConsumerRole.class.php
index f587c1fc..1771ba5c 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/LdapAuthorizationConsumerRole.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/LdapAuthorizationConsumerRole.class.php
@@ -14,14 +14,14 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
   public $consumerType = 'drupal_role';
   public $allowConsumerObjectCreation = TRUE;
 
-  public $defaultConsumerConfProperties = array(
+  public $defaultConsumerConfProperties = [
     'onlyApplyToLdapAuthenticated' => TRUE,
     'useMappingsAsFilter' => TRUE,
     'synchOnLogon' => TRUE,
     'revokeLdapProvisioned' => TRUE,
     'regrantLdapProvisioned' => TRUE,
     'createConsumers' => TRUE,
-  );
+  ];
 
   /**
    *
@@ -45,7 +45,7 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
     elseif (drupal_strlen($consumer_id) > 63) {
       watchdog('ldap_authorization_drupal_role', 'Tried to create drupal role
         with name of over 63 characters (%group_name).  Please correct your
-        drupal ldap_authorization settings', array('%group_name' => $consumer_id));
+        drupal ldap_authorization settings', ['%group_name' => $consumer_id]);
       return FALSE;
     }
 
@@ -53,13 +53,13 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
     $new_role->name = empty($consumer['value']) ? $consumer_id : $consumer['value'];
     if (!($status = user_role_save($new_role))) {
       // If role is not created, remove from array to user object doesn't have it stored as granted.
-      watchdog('user', 'failed to create drupal role %role in ldap_authorizations module', array('%role' => $new_role->name));
+      watchdog('user', 'failed to create drupal role %role in ldap_authorizations module', ['%role' => $new_role->name]);
       return FALSE;
     }
     else {
       // Flush existingRolesByRoleName cache after creating new role.
       $roles_by_consumer_id = $this->existingRolesByRoleName(TRUE);
-      watchdog('user', 'created drupal role %role in ldap_authorizations module', array('%role' => $new_role->name));
+      watchdog('user', 'created drupal role %role in ldap_authorizations module', ['%role' => $new_role->name]);
     }
     return TRUE;
   }
@@ -119,7 +119,7 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
     }
     else {
       unset($user->roles[$rid]);
-      $user_edit = array('roles' => $user->roles);
+      $user_edit = ['roles' => $user->roles];
       $account = user_load($user->uid);
       $user = user_save($account, $user_edit);
       $result = ($user && !isset($user->roles[$rid]));
@@ -131,12 +131,12 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
     if ($this->detailedWatchdogLog) {
       watchdog('ldap_authorization', 'LdapAuthorizationConsumerDrupalRole.revokeSingleAuthorization()
         revoked:  rid=%rid, role_name=%role_name for username=%username, result=%result',
-        array(
+        [
           '%rid' => $rid,
           '%role_name' => $role_name,
           '%username' => $user->name,
           '%result' => $result,
-        ), WATCHDOG_DEBUG);
+        ], WATCHDOG_DEBUG);
     }
 
     return $result;
@@ -154,15 +154,15 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
     if (is_null($rid)) {
       watchdog('ldap_authorization', 'LdapAuthorizationConsumerDrupalRole.grantSingleAuthorization()
       failed to grant %username the role %role_name because role does not exist',
-      array('%role_name' => $role_name, '%username' => $user->name),
+      ['%role_name' => $role_name, '%username' => $user->name],
       WATCHDOG_ERROR);
       return FALSE;
     }
 
     $user->roles[$rid] = $role_name;
-    $user_edit = array('roles' => $user->roles);
+    $user_edit = ['roles' => $user->roles];
     if ($this->detailedWatchdogLog) {
-      watchdog('ldap_authorization', 'grantSingleAuthorization in drupal rold' . print_r($user, TRUE), array(), WATCHDOG_DEBUG);
+      watchdog('ldap_authorization', 'grantSingleAuthorization in drupal rold' . print_r($user, TRUE), [], WATCHDOG_DEBUG);
     }
 
     $account = user_load($user->uid);
@@ -172,12 +172,12 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
     if ($this->detailedWatchdogLog) {
       watchdog('ldap_authorization', 'LdapAuthorizationConsumerDrupalRole.grantSingleAuthorization()
         granted: rid=%rid, role_name=%role_name for username=%username, result=%result',
-        array(
+        [
           '%rid' => $rid,
           '%role_name' => $role_name,
           '%username' => $user->name,
           '%result' => $result,
-        ), WATCHDOG_DEBUG);
+        ], WATCHDOG_DEBUG);
     }
 
     return $result;
@@ -188,7 +188,7 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
    *
    */
   public function usersAuthorizations(&$user) {
-    $authorizations = array();
+    $authorizations = [];
     foreach ($user->roles as $rid => $role_name_mixed_case) {
       $authorizations[] = drupal_strtolower($role_name_mixed_case);
     }
@@ -204,7 +204,7 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
     $message_type = NULL;
     $message_text = NULL;
     $role_name = $mapping['normalized'];
-    $tokens = array('!map_to' => $role_name);
+    $tokens = ['!map_to' => $role_name];
     $roles_by_name = $this->existingRolesByRoleName();
     $pass = isset($roles_by_name[drupal_strtolower($role_name)]);
 
@@ -229,7 +229,7 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
         $message_text .= ' ' . t('Since automatic Drupal role creation is disabled, an existing role must be mapped to.  Either enable role creation or map to an existing role.');
       }
     }
-    return array($message_type, $message_text);
+    return [$message_type, $message_text];
   }
 
   /**
@@ -253,7 +253,7 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
     static $roles_by_name;
 
     if ($reset || !is_array($roles_by_name)) {
-      $roles_by_name = array();
+      $roles_by_name = [];
       foreach (array_flip(user_roles(TRUE)) as $role_name => $rid) {
         $roles_by_name[drupal_strtolower($role_name)]['rid'] = $rid;
         $roles_by_name[drupal_strtolower($role_name)]['role_name'] = $role_name;
@@ -267,19 +267,19 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
    */
   public function normalizeMappings($mappings) {
 
-    $new_mappings = array();
+    $new_mappings = [];
     // In rid => role name format.
     $roles = user_roles(TRUE);
     $roles_by_name = array_flip($roles);
     foreach ($mappings as $i => $mapping) {
-      $new_mapping = array();
+      $new_mapping = [];
       $new_mapping['user_entered'] = $mapping[1];
       $new_mapping['from'] = $mapping[0];
       $new_mapping['normalized'] = $mapping[1];
       $new_mapping['simplified'] = $mapping[1];
       $create_consumers = (boolean) ($this->allowConsumerObjectCreation && $this->consumerConf->createConsumers);
       $new_mapping['valid'] = (boolean) (!$create_consumers && !empty($roles_by_name[$mapping[1]]));
-      $new_mapping['error_message'] = ($new_mapping['valid']) ? '' : t("Role %role_name does not exist and role creation is not enabled.", array('%role' => $mapping[1]));
+      $new_mapping['error_message'] = ($new_mapping['valid']) ? '' : t("Role %role_name does not exist and role creation is not enabled.", ['%role' => $mapping[1]]);
       $new_mappings[] = $new_mapping;
     }
 
@@ -290,7 +290,7 @@ class LdapAuthorizationConsumerDrupalRole extends LdapAuthorizationConsumerAbstr
    * @see ldapAuthorizationConsumerAbstract::convertToFriendlyAuthorizationIds
    */
   public function convertToFriendlyAuthorizationIds($authorizations) {
-    $authorization_ids_friendly = array();
+    $authorization_ids_friendly = [];
     foreach ($authorizations as $authorization_id => $authorization) {
       $authorization_ids_friendly[] = $authorization['name'] . '  (' . $authorization_id . ')';
     }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info
index 7229d079..4e4385d0 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info
@@ -9,8 +9,8 @@ files[] = LdapAuthorizationConsumerRole.class.php
 files[] = ldap_authorization_drupal_role.module
 files[] = ldap_authorization_drupal_role.inc
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.module b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.module
index 64ce5707..d1c2a7ab 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.module
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.module
@@ -10,7 +10,7 @@
  */
 function ldap_authorization_drupal_role_ldap_authorization_consumer() {
 
-  $types['drupal_role'] = array(
+  $types['drupal_role'] = [
     'consumer_name' => t('drupal role'),
     'consumer_name_plural' => t('drupal roles'),
     'consumer_short_name' => t('role'),
@@ -30,7 +30,7 @@ or if "Convert full dn" is selected below, they should look like:
 <code>students|students<br/>
 faculty|administrator
 </code><br/>',
-  );
+  ];
 
   return $types;
 }
@@ -40,7 +40,7 @@ faculty|administrator
  */
 function ldap_authorization_drupal_role_ldap_user_attrs_list_alter(&$available_user_attrs, &$params) {
 
-  $available_user_attrs['[property.role]'] = array(
+  $available_user_attrs['[property.role]'] = [
     'name' => 'Property: Drupal Roles',
     'source' => 'depends on configuration',
     'configurable_to_drupal' => 0,
@@ -49,8 +49,8 @@ function ldap_authorization_drupal_role_ldap_user_attrs_list_alter(&$available_u
     'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
     'enabled' => TRUE,
     'config_module' => 'ldap_authorization_drupal_role',
-    'prov_events' => array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, LDAP_USER_EVENT_CREATE_DRUPAL_USER),
+    'prov_events' => [LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, LDAP_USER_EVENT_CREATE_DRUPAL_USER],
     'prov_module' => 'ldap_authorization_drupal_role',
-  );
+  ];
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php
index 913d2a95..df2f8dc8 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php
@@ -22,25 +22,21 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
   public $allowConsumerObjectCreation = FALSE;
   public $defaultMembershipRid;
   public $anonymousRid;
-  public $defaultConsumerConfProperties = array(
+  public $defaultConsumerConfProperties = [
     'onlyApplyToLdapAuthenticated' => TRUE,
     'useMappingsAsFilter' => TRUE,
     'synchOnLogon' => TRUE,
     'revokeLdapProvisioned' => TRUE,
     'regrantLdapProvisioned' => TRUE,
     'createConsumers' => TRUE,
-  );
+  ];
 
   /**
    *
    */
   public function __construct($consumer_type) {
 
-    // @todo these properties are not used in ldap og 2, but when they are their derivation needs to be examined and tested
-    // as they may be per entity rids, not global.
-    // ldap_authorization_og_rid_from_role_name(OG_AUTHENTICATED_ROLE);
     $this->defaultMembershipRid = NULL;
-    // ldap_authorization_og_rid_from_role_name(OG_ANONYMOUS_ROLE);
     $this->anonymousRid = NULL;
 
     $params = ldap_authorization_og_ldap_authorization_consumer();
@@ -52,10 +48,10 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
    */
   public function og2ConsumerIdParts($consumer_id) {
     if (!is_scalar($consumer_id)) {
-      return array(NULL, NULL, NULL);
+      return [NULL, NULL, NULL];
     }
     $parts = explode(':', $consumer_id);
-    return (count($parts) != 3) ? array(NULL, NULL, NULL) : $parts;
+    return (count($parts) != 3) ? [NULL, NULL, NULL] : $parts;
   }
 
   /**
@@ -73,19 +69,19 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
    * @see LdapAuthorizationConsumerAbstract::normalizeMappings
    */
   public function normalizeMappings($mappings) {
-    $new_mappings = array();
+    $new_mappings = [];
     $group_entity_types = og_get_all_group_bundle();
     foreach ($mappings as $i => $mapping) {
       $from = $mapping[0];
       $to = $mapping[1];
       $to_parts = explode('(raw: ', $to);
       $user_entered = $to_parts[0];
-      $new_mapping = array(
+      $new_mapping = [
         'from' => $from,
         'user_entered' => $user_entered,
         'valid' => TRUE,
         'error_message' => '',
-      );
+      ];
 
       // Has simplified and normalized part in (). update normalized part as validation.
       if (count($to_parts) == 2) {
@@ -104,7 +100,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
         $role = (count($to_simplified_parts) < 3) ? OG_AUTHENTICATED_ROLE : $to_simplified_parts[2];
         $group_name = (count($to_simplified_parts) == 1) ? $to_simplified_parts[0] : $to_simplified_parts[1];
         list($group_entity, $group_entity_id) = ldap_authorization_og2_get_group_from_name($entity_type, $group_name);
-        $to_simplified = join(':', array($entity_type, $group_name));
+        $to_simplified = join(':', [$entity_type, $group_name]);
       }
       // May be simplified or normalized, but not both.
       else {
@@ -122,7 +118,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
         list($group_entity, $group_entity_id) = ldap_authorization_og2_get_group_from_name($entity_type, $group_name_or_entity_id);
         // If load by name works, $group_name_or_entity_id is group title.
         if ($group_entity) {
-          $to_simplified = join(':', array($entity_type, $group_name_or_entity_id));
+          $to_simplified = join(':', [$entity_type, $group_name_or_entity_id]);
         }
         else {
           $to_simplified = FALSE;
@@ -136,13 +132,13 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
         $new_mapping['normalized'] = FALSE;
         $new_mapping['simplified'] = FALSE;
         $new_mapping['valid'] = FALSE;
-        $new_mapping['error_message'] = t("cannot find matching group: !to", array('!to' => $to));
+        $new_mapping['error_message'] = t("cannot find matching group: !to", ['!to' => $to]);
       }
       else {
         $role_id = is_numeric($role) ? $role : ldap_authorization_og2_rid_from_role_name($entity_type, $group_entity->type, $group_entity_id, $role);
         $roles = og_roles($entity_type, isset($group_entity->type) ? $group_entity->type : NULL, 0, FALSE, TRUE);
         $role_name = is_numeric($role) ? $roles[$role] : $role;
-        $to_normalized = join(':', array($entity_type, $group_entity_id, $role_id));
+        $to_normalized = join(':', [$entity_type, $group_entity_id, $role_id]);
         $to_simplified = ($to_simplified) ? $to_simplified . ':' . $role_name : $to_normalized;
         $new_mapping['normalized'] = $to_normalized;
         $new_mapping['simplified'] = $to_simplified;
@@ -186,7 +182,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
   public function populateConsumersFromConsumerIds(&$consumers, $create_missing_consumers = FALSE) {
 
     // Generate a query for all og groups of interest.
-    $gids = array();
+    $gids = [];
     foreach ($consumers as $consumer_id => $consumer) {
       list($entity_type, $gid, $rid) = explode(':', $consumer_id);
       $gids[$entity_type][] = $gid;
@@ -239,7 +235,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
     og_membership_invalidate_cache();
 
     if ($consumers) {
-      $gids_to_clear_cache = array();
+      $gids_to_clear_cache = [];
       foreach ($consumers as $i => $consumer_id) {
         list($entity_type, $gid, $rid) = $this->og2ConsumerIdParts($consumer_id);
         $gids_to_clear_cache[$gid] = $gid;
@@ -274,14 +270,14 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
   protected function grantsAndRevokes($op, &$user, &$user_auth_data, $consumers, &$ldap_entry = NULL, $user_save = TRUE) {
 
     if (!is_array($user_auth_data)) {
-      $user_auth_data = array();
+      $user_auth_data = [];
     }
 
     $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
     $this->sortConsumerIds($op, $consumers);
 
-    $results = array();
-    $watchdog_tokens = array();
+    $results = [];
+    $watchdog_tokens = [];
     $watchdog_tokens['%username'] = $user->name;
     $watchdog_tokens['%action'] = $op;
     $watchdog_tokens['%user_save'] = $user_save;
@@ -301,7 +297,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
      * step #1:  generate $og_actions = array of form $og_actions['revokes'|'grants'][$gid] = $rid
      *  based on all consumer ids granted and revokes
      */
-    $og_actions = array('grants' => array(), 'revokes' => array());
+    $og_actions = ['grants' => [], 'revokes' => []];
     $consumer_ids_log = "";
     $log = "";
 
@@ -323,10 +319,10 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
         if ($user_has_authorization && !$user_has_authorization_recorded) {
           // Grant case 1: authorization id already exists for user, but is not ldap provisioned.  mark as ldap provisioned, but don't regrant.
           $results[$consumer_id] = TRUE;
-          $user_auth_data[$consumer_id] = array(
+          $user_auth_data[$consumer_id] = [
             'date_granted' => time(),
             'consumer_id_mixed_case' => $consumer_id,
-          );
+          ];
           $log .= "grant case 1: authorization id already exists for user, but is not ldap provisioned.  mark as ldap provisioned, but don't regrant";
           $log .= $consumer_id;
         }
@@ -397,7 +393,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
     $this->og2Grants($og_actions, $user, $user_auth_data);
     $this->og2Revokes($og_actions, $user, $user_auth_data);
 
-    $user_edit = array('data' => $user->data);
+    $user_edit = ['data' => $user->data];
     $user_edit['data']['ldap_authorizations'][$this->consumerType] = $user_auth_data;
     // Force a reload of the user object, since changes made through the grant-
     // and revoke-functions above might have changed og-related field data.
@@ -434,26 +430,26 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
         $all_group_rids = array_keys($all_group_roles);
         // Users current rids w/authen or anon roles returned.
         $users_group_rids = array_keys(og_get_user_roles($group_entity_type, $gid, $user->uid, TRUE));
-        $users_group_rids = array_diff($users_group_rids, array($anonymous_rid));
+        $users_group_rids = array_diff($users_group_rids, [$anonymous_rid]);
         // Rids to be added without anonymous rid.
-        $new_rids = array_diff($granting_rids, $users_group_rids, array($anonymous_rid));
+        $new_rids = array_diff($granting_rids, $users_group_rids, [$anonymous_rid]);
 
         // If adding OG_AUTHENTICATED_ROLE or any other role and does not currently have OG_AUTHENTICATED_ROLE, group.
         if (!in_array($authenticated_rid, $users_group_rids) && count($new_rids) > 0) {
-          $values = array(
+          $values = [
             'entity_type' => 'user',
             'entity' => $user->uid,
             'field_name' => FALSE,
             'state' => OG_STATE_ACTIVE,
-          );
+          ];
           $og_membership = og_group($group_entity_type, $gid, $values);
-          $consumer_id = join(':', array($group_entity_type, $gid, $authenticated_rid));
-          $user_auth_data[$consumer_id] = array(
+          $consumer_id = join(':', [$group_entity_type, $gid, $authenticated_rid]);
+          $user_auth_data[$consumer_id] = [
             'date_granted' => time(),
             'consumer_id_mixed_case' => $consumer_id,
-          );
+          ];
           // Granted on membership creation.
-          $new_rids = array_diff($new_rids, array($authenticated_rid));
+          $new_rids = array_diff($new_rids, [$authenticated_rid]);
 
         }
         foreach ($new_rids as $i => $rid) {
@@ -461,11 +457,11 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
         }
         foreach ($granting_rids as $i => $rid) {
           // Attribute to ldap regardless of if is being granted.
-          $consumer_id = join(':', array($group_entity_type, $gid, $rid));
-          $user_auth_data[$consumer_id] = array(
+          $consumer_id = join(':', [$group_entity_type, $gid, $rid]);
+          $user_auth_data[$consumer_id] = [
             'date_granted' => time(),
             'consumer_id_mixed_case' => $consumer_id,
-          );
+          ];
         }
       }
     }
@@ -496,8 +492,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
           // Unattribute to ldap even if user does not currently have role.
           unset($user_auth_data[ldap_authorization_og_authorization_id($gid, $rid, $group_entity_type)]);
         }
-        // define('OG_ANONYMOUS_ROLE', 'non-member'); define('OG_AUTHENTICATED_ROLE', 'member');
-        // ungroup if only authenticated and anonymous role left.
+        // Ungroup if only authenticated and anonymous role left.
         if (in_array($authenticated_rid, $revoking_rids) || count($remaining_rids) == 0) {
           $entity = og_ungroup($group_entity_type, $gid, 'user', $user->uid);
           $result = (boolean) ($entity);
@@ -514,7 +509,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
     static $users;
     if (!is_array($users)) {
       // No cache exists, create static array.
-      $users = array();
+      $users = [];
     }
     elseif ($reset && isset($users[$user->uid])) {
       // Clear users cache.
@@ -529,9 +524,9 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
       return $users[$user->uid];
     }
 
-    $authorizations = array();
+    $authorizations = [];
 
-    $user_entities = entity_load('user', array($user->uid));
+    $user_entities = entity_load('user', [$user->uid]);
     $memberships = og_get_entity_groups('user', $user_entities[$user->uid]);
     foreach ($memberships as $entity_type => $entity_memberships) {
       foreach ($entity_memberships as $og_membership_id => $gid) {
@@ -550,7 +545,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
    * @see ldapAuthorizationConsumerAbstract::convertToFriendlyAuthorizationIds
    */
   public function convertToFriendlyAuthorizationIds($authorizations) {
-    $authorization_ids_friendly = array();
+    $authorization_ids_friendly = [];
     foreach ($authorizations as $authorization_id => $authorization) {
       $authorization_ids_friendly[] = $authorization['name'] . '  (' . $authorization_id . ')';
     }
@@ -572,14 +567,14 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
      *
      */
     if (!$pass) {
-      $tokens = array(
+      $tokens = [
         '!from' => $mapping['from'],
         '!user_entered' => $mapping['user_entered'],
         '!error' => $mapping['error_message'],
-      );
+      ];
       $message_text = '<code>"' . t('!map_to|!user_entered', $tokens) . '"</code> ' . t('has the following error: !error.', $tokens);
     }
-    return array($message_type, $message_text);
+    return [$message_type, $message_text];
   }
 
   /**
@@ -612,7 +607,7 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
      */
 
     $og_fields = field_info_field(OG_GROUP_FIELD);
-    $rows = array();
+    $rows = [];
     $role_name = OG_AUTHENTICATED_ROLE;
 
     if (!empty($og_fields['bundles'])) {
@@ -644,11 +639,11 @@ class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract {
       }
     }
 
-    $variables = array(
-      'header' => array('Group Entity - Group Title - OG Membership Type', 'example'),
+    $variables = [
+      'header' => ['Group Entity - Group Title - OG Membership Type', 'example'],
       'rows' => $rows,
-      'attributes' => array(),
-    );
+      'attributes' => [],
+    ];
 
     $table = theme('table', $variables);
     $link = l(t('admin/config/people/ldap/authorization/test/og_group'), 'admin/config/people/ldap/authorization/test/og_group');
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info
index 499cbb6b..5ca572fe 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info
@@ -13,8 +13,8 @@ files[] = ldap_authorization_og.inc
 
 core = "7.x"
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.module b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.module
index 63f53f52..4478e42e 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.module
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.module
@@ -9,7 +9,7 @@
  * Implements hook_ldap_authorization_consumer().
  */
 function ldap_authorization_og_ldap_authorization_consumer() {
-  $types['og_group'] = array(
+  $types['og_group'] = [
     'consumer_name' => t('OG group'),
     'consumer_name_plural' => t('OG groups'),
     'consumer_short_name' => t('group'),
@@ -18,7 +18,7 @@ function ldap_authorization_og_ldap_authorization_consumer() {
     'consumer_class_name' => 'LdapAuthorizationConsumerOG',
     'consumer_class_file' => 'LdapAuthorizationConsumerOG.class.php',
     'consumer_module' => 'ldap_authorization_og',
-  );
+  ];
 
   $types['og_group']['consumer_mapping_directions'] = 'Mappings should be of form:<br/>
     <code>[raw authorization id]|[og entity type]:[og entity id or title]:[og role id]</code>
@@ -85,7 +85,7 @@ function ldap_authorization_og2_get_group_from_name($entity_type, $group_name) {
     }
   }
 
-  return array($group_entity, $group_entity_id);
+  return [$group_entity, $group_entity_id];
 
 }
 
@@ -95,10 +95,10 @@ function ldap_authorization_og2_get_group_from_name($entity_type, $group_name) {
 function ldap_authorization_og2_has_consumer_id($consumer_id, $uid) {
   $parts = explode(':', $consumer_id);
   $result = FALSE;
-  $watchdog_tokens = array(
+  $watchdog_tokens = [
     '%consumer_id' => $consumer_id,
     '%uid' => $uid,
-  );
+  ];
   if (count($parts) == 3) {
     list($group_type, $gid, $rid) = $parts;
     // Need to make sure entity exists before calling og_get_user_roles which will throw fatal error.
@@ -154,7 +154,7 @@ function ldap_authorization_og2_rid_from_role_name($entity_type, $bundle, $gid,
  *
  */
 function ldap_authorization_og_get_all_group_entities() {
-  $entities = array();
+  $entities = [];
   $group_entity_types = og_get_all_group_bundle();
   foreach ($group_entity_types as $entity_type => $group) {
     $entity_ids = og_get_all_group('node');
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/tests/BasicTests.test b/drupal7/sites/all/modules/ldap/ldap_authorization/tests/BasicTests.test
index 44fead5a..f0831432 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/tests/BasicTests.test
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/tests/BasicTests.test
@@ -15,11 +15,11 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
    *
    */
   public static function getInfo() {
-    return array(
+    return [
       'name' => 'LDAP Authorization Basic Tests',
       'description' => 'Test ldap authorization.',
       'group' => 'LDAP Authorization',
-    );
+    ];
   }
 
   /**
@@ -36,13 +36,13 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
    *
    */
   public function setUp() {
-    parent::setUp(array(
+    parent::setUp([
       'ldap_authentication',
       'ldap_authorization',
       'ldap_authorization_drupal_role',
     // don't need any real servers, configured, just ldap_servers code base.
       'ldap_test',
-    ));
+    ]);
     variable_set('ldap_simpletest', 2);
   }
 
@@ -70,11 +70,11 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
       );
     $this->assertTrue($setup_success, ' ldap_authorizations setup successful', 'LDAP Authorization: Test Setup Success');
 
-    $api_functions = array(
-      'ldap_authorization_get_consumer_object' => array(1, 1),
-      'ldap_authorization_get_consumers'  => array(3, 0),
-      'ldap_authorizations_user_authorizations'  => array(4, 1),
-    );
+    $api_functions = [
+      'ldap_authorization_get_consumer_object' => [1, 1],
+      'ldap_authorization_get_consumers'  => [3, 0],
+      'ldap_authorizations_user_authorizations'  => [4, 1],
+    ];
 
     foreach ($api_functions as $api_function_name => $param_count) {
       $reflector = new ReflectionFunction($api_function_name);
@@ -97,13 +97,13 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
 
     $sid = 'activedirectory1';
     $testid = 'ExclusiveModeUserLogon3';
-    $sids = array($sid);
+    $sids = [$sid];
     $this->prepTestData(LDAP_TEST_LDAP_NAME, $sids, 'provisionToDrupal', 'default', 'drupal_role_default');
 
-    $hpotter_logon_edit = array(
+    $hpotter_logon_edit = [
       'name' => 'hpotter',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $hpotter_logon_edit, t('Log in'));
     $this->assertText(t('Member for'), 'New Ldap user with good password authenticated.', 'LDAP Authorization: Test Logon');
     $this->assertTrue(
@@ -114,7 +114,7 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
 
     $hpotter = $this->testFunctions->userByNameFlushingCache('hpotter');
     $roles = array_values($hpotter->roles);
-    $desired_roles = array('students', 'authenticated user', 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu', 'cn=honors students,ou=groups,dc=hogwarts,dc=edu');
+    $desired_roles = ['students', 'authenticated user', 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu', 'cn=honors students,ou=groups,dc=hogwarts,dc=edu'];
     $diff1 = array_diff($roles, $desired_roles);
     $diff2 = array_diff($desired_roles, $roles);
     $correct_roles = (count($diff1) == 0 && count($diff2) == 0);
@@ -124,7 +124,7 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     }
     $this->assertTrue(
       $correct_roles,
-      t('hpotter granted correct roles on actual logon: %roles', array('%roles' => $roles_display)),
+      t('hpotter granted correct roles on actual logon: %roles', ['%roles' => $roles_display]),
       'LDAP Authorization: Test Logon for roles'
     );
 
@@ -214,7 +214,7 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     $sid = 'activedirectory1';
     $this->prepTestData(
     LDAP_TEST_LDAP_NAME,
-    array($sid),
+    [$sid],
     'provisionToDrupal',
     'default',
     'drupal_role_default'
@@ -224,19 +224,18 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
    * LDAP_authorz.Flags.status=0: Disable ldap_authorization_drupal_role configuration and make sure no authorizations performed
    */
 
-    $user = $this->drupalCreateUser(array());
-    $hpotter = $this->testFunctions->drupalLdapUpdateUser(array('name' => 'hpotter', 'mail' => 'hpotter@hogwarts.edu'), TRUE, $user);
+    $user = $this->drupalCreateUser([]);
+    $hpotter = $this->testFunctions->drupalLdapUpdateUser(['name' => 'hpotter', 'mail' => 'hpotter@hogwarts.edu'], TRUE, $user);
     // Just see if the correct ones are derived.
     list($new_authorizations, $notifications) = ldap_authorizations_user_authorizations($hpotter, 'query');
     $roles1 = $new_authorizations['drupal_role'];
 
-    // $consumer_conf_admin = ldap_authorization_get_consumer_admin_object('drupal_role', FALSE);.
     $this->consumerAdminConf['drupal_role']->status = 0;
     $this->consumerAdminConf['drupal_role']->save();
 
     // Just see if the correct ones are derived.
     list($new_authorizations, $notifications) = ldap_authorizations_user_authorizations($hpotter, 'query', 'drupal_role');
-    $roles2 = isset($new_authorizations['drupal_role']) ? $new_authorizations['drupal_role'] : array();
+    $roles2 = isset($new_authorizations['drupal_role']) ? $new_authorizations['drupal_role'] : [];
     // Not worried about which roles here, just that some are granted.
     $correct_roles = (count($roles1) > 0 && count($roles2) == 0);
 
@@ -260,8 +259,8 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     $this->consumerAdminConf['drupal_role']->status = 1;
     $this->consumerAdminConf['drupal_role']->save();
 
-    $user = $this->drupalCreateUser(array());
-    $hgrainger = $this->testFunctions->drupalLdapUpdateUser(array('name' => 'hgrainger', 'mail' => 'hgrainger@hogwarts.edu'), TRUE, $user);
+    $user = $this->drupalCreateUser([]);
+    $hgrainger = $this->testFunctions->drupalLdapUpdateUser(['name' => 'hgrainger', 'mail' => 'hgrainger@hogwarts.edu'], TRUE, $user);
 
     // Remove authmap in case it exists so test will work.
     db_delete('authmap')
@@ -271,7 +270,7 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
 
     // Just see if the correct ones are derived.
     list($new_authorizations, $notifications) = ldap_authorizations_user_authorizations($hgrainger, 'query');
-    $roles = isset($new_authorizations['drupal_role']) ? $new_authorizations['drupal_role'] : array();
+    $roles = isset($new_authorizations['drupal_role']) ? $new_authorizations['drupal_role'] : [];
     $success = (count($roles) == 0);
     $this->assertTrue(
       $success,
@@ -292,10 +291,10 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
 
     $this->consumerAdminConf['drupal_role']->synchOnLogon = 0;
     $this->consumerAdminConf['drupal_role']->save();
-    $edit = array(
+    $edit = [
       'name' => 'hgrainger',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(
       t('Member for'),
@@ -313,10 +312,10 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
 
     $this->consumerAdminConf['drupal_role']->synchOnLogon = 1;
     $this->consumerAdminConf['drupal_role']->save();
-    $edit = array(
+    $edit = [
       'name' => 'hgrainger',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'New Ldap user with good password authenticated.',
       'LDAP_authorz.Flags.synchOnLogon=1');
@@ -353,12 +352,12 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     // Set correct roles manually.
     $hpotter = user_load_by_name('hpotter');
     user_delete($hpotter->uid);
-    $user = $this->drupalCreateUser(array());
-    $hpotter = $this->testFunctions->drupalLdapUpdateUser(array('name' => 'hpotter', 'mail' => 'hpotter@hogwarts.edu'), TRUE, $user);
-    $edit = array(
+    $user = $this->drupalCreateUser([]);
+    $hpotter = $this->testFunctions->drupalLdapUpdateUser(['name' => 'hpotter', 'mail' => 'hpotter@hogwarts.edu'], TRUE, $user);
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(
       t('Member for'),
@@ -374,19 +373,19 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     $roles[$troublemaker->rid] = $troublemaker->name;
     $roles[$superadmin->rid] = $superadmin->name;
 
-    $data = array(
+    $data = [
       'roles' => $roles,
-      'data' => array(
+      'data' => [
         'ldap_authorizations' =>
-      array(
+      [
         'drupal_role' =>
-        array(
+        [
           $superadmin->name =>
-          array('date_granted' => 1304216778),
-        ),
-      ),
-      ),
-    );
+          ['date_granted' => 1304216778],
+        ],
+      ],
+      ],
+    ];
     $hpotter = user_save($hpotter, $data);
 
     // Apply correct authorizations.  should remove the administrator role but not the manually created 'troublemaker' role.
@@ -415,7 +414,7 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     $hpotter = user_load($hpotter->uid, TRUE);
     $roles = $hpotter->roles;
     unset($roles[$superadmin->rid]);
-    user_save($hpotter, array('roles' => $roles));
+    user_save($hpotter, ['roles' => $roles]);
     $hpotter = user_load($hpotter->uid, TRUE);
     list($new_authorizations, $notifications) = ldap_authorizations_user_authorizations($hpotter, 'set', 'drupal_role', 'logon');
     $hpotter = user_load($hpotter->uid, TRUE);
@@ -437,24 +436,24 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
   */
 
     // Add new mapping to and enable create consumers.
-    $this->prepTestData(LDAP_TEST_LDAP_NAME, array($sid), 'provisionToDrupal', 'default', 'drupal_role_default');
+    $this->prepTestData(LDAP_TEST_LDAP_NAME, [$sid], 'provisionToDrupal', 'default', 'drupal_role_default');
     $this->drupalGet('user/logout');
     $new_role = 'oompa-loompas';
     $this->consumerAdminConf['drupal_role']->createConsumers = 1;
-    $this->consumerAdminConf['drupal_role']->mappings[] = array(
+    $this->consumerAdminConf['drupal_role']->mappings[] = [
       'from' => 'cn=students,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => $new_role,
       'normalized' => $new_role,
       'simplified' => $new_role,
       'valid' => TRUE,
       'error_message' => '',
-    );
+    ];
     $this->consumerAdminConf['drupal_role']->save();
 
-    $edit = array(
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
 
     $new_role_created = in_array($new_role, array_values(user_roles()));
@@ -491,7 +490,7 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     variable_del('ldap_simpletest');
 
     $sid = 'activedirectory1';
-    $this->prepTestData(LDAP_TEST_LDAP_NAME, array($sid), 'provisionToDrupal', 'default');
+    $this->prepTestData(LDAP_TEST_LDAP_NAME, [$sid], 'provisionToDrupal', 'default');
 
     ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class');
     $ldap_server = new LdapServerAdmin($sid);
@@ -502,20 +501,20 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     }
     $ldap_server->save('add');
 
-    $consumer_form_data = array(
-      'sid'        => array('activedirectory1', 'activedirectory1'),
-      'status'     => array(TRUE, TRUE),
-      'only_ldap_authenticated'    => array(FALSE, TRUE),
-      'use_first_attr_as_groupid'       => array(FALSE, TRUE),
-      'mappings' => array("a|b", "a|b"),
-      'use_filter' => array(FALSE, TRUE),
-      'synchronization_modes[user_logon]' => array(TRUE, FALSE),
-      'synchronization_actions[revoke_ldap_provisioned]' => array(TRUE, FALSE),
-      'synchronization_actions[regrant_ldap_provisioned]' => array(FALSE, TRUE),
-      'synchronization_actions[create_consumers]' => array(TRUE, FALSE),
-    );
-
-    $this->privileged_user = $this->drupalCreateUser(array('administer site configuration'));
+    $consumer_form_data = [
+      'sid'        => ['activedirectory1', 'activedirectory1'],
+      'status'     => [TRUE, TRUE],
+      'only_ldap_authenticated'    => [FALSE, TRUE],
+      'use_first_attr_as_groupid'       => [FALSE, TRUE],
+      'mappings' => ["a|b", "a|b"],
+      'use_filter' => [FALSE, TRUE],
+      'synchronization_modes[user_logon]' => [TRUE, FALSE],
+      'synchronization_actions[revoke_ldap_provisioned]' => [TRUE, FALSE],
+      'synchronization_actions[regrant_ldap_provisioned]' => [FALSE, TRUE],
+      'synchronization_actions[create_consumers]' => [TRUE, FALSE],
+    ];
+
+    $this->privileged_user = $this->drupalCreateUser(['administer site configuration']);
     $this->drupalLogin($this->privileged_user);
     $ldap_server = ldap_servers_get_servers('activedirectory1', NULL, TRUE, TRUE);
     // This is just for debugging to show the server.
@@ -529,24 +528,24 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
     }
     $this->drupalGet('admin/config/people/ldap/servers/edit/activedirectory1');
 
-    foreach (array(0) as $i) {
-      foreach (array('drupal_role') as $consumer_type) {
+    foreach ([0] as $i) {
+      foreach (['drupal_role'] as $consumer_type) {
         // May want to put this back in after ctools requirement is fixed.
-        foreach (array(1) as $ctools_enabled) {
+        foreach ([1] as $ctools_enabled) {
           $this->ldapTestId = "testUIForms.$i.$consumer_type.ctools.$ctools_enabled";
           if ($ctools_enabled) {
-            module_enable(array('ctools'));
+            module_enable(['ctools']);
           }
           else {
-            module_disable(array('ctools'));
+            module_disable(['ctools']);
           }
 
-          $lcase_transformed = array();
+          $lcase_transformed = [];
 
           /** add server conf test **/
           $this->drupalGet('admin/config/people/ldap/authorization/add/' . $consumer_type);
 
-          $edit = array();
+          $edit = [];
           foreach ($consumer_form_data as $input_name => $input_values) {
             $edit[$input_name] = $input_values[$i];
           }
@@ -569,7 +568,7 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
 
           $this->drupalGet('admin/config/people/ldap/authorization/edit/' . $consumer_type);
 
-          $edit = array();
+          $edit = [];
           foreach ($consumer_form_data as $input_name => $input_values) {
             if ($input_values[$i] !== NULL) {
               $edit[$input_name] = $input_values[$i];
@@ -591,7 +590,7 @@ class LdapAuthorizationBasicTests extends LdapTestCase {
 
           /** delete server conf test **/
           $this->drupalGet('admin/config/people/ldap/authorization/delete/' . $consumer_type);
-          $this->drupalPost('admin/config/people/ldap/authorization/delete/' . $consumer_type, array(), t('Delete'));
+          $this->drupalPost('admin/config/people/ldap/authorization/delete/' . $consumer_type, [], t('Delete'));
           ctools_include('export');
           ctools_export_load_object_reset('ldap_authorization');
           $consumer_conf = ldap_authorization_get_consumer_conf($consumer_type);
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/tests/Og2Tests.test b/drupal7/sites/all/modules/ldap/ldap_authorization/tests/Og2Tests.test
index b691d2bf..229501e4 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/tests/Og2Tests.test
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/tests/Og2Tests.test
@@ -1,20 +1,22 @@
 <?php
 
 /**
- * @file Simpletest for Ldap Authorization OG Module, for og 7.x-2.x.
- *
- * Manual testing to accompany simpletests:
- *  - logon with og authorization disabled and make sure nothing happens
- *  - logon with og authorization enabled and make sure admin and member group memberships granted
- *  - change mappings so no roles granted
- *  - logon and make sure memberships revoked.
+ * @file
+ * Simpletest for Ldap Authorization OG Module, for og 7.x-2.x.
  */
 
 drupal_load('module', 'ldap_test');
 module_load_include('php', 'ldap_test', 'LdapTestCase.class');
 require_once drupal_get_path('module', 'ldap_authorization_og') . '/LdapAuthorizationConsumerOG.class.php';
+
 /**
+ * Simpletest for Ldap Authorization OG Module, for og 7.x-2.x.
  *
+ * Manual testing to accompany simpletests:
+ *  - logon with og authorization disabled and make sure nothing happens
+ *  - logon with og authorization enabled and make sure admin and member group memberships granted
+ *  - change mappings so no roles granted
+ *  - logon and make sure memberships revoked.
  */
 class LdapAuthorizationOg2Tests extends LdapTestCase {
 
@@ -22,25 +24,25 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
   public $groupBundle = 'group';
   public $groupType = 'node';
   public $group_content_type = NULL;
-  public $group_nodes = array();
+  public $group_nodes = [];
   public $user1;
   public $consumerType = 'og_group';
   public $module_name = 'ldap_authorization_og';
   protected $ldap_test_data;
-  public $customOgRoles = array(
-    'dungeon-master' => array('entity_type' => 'node', 'bundle_type' => 'group'),
-    'time-keeper' => array('entity_type' => 'node', 'bundle_type' => 'group'),
-  );
+  public $customOgRoles = [
+    'dungeon-master' => ['entity_type' => 'node', 'bundle_type' => 'group'],
+    'time-keeper' => ['entity_type' => 'node', 'bundle_type' => 'group'],
+  ];
 
   /**
    *
    */
   public static function getInfo() {
-    return array(
+    return [
       'group' => 'LDAP Authorization',
       'name' => 'OG 7.x-2.x Tests.',
       'description' => 'Test ldap authorization og 2.',
-    );
+    ];
   }
 
   /**
@@ -53,19 +55,19 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
   /**
    *
    */
-  public function setUp($addl_modules = array()) {
-    parent::setUp(array('ldap_authentication', 'ldap_authorization', 'ldap_authorization_og'));
+  public function setUp($addl_modules = []) {
+    parent::setUp(['ldap_authentication', 'ldap_authorization', 'ldap_authorization_og']);
     variable_set('ldap_simpletest', 2);
 
     $this->user1 = $this->drupalCreateUser();
-    $this->groups = array();
-    $this->prepTestData(LDAP_TEST_LDAP_NAME, array('activedirectory1'));
+    $this->groups = [];
+    $this->prepTestData(LDAP_TEST_LDAP_NAME, ['activedirectory1']);
 
     // Create group and group content node types.
-    $this->groupBundle = $this->drupalCreateContentType(array(
+    $this->groupBundle = $this->drupalCreateContentType([
       'type' => 'group',
       'name' => 'OG Group',
-    ))->type;
+    ])->type;
 
     og_create_field(OG_GROUP_FIELD, $this->groupEntityType, $this->groupBundle);
     og_create_field(OG_AUDIENCE_FIELD, $this->groupEntityType, $this->groupBundle);
@@ -75,7 +77,7 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     $this->testFunctions->getCsvLdapData(LDAP_TEST_LDAP_NAME);
     foreach ($this->testFunctions->csvTables['groups'] as $guid => $group) {
       $label = $group['cn'];
-      $settings = array();
+      $settings = [];
       $settings['type'] = $this->groupBundle;
       $settings[OG_GROUP_FIELD][LANGUAGE_NONE][0]['value'] = 1;
       $settings['uid'] = $this->user1->uid;
@@ -106,13 +108,13 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
    * Get test data in convenient format, so tests are easier to read and write.
    */
   public function getTestData($debug = FALSE) {
-    $group_nodes = array();
-    $group_nids = array();
-    $group_entity_ids = array();
-    $roles = array();
-    $roles_by_name = array();
-    $consumer_ids = array();
-    foreach (array('gryffindor', 'students', 'faculty', 'users', 'hufflepuff', 'slytherin') as $i => $group_name) {
+    $group_nodes = [];
+    $group_nids = [];
+    $group_entity_ids = [];
+    $roles = [];
+    $roles_by_name = [];
+    $consumer_ids = [];
+    foreach (['gryffindor', 'students', 'faculty', 'users', 'hufflepuff', 'slytherin'] as $i => $group_name) {
       list($group_nodes[$group_name], $group_entity_ids[$group_name]) = ldap_authorization_og2_get_group_from_name($this->groupEntityType, $group_name);
       $nid = $group_nodes[$group_name]->nid;
       $group_nids[$group_name] = $nid;
@@ -126,7 +128,7 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     if ($debug) {
       debug("group_nids"); debug($group_nids); debug("group_entity_ids"); debug($group_entity_ids); debug("roles"); debug($roles); debug("roles_by_name"); debug($roles_by_name);
     }
-    return array($group_nodes, $group_nids, $group_entity_ids, $roles_by_name, $consumer_ids);
+    return [$group_nodes, $group_nids, $group_entity_ids, $roles_by_name, $consumer_ids];
   }
 
   /**
@@ -169,12 +171,12 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
      *   og_is_member($group_type, $gid, $entity_type = 'user', $entity = NULL, $states = array(OG_STATE_ACTIVE))
      */
 
-    $values = array(
+    $values = [
       'entity_type' => 'user',
       'entity' => $web_user->uid,
       'field_name' => FALSE,
       'state' => OG_STATE_ACTIVE,
-    );
+    ];
     $og_gryffindor_membership = og_group($this->groupType, $group_nids['gryffindor'], $values);
     $og_faculty_membership = og_group($this->groupType, $group_nids['faculty'], $values);
 
@@ -185,7 +187,7 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
 
     // Need to reload because of issue with og_group and og_role_grant.
     $web_user = user_load($web_user->uid, TRUE);
-    $ids = array($web_user->uid);
+    $ids = [$web_user->uid];
     $user_entity = entity_load('user', $ids);
 
     $this->assertTrue(og_is_member($this->groupType, $group_nids['gryffindor'], 'user', $web_user),
@@ -217,12 +219,12 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     $this->assertTrue($og_auth->hasAuthorization($web_user, ldap_authorization_og_authorization_id($group_nids['faculty'], $roles_by_name['faculty'][OG_ADMINISTRATOR_ROLE], 'node')),
       'hasAuthorization() method works for non LDAP provisioned og authorization, faculty admin role', $this->ldapTestId);
 
-    $should_haves = array(
+    $should_haves = [
       $consumer_ids['gryffindor'][OG_AUTHENTICATED_ROLE] => 'gryffindor member',
       $consumer_ids['faculty'][OG_AUTHENTICATED_ROLE] => 'faculty member',
       $consumer_ids['faculty'][OG_ADMINISTRATOR_ROLE] => 'faculty admin',
       $consumer_ids['faculty']['dungeon-master'] => 'faculty dungeon master',
-    );
+    ];
 
     foreach ($should_haves as $consumer_id => $descriptor) {
       $this->assertTrue(ldap_authorization_og2_has_consumer_id($consumer_id, $web_user->uid),
@@ -230,21 +232,21 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     }
 
     $ldap_entry = NULL;
-    $user_data = array();
+    $user_data = [];
     $web_user = user_load($web_user->uid, TRUE);
 
     $this->assertTrue(ldap_authorization_og2_has_consumer_id($consumer_ids['faculty']['dungeon-master'], $web_user->uid),
       "LdapAuthorizationConsumerOG has faculty member role BEFORE authorizationRevoke() test revoke on member role " . $consumer_ids['faculty']['dungeon-master'], $this->ldapTestId);
 
     $web_user = user_load($web_user->uid, TRUE);
-    $consumers = array($consumer_ids['faculty']['dungeon-master'] => $og_auth->emptyConsumer);
+    $consumers = [$consumer_ids['faculty']['dungeon-master'] => $og_auth->emptyConsumer];
     $og_auth->authorizationRevoke($web_user, $user_data, $consumers, $ldap_entry, TRUE);
     $result = ldap_authorization_og2_has_consumer_id($consumer_ids['faculty']['dungeon-master'], $web_user->uid);
     $this->assertFalse($result,
       "LdapAuthorizationConsumerOG authorizationRevoke() test revoke on member role " . $consumer_ids['faculty']['dungeon-master'], $this->ldapTestId);
 
     $web_user = user_load($web_user->uid, TRUE);
-    $consumers = array($consumer_ids['faculty']['dungeon-master'] => $og_auth->emptyConsumer);
+    $consumers = [$consumer_ids['faculty']['dungeon-master'] => $og_auth->emptyConsumer];
     $og_auth->authorizationRevoke($web_user, $user_data, $consumers, $ldap_entry, TRUE);
     $this->assertFalse(ldap_authorization_og2_has_consumer_id($consumer_ids['faculty']['dungeon-master'], $web_user->uid),
       "LdapAuthorizationConsumerOG authorizationRevoke() test revoke on custom member role role " . $consumer_ids['faculty']['dungeon-master'], $this->ldapTestId);
@@ -253,30 +255,30 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     $initial_user_authorizations = $og_auth->usersAuthorizations($web_user, TRUE, TRUE);
     debug("initial_user_authorizations authorizations:"); debug($initial_user_authorizations);
     debug("initial_user data:"); debug($web_user->data);
-    $og_auth->authorizationGrant($web_user, $user_data, array($consumer_ids['students'][OG_AUTHENTICATED_ROLE] => $og_auth->emptyConsumer), $ldap_entry, TRUE);
+    $og_auth->authorizationGrant($web_user, $user_data, [$consumer_ids['students'][OG_AUTHENTICATED_ROLE] => $og_auth->emptyConsumer], $ldap_entry, TRUE);
     $success = ldap_authorization_og2_has_consumer_id($consumer_ids['students'][OG_AUTHENTICATED_ROLE], $web_user->uid);
     $this->assertTrue($success, "LdapAuthorizationConsumerOG authorizationGrant() test grant on member role " . $consumer_ids['students'][OG_AUTHENTICATED_ROLE], $this->ldapTestId);
     if (!$success) {
-      debug(array($user_data, array($consumer_ids['students'][OG_AUTHENTICATED_ROLE] => $og_auth->emptyConsumer)));
+      debug([$user_data, [$consumer_ids['students'][OG_AUTHENTICATED_ROLE] => $og_auth->emptyConsumer]]);
       debug("user authorizations:"); debug($og_auth->usersAuthorizations($web_user, TRUE));
     }
     $web_user = user_load($web_user->uid, TRUE);
-    $result = $og_auth->authorizationRevoke($web_user, $user_data, array('node:454:44334' => $og_auth->emptyConsumer), $ldap_entry, TRUE);
+    $result = $og_auth->authorizationRevoke($web_user, $user_data, ['node:454:44334' => $og_auth->emptyConsumer], $ldap_entry, TRUE);
     $this->assertFalse($result,
       'LdapAuthorizationConsumerOG authorizationRevoke() test revoke of bogus authorization', $this->ldapTestId);
 
     $web_user = user_load($web_user->uid, TRUE);
-    $result = $og_auth->authorizationGrant($web_user, $user_data, array('node:454:44334' => $og_auth->emptyConsumer), $ldap_entry, TRUE);
+    $result = $og_auth->authorizationGrant($web_user, $user_data, ['node:454:44334' => $og_auth->emptyConsumer], $ldap_entry, TRUE);
     $this->assertFalse($result,
       'LdapAuthorizationConsumerOG authorizationGrant() test grant of bogus authorization', $this->ldapTestId);
 
     $web_user = user_load($web_user->uid, TRUE);
-    $result = $og_auth->authorizationRevoke($web_user, $user_data, array('bogusformat'), $ldap_entry, TRUE);
+    $result = $og_auth->authorizationRevoke($web_user, $user_data, ['bogusformat'], $ldap_entry, TRUE);
     $this->assertFalse($result,
       'LdapAuthorizationConsumerOG authorizationRevoke()  test revoke malformed params', $this->ldapTestId);
 
     $web_user = user_load($web_user->uid, TRUE);
-    $result = $og_auth->authorizationGrant($web_user, $user_data, array('bogusformat'), $ldap_entry, TRUE);
+    $result = $og_auth->authorizationGrant($web_user, $user_data, ['bogusformat'], $ldap_entry, TRUE);
     $this->assertFalse($result,
       'LdapAuthorizationConsumerOG authorizationGrant() test grant malformed params', $this->ldapTestId);
 
@@ -305,7 +307,7 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     $sid = 'activedirectory1';
     $this->prepTestData(
     LDAP_TEST_LDAP_NAME,
-    array($sid),
+    [$sid],
     'provisionToDrupal',
     'default',
     'og_group2'
@@ -330,8 +332,8 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     $this->consumerAdminConf['og_group']->status = 0;
     $this->consumerAdminConf['og_group']->save();
 
-    $user = $this->drupalCreateUser(array());
-    $hpotter = $this->testFunctions->drupalLdapUpdateUser(array('name' => 'hpotter', 'mail' => 'hpotter@hogwarts.edu'), TRUE, $user);
+    $user = $this->drupalCreateUser([]);
+    $hpotter = $this->testFunctions->drupalLdapUpdateUser(['name' => 'hpotter', 'mail' => 'hpotter@hogwarts.edu'], TRUE, $user);
 
     // Just see if the correct ones are derived.
     list($new_authorizations, $notifications) = ldap_authorizations_user_authorizations($hpotter, 'query');
@@ -364,8 +366,8 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     $this->consumerAdminConf['og_group']->status = 1;
     $this->consumerAdminConf['og_group']->save();
 
-    $user = $this->drupalCreateUser(array());
-    $hgrainger = $this->testFunctions->drupalLdapUpdateUser(array('name' => 'hgrainger', 'mail' => 'hgrainger@hogwarts.edu'), TRUE, $user);
+    $user = $this->drupalCreateUser([]);
+    $hgrainger = $this->testFunctions->drupalLdapUpdateUser(['name' => 'hgrainger', 'mail' => 'hgrainger@hogwarts.edu'], TRUE, $user);
 
     // Remove old authmap in case it exists so test will work.
     db_delete('authmap')
@@ -390,10 +392,10 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
 
     $this->consumerAdminConf['og_group']->synchOnLogon = 0;
     $this->consumerAdminConf['og_group']->save();
-    $edit = array(
+    $edit = [
       'name' => 'hgrainger',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(
       t('Member for'),
@@ -411,10 +413,10 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
 
     $this->consumerAdminConf['og_group']->synchOnLogon = 1;
     $this->consumerAdminConf['og_group']->save();
-    $edit = array(
+    $edit = [
       'name' => 'hgrainger',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(t('Member for'), 'New Ldap user with good password authenticated.',
       'LDAP_authorz.Flags.synchOnLogon=1');
@@ -451,12 +453,12 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     // Set correct roles manually.
     $hpotter = user_load_by_name('hpotter');
     user_delete($hpotter->uid);
-    $user = $this->drupalCreateUser(array());
-    $hpotter = $this->testFunctions->drupalLdapUpdateUser(array('name' => 'hpotter', 'mail' => 'hpotter@hogwarts.edu'), TRUE, $user);
-    $edit = array(
+    $user = $this->drupalCreateUser([]);
+    $hpotter = $this->testFunctions->drupalLdapUpdateUser(['name' => 'hpotter', 'mail' => 'hpotter@hogwarts.edu'], TRUE, $user);
+    $edit = [
       'name' => 'hpotter',
       'pass' => 'goodpwd',
-    );
+    ];
     $this->drupalPost('user', $edit, t('Log in'));
     $this->assertText(
       t('Member for'),
@@ -472,19 +474,19 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     $roles[$troublemaker->rid] = $troublemaker->name;
     $roles[$superadmin->rid] = $superadmin->name;
 
-    $data = array(
+    $data = [
       'roles' => $roles,
-      'data' => array(
+      'data' => [
         'ldap_authorizations' =>
-      array(
+      [
         'og_group' =>
-        array(
+        [
           $superadmin->name =>
-          array('date_granted' => 1304216778),
-        ),
-      ),
-      ),
-    );
+          ['date_granted' => 1304216778],
+        ],
+      ],
+      ],
+    ];
     $hpotter = user_save($hpotter, $data);
 
     // Apply correct authorizations.  should remove the administrator role but not the manually created 'troublemaker' role.
@@ -513,7 +515,7 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
     $hpotter = user_load($hpotter->uid, TRUE);
     $roles = $hpotter->roles;
     unset($roles[$superadmin->rid]);
-    user_save($hpotter, array('roles' => $roles));
+    user_save($hpotter, ['roles' => $roles]);
     $hpotter = user_load($hpotter->uid, TRUE);
     list($new_authorizations, $notifications) = ldap_authorizations_user_authorizations($hpotter, 'set', 'og_group', 'logon');
     $hpotter = user_load($hpotter->uid, TRUE);
@@ -538,25 +540,25 @@ class LdapAuthorizationOg2Tests extends LdapTestCase {
       // @todo.  this needs to be finished when creation of og groups is added to ldap authorization og functionality
 
       // Add new mapping to and enable create consumers.
-      $this->prepTestData('hogwarts', array($sid), 'provisionToDrupal', 'default', 'drupal_role_default');
+      $this->prepTestData('hogwarts', [$sid], 'provisionToDrupal', 'default', 'drupal_role_default');
       $this->drupalGet('user/logout');
       $new_role = 'oompa-loompas';
       $this->consumerAdminConf['og_group']->createConsumers = 1;
-      $this->consumerAdminConf['og_group']->mappings[] = array(
+      $this->consumerAdminConf['og_group']->mappings[] = [
         'from' => 'cn=students,ou=groups,dc=hogwarts,dc=edu',
         'user_entered' => $new_role,
         'normalized' => 'node:' . $new_role . ':' . OG_AUTHENTICATED_ROLE,
         'simplified' => $new_role,
         'valid' => TRUE,
         'error_message' => '',
-      );
+      ];
 
       $this->consumerAdminConf['og_group']->save();
 
-      $edit = array(
+      $edit = [
         'name' => 'hpotter',
         'pass' => 'goodpwd',
-      );
+      ];
       $this->drupalPost('user', $edit, t('Log in'));
 
       $new_role_created = in_array($new_role, array_values(user_roles()));
diff --git a/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsDrupalUserLdapEntryFetcher.inc b/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsDrupalUserLdapEntryFetcher.inc
index e6710831..f93dd266 100644
--- a/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsDrupalUserLdapEntryFetcher.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsDrupalUserLdapEntryFetcher.inc
@@ -2,12 +2,14 @@
 
 /**
  * @file
- * FeedsDrupalUserLdapEntryFetcher
+ * FeedsDrupalUserLdapEntryFetcher.
  */
 
 define('LDAP_FEEDS_DRUPAL_USER_FETCHER_FILTER_AUTHENTICATED', FALSE);
 define('LDAP_FEEDS_DRUPAL_USER_FETCHER_FILTER_ROLES', FALSE);
-
+/**
+ *
+ */
 class FeedsDrupalUserLdapEntryFetcherResult extends FeedsFetcherResult {
 
   public $filterLdapAuthenticated;
@@ -28,26 +30,24 @@ class FeedsDrupalUserLdapEntryFetcherResult extends FeedsFetcherResult {
   }
 
   /**
-   * Overrides parent::getRaw();
+   * Overrides parent::getRaw();.
    */
   public function getRaw() {
 
-    // needs to loop through all users, and query ldap for each, one at a time
-
-    $query = new EntityFieldQuery;
+    // Needs to loop through all users, and query ldap for each, one at a time.
+    $query = new EntityFieldQuery();
     $entities = $query
       ->entityCondition('entity_type', 'user')
       ->execute();
     $users = entity_load('user', array_keys($entities['user']));
     if ($this->filterRoles) {
       $selectedRoles = array_filter($this->filterRoles);
-      $filterOnRoles = (boolean)(count($selectedRoles));
+      $filterOnRoles = (boolean) (count($selectedRoles));
     }
     else {
       $filterOnRoles = FALSE;
     }
 
-
     foreach ($users as $uid => $user) {
       if (
         $uid == 0 ||
@@ -64,16 +64,16 @@ class FeedsDrupalUserLdapEntryFetcherResult extends FeedsFetcherResult {
         foreach ($this->availableDrupalUserAttributes as $attr_name => $attr_conf) {
           $ldap_user['attr'][] = $attr_conf['token'];
           $ldap_user['attr'][$attr_conf['token']]['count'] = 1;
-          $ldap_user['attr'][$attr_conf['token']][0] = (string)$user->{$attr_name};
+          $ldap_user['attr'][$attr_conf['token']][0] = (string) $user->{$attr_name};
         }
 
         $results[] = $ldap_user;
       }
     }
     $results['count'] = count($results);
-   // drupal_set_message("<pre>" . print_r($results, TRUE));
     return $results;
   }
+
 }
 
 /**
@@ -94,11 +94,11 @@ class FeedsDrupalUserLdapEntryFetcher extends FeedsFetcher {
    * Override parent::configDefaults().
    */
   public function configDefaults() {
-    return array(
-      'filterLdapAuthenticated' => array(),
+    return [
+      'filterLdapAuthenticated' => [],
       'availableDrupalUserAttributes' => ldap_feeds_drupal_user_attributes(),
-      'filterRoles' => array(),
-    );
+      'filterRoles' => [],
+    ];
   }
 
   /**
@@ -106,13 +106,13 @@ class FeedsDrupalUserLdapEntryFetcher extends FeedsFetcher {
    */
   public function configForm(&$form_state) {
 
-    $form = array();
-    $form['filterLdapAuthenticated'] = array(
+    $form = [];
+    $form['filterLdapAuthenticated'] = [
       '#type' => 'checkbox',
       '#title' => t('Only return ldap authenticated users.'),
       '#default_value' => $this->config['filterLdapAuthenticated'],
       '#description' => t('If checked, only users who are associated with ldap accounts will be returned.'),
-    );
+    ];
 
     return $form;
   }
@@ -128,20 +128,18 @@ class FeedsDrupalUserLdapEntryFetcher extends FeedsFetcher {
    * Override parent::sourceForm().
    */
   public function sourceForm($source_config) {
-    $tokens = array(
+    $tokens = [
       '!edit_link' => l(t('Edit Feed'), 'admin/structure/feeds/' . $this->id),
-    );
+    ];
 
-    $form_state = array();
+    $form_state = [];
     $form = $this->configForm($form_state);
-    $form['addendum'] = array(
+    $form['addendum'] = [
       '#type' => 'markup',
       '#markup' => t('This import is configured at !edit_link.', $tokens),
-    );
+    ];
 
     return $form;
   }
 
-
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapEntryParser.inc b/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapEntryParser.inc
index 0b11b0ae..6d4bf471 100644
--- a/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapEntryParser.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapEntryParser.inc
@@ -2,33 +2,35 @@
 
 /**
  * @file
- *
  * Provides the Parser for an ldap entry array.
  */
 
+/**
+ *
+ */
 class FeedsLdapEntryParser extends FeedsParser {
   public $ldap_result;
 
-   /**
+  /**
    * Implements FeedsParser::parse().
    */
   public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
 
     $mappings = feeds_importer($this->id)->processor->config['mappings'];
     $ldap_entries = $fetcher_result->ldap_result;
-    $parsed_items = array();
+    $parsed_items = [];
     for ($i = 0; $i < $ldap_entries['count']; $i++) {
       $ldap_entry = $ldap_entries[$i];
-      $parsed_item = array('dn' => (string)$ldap_entry['dn']);
+      $parsed_item = ['dn' => (string) $ldap_entry['dn']];
       foreach ($mappings as $j => $map) {
         $source_lcase = drupal_strtolower($map['source']);
-        // dn is already parsed
+        // Dn is already parsed.
         if ($source_lcase == 'dn') {
           continue;
         }
         $source = $map['source'];
         if (isset($ldap_entry['attr'])) {
-          // exception need because of unconvential format of ldap data returned from $ldap_server->userUserNameToExistingLdapEntry
+          // Exception need because of unconvential format of ldap data returned from $ldap_server->userUserNameToExistingLdapEntry.
           $ldap_attributes = $ldap_entry['attr'];
         }
         else {
@@ -36,7 +38,7 @@ class FeedsLdapEntryParser extends FeedsParser {
         }
         if (isset($ldap_attributes[$source_lcase][0])) {
           if ($ldap_attributes[$source_lcase]['count'] == 1 && is_scalar($ldap_attributes[$source_lcase][0])) {
-            $parsed_item[$source] = (string)$ldap_attributes[$source_lcase][0];
+            $parsed_item[$source] = (string) $ldap_attributes[$source_lcase][0];
           }
           else {
             unset($ldap_attributes[$source_lcase]['count']);
@@ -54,12 +56,11 @@ class FeedsLdapEntryParser extends FeedsParser {
     return $result;
   }
 
-
   /**
    * Source form.
    */
   public function sourceForm($source_config) {
-    $form = array();
+    $form = [];
     $mappings = feeds_importer($this->id)->processor->config['mappings'];
     if (empty($source_config)) {
       $source_config = $this->config;
@@ -71,14 +72,13 @@ class FeedsLdapEntryParser extends FeedsParser {
    * Override parent::configFormValidate().
    */
   public function configFormValidate(&$values) {
-    $this->setConfig(array('sources' => $values));
+    $this->setConfig(['sources' => $values]);
     $this->save();
   }
 
-
   /**
-  * Override parent::getMappingSources().
-  */
+   * Override parent::getMappingSources().
+   */
   public function getMappingSources() {
     return FALSE;
   }
@@ -87,25 +87,22 @@ class FeedsLdapEntryParser extends FeedsParser {
    * Override parent::configDefaults().
    */
   public function configDefaults() {
-    /** removed until design decisions on multivalued attributes are made
-    return array(
-      'multivalued' => LDAP_FEEDS_QUERY_FETCHER_MULTI_DEFAULT,
-    );
-
-  */
-    return array();
+    return [];
   }
 
-   /**
+  /**
    * Override parent::configForm().
    */
   public function configForm(&$form_state) {
-    $form = array();
+    $form = [];
     return $form;
   }
 
+  /**
+   *
+   */
   public function sourceDefaults() {
-    return array();
+    return [];
   }
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapQueryFetcher.inc b/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapQueryFetcher.inc
index a7b91f84..94cc0279 100644
--- a/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapQueryFetcher.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapQueryFetcher.inc
@@ -2,32 +2,32 @@
 
 /**
  * @file
- * FeedsLdapQueryFetcher
+ * FeedsLdapQueryFetcher.
  */
 
 /**
- * FeedsLdapQueryFetcherResult
+ * FeedsLdapQueryFetcherResult.
  */
 class FeedsLdapQueryFetcherResult extends FeedsFetcherResult {
-  public $query_ids = array();
+  public $query_ids = [];
   public $ldap_result;
 
   /**
    * Constructor.
    */
   public function __construct($source_config) {
-    $this->query_ids = (isset($source_config['query_ids']) && is_array($source_config['query_ids'])) ? $source_config['query_ids'] : array();
+    $this->query_ids = (isset($source_config['query_ids']) && is_array($source_config['query_ids'])) ? $source_config['query_ids'] : [];
     parent::__construct('');
     $this->ldap_result = $this->getRaw();
     return $this->ldap_result;
   }
 
   /**
-   * Overrides parent::getRaw();
+   * Overrides parent::getRaw();.
    */
   public function getRaw() {
 
-    $results = array();
+    $results = [];
     $count = 0;
     foreach ($this->query_ids as $i => $query_id) {
       $ldapQuery = ldap_query_get_queries($query_id, 'enabled', TRUE);
@@ -42,6 +42,7 @@ class FeedsLdapQueryFetcherResult extends FeedsFetcherResult {
     }
     return $results;
   }
+
 }
 
 /**
@@ -58,27 +59,26 @@ class FeedsLdapQueryFetcher extends FeedsFetcher {
     return $result;
   }
 
-
   /**
    * Override parent::configDefaults().
    */
   public function configDefaults() {
-    return array(
-      'query_ids' => array(),
-    );
+    return [
+      'query_ids' => [],
+    ];
   }
 
-    /**
+  /**
    * Override parent::configForm().
    */
   public function configForm(&$form_state) {
     $queries = ldap_query_get_queries(NULL, 'enabled');
-    $query_options = array(0 => '--- select one or more queries ---');
+    $query_options = [0 => '--- select one or more queries ---'];
     foreach ($queries as $qid => $query) {
       $query_options[$qid] = $query->name;
     }
-    $form = array();
-    $form['query_ids'] = array(
+    $form = [];
+    $form['query_ids'] = [
       '#type' => 'select',
       '#title' => t('LDAP Query'),
       '#multiple' => TRUE,
@@ -86,10 +86,10 @@ class FeedsLdapQueryFetcher extends FeedsFetcher {
       '#required' => TRUE,
       '#default_value' => $this->config['query_ids'],
       '#description' => t('If more than one query is selected, results from all the queries will be returned.') .
-        ' ' .
-        t('Queries can be added and edited at !link', array('!link' => l(t('LDAP Query Admin'), LDAP_QUERY_INDEX_BASE_PATH))),
+      ' ' .
+      t('Queries can be added and edited at !link', ['!link' => l(t('LDAP Query Admin'), LDAP_QUERY_INDEX_BASE_PATH)]),
       '#options' => $query_options,
-    );
+    ];
 
     return $form;
   }
@@ -99,16 +99,16 @@ class FeedsLdapQueryFetcher extends FeedsFetcher {
    */
   public function sourceForm($source_config) {
 
-    $tokens = array(
+    $tokens = [
       '!edit_link' => l(t('Edit Feed'), 'admin/structure/feeds/' . $this->id),
-    );
+    ];
 
-    $form_state = array();
+    $form_state = [];
     $form = $this->configForm($form_state);
-    $form['preamble'] = array(
+    $form['preamble'] = [
       '#type' => 'markup',
       '#markup' => t('This import is configured at !edit_link.', $tokens),
-    );
+    ];
 
     return $form;
   }
@@ -117,7 +117,7 @@ class FeedsLdapQueryFetcher extends FeedsFetcher {
    * Override parent::sourceFormValidate().
    */
   public function sourceFormValidate(&$values) {
-     // could execute query and see if it returns anything for validation
+    // Could execute query and see if it returns anything for validation.
   }
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info b/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info
index d7df020c..4c4c0743 100644
--- a/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info
+++ b/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info
@@ -10,10 +10,10 @@ dependencies[] = ldap_query
 configure = admin/structure/feeds
 
 core = 7.x
-php = 5.2
+php = 5.4
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.module b/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.module
index b41c8aed..7ac2d18e 100644
--- a/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.module
+++ b/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.module
@@ -9,7 +9,7 @@
  */
 function ldap_feeds_ctools_plugin_api($owner, $api) {
   if ($owner == 'feeds' && $api == 'plugins') {
-  return array('version' => 1);
+    return ['version' => 1];
   }
 }
 
@@ -19,43 +19,45 @@ function ldap_feeds_ctools_plugin_api($owner, $api) {
 function ldap_feeds_feeds_plugins() {
 
   $path = drupal_get_path('module', 'ldap_feeds');
-  $info = array();
+  $info = [];
 
-  $info['FeedsLdapQueryFetcher'] = array(
+  $info['FeedsLdapQueryFetcher'] = [
     'name' => 'LDAP Query Fetcher',
     'description' => 'Fetch content from ldap query',
-    'handler' => array(
-      'parent' => 'FeedsFetcher', // This is the key name, not the class name.
+    'handler' => [
+       // This is the key name, not the class name.
+      'parent' => 'FeedsFetcher',
       'class' => 'FeedsLdapQueryFetcher',
       'file' => 'FeedsLdapQueryFetcher.inc',
       'path' => $path,
-    ),
-  );
+    ],
+  ];
 
-  $info['FeedsDrupalUserLdapEntryFetcher'] = array(
+  $info['FeedsDrupalUserLdapEntryFetcher'] = [
     'name' => 'Drupal User LDAP Entry Fetcher',
     'description' => 'Fetches one entry for each LDAP authenticated user.  Fetches both LDAP entry attributes such as
     <code>cn, dn,</code> etc.
       and Drupal user data such as <code>uid, name, mail, created, status, language, </code>and <code>signature</code>.
       Make sure to add dn in your LDAP query for this parser, if you use custom attributes.',
-    'handler' => array(
-      'parent' => 'FeedsFetcher', // This is the key name, not the class name.
+    'handler' => [
+      // This is the key name, not the class name.
+      'parent' => 'FeedsFetcher',
       'class' => 'FeedsDrupalUserLdapEntryFetcher',
       'file' => 'FeedsDrupalUserLdapEntryFetcher.inc',
       'path' => $path,
-    ),
-  );
+    ],
+  ];
 
-  $info['FeedsLdapEntryParser'] = array(
+  $info['FeedsLdapEntryParser'] = [
     'name'        => t('LDAP Entry Parser for Feeds'),
     'description' => t('Parse an LDAP Entry Array'),
-    'handler'     => array(
+    'handler'     => [
       'parent' => 'FeedsParser',
       'class'  => 'FeedsLdapEntryParser',
       'file'   => 'FeedsLdapEntryParser.inc',
       'path'   => $path,
-    ),
-  );
+    ],
+  ];
 
   return $info;
 
@@ -70,32 +72,33 @@ function ldap_feeds_enable() {
   cache_clear_all('plugins:feeds:plugins', 'cache');
 }
 
+/**
+ *
+ */
 function ldap_feeds_drupal_user_attributes() {
 
-  $attributes = array(
-    'uid' => array('token' => 'drupal.uid', 'description' => 'Drupal used id.  e.g. 413'),
-    'name' => array('token' => 'drupal.name', 'description' => 'Drupal username.  e.g. jdoe'),
-    'mail' => array('token' => 'drupal.mail', 'description' => 'Drupal email address.  e.g. jdoe@gmail.com'),
-    'created' => array('token' => 'drupal.created', 'description' => 'Drupal account created timestamp in unix e.g. 432432432'),
-    'status' => array('token' => 'drupal.status', 'description' => 'Drupal user status  e.g. 1 or 0'),
-    'language' => array('token' => 'drupal.language', 'description' => 'Drupal language.'),
-    'signature' => array('token' => 'drupal.signature', 'description' => 'Drupal signature.  e.g. Happy Joe'),
-    'login' => array('token' => 'drupal.login', 'description' => 'Drupal unix timestamp of last login  e.g. 1317494439'),
-    'init' => array('token' => 'drupal.init', 'description' => 'Drupal user init  e.g. jdoe@gmail.com'),
-  );
+  $attributes = [
+    'uid' => ['token' => 'drupal.uid', 'description' => 'Drupal used id.  e.g. 413'],
+    'name' => ['token' => 'drupal.name', 'description' => 'Drupal username.  e.g. jdoe'],
+    'mail' => ['token' => 'drupal.mail', 'description' => 'Drupal email address.  e.g. jdoe@gmail.com'],
+    'created' => ['token' => 'drupal.created', 'description' => 'Drupal account created timestamp in unix e.g. 432432432'],
+    'status' => ['token' => 'drupal.status', 'description' => 'Drupal user status  e.g. 1 or 0'],
+    'language' => ['token' => 'drupal.language', 'description' => 'Drupal language.'],
+    'signature' => ['token' => 'drupal.signature', 'description' => 'Drupal signature.  e.g. Happy Joe'],
+    'login' => ['token' => 'drupal.login', 'description' => 'Drupal unix timestamp of last login  e.g. 1317494439'],
+    'init' => ['token' => 'drupal.init', 'description' => 'Drupal user init  e.g. jdoe@gmail.com'],
+  ];
   // ldap_authentication and some other modules may want to add additional drupal user tokens
   // largely derived from the $user->data array, but possibly from related data such as authmaps
-  // some use cases for alter are simply edge cases
-
+  // some use cases for alter are simply edge cases.
   drupal_alter('ldap_feeds_drupal_user_attributes', $attributes);
 
   return $attributes;
 }
 
 /**
- * show some sample ldap user data to help with mapping interface
+ * Show some sample ldap user data to help with mapping interface.
  */
-
 function ldap_feeds_form_feeds_ui_mapping_form_alter(&$form, &$form_state, $form_id) {
 
   $importer = feeds_importer_load($form['#importer']);
@@ -109,47 +112,41 @@ function ldap_feeds_form_feeds_ui_mapping_form_alter(&$form, &$form_state, $form
 }
 
 /**
- * add additional data to mapping form for ldap query fetcher
+ * Add additional data to mapping form for ldap query fetcher.
  */
 function ldap_feeds_query_legend(&$form, $importer) {
 
   $source = feeds_source($importer->id);
   $fetcher = feeds_plugin('FeedsLdapQueryFetcher', $source->importer->id);
- // $fetcher_result = new FeedsLdapQueryFetcher($source->config);
- // $records = $fetcher->getRaw(); // FeedsSource $source
- // foreach ($records[0] as $field_name => $value) {
-  //  $sources[$field_name] = array(
-  //    'name' => array('#markup' => $field_name),
-   //   'description' => array('#markup' =>  _ldap_feeds_query_legend($records, $field_name)));
- // }
- // $form['legendset']['#description'] = t('Name column is the value that should go in the SOURCE column above.  Description column are from first few records of query in fetcher.', $tokens);
- // $form['legendset']['legend']['sources'] = $sources;
-
 }
 
+/**
+ *
+ */
 function _ldap_feeds_query_legend($records, $field_name) {
-  $examples = array();
+  $examples = [];
   foreach ($records as $i => $record) {
     $examples[] = $record[$field_name];
-    if ($i > 5 ) {
+    if ($i > 5) {
       break;
     }
   }
   return join(', ', array_filter($examples));
 }
+
 /**
- * add additional data to mapping form for drupal user fetcher
+ * Add additional data to mapping form for drupal user fetcher.
  */
 function ldap_feeds_drupal_user_legend(&$form, $importer) {
 
-  $sources = array();
+  $sources = [];
   $servers = ldap_servers_get_servers(NULL, 'enabled');
   $form['legendset']['#description'] = "";
   $drupal_user_attributes = $importer->config['fetcher']['config']['availableDrupalUserAttributes'];
 
   foreach ($drupal_user_attributes as $attr_name => $attr_conf) {
     $id = $attr_conf['token'];
-    $sources[$id] = array('name' => array('#markup' => $id), 'description' => array('#markup' => ''));
+    $sources[$id] = ['name' => ['#markup' => $id], 'description' => ['#markup' => '']];
   }
 
   foreach ($servers as $sid => $ldap_server) {
@@ -162,26 +159,26 @@ function ldap_feeds_drupal_user_legend(&$form, $importer) {
         }
         $id = $attr_conf['token'];
         if ($account) {
-          $sources[$id] = array('name' => array('#markup' => $id), 'description' => array('#markup' => $account->{$attr_name}));
+          $sources[$id] = ['name' => ['#markup' => $id], 'description' => ['#markup' => $account->{$attr_name}]];
         }
       }
 
       $ldap_user = ldap_servers_get_user_ldap_data($ldap_server->testingDrupalUsername, $sid);
       foreach ($ldap_user['attr'] as $id => $value) {
         if (!is_numeric($id) && is_scalar($ldap_user['attr'][$id][0]) && $ldap_user['attr'][$id]['count'] == 1) {
-          $sources[$id] = array('name' => array('#markup' => $id), 'description' => array('#markup' => $ldap_user['attr'][$id][0]));
+          $sources[$id] = ['name' => ['#markup' => $id], 'description' => ['#markup' => $ldap_user['attr'][$id][0]]];
         }
         elseif ($ldap_user['attr'][$id]['count'] > 1) {
           $item = t('MULTIVALUED ATTRIBUTE:') . join(" , \n", $ldap_user['attr'][$id]);
-          $sources[$id] = array('name' => array('#markup' => $id), 'description' => array('#markup' => $item));
+          $sources[$id] = ['name' => ['#markup' => $id], 'description' => ['#markup' => $item]];
         }
       }
       $form['legendset']['#description'] .= t('LDAP Attributes in the source "description" column are from testing ldap user (%testing_user) on the server %sid, which is configured in
-        the ldap server form.', array('%sid' => $sid, '%testing_user' => $ldap_server->testingDrupalUsername));
+        the ldap server form.', ['%sid' => $sid, '%testing_user' => $ldap_server->testingDrupalUsername]);
     }
     else {
-      foreach (array('dn' => 'distinguished name', 'cn' => 'cname') as $id => $value) {
-        $sources[$id] = array('name' => array('#markup' => $id), 'description' => array('#markup' => $value));
+      foreach (['dn' => 'distinguished name', 'cn' => 'cname'] as $id => $value) {
+        $sources[$id] = ['name' => ['#markup' => $id], 'description' => ['#markup' => $value]];
       }
     }
   }
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.examples.inc b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.examples.inc
index 7c669b88..be4c47d6 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.examples.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.examples.inc
@@ -3,11 +3,10 @@
 /**
  * @file
  * The ldap_help issues provides a filtered watchdog view for ldap issues.
- *
  */
 
 /**
- * the goal of this function is to illustrate samples from various ldap
+ * The goal of this function is to illustrate samples from various ldap
  * implementations (AD, openldap, etc) alongside default/common
  * ldap module configurations.  The data for the ldaps and the configuration
  * should be the same as is used in the simpletets.
@@ -16,35 +15,34 @@ function ldap_help_examples() {
   module_load_include('php', 'ldap_test', 'LdapTestFunctions.class');
   $test_functions = new LdapTestFunctions();
   drupal_add_library('system', 'drupal.collapse');
-  $sample_ldaps = array(
-   'activedirectory' => 'activedirectory1',
-   'openldap' => 'openldap1',
-  );
+  $sample_ldaps = [
+    'activedirectory' => 'activedirectory1',
+    'openldap' => 'openldap1',
+  ];
 
-
-  $form = array();
-  foreach ($sample_ldaps as  $ldap_type => $sample_ldap_id) {
+  $form = [];
+  foreach ($sample_ldaps as $ldap_type => $sample_ldap_id) {
 
     $sample_ldap_id = $sample_ldaps[$ldap_type];
     $test_functions->populateFakeLdapServerData(LDAP_TEST_LDAP_NAME, $sample_ldap_id);
     $data = $test_functions->data['ldap_servers'][$sample_ldap_id]['ldap'];
-    $form[$sample_ldap_id] = array(
-        '#type' => 'fieldset',
-        '#title' => $ldap_type,
-        '#description' => '',
-        '#attributes' => array('class' => array('collapsible', 'collapsed')),
-        '#collapsible' => TRUE,
-        '#collapsed' => TRUE,
-      );
-    foreach (array('people', 'groups') as $ou) {
-      $form[$sample_ldap_id][$ou] = array(
+    $form[$sample_ldap_id] = [
+      '#type' => 'fieldset',
+      '#title' => $ldap_type,
+      '#description' => '',
+      '#attributes' => ['class' => ['collapsible', 'collapsed']],
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    ];
+    foreach (['people', 'groups'] as $ou) {
+      $form[$sample_ldap_id][$ou] = [
         '#type' => 'fieldset',
         '#title' => "ou=$ou",
         '#description' => '',
-        '#attributes' => array('class' => array('collapsible', 'collapsed')),
+        '#attributes' => ['class' => ['collapsible', 'collapsed']],
         '#collapsible' => TRUE,
         '#collapsed' => TRUE,
-      );
+      ];
     }
 
     foreach ($data as $dn => $item) {
@@ -52,26 +50,26 @@ function ldap_help_examples() {
       $ou = $ou[0];
       unset($item['count']);
 
-      $li = array();
+      $li = [];
       foreach ($item as $attr => $values) {
         unset($values['count']);
         if (count($values) == 1) {
           $li[] = "$attr: " . $values[0] . '<br/>';
         }
         else {
-          $li[]  = theme('item_list', array('items' => $values , 'type' => 'ul', 'title' => $attr));
+          $li[] = theme('item_list', ['items' => $values, 'type' => 'ul', 'title' => $attr]);
         }
       }
-      $form[$sample_ldap_id][$ou][$dn] = array(
+      $form[$sample_ldap_id][$ou][$dn] = [
         '#type' => 'fieldset',
-        '#attributes' => array('class' => array('collapsible', 'collapsed')),
+        '#attributes' => ['class' => ['collapsible', 'collapsed']],
         '#title' => $dn,
         '#collapsible' => TRUE,
         '#collapsed' => TRUE,
-      );
-      $form[$sample_ldap_id][$ou][$dn][] = array(
-        '#markup' => theme('item_list', array('items' => $li , 'type' => 'ul', 'title' => '')),
-      );
+      ];
+      $form[$sample_ldap_id][$ou][$dn][] = [
+        '#markup' => theme('item_list', ['items' => $li, 'type' => 'ul', 'title' => '']),
+      ];
 
     }
   }
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info
index 9f459df9..260f7e7a 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info
@@ -2,12 +2,13 @@ name = LDAP Help
 description = LDAP Help for configuration and reporting issues.
 package = Lightweight Directory Access Protocol
 core = 7.x
+php = 5.4
 
 dependencies[] = ldap_servers
 dependencies[] = ldap_test
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.install b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.install
index ada185fb..64f38fe7 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.install
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.install
@@ -2,14 +2,13 @@
 
 /**
  * @file
- * LDAP Help Install File
+ * LDAP Help Install File.
  */
 
 /**
  * Implements hook_uninstall().
  */
 function ldap_help_uninstall() {
-  //$result = db_query('DELETE FROM {variables} WHERE name like "ldap_authentication_%"');
   variable_del('ldap_help_watchdog_detail');
   variable_del('ldap_help_user_data_clear');
   variable_del('ldap_help_user_data_clear_set_date');
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.issues.inc b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.issues.inc
index 0d5ee11f..040d7fb4 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.issues.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.issues.inc
@@ -3,9 +3,11 @@
 /**
  * @file
  * The ldap_help issues provides a filtered watchdog view for ldap issues.
- *
  */
 
+/**
+ *
+ */
 function ldap_help_issues() {
 
   $text = '<h3>' . t('LDAP Help Module') . '</h3><p>' .
@@ -54,6 +56,5 @@ Additional directions are at the beginning of the add issue form at
 $ldap_config
 EOT;
 
-
   return $text;
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.module b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.module
index 9378f16f..0ec94aa0 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.module
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.module
@@ -3,100 +3,103 @@
 /**
  * @file
  * The ldaphelp module is a module to help admins debug ldap_integration modules.
- *
  */
 
 /**
  * Implements hook_menu().
  */
 function ldap_help_menu() {
-  $items = array();
-  $items['admin/config/people/ldap/help'] = array(
+  $items = [];
+  $items['admin/config/people/ldap/help'] = [
     'title' => 'Help',
     'type' => MENU_LOCAL_TASK,
     'weight' => 9,
     'description' => 'Debugging and Configuration Help with LDAP',
     'file' => 'ldap_help.resources.inc',
     'page callback' => 'ldap_help_main',
-    'access arguments' => array('administer site configuration'),
-  );
+    'access arguments' => ['administer site configuration'],
+  ];
 
-  $items['admin/config/people/ldap/help/intro'] = array(
+  $items['admin/config/people/ldap/help/intro'] = [
     'title' => 'Resources',
     'type' => MENU_DEFAULT_LOCAL_TASK,
-  );
+  ];
 
-  $items['admin/config/people/ldap/help/status'] = array(
+  $items['admin/config/people/ldap/help/status'] = [
     'title' => 'Status',
     'description' => 'LDAP status page',
     'page callback' => 'ldap_help_status',
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_help.status.inc',
     'type' => MENU_LOCAL_TASK,
     'weight' => 4,
-  );
+  ];
 
-  $items['admin/config/people/ldap/help/watchdog'] = array(
+  $items['admin/config/people/ldap/help/watchdog'] = [
     'title' => 'Watchdog',
     'description' => 'LDAP watchdog logs',
     'page callback' => 'ldap_help_watchdog',
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_help.watchdog.inc',
     'type' => MENU_LOCAL_TASK,
     'weight' => 5,
-  );
+  ];
 
-  $items['admin/config/people/ldap/help/issues'] = array(
+  $items['admin/config/people/ldap/help/issues'] = [
     'title' => 'Issue Reporting',
     'description' => 'Creating LDAP Issue Queue Items',
     'page callback' => 'ldap_help_issues',
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_help.issues.inc',
     'type' => MENU_LOCAL_TASK,
     'weight' => 7,
-  );
-
+  ];
 
-  $items['admin/config/people/ldap/help/examples'] = array(
+  $items['admin/config/people/ldap/help/examples'] = [
     'title' => 'Sample LDAPs',
     'description' => 'Sample LDAPs from Documentation',
     'page callback' => 'ldap_help_examples',
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_help.examples.inc',
     'type' => MENU_LOCAL_TASK,
     'weight' => 7,
-  );
-
+  ];
 
   return $items;
 }
 
+/**
+ *
+ */
 function ldap_help_form_ldap_servers_settings_alter(&$form, &$form_state) {
-  $form['watchdog_detail'] = array('#type' => 'fieldset', '#title' => t('Development'));
-  $form['watchdog_detail']['watchdog_detail'] = array(
+  $form['watchdog_detail'] = ['#type' => 'fieldset', '#title' => t('Development')];
+  $form['watchdog_detail']['watchdog_detail'] = [
     '#type' => 'checkbox',
     '#title' => t('Enabled Detailed LDAP Watchdog logging.  This is generally for
        debugging and reporting issues with the ldap modules and should not be left
        on.'),
     '#default_value' => variable_get('ldap_help_watchdog_detail', 0),
-  );
- $date = variable_get('ldap_help_user_data_clear_set_date', time());
- $form['watchdog_detail']['user_data_clear'] = array(
+  ];
+  $date = variable_get('ldap_help_user_data_clear_set_date', time());
+  $form['watchdog_detail']['user_data_clear'] = [
     '#type' => 'checkbox',
     '#title' => t('Discard and ignore user authorization data stored by ldap module in user records data before %date.
       This is useful for implementers of development versions of the module
-      that may have corrupt user data from the past.', array('%date' => date('Y-m-d H:i:s', $date))),
+      that may have corrupt user data from the past.', ['%date' => date('Y-m-d H:i:s', $date)]),
     '#default_value' => variable_get('ldap_help_user_data_clear', 0),
-  );  //array('%date' => date('Y-m-d H:i:s', $date))
- $form['watchdog_detail']['user_data_clear_date'] = array(
+  // array('%date' => date('Y-m-d H:i:s', $date))
+  ];
+  $form['watchdog_detail']['user_data_clear_date'] = [
     '#type' => 'checkbox',
-    '#title' => t('Reset the clear date to the current date %date', array('%date' => date('Y-m-d H:i:s'))),
+    '#title' => t('Reset the clear date to the current date %date', ['%date' => date('Y-m-d H:i:s')]),
     '#default_value' => variable_get('ldap_help_user_data_clear_set_date', 0),
-  );
+  ];
   $form['#submit'][] = 'ldap_help_watchdog_detail_submit';
 }
 
-
+/**
+ *
+ */
 function ldap_help_watchdog_detail_submit($form, &$form_state) {
   if ($form_state['submitted']) {
     $watchdog_detail = $form_state['values']['watchdog_detail'];
@@ -112,6 +115,9 @@ function ldap_help_watchdog_detail_submit($form, &$form_state) {
   }
 }
 
+/**
+ *
+ */
 function ldap_help_help($path, $arg) {
 
   $help = '<h3>' . t('LDAP Help Module') . '</h3><p>' .
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.resources.inc b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.resources.inc
index 11598f4e..983e37c9 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.resources.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.resources.inc
@@ -3,9 +3,11 @@
 /**
  * @file
  * The ldap_help resources are just links.
- *
  */
 
+/**
+ *
+ */
 function ldap_help_main() {
 
   $text = <<<EOT
@@ -51,6 +53,5 @@ function ldap_help_main() {
 
 EOT;
 
-
   return $text;
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.status.inc b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.status.inc
index 31b4fa8a..5b6cb78a 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.status.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.status.inc
@@ -2,44 +2,46 @@
 
 /**
  * @file
- * status file for ldaphelp module
- *
+ * Status file for ldaphelp module.
  */
 
+/**
+ *
+ */
 function ldap_help_status($return = 'html') {
 
   drupal_add_css(drupal_get_path('module', 'system') . '/system.css', 'module', 'all', FALSE);
-  include_once(drupal_get_path('module', 'system') . '/system.admin.inc');
+  include_once drupal_get_path('module', 'system') . '/system.admin.inc';
 
-  // server and LDAP Module Data
+  // Server and LDAP Module Data.
   $heading = "Server and LDAP Module";
   $key = 'server';
   $phpinfo = ldap_help_parsePHPModules();
   $status['server'] = ldap_help_get_server($phpinfo, $info);
   $reporting_text = _ldap_help_parse_status_to_text($status['server'], $heading);
-  $content = "<h3>$heading</h3>" . theme('status_report', array('requirements' => $status['server'])); //  . ldap_help_phpinfo();
+  $content = "<h3>$heading</h3>" . theme('status_report', ['requirements' => $status['server']]);
 
   $status['user_settings'] = ldap_help_get_user_settings();
-  $content .= "<h3>User Settings</h3>" . theme('status_report', array('requirements' => $status['user_settings']));
+  $content .= "<h3>User Settings</h3>" . theme('status_report', ['requirements' => $status['user_settings']]);
 
   if (module_exists('ldap_servers')) {
     list($status['ldap_servers'], $servers) = ldap_help_get_ldap_servers();
-    $content .= "<h3>General Settings</h3>" . theme('status_report', array('requirements' => $status['ldap_servers']));
+    $content .= "<h3>General Settings</h3>" . theme('status_report', ['requirements' => $status['ldap_servers']]);
 
     foreach ($servers as $sid => $server) {
-      $content .= "<h3>Server: " . $server[1]['value'] . "</h3>" . theme('status_report', array('requirements' => $server));
+      $content .= "<h3>Server: " . $server[1]['value'] . "</h3>" . theme('status_report', ['requirements' => $server]);
     }
   }
 
   if (module_exists('ldap_authentication')) {
     $status['ldap_authentication'] = ldap_help_get_ldap_authentication();
-    $content .= "<h3>LDAP Authentication Settings</h3>" . theme('status_report', array('requirements' => $status['ldap_authentication']));
+    $content .= "<h3>LDAP Authentication Settings</h3>" . theme('status_report', ['requirements' => $status['ldap_authentication']]);
   }
   if (module_exists('ldap_authorization')) {
     $status['ldap_authorizations'] = ldap_help_get_ldap_authorization();
     if (count($status['ldap_authorizations'])) {
       foreach ($status['ldap_authorizations'] as $sid => $mapping) {
-        $content .= "<h3>LDAP Authorization Mapping</h3>" . theme('status_report', array('requirements' => $mapping));
+        $content .= "<h3>LDAP Authorization Mapping</h3>" . theme('status_report', ['requirements' => $mapping]);
       }
     }
   }
@@ -52,6 +54,10 @@ function ldap_help_status($return = 'html') {
   }
 
 }
+
+/**
+ *
+ */
 function ldap_help_get_server($phpinfo, &$info) {
 
   $info['phpversion'] = phpversion();
@@ -71,9 +77,11 @@ function ldap_help_get_server($phpinfo, &$info) {
   $info['ldap']['text'] = $text;
 
   $modules = system_rebuild_module_data();
-  $ldapmodules = array('ldap_servers', 'ldap_authentication', 'ldap_authorization',
+  $ldapmodules = [
+    'ldap_servers', 'ldap_authentication', 'ldap_authorization',
     'ldap_authorization_drupal_role', 'ldap_authorization_og', 'ldap_feeds',
-    'ldap_query', 'ldap_sso', 'ldap_views');
+    'ldap_query', 'ldap_sso', 'ldap_views',
+  ];
 
   foreach ($ldapmodules as $ldapmodule) {
     $data['status'] = $modules[$ldapmodule]->status;
@@ -86,117 +94,120 @@ function ldap_help_get_server($phpinfo, &$info) {
     $info[$ldapmodule] = $data;
   }
 
-  // set status array to be converted into html table.
+  // Set status array to be converted into html table.
   if (isset($phpinfo['Apache Environment'])) {
-    $status[] = array(
+    $status[] = [
       'title' => 'Apache',
-      'value' => $phpinfo['Apache Environment']['SERVER_SOFTWARE']
-    );
+      'value' => $phpinfo['Apache Environment']['SERVER_SOFTWARE'],
+    ];
   }
   elseif (isset($_SERVER["SERVER_SOFTWARE"])) {
-        $status[] = array(
+    $status[] = [
       'title' => 'SERVER_SOFTWARE',
-      'value' => $_SERVER["SERVER_SOFTWARE"]
-    );
+      'value' => $_SERVER["SERVER_SOFTWARE"],
+    ];
 
   }
 
-
-  $status[] = array(
+  $status[] = [
     'title' => 'PHP version',
-    'value' => phpversion()
-  );
-
-
-
+    'value' => phpversion(),
+  ];
 
-  if (! $info['ldaploaded']) {
-    $status[] = array( 'title' => 'PHP ldap extension not loaded',
-    'value' => l(t('PHP LDAP extension'), 'http://us2.php.net/ldap') . ' must be loaded for LDAP Integration to work.
+  if (!$info['ldaploaded']) {
+    $status[] = [
+      'title' => 'PHP ldap extension not loaded',
+      'value' => l(t('PHP LDAP extension'), 'http://us2.php.net/ldap') . ' must be loaded for LDAP Integration to work.
     It comes compiled with most versions of PHP.'  ,
-    'severity' => REQUIREMENT_ERROR);
+      'severity' => REQUIREMENT_ERROR,
+    ];
   }
   else {
-    $status[] = array( 'title' => 'PHP ldap extension data',
-    'value' => $info['ldap']['text']  ,
-    'severity' => 0);
+    $status[] = [
+      'title' => 'PHP ldap extension data',
+      'value' => $info['ldap']['text']  ,
+      'severity' => 0,
+    ];
   }
 
-  $status[] = array(
-    'title' => 'mcrypt extension loaded',
-    'value' => (extension_loaded('mcrypt')) ? "yes" : "no",
-  );
-
-  $status[] = array(
+  $status[] = [
     'title' => 'open ssl extension loaded',
     'value' => extension_loaded('openssl') ? "yes" : "no",
-  );
+  ];
 
-  $status[] = array('title' => 'Drupal', 'value' => VERSION , 'severity' => "0");
+  $status[] = ['title' => 'Drupal', 'value' => VERSION , 'severity' => "0"];
 
-  foreach ( $ldapmodules as $ldapmodule) {
-    $status[] = array('title' => $ldapmodule, 'value' => $info[$ldapmodule]['text'], 'severity' => "0");
+  foreach ($ldapmodules as $ldapmodule) {
+    $status[] = ['title' => $ldapmodule, 'value' => $info[$ldapmodule]['text'], 'severity' => "0"];
   }
   return $status;
 }
 
+/**
+ *
+ */
 function ldap_help_get_ldapauth(&$info) {
 
-  $status[] = array(
+  $status[] = [
     'title' => 'Authentication mode',
     value => $info['ldapauth']['login_process_text'] ,
-  'severity' => "0");
+    'severity' => "0",
+  ];
 
-  $status[] = array(
+  $status[] = [
     'title' => 'Conflict Resolve Feature',
     value => $info['ldapauth']['login_conflict_text'],
-  'severity' => "0");
+    'severity' => "0",
+  ];
 
   $info['ldapauth']['ldapauth_disable_pass_change_text'] = (LDAPAUTH_FORGET_PASSWORDS == TRUE) ? "Do not " : "Do";
   $info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'store users\' passwords during sessions.';
 
-  $status[] = array('title' => 'Security Options', value => $info['ldapauth']['ldapauth_disable_pass_change_text'], 'severity' => "0");
+  $status[] = ['title' => 'Security Options', value => $info['ldapauth']['ldapauth_disable_pass_change_text'], 'severity' => "0"];
 
   $info['ldapauth']['ldapauth_disable_pass_change_text'] = (LDAPAUTH_DISABLE_PASS_CHANGE == TRUE) ? "R" : "Do not R";
   $info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'emove password change fields from user edit form';
-  $info['ldapauth']['ldapauth_alter_email_field_text'] = 'ldapauth_alter_email_field: ' . LDAPAUTH_ALTER_EMAIL_FIELD ;
+  $info['ldapauth']['ldapauth_alter_email_field_text'] = 'ldapauth_alter_email_field: ' . LDAPAUTH_ALTER_EMAIL_FIELD;
 
-  $status[] = array('title' => 'LDAP UI Options', value => $info['ldapauth']['ldapauth_disable_pass_change_text'] . "<br/>" . $info['ldapauth']['ldapauth_alter_email_field_text'], 'severity' => "0");
+  $status[] = ['title' => 'LDAP UI Options', value => $info['ldapauth']['ldapauth_disable_pass_change_text'] . "<br/>" . $info['ldapauth']['ldapauth_alter_email_field_text'], 'severity' => "0"];
 
   return $status;
 }
 
-function _ldap_help_parse_status_to_text($status, $heading, $replacements = array()) {
+/**
+ *
+ */
+function _ldap_help_parse_status_to_text($status, $heading, $replacements = []) {
 
   $var_del = "\r\n------------------------------------------------\r\n";
   $section_del = "\r\n\r\n================================================\r\n";
   $name_val_del = ":\r\n";
   $lr = "\r\n";
 
-  $replacements = array_merge($replacements, array(
-  '<br/>' => $lr,
-  '<ul>' => $lr,
-  '</ul>' => $lr,
-  '<li>' => $lr,
-  '</li>' => "",
-  "<code>" => "",
-  "</code>" => "",
-  "<strong>" => "",
-  "</strong>" => ""
-  ));
-
-
-  $content = drupal_strtoupper($heading) . $lr  ;
+  $replacements = array_merge($replacements, [
+    '<br/>' => $lr,
+    '<ul>' => $lr,
+    '</ul>' => $lr,
+    '<li>' => $lr,
+    '</li>' => "",
+    "<code>" => "",
+    "</code>" => "",
+    "<strong>" => "",
+    "</strong>" => "",
+  ]);
+
+  $content = drupal_strtoupper($heading) . $lr;
   foreach ($status as $item) {
-  //  $item['value'] = str_replace(array('<br/>','<ul>','</ul>','<li>','</li>',"<code>","</code>"),
-   // array("\r\n","\r\n","\r\n","\r\n","\r\n"),$item['value'] );
-    $item['value'] = str_replace(array_keys($replacements), array_values($replacements), $item['value'] );
-    $item['title'] = str_replace(array_keys($replacements), array_values($replacements), $item['title'] );
+    $item['value'] = str_replace(array_keys($replacements), array_values($replacements), $item['value']);
+    $item['title'] = str_replace(array_keys($replacements), array_values($replacements), $item['title']);
     $content .= $item['title'] . $name_val_del . $item['value'] . $var_del;
   }
   return $content;
 }
 
+/**
+ *
+ */
 function ldap_help_phpinfo() {
   ob_start();
   phpinfo();
@@ -204,7 +215,9 @@ function ldap_help_phpinfo() {
   ob_end_clean();
   return $s;
 }
-/** parse php modules from phpinfo */
+
+/**
+ * Parse php modules from phpinfo .*/
 function ldap_help_parsePHPModules() {
   ob_start();
   phpinfo();
@@ -215,19 +228,21 @@ function ldap_help_parsePHPModules() {
   $s = preg_replace('/<th[^>]*>([^<]+)<\/th>/', "<info>\\1</info>", $s);
   $s = preg_replace('/<td[^>]*>([^<]+)<\/td>/', "<info>\\1</info>", $s);
   $vtmp = preg_split('/(<h2>[^<]+<\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE);
-  $vmodules = array();
+  $vmodules = [];
   for ($i = 1; $i < count($vtmp); $i++) {
     if (preg_match('/<h2>([^<]+)<\/h2>/', $vtmp[$i], $vmat)) {
       $vname = trim($vmat[1]);
       $vtmp2 = explode("\n", $vtmp[$i + 1]);
-      foreach ($vtmp2 AS $vone) {
+      foreach ($vtmp2 as $vone) {
         $vpat = '<info>([^<]+)<\/info>';
         $vpat3 = "/$vpat\s*$vpat\s*$vpat/";
         $vpat2 = "/$vpat\s*$vpat/";
-        if (preg_match($vpat3, $vone, $vmat)) { // 3cols
-          $vmodules[$vname][trim($vmat[1])] = array(trim($vmat[2]), trim($vmat[3]));
+        // 3cols.
+        if (preg_match($vpat3, $vone, $vmat)) {
+          $vmodules[$vname][trim($vmat[1])] = [trim($vmat[2]), trim($vmat[3])];
         }
-        elseif (preg_match($vpat2, $vone, $vmat)) { // 2cols
+        // 2cols.
+        elseif (preg_match($vpat2, $vone, $vmat)) {
           $vmodules[$vname][trim($vmat[1])] = trim($vmat[2]);
         }
       }
@@ -236,25 +251,30 @@ function ldap_help_parsePHPModules() {
   return $vmodules;
 }
 
+/**
+ *
+ */
 function ldap_help_get_user_settings() {
 
   $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
-  $options = array(
+  $options = [
     USER_REGISTER_ADMINISTRATORS_ONLY => t('Administrators only'),
     USER_REGISTER_VISITORS => t('Visitors'),
     USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL => t('Visitors, but administrator approval is required'),
-  );
+  ];
 
+  $status[] = [
+    'title' => 'Who can register accounts?',
+    'value' => $options[$user_register],
+  ];
 
-    $status[] = array(
-      'title' => 'Who can register accounts?',
-      'value' => $options[$user_register],
-    );
-
-    return $status;
+  return $status;
 
 }
 
+/**
+ *
+ */
 function ldap_help_get_ldap_servers() {
   if (!module_exists('ldap_servers')) {
     return FALSE;
@@ -266,15 +286,16 @@ function ldap_help_get_ldap_servers() {
   $conf_form = ldap_servers_settings();
 
   $selected = @$conf_form['encryption']['ldap_servers_encryption']['#default_value'];
-  $status[] = array(
-      'title' => 'encryption',
-      'value' => @$conf_form['encryption']['ldap_servers_encryption']['#options'][$selected],
-    );
+  $status[] = [
+    'title' => 'encryption',
+    'value' => @$conf_form['encryption']['ldap_servers_encryption']['#options'][$selected],
+  ];
 
   $servers_objects = ldap_servers_get_servers(NULL, 'all');
-  $servers = array();
+  $servers = [];
   $field_to_properties = LdapServer::field_to_properties_map();
-  $props = array_values($field_to_properties); // array('sid', 'name', 'status', 'ldap_type', 'port', 'tls', 'user_attr', 'mail_attr', 'user_dn_expression', 'ldap_to_drupal_user');
+  // Format: ['sid', 'name', 'status', 'ldap_type', 'port', 'tls', 'user_attr', 'mail_attr', 'user_dn_expression', 'ldap_to_drupal_user'].
+  $props = array_values($field_to_properties);
   foreach ($servers_objects as $sid => $server_object) {
     $server_admin = new LdapServerAdmin($sid);
     $form = $server_admin->drupalForm('update');
@@ -286,35 +307,38 @@ function ldap_help_get_ldap_servers() {
         $value = $form['bind_method']['bind_method']['#options'][$value];
       }
 
-      $servers[$sid][] = array(
-          'title' => $property,
-          'value' => $value,
-      );
+      $servers[$sid][] = [
+        'title' => $property,
+        'value' => $value,
+      ];
     }
 
-  $ldaps = (strpos(drupal_strtolower($server_object->address), 'ldaps') !== FALSE) ? 'y' : 'n';
-  $servers[$sid][] = array(
-    'title' => 'ldaps in address',
-    'value' => $ldaps,
-    );
+    $ldaps = (strpos(drupal_strtolower($server_object->address), 'ldaps') !== FALSE) ? 'y' : 'n';
+    $servers[$sid][] = [
+      'title' => 'ldaps in address',
+      'value' => $ldaps,
+    ];
 
-  $binddn = trim($server_object->binddn) ? 'yes' : 'no';
-  $servers[$sid][] = array(
-    'title' => 'binddn present',
-    'value' => $binddn,
-    );
+    $binddn = trim($server_object->binddn) ? 'yes' : 'no';
+    $servers[$sid][] = [
+      'title' => 'binddn present',
+      'value' => $binddn,
+    ];
 
-  $basedn = count($server_object->basedn);
-  $servers[$sid][] = array(
-    'title' => 'basedn count',
-    'value' => $basedn,
-    );
+    $basedn = count($server_object->basedn);
+    $servers[$sid][] = [
+      'title' => 'basedn count',
+      'value' => $basedn,
+    ];
 
   }
 
-  return array($status, $servers);
+  return [$status, $servers];
 }
 
+/**
+ *
+ */
 function ldap_help_get_ldap_authentication() {
 
   ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
@@ -341,6 +365,9 @@ function ldap_help_get_ldap_authentication() {
   return $status;
 }
 
+/**
+ *
+ */
 function ldap_help_get_ldap_user() {
   ldap_servers_module_load_include('php', 'ldap_user', 'LdapUserConfAdmin.class');
   $conf = new LdapUserConfAdmin();
@@ -354,11 +381,11 @@ function ldap_help_get_ldap_user() {
   return $status;
 }
 
-
-
-
+/**
+ *
+ */
 function ldap_help_get_ldap_authorization() {
-  $status = array();
+  $status = [];
   ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class');
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.settings');
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.admin');
@@ -367,20 +394,18 @@ function ldap_help_get_ldap_authorization() {
   $consumers = ldap_authorization_get_consumers();
 
   if (count($servers) == 0) {
-    return array();
+    return [];
   }
 
   foreach ($servers as $sid => $server) {
     $server_options[$sid] = $server->name;
   }
 
-
   $items['status']['mapping_id'] = 'string';
   $items['status']['consumer_type'] = 'string';
   $items['status']['status'] = 'string';
   $items['status']['only_ldap_authenticated'] = 'string';
 
-  // $items['filter_and_mappings']['mappings'] = 'string';
   $items['use_filter']['mappings'] = 'string';
 
   $items['misc_settings']['allow_synch_both_directions'] = 'string';
@@ -397,20 +422,22 @@ function ldap_help_get_ldap_authorization() {
     if ($map_content == 'data present') {
       $map_content .= ($maps == drupal_strtolower($maps)) ? ', lower case' : ', mixed case';
     }
-    $status[$consumer_type][] = array(
+    $status[$consumer_type][] = [
       'title' => 'mappings',
       'value' => $map_content,
-    );
+    ];
 
   }
   return $status;
 
 }
 
-
+/**
+ *
+ */
 function ldap_help_parse_form($form, $items) {
 
-  $status = array();
+  $status = [];
   foreach ($form as $fieldset_name => $field) {
     foreach ($field as $field_name => $field_data) {
       if (isset($items[$fieldset_name][$field_name])) {
@@ -426,16 +453,20 @@ function ldap_help_parse_form($form, $items) {
           case 'radios':
             $value = $field_data['#options'][$default_value];
             break;
+
           case 'select':
           case 'checkboxes':
             $value = $default_value;
             break;
+
           case 'checkbox':
-            $value = (boolean)($field_data['#default_value']) ? 'y' : 'n';
+            $value = (boolean) ($field_data['#default_value']) ? 'y' : 'n';
             break;
+
           case 'hidden':
             $value = $field_data['#value'];
             break;
+
           case 'textarea':
           case 'textfield':
 
@@ -443,12 +474,12 @@ function ldap_help_parse_form($form, $items) {
             break;
         }
         if ($items[$fieldset_name][$field_name] == 'empty') {
-          $value = ((boolean)trim($value)) ? 'populated' : 'empty';
+          $value = ((boolean) trim($value)) ? 'populated' : 'empty';
         }
-        $status[] = array(
+        $status[] = [
           'title' => $field_name,
           'value' => $value,
-        );
+        ];
 
       }
 
@@ -458,5 +489,4 @@ function ldap_help_parse_form($form, $items) {
 
   return $status;
 
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.watchdog.inc b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.watchdog.inc
index fae5c724..a2aa91ee 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.watchdog.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.watchdog.inc
@@ -3,16 +3,18 @@
 /**
  * @file
  * The ldap_help watchdog is just a filtered watchdog summary.
- *
  */
 
+/**
+ *
+ */
 function ldap_help_watchdog() {
 
   $path = drupal_get_path("module", "ldap_help");
   $_content = "";
   if (module_exists('dblog')) {
-    include_once(drupal_get_path('module', 'dblog') . '/dblog.admin.inc');
-    $_SESSION['dblog_overview_filter']['type'] = Array('ldap' => 'ldap');
+    include_once drupal_get_path('module', 'dblog') . '/dblog.admin.inc';
+    $_SESSION['dblog_overview_filter']['type'] = ['ldap' => 'ldap'];
     $_content .= "<h3>" . t('LDAP Watchdog Errors and Notifications') . "</h3>";
     $overview = dblog_overview();
     $_content .= render($overview);
@@ -25,6 +27,5 @@ function ldap_help_watchdog() {
     $_content .= l(t('Module enable page'), 'admin/build/modules');
   }
 
-
   return $_content;
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/config.inc b/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/config.inc
index 1ec7a1a5..005cbf25 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/config.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/config.inc
@@ -2,15 +2,18 @@
 
 /**
  * @file
- * test script for testing ldap functionality outside of Drupal
- *
+ * Test script for testing ldap functionality outside of Drupal.
  */
 
-die('Move this script outside of Drupal and uncomment the die statement in config.inc to run.'); // remove this line after moving out the scripts outside of drupal root.
+// Remove this line after moving out the scripts outside of drupal root.
+die('Move this script outside of Drupal and uncomment the die statement in config.inc to run.');
 
+/**
+ *
+ */
 function ldap_help_config() {
 
-  // these variables are just for convenience, they can be hard coded directly into the $config array
+  // These variables are just for convenience, they can be hard coded directly into the $config array.
   $provision_root = 'ou=test,ou=drupal,dc=ad,dc=mycollege,dc=edu';
   $query_root = 'dc=ad,dc=mycollege,dc=edu';
   $user_root = 'ou=people,dc=mycollege,dc=edu';
@@ -18,87 +21,90 @@ function ldap_help_config() {
   $bind_pwd = 'password';
   $server_address = 'ad.mycollege.edu';
 
-  $config = array(
-    'servers' => array(
-      'default test' => array(
+  $config = [
+    'servers' => [
+      'default test' => [
         'server_address' => $server_address,
         'server_port'  => 389,
         'server_tls'  => FALSE,
-        'server_bind_method'  => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT, // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON
+        // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON.
+        'server_bind_method'  => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT,
         'server_base_dn' => $user_root,
         'server_bind_dn' => $bind_user,
         'server_bind_pw' => $bind_pwd,
-        'test_queries' => array(
-          'user' => array(
+        'test_queries' => [
+          'user' => [
             'filter'  => 'cn=jbarclay',
-            'show_attr' => array('dn', 'cn', 'displayname', 'sn', 'givenname', 'mail', 'samaccountname', 'email'),
-          ),
-        ),
-        'test_provisions' => array(),
-      ),
-      'query test' => array(
+            'show_attr' => ['dn', 'cn', 'displayname', 'sn', 'givenname', 'mail', 'samaccountname', 'email'],
+          ],
+        ],
+        'test_provisions' => [],
+      ],
+      'query test' => [
         'server_address' => $server_address,
         'server_port'  => 389,
         'server_tls'  => FALSE,
-        'server_bind_method'  => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT, // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON
+        // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON.
+        'server_bind_method'  => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT,
         'server_base_dn' => $query_root,
         'server_bind_dn' => $bind_user,
         'server_bind_pw' => $bind_pwd,
-        'test_queries' => array(
-          'group' => array(
+        'test_queries' => [
+          'group' => [
             'filter'  => 'cn=ed-it-nag',
-            'show_attr' => array('dn', 'cn', 'samaccountname'),
-          ),
-        ),
-        'test_provisions' => array(),
-      ),
-      'provision test' => array(
+            'show_attr' => ['dn', 'cn', 'samaccountname'],
+          ],
+        ],
+        'test_provisions' => [],
+      ],
+      'provision test' => [
         'server_address' => $server_address,
         'server_port'  => 389,
         'server_tls'  => FALSE,
-        'server_bind_method'  => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT, // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON
+         // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON.
+        'server_bind_method'  => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT,
         'server_base_dn' => $provision_root,
         'server_bind_dn' => $bind_user,
         'server_bind_pw' => $bind_pwd,
-        'test_queries' => array(),
-        'test_provisions' => array(
-          'simple_user' => array(
+        'test_queries' => [],
+        'test_provisions' => [
+          'simple_user' => [
             'delete_if_exists' => TRUE,
             'find_filter' => "distinguishedName=cn=ed-drupal-user-17,$provision_root",
             'dn' => "cn=ed-drupal-user-17, $provision_root",
-            'attr' => array(
+            'attr' => [
               "displayName" => "Drupal User",
               "cn" => 'ed-drupal-user-17',
               "samaccountname" => 'ed-drupal-user-17',
-              "objectclass" => array(
+              "objectclass" => [
                 "top", "person", "organizationalPerson", "user",
-              ),
+              ],
               "description" => "test user",
               'mail' => 'ed-drupal-user-17@blah.com',
               'givenName' => 'Drupal',
               'sn' => 'User',
               'distinguishedName' => "cn=ed-drupal-user-17,$provision_root",
-            ),
-          ),
-          'simple_group' => array(
+            ],
+          ],
+          'simple_group' => [
             'delete_if_exists' => TRUE,
             'find_filter' => "distinguishedName=cn=ed-drupal-group2,$provision_root",
             'dn' => "cn=ed-drupal-group2,$provision_root",
-            'attr' => array(
+            'attr' => [
               "cn" => 'ed-drupal-group2',
               "sAMAccountName" => 'ed-drupal-group2',
               'instanceType' => '4',
-              "objectClass" => array(
+              "objectClass" => [
                 "top", "group",
-              ),
+              ],
               'name' => 'ed-drupal-group2',
               'distinguishedName' => "cn=ed-drupal-group2,$provision_root",
-            ),
-          ),
-        ),
-      ),
-    ),
-  );
+            ],
+          ],
+        ],
+      ],
+    ],
+  ];
 
   return $config;
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/functions.inc b/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/functions.inc
index 6c5cfc6d..268e0370 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/functions.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/functions.inc
@@ -1,14 +1,12 @@
 <?php
 
-
 /**
  * @file
- * test script functions for testing ldap functionality outside of Drupal
- *
+ * Test script functions for testing ldap functionality outside of Drupal.
  */
 
 error_reporting(E_ALL | E_STRICT);
-set_time_limit (0);
+set_time_limit(0);
 ini_set("display_errors", 1);
 ini_set("max_execution_time", 0);
 
@@ -26,10 +24,11 @@ define('LDAP_COMPARE_FALSE', 0x05);
 define('LDAP_COMPARE_TRUE', 0x06);
 define('LDAP_AUTH_METHOD_NOT_SUPPORTED', 0x07);
 define('LDAP_STRONG_AUTH_REQUIRED', 0x08);
-//NotusedinLDAPv3);
+
+// Not used in LDAPv3.
 define('LDAP_PARTIAL_RESULTS', 0x09);
 
-//Next5newinLDAPv3);
+// Next 5 new in LDAPv3.
 define('LDAP_REFERRAL', 0x0a);
 define('LDAP_ADMINLIMIT_EXCEEDED', 0x0b);
 define('LDAP_UNAVAILABLE_CRITICAL_EXTENSION', 0x0c);
@@ -68,11 +67,12 @@ define('LDAP_NOT_ALLOWED_ON_RDN', 0x43);
 define('LDAP_ALREADY_EXISTS', 0x44);
 define('LDAP_NO_OBJECT_CLASS_MODS', 0x45);
 define('LDAP_RESULTS_TOO_LARGE', 0x46);
-//NexttwoforLDAPv3);
+
+// Next two for LDAPv3.
 define('LDAP_AFFECTS_MULTIPLE_DSAS', 0x47);
 define('LDAP_OTHER', 0x50);
 
-//UsedbysomeAPIs);
+// Used by some APIs.
 define('LDAP_SERVER_DOWN', 0x51);
 define('LDAP_LOCAL_ERROR', 0x52);
 define('LDAP_ENCODING_ERROR', 0x53);
@@ -84,7 +84,7 @@ define('LDAP_USER_CANCELLED', 0x58);
 define('LDAP_PARAM_ERROR', 0x59);
 define('LDAP_NO_MEMORY', 0x5a);
 
-//PreliminaryLDAPv3codes);
+// Preliminary LDAPv3 codes.
 define('LDAP_CONNECT_ERROR', 0x5b);
 define('LDAP_NOT_SUPPORTED', 0x5c);
 define('LDAP_CONTROL_NOT_FOUND', 0x5d);
@@ -93,20 +93,21 @@ define('LDAP_MORE_RESULTS_TO_RETURN', 0x5f);
 define('LDAP_CLIENT_LOOP', 0x60);
 define('LDAP_REFERRAL_LIMIT_EXCEEDED', 0x61);
 
-
-//error_reporting(E_ALL  &  ~E_NOTICE);
-
 define('LDAP_SCRIPTS_COMMAND_LINE_WARNING', "Warning: PHP from the command line may have different PHP versions, php.ini files, and security context than running in a webserver context. This may produce false test results since Drupal LDAP Modules are run in the web server context.");
 
-require_once('config.inc');
+require_once 'config.inc';
 
+/**
+ *
+ */
 function ldap_help_connect($address, $port, $tls, $test = FALSE) {
 
   if ($test) {
-    $false_con = ldap_connect("fakehostname.sdfserewerdfsdf.com", 389); // test for ldap extensions that don't actually connect until bind
+    // Test for ldap extensions that don't actually connect until bind.
+    $false_con = ldap_connect("fakehostname.sdfserewerdfsdf.com", 389);
     if (ldap_errno($false_con) == LDAP_SUCCESS) {
       $con = ldap_connect($address, $port);
-      return array(LDAP_OTHER, "ldap_connect does not actually connect until bind with installed extension, so connect is not a valid test.", $con);
+      return [LDAP_OTHER, "ldap_connect does not actually connect until bind with installed extension, so connect is not a valid test.", $con];
     }
   }
 
@@ -114,33 +115,39 @@ function ldap_help_connect($address, $port, $tls, $test = FALSE) {
 
   if (!$con || ldap_errno($con) != LDAP_SUCCESS) {
     $err = ldap_errno($con) . ":" . ldap_error($con) . ":" . ldap_err2str(ldap_errno($con)) . "!";
-    return array(LDAP_CONNECT_ERROR, "LDAP Connect failure to  $address : $port. $err");
+    return [LDAP_CONNECT_ERROR, "LDAP Connect failure to  $address : $port. $err"];
   }
 
   // Use TLS if we are configured and able to.
   if ($tls) {
     ldap_get_option($con, LDAP_OPT_PROTOCOL_VERSION, $vers);
     if ($vers == -1) {
-      return array(LDAP_PROTOCOL_ERROR, "Could not get LDAP protocol version.");
+      return [LDAP_PROTOCOL_ERROR, "Could not get LDAP protocol version."];
     }
     if ($vers != 3) {
-      return array(LDAP_CONNECT_ERROR, 'Could not start TLS, only supported by LDAP v3.');
+      return [LDAP_CONNECT_ERROR, 'Could not start TLS, only supported by LDAP v3.'];
     }
     elseif (!function_exists('ldap_start_tls')) {
-      return array(LDAP_CONNECT_ERROR, 'Could not start TLS. It does not seem to be supported by this PHP setup.');
+      return [LDAP_CONNECT_ERROR, 'Could not start TLS. It does not seem to be supported by this PHP setup.'];
     }
     elseif (!ldap_start_tls($con)) {
-      return array(LDAP_CONNECT_ERROR, "Could not start TLS. (Error " . ldap_errno($con) . ":" . ldap_error($con) . ").");
+      return [LDAP_CONNECT_ERROR, "Could not start TLS. (Error " . ldap_errno($con) . ":" . ldap_error($con) . ")."];
     }
   }
 
-  return array(LDAP_SUCCESS, "Successful Connection!", $con);
+  return [LDAP_SUCCESS, "Successful Connection!", $con];
 }
 
+/**
+ *
+ */
 function ldap_help_show_error($con) {
   return "\nLDAP Error Number: " . ldap_errno($con) . "\nLDAP Error Description: " . ldap_error($con);
 }
 
+/**
+ *
+ */
 function ldap_help_display($title, $value = NULL) {
   if (is_array($value)) {
     echo "\n" . $title;
@@ -151,7 +158,7 @@ function ldap_help_display($title, $value = NULL) {
   if (!$title && $value) {
     echo "\n" . $value;
   }
-  elseif ((int)$title === $title) {
+  elseif ((int) $title === $title) {
     echo "\n" . $value;
   }
   else {
@@ -159,12 +166,13 @@ function ldap_help_display($title, $value = NULL) {
   }
 
 }
+
 /**
  * Disconnect (unbind) from an active LDAP server.
  */
 function ldap_help_disconnect(&$con) {
   if (!$con) {
-    // never bound or not currently bound, so no need to disconnect
+    // Never bound or not currently bound, so no need to disconnect.
   }
   else {
     ldap_help_disconnect($con);
@@ -172,17 +180,21 @@ function ldap_help_disconnect(&$con) {
   }
 }
 
-/** parse php modules from phpinfo */
+/**
+ * Parse php modules from phpinfo .*/
 function ldap_help_parsePHPModules() {
   ob_start();
   phpinfo(INFO_MODULES);
   $s = ob_get_contents();
   ob_end_clean();
-  $matches = array();
+  $matches = [];
   preg_match_all("/(\nLDAP Support.*Vendor Version[^\n]*?).*$/iDsU", $s, $matches);
   return isset($matches[1][0]) ? "\nphpinfo() LDAP Info:" . $matches[1][0] : '';
 }
 
+/**
+ *
+ */
 function ldap_help_encodePassword($password) {
   $password = "\"" . $password . "\"";
   $encoded = "";
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/test.php b/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/test.php
index b7327661..285b5182 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/test.php
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_test_script/test.php
@@ -1,13 +1,12 @@
 <?php
 
-
 /**
  * @file
- * test script functions for testing ldap functionality outside of Drupal
- * see README.txt for instructions
+ * Test script functions for testing ldap functionality outside of Drupal
+ * see README.txt for instructions.
  */
 
-require_once('functions.inc');
+require_once 'functions.inc';
 
 $config = ldap_help_config();
 
@@ -26,7 +25,7 @@ if (!extension_loaded('ldap')) {
 foreach ($config['servers'] as $sid => $server) {
 
   /**
-   * Test LDAP Connect
+   * Test LDAP Connect.
    */
   $results = ldap_help_connect($server['server_address'], $server['server_port'], $server['server_tls'], TRUE);
   $test_name = "\"" . $sid . "\"";
@@ -40,7 +39,7 @@ foreach ($config['servers'] as $sid => $server) {
   ldap_help_display('anonymous bind', $anon_bind_text);
 
   ldap_help_display('connect result', $results[1]);
-  ldap_help_display('connect context', join("", array("server: ", $server['server_address'], ", port: ", $server['server_port'], ", tls= $tls")));
+  ldap_help_display('connect context', join("", ["server: ", $server['server_address'], ", port: ", $server['server_port'], ", tls= $tls"]));
   $con = FALSE;
   if ($results[0] == LDAP_SUCCESS) {
     $con = $results[2];
@@ -54,23 +53,23 @@ foreach ($config['servers'] as $sid => $server) {
   }
 
   /**
-   * Test LDAP Bind
+   * Test LDAP Bind.
    */
 
   ldap_help_display(NULL, "------------------------------------------\n$test_name bind\n------------------------------------------");
 
   if ($anon_bind) {
     if (@!ldap_bind($con)) {
-      $results = array(ldap_errno($con), "LDAP anonymous bind error." . ldap_help_show_error($con));
+      $results = [ldap_errno($con), "LDAP anonymous bind error." . ldap_help_show_error($con)];
     }
   }
   else {
     $bind_result = @ldap_bind($con, $server['server_bind_dn'], $server['server_bind_pw']);
     if (!$bind_result) {
-      $results = array(ldap_errno($con), "LDAP bind failure for user " . $server['server_bind_dn'] . "." . ldap_help_show_error($con));
+      $results = [ldap_errno($con), "LDAP bind failure for user " . $server['server_bind_dn'] . "." . ldap_help_show_error($con)];
     }
     else {
-      $results = array(LDAP_SUCCESS, "LDAP bind success.");
+      $results = [LDAP_SUCCESS, "LDAP bind success."];
     }
   }
 
@@ -81,7 +80,7 @@ foreach ($config['servers'] as $sid => $server) {
   }
 
   /**
-   * Test LDAP Queries
+   * Test LDAP Queries.
    */
   foreach ($server['test_queries'] as $query_id => $query) {
     ldap_help_display(NULL, "------------------------------------------\n$test_name query \"$query_id\" \n------------------------------------------");
@@ -97,9 +96,9 @@ foreach ($config['servers'] as $sid => $server) {
     if (!$query_result) {
       ldap_help_display(ldap_errno($con), "LDAP search failure for user $filter." . ldap_help_show_error($con));
     }
-    else {// display results
+    // Display results.
+    else {
       $entries = ldap_get_entries($con, $query_result);
-     // print_r($entries);
       ldap_help_display('search result');
       if (is_array($entries)) {
         $entry_count = $entries['count'];
@@ -127,8 +126,8 @@ foreach ($config['servers'] as $sid => $server) {
     }
   }
 
-   /**
-   * Test LDAP Provisioning
+  /**
+   * Test LDAP Provisioning.
    */
   foreach ($server['test_provisions'] as $provision_id => $provision) {
     ldap_help_display(NULL, "------------------------------------------\n$test_name provision \"$provision_id\"\n------------------------------------------");
@@ -151,7 +150,7 @@ foreach ($config['servers'] as $sid => $server) {
           }
         }
         else {
-          // no entry exists
+          // No entry exists.
         }
       }
     }
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/LdapQuery.class.php b/drupal7/sites/all/modules/ldap/ldap_query/LdapQuery.class.php
index 4ed4344f..ba07db88 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/LdapQuery.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_query/LdapQuery.class.php
@@ -3,11 +3,10 @@
 /**
  * @file
  * Defines server classes and related functions.
- *
  */
 
 /**
- * LDAP Server Class
+ * LDAP Server Class.
  *
  *  This class is used to create, work with, and eventually destroy ldap_server
  * objects.
@@ -15,19 +14,20 @@
  * @todo make bindpw protected
  */
 class LdapQuery {
-  // LDAP Settings
-
+  /**
+   * LDAP Settings.
+   */
   public $query_numeric_id;
   public $qid;
   public $name;
   public $sid;
   public $status;
 
-  public $baseDn = array();
+  public $baseDn = [];
   public $base_dn_str = NULL;
   public $filter;
   public $attributes_str = NULL;
-  public $attributes = array();
+  public $attributes = [];
 
   public $sizelimit = 0;
   public $timelimit = 0;
@@ -38,19 +38,18 @@ class LdapQuery {
   public $inDatabase = FALSE;
   public $detailedWatchdogLog = FALSE;
 
-
   /**
-   * Constructor Method
+   * Constructor Method.
    */
-  function __construct($qid) {
+  public function __construct($qid) {
     if (!is_scalar($qid)) {
       return;
     }
 
-    $query_records = array();
+    $query_records = [];
     if (module_exists('ctools')) {
       ctools_include('export');
-      $result = ctools_export_load_object('ldap_query', 'names', array($qid));
+      $result = ctools_export_load_object('ldap_query', 'names', [$qid]);
       if (isset($result[$qid])) {
         $query_record = $result[$qid];
         foreach ($query_record as $property_name => $value) {
@@ -71,45 +70,45 @@ class LdapQuery {
         return;
       }
       $query_record = $query_records[$qid];
-      foreach ($this->fields() as $field_id => $field ) {
+      foreach ($this->fields() as $field_id => $field) {
         if (isset($query_record->$field_id)) {
           $this->{$field['property_name']} = @$query_record->$field_id;
         }
       }
     }
 
-    // special properties that don't map directly from storage and defaults
+    // Special properties that don't map directly from storage and defaults.
     $this->inDatabase = TRUE;
     $this->detailedWatchdogLog = variable_get('ldap_help_watchdog_detail', 0);
 
     $this->baseDn = $this->linesToArray($this->base_dn_str);
-    $this->attributes = ($this->attributes_str) ? $this->csvToArray($this->attributes_str, TRUE) : array();
+    $this->attributes = ($this->attributes_str) ? $this->csvToArray($this->attributes_str, TRUE) : [];
 
   }
 
   /**
-   * Destructor Method
+   * Destructor Method.
    */
-  function __destruct() {
+  public function __destruct() {
 
   }
 
-
   /**
-   * Invoke Method
+   * Invoke Method.
    */
-  function __invoke() {
+  public function __invoke() {
 
   }
 
-//  function search($base_dn = NULL, $filter, $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) {
-
-  function query() {
+  /**
+   * Function search($base_dn = NULL, $filter, $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) {.
+   */
+  public function query() {
     ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServer.class');
     $ldap_server = new LdapServer($this->sid);
     $ldap_server->connect();
     $ldap_server->bind();
-    $results = array();
+    $results = [];
 
     $count = 0;
 
@@ -133,22 +132,36 @@ class LdapQuery {
   protected $_hasError = FALSE;
   protected $_errorName = NULL;
 
+  /**
+   *
+   */
   public function setError($_errorName, $_errorMsgText = NULL) {
     $this->_errorMsgText = $_errorMsgText;
     $this->_errorName = $_errorName;
     $this->_hasError = TRUE;
   }
 
+  /**
+   *
+   */
   public function clearError() {
     $this->_hasError = FALSE;
     $this->_errorMsg = NULL;
     $this->_errorName = NULL;
   }
 
+  /**
+   *
+   */
   public function hasError() {
     return ($this->_hasError || $this->ldapErrorNumber());
   }
 
+  /**
+   * @param null $type
+   *
+   * @return string|null
+   */
   public function errorMsg($type = NULL) {
     if ($type == 'ldap' && $this->connection) {
       return ldap_err2str(ldap_errno($this->connection));
@@ -161,6 +174,11 @@ class LdapQuery {
     }
   }
 
+  /**
+   * @param null $type
+   *
+   * @return string|null
+   */
   public function errorName($type = NULL) {
     if ($type == 'ldap' && $this->connection) {
       return "LDAP Error: " . ldap_error($this->connection);
@@ -173,15 +191,16 @@ class LdapQuery {
     }
   }
 
+  /**
+   *
+   */
   public function ldapErrorNumber() {
-   // if ($this->connection && ldap_errno($this->connection)) {
-    //  return ldap_errno($this->connection);
-   // }
-   // else {
-      return FALSE;
-   // }
+    return FALSE;
   }
 
+  /**
+   *
+   */
   protected function linesToArray($lines) {
     $lines = trim($lines);
     if ($lines) {
@@ -191,11 +210,14 @@ class LdapQuery {
       }
     }
     else {
-      $array = array();
+      $array = [];
     }
     return $array;
   }
 
+  /**
+   *
+   */
   protected function csvToArray($string, $strip_quotes = FALSE) {
     $items = explode(',', $string);
     foreach ($items as $i => $item) {
@@ -207,47 +229,50 @@ class LdapQuery {
     return $items;
   }
 
+  /**
+   *
+   */
   public static function fields() {
-    $fields = array(
-      'query_numeric_id' => array(
-          'property_name' => 'query_numeric_id',
-          'schema' => array(
-            'type' => 'serial',
-            'unsigned' => TRUE,
-            'not null' => TRUE,
-            'description' => 'Primary ID field for the table.  Only used internally.',
-            'no export' => TRUE,
-          ),
-        ),
-
-      'qid' => array(
+    $fields = [
+      'query_numeric_id' => [
+        'property_name' => 'query_numeric_id',
+        'schema' => [
+          'type' => 'serial',
+          'unsigned' => TRUE,
+          'not null' => TRUE,
+          'description' => 'Primary ID field for the table.  Only used internally.',
+          'no export' => TRUE,
+        ],
+      ],
+
+      'qid' => [
         'property_name' => 'qid',
-        'schema' => array(
+        'schema' => [
           'type' => 'varchar',
           'length' => 20,
           'description' => 'Machine name for query.',
           'not null' => TRUE,
-          ),
-        'form' => array(
+        ],
+        'form' => [
           'field_group' => 'basic',
           '#type' => 'textfield',
           '#title' => t('Machine name for this query configuration.'),
           '#size' => 20,
           '#maxlength' => 20,
-          '#description' => t('May only contain alphanumeric characters (a-z, A-Z, 0-9, and _)' ),
+          '#description' => t('May only contain alphanumeric characters (a-z, A-Z, 0-9, and _)'),
           '#required' => TRUE,
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'name' => array(
+      'name' => [
         'property_name' => 'name',
-        'schema' => array(
+        'schema' => [
           'type' => 'varchar',
           'length' => '60',
-          'not null' => TRUE
-        ),
-        'form' => array(
+          'not null' => TRUE,
+        ],
+        'form' => [
           'field_group' => 'basic',
           '#type' => 'textfield',
           '#title' => t('Name'),
@@ -255,50 +280,50 @@ class LdapQuery {
           '#size' => 50,
           '#maxlength' => 255,
           '#required' => TRUE,
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'sid' => array(
+      'sid' => [
         'property_name' => 'sid',
-        'schema' => array(
+        'schema' => [
           'type' => 'varchar',
           'length' => 20,
           'not null' => TRUE,
-        ),
-        'form' => array(
+        ],
+        'form' => [
           'field_group' => 'basic',
           '#type' => 'radios',
           '#title' => t('LDAP Server used for query.'),
           '#required' => 1,
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'status' => array(
+      'status' => [
         'property_name' => 'status',
-        'schema' => array(
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => 0,
-        ),
-        'form' => array(
+        ],
+        'form' => [
           'field_group' => 'basic',
           '#type' => 'checkbox',
           '#title' => t('Enabled'),
           '#description' => t('Disable in order to keep configuration without having it active.'),
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'base_dn_str' => array(
+      'base_dn_str' => [
         'property_name' => 'base_dn_str',
-        'schema' => array(
+        'schema' => [
           'type' => 'text',
-          'not null' => FALSE
-        ),
-        'form' => array(
+          'not null' => FALSE,
+        ],
+        'form' => [
           'field_group' => 'query',
           '#type' => 'textarea',
           '#title' => t('Base DNs to search in query.'),
@@ -306,22 +331,22 @@ class LdapQuery {
           '#cols' => 50,
           '#rows' => 6,
           '#required' => TRUE,
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'baseDn' => array(
+      'baseDn' => [
         'property_name' => 'baseDn',
         'exportable' => FALSE,
-      ),
+      ],
 
-      'filter' => array(
+      'filter' => [
         'property_name' => 'filter',
-        'schema' => array(
+        'schema' => [
           'type' => 'text',
-          'not null' => FALSE
-        ),
-        'form' => array(
+          'not null' => FALSE,
+        ],
+        'form' => [
           'field_group' => 'query',
           '#type' => 'textarea',
           '#title' => t('Filter'),
@@ -330,41 +355,41 @@ class LdapQuery {
           '#cols' => 50,
           '#rows' => 1,
           '#required' => TRUE,
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'attributes_str' => array(
+      'attributes_str' => [
         'property_name' => 'attributes_str',
-        'schema' => array(
+        'schema' => [
           'type' => 'text',
-          'not null' => FALSE
-        ),
-        'form' => array(
+          'not null' => FALSE,
+        ],
+        'form' => [
           'field_group' => 'query',
           '#type' => 'textarea',
           '#title' => t('Attributes to return.'),
           '#description' => t('Enter as comma separated list. DN is automatically returned. Leave empty to return all attributes. e.g. <code>objectclass,name,cn,samaccountname</code>'),
           '#cols' => 50,
           '#rows' => 6,
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'attributes' => array(
+      'attributes' => [
         'property_name' => 'attributes',
         'exportable' => FALSE,
-      ),
+      ],
 
-      'sizelimit' => array(
+      'sizelimit' => [
         'property_name' => 'sizelimit',
-        'schema' => array(
+        'schema' => [
           'type' => 'int',
           'size' => 'small',
           'not null' => TRUE,
           'default' => 0,
-        ),
-        'form' => array(
+        ],
+        'form' => [
           'field_group' => 'query_advanced',
           '#type' => 'textfield',
           '#title' => t('Size Limit of returned data'),
@@ -372,20 +397,20 @@ class LdapQuery {
           '#size' => 7,
           '#maxlength' => 5,
           '#required' => TRUE,
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'timelimit' => array(
+      'timelimit' => [
         'property_name' => 'timelimit',
-        'schema' => array(
+        'schema' => [
           'type' => 'int',
           'size' => 'small',
           'not null' => TRUE,
           'default' => 0,
 
-        ),
-        'form' => array(
+        ],
+        'form' => [
           'field_group' => 'query_advanced',
           '#type' => 'textfield',
           '#title' => t('Time Limit in Seconds'),
@@ -393,57 +418,56 @@ class LdapQuery {
           '#size' => 7,
           '#maxlength' => 5,
           '#required' => TRUE,
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-      'deref' => array(
+      'deref' => [
         'property_name' => 'deref',
-        'schema' => array(
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => LDAP_DEREF_NEVER,
-        ),
-        'form' => array(
+        ],
+        'form' => [
           'field_group' => 'query_advanced',
           '#type' => 'radios',
           '#title' => t('How aliases should be handled during the search.'),
           '#required' => 1,
-          '#options' => array(
+          '#options' => [
             LDAP_DEREF_NEVER => t('(default) aliases are never dereferenced.'),
             LDAP_DEREF_SEARCHING => t('aliases should be dereferenced during the search but not when locating the base object of the search.'),
             LDAP_DEREF_FINDING => t('aliases should be dereferenced when locating the base object but not during the search.'),
             LDAP_DEREF_ALWAYS => t('aliases should be dereferenced always.'),
-          ),
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
-     'scope' => array(
+          ],
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
+      'scope' => [
         'property_name' => 'scope',
-        'schema' => array(
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => TRUE,
           'default' => LDAP_SCOPE_SUBTREE,
-        ),
-        'form' => array(
+        ],
+        'form' => [
           'field_group' => 'query_advanced',
           '#type' => 'radios',
           '#title' => t('Scope of search.'),
           '#required' => 1,
-          '#options' => array(
+          '#options' => [
             LDAP_SCOPE_BASE => t('BASE. This value is used to indicate searching only the entry at the base DN, resulting in only that entry being returned (keeping in mind that it also has to meet the search filter criteria!).'),
             LDAP_SCOPE_ONELEVEL => t('ONELEVEL. This value is used to indicate searching all entries one level under the base DN - but not including the base DN and not including any entries under that one level under the base DN.'),
             LDAP_SCOPE_SUBTREE => t('SUBTREE. (default) This value is used to indicate searching of all entries at all levels under and including the specified base DN.'),
-          ),
-        ),
-        'form_to_prop_functions' => array('trim'),
-      ),
+          ],
+        ],
+        'form_to_prop_functions' => ['trim'],
+      ],
 
-    );
+    ];
     return $fields;
   }
 
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/LdapQueryAdmin.class.php b/drupal7/sites/all/modules/ldap/ldap_query/LdapQueryAdmin.class.php
index 2e28ca07..5f8f8dfd 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/LdapQueryAdmin.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_query/LdapQueryAdmin.class.php
@@ -2,20 +2,23 @@
 
 /**
  * @file
- * LDAP Query Admin Class
- *
+ * LDAP Query Admin Class.
  */
 
 module_load_include('php', 'ldap_query', 'LdapQuery.class');
-
+/**
+ *
+ */
 class LdapQueryAdmin extends LdapQuery {
 
   /**
-   * @param string $sid either 'all' or the ldap server sid
-   * @param $type = 'all', 'enabled'
+   * @param string $sid
+   *   either 'all' or the ldap server sid.
+   * @param $type
+   *   = 'all', 'enabled'
    */
   public static function getLdapQueryObjects($sid = 'all', $type = 'enabled', $class = 'LdapQuery') {
-    $queries = array();
+    $queries = [];
     if (module_exists('ctools')) {
       ctools_include('export');
       $select = ctools_export_load_object('ldap_query', 'all');
@@ -28,8 +31,8 @@ class LdapQueryAdmin extends LdapQuery {
       }
       catch (Exception $e) {
         drupal_set_message(t('query index query failed. Message = %message, query= %query',
-          array('%message' => $e->getMessage(), '%query' => $e->query_string)), 'error');
-        return array();
+          ['%message' => $e->getMessage(), '%query' => $e->query_string]), 'error');
+        return [];
       }
     }
     foreach ($select as $result) {
@@ -46,10 +49,16 @@ class LdapQueryAdmin extends LdapQuery {
 
   }
 
-  function __construct($qid) {
+  /**
+   *
+   */
+  public function __construct($qid) {
     parent::__construct($qid);
   }
 
+  /**
+   *
+   */
   protected function populateFromDrupalForm($op, $values) {
 
     foreach ($this->fields() as $field_id => $field) {
@@ -66,31 +75,36 @@ class LdapQueryAdmin extends LdapQuery {
     $this->inDatabase = ($op == 'edit');
   }
 
+  /**
+   *
+   */
   public function save($op) {
 
     $op = $this->inDatabase ? 'edit' : 'insert';
 
-    if (module_exists('ctools')) { // add or edit with ctolls
+    // Add or edit with ctolls.
+    if (module_exists('ctools')) {
 
       ctools_include('export');
       $ctools_values = clone $this;
 
       foreach ($this->fields() as $field_id => $field) {
         $value = $this->{$field['property_name']};
-        if (isset($field['exportable']) && $field['exportable'] === FALSE) { // field not exportable
+        // Field not exportable.
+        if (isset($field['exportable']) && $field['exportable'] === FALSE) {
           unset($ctools_values->{$field['property_name']});
         }
-        elseif (isset($field['schema']) && $field['property_name'] != $field_id) { // field in property with different name
+        // Field in property with different name.
+        elseif (isset($field['schema']) && $field['property_name'] != $field_id) {
           $ctools_values->{$field_id} = $value;
           unset($ctools_values->{$field['property_name']});
         }
         else {
-          // do nothing.  property is already in cloned objecat
-
+          // Do nothing.  property is already in cloned objecat.
         }
       }
 
-      // Populate our object with ctool's properties.  copying all properties for backward compatibility
+      // Populate our object with ctool's properties.  copying all properties for backward compatibility.
       $object = ctools_export_crud_new('ldap_query');
 
       foreach ($object as $property_name => $value) {
@@ -99,19 +113,22 @@ class LdapQueryAdmin extends LdapQuery {
         }
       }
       $result = ctools_export_crud_save('ldap_query', $ctools_values);
-      ctools_export_load_object_reset('ldap_query'); // ctools_export_crud_save doesn't invalidate cache
+      // ctools_export_crud_save doesn't invalidate cache.
+      ctools_export_load_object_reset('ldap_query');
     }
     else {
-      $values = array();
+      $values = [];
       foreach ($this->fields() as $field_id => $field) {
         if (isset($field['schema'])) {
           $values[$field_id] = $this->{$field['property_name']};
         }
       }
-      if ($op == 'edit') { // edit w/o ctools
+      // Edit w/o ctools.
+      if ($op == 'edit') {
         $result = drupal_write_record('ldap_query', $values, 'qid');
       }
-      else { // insert
+      // Insert.
+      else {
         $result = drupal_write_record('ldap_query', $values);
       }
     }
@@ -124,6 +141,9 @@ class LdapQueryAdmin extends LdapQuery {
     }
   }
 
+  /**
+   *
+   */
   public function delete($qid) {
     if ($qid == $this->qid) {
       $this->inDatabase = FALSE;
@@ -138,51 +158,56 @@ class LdapQueryAdmin extends LdapQuery {
     }
   }
 
+  /**
+   *
+   */
   public function getActions() {
-    $switch = ($this->status ) ? 'disable' : 'enable';
-    $actions = array();
+    $switch = ($this->status) ? 'disable' : 'enable';
+    $actions = [];
     $actions[] = l(t('edit'), LDAP_QUERY_MENU_BASE_PATH . '/query/edit/' . $this->qid);
     if (property_exists($this, 'type')) {
       if ($this->type == 'Overridden') {
-          $actions[] = l(t('revert'), LDAP_QUERY_MENU_BASE_PATH . '/query/delete/' . $this->qid);
+        $actions[] = l(t('revert'), LDAP_QUERY_MENU_BASE_PATH . '/query/delete/' . $this->qid);
       }
       if ($this->type == 'Normal') {
-          $actions[] = l(t('delete'), LDAP_QUERY_MENU_BASE_PATH . '/query/delete/' . $this->qid);
+        $actions[] = l(t('delete'), LDAP_QUERY_MENU_BASE_PATH . '/query/delete/' . $this->qid);
       }
     }
     else {
-        $actions[] = l(t('delete'), LDAP_QUERY_MENU_BASE_PATH . '/query/delete/' . $this->qid);
+      $actions[] = l(t('delete'), LDAP_QUERY_MENU_BASE_PATH . '/query/delete/' . $this->qid);
     }
     $actions[] = l(t('test'), LDAP_QUERY_MENU_BASE_PATH . '/query/test/' . $this->qid);
     $actions[] = l($switch, LDAP_QUERY_MENU_BASE_PATH . '/query/' . $switch . '/' . $this->qid);
     return $actions;
   }
 
+  /**
+   *
+   */
   public function drupalForm($op) {
     $form['#prefix'] = t('<p>Setup an LDAP query to be used by other modules
       such as LDAP Feeds.</p>');
 
-    $form['basic'] = array(
+    $form['basic'] = [
       '#type' => 'fieldset',
       '#title' => t('Basic LDAP Query Settings'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-    $form['query'] = array(
+    $form['query'] = [
       '#type' => 'fieldset',
       '#title' => t('Query'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-    $form['query_advanced'] = array(
+    $form['query_advanced'] = [
       '#type' => 'fieldset',
       '#title' => t('Advanced Query Settings'),
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
-    );
-
+    ];
 
     foreach ($this->fields() as $field_id => $field) {
       $field_group = isset($field['form']['field_group']) ? $field['form']['field_group'] : FALSE;
@@ -191,7 +216,8 @@ class LdapQueryAdmin extends LdapQuery {
         $form_item['#default_value'] = $this->{$field['property_name']};
         if ($field_group) {
           $form[$field_group][$field_id] = $form_item;
-          unset($form[$field_group][$field_id]['field_group']); // sirrelevant to form api
+          // Sirrelevant to form api.
+          unset($form[$field_group][$field_id]['field_group']);
         }
         else {
           $form[$field_id] = $form_item;
@@ -211,24 +237,26 @@ class LdapQueryAdmin extends LdapQuery {
 
     $form['basic']['sid']['#options'] = $server_options;
 
-    $form['submit'] = array(
+    $form['submit'] = [
       '#type' => 'submit',
       '#value' => t('Save Query'),
-    );
+    ];
 
     $action = ($op == 'add') ? 'Add' : 'Update';
-      $form['submit'] = array(
+    $form['submit'] = [
       '#type' => 'submit',
       '#value' => $action,
       '#weight' => 100,
-    );
+    ];
 
     return $form;
   }
 
-
-  public function drupalFormValidate($op, $values)  {
-    $errors = array();
+  /**
+   *
+   */
+  public function drupalFormValidate($op, $values) {
+    $errors = [];
 
     if ($op == 'delete') {
       if (!$this->qid) {
@@ -242,14 +270,17 @@ class LdapQueryAdmin extends LdapQuery {
     return $errors;
   }
 
+  /**
+   *
+   */
   protected function validate($op) {
-    $errors = array();
+    $errors = [];
     if ($op == 'add') {
       $ldap_queries = $this->getLdapQueryObjects('all', 'all');
       if (count($ldap_queries)) {
         foreach ($ldap_queries as $qid => $ldap_query) {
           if ($this->qid == $ldap_query->qid) {
-            $errors['qid'] = t('An LDAP Query with the name %qid already exists.', array('%qid' => $this->qid));
+            $errors['qid'] = t('An LDAP Query with the name %qid already exists.', ['%qid' => $this->qid]);
           }
         }
       }
@@ -258,6 +289,9 @@ class LdapQueryAdmin extends LdapQuery {
     return $errors;
   }
 
+  /**
+   *
+   */
   public function drupalFormSubmit($op, $values) {
 
     $this->populateFromDrupalForm($op, $values);
@@ -265,7 +299,8 @@ class LdapQueryAdmin extends LdapQuery {
     if ($op == 'delete') {
       $this->delete($this);
     }
-    else { // add or edit
+    // Add or edit.
+    else {
       try {
         $save_result = $this->save($op);
       }
@@ -276,6 +311,9 @@ class LdapQueryAdmin extends LdapQuery {
     }
   }
 
+  /**
+   *
+   */
   protected function arrayToLines($array) {
     $lines = "";
     if (is_array($array)) {
@@ -287,8 +325,9 @@ class LdapQueryAdmin extends LdapQuery {
     return $lines;
   }
 
-
-
+  /**
+   *
+   */
   protected function arrayToCsv($array) {
     return join(",", $array);
   }
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.admin.inc b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.admin.inc
index 39e04b2e..0a275a0f 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.admin.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.admin.inc
@@ -2,19 +2,19 @@
 
 /**
  * @file
- * Defines functions for administrative interface for servers
- *
+ * Defines functions for administrative interface for servers.
  */
 
 /**
- * @return index of ldap queries
+ * @return string
+ *   Index of ldap queries
  */
-
 function ldap_query_index() {
 
   return ldap_query_list(NULL, TRUE);
 
 }
+
 /**
  * LDAP queries list.
  *
@@ -22,24 +22,24 @@ function ldap_query_index() {
  *   query id.  if empty list all queries
  * @param $actions
  *   True or False indicating if query edit, delete, enable, disable, etc links should show in table
+ *
  * @return
  *   The HTML table with the servers list.
  */
 function ldap_query_list($qid = NULL, $actions = FALSE) {
 
   $ldap_queries = ldap_query_get_queries($qid, 'all');
-  $variables = array(
+  $variables = [
     'ldap_queries' => $ldap_queries,
     'action' => TRUE,
     'type' => 'table',
-    );
+  ];
 
   $html = theme('ldap_query_list', $variables);
 
   return $html;
 }
 
-
 /**
  * Implements the LDAP query edit page.
  *
@@ -53,7 +53,6 @@ function ldap_query_list($qid = NULL, $actions = FALSE) {
  * @return
  *   The form structure.
  */
-
 function ldap_query_admin_form($form, &$form_state, $op = NULL, $qid = NULL) {
   ldap_servers_module_load_include('php', 'ldap_query', 'LdapQueryAdmin.class');
   $server = new LdapQueryAdmin($qid);
@@ -73,13 +72,6 @@ function ldap_query_admin_form_validate($form, &$form_state) {
   foreach ($errors as $error_name => $error_text) {
     form_set_error($error_name, t($error_text));
   }
- // $warnings = $server->drupalFormWarnings($op, $form_state['values']);
-  //foreach ($warnings as $warning_name => $warning_text) {
-   // drupal_set_message($warning_text, 'warning');
-  //}
-
-  //$form_state['ldap_warnings'] = (boolean)(count($warnings) > 0);
-
 }
 
 /**
@@ -91,18 +83,19 @@ function ldap_query_admin_form_submit($form, &$form_state) {
   $verb = ($op == 'edit') ? 'edited' : $op . 'ed';
   ldap_servers_module_load_include('php', 'ldap_query', 'LdapQueryAdmin.class');
   $query = new LdapQueryAdmin($form_state['values']['qid']);
-  $query->drupalFormSubmit($op, $form_state['values']);  // add form data to object and save or create
+  // Add form data to object and save or create.
+  $query->drupalFormSubmit($op, $form_state['values']);
 
   if ($query->hasError() == FALSE) {
-    drupal_set_message(t('LDAP Query %name !verb.', array('!verb' => $verb, '%name' => $query->name)), 'status');
+    drupal_set_message(t('LDAP Query %name !verb.', ['!verb' => $verb, '%name' => $query->name]), 'status');
     ldap_query_cache_clear();
-   // if ($form_state['ldap_warnings'] && $op != 'add') {
-      // do nothing, but don't redirect away from form.
-      // if there are warnings, want them to see form even if its been saved
-   // }
-   // else {
-      drupal_goto(LDAP_QUERY_MENU_BASE_PATH . '/query');
-   // }
+    // If ($form_state['ldap_warnings'] && $op != 'add') {
+    // do nothing, but don't redirect away from form.
+    // if there are warnings, want them to see form even if its been saved
+    // }
+    // else {.
+    drupal_goto(LDAP_QUERY_MENU_BASE_PATH . '/query');
+    // }.
   }
   else {
     form_set_error($query->errorName(), $query->errorMsg());
@@ -124,27 +117,27 @@ function ldap_query_admin_form_submit($form, &$form_state) {
  */
 function ldap_query_admin_delete($form, &$form_state, $op = NULL, $qid = NULL) {
 
-
   if ($qid && ($ldap_query = ldap_query_get_queries($qid, 'all', TRUE))) {
     // array()
-
-    $variables = array(
-      'ldap_query' => $ldap_query, 'actions' => FALSE, 'type' => 'detail'
-    );
+    $variables = [
+      'ldap_query' => $ldap_query,
+      'actions' => FALSE,
+      'type' => 'detail',
+    ];
     $form['#prefix'] = '<div>' . theme('ldap_query', $variables) . '</div>';
-    $form['qid'] = array(
+    $form['qid'] = [
       '#type' => 'hidden',
       '#value' => $qid,
-    );
-    $form['name'] = array(
+    ];
+    $form['name'] = [
       '#type' => 'hidden',
       '#value' => $ldap_query->name,
-    );
+    ];
     return confirm_form(
       $form,
       'Delete Confirmation Form',
       LDAP_QUERY_MENU_BASE_PATH . '/query/list',
-        '<p>' . t('Are you sure you want to delete the LDAP query named <em><strong>%name</strong></em> ?', array('%name' => $ldap_query->name)) . '</p><p>' .
+        '<p>' . t('Are you sure you want to delete the LDAP query named <em><strong>%name</strong></em> ?', ['%name' => $ldap_query->name]) . '</p><p>' .
         t('This action cannot be undone.') . '</p>',
       t('Delete'),
       t('Cancel')
@@ -163,7 +156,7 @@ function ldap_query_admin_delete_submit($form, &$form_state) {
   $ldap_query = new LdapQueryAdmin($qid);
   if ($values['confirm'] && $qid) {
     if ($result = $ldap_query->delete($qid)) {
-      $tokens = array('%name' => $ldap_query->name, '!qid' => $qid);
+      $tokens = ['%name' => $ldap_query->name, '!qid' => $qid];
       drupal_set_message(t('LDAP Server %name (query id = !qid) has been deleted.', $tokens), 'status');
       watchdog('ldap_query', 'LDAP Query deleted: %name (qid = !qid) ', $tokens);
     }
@@ -178,9 +171,8 @@ function ldap_query_admin_delete_submit($form, &$form_state) {
   drupal_goto(LDAP_QUERY_MENU_BASE_PATH . '/query/list');
 }
 
-
 /**
- * Implements the LDAP query disable
+ * Implements the LDAP query disable.
  *
  * @param $form_state
  *   A form state array.
@@ -190,31 +182,31 @@ function ldap_query_admin_delete_submit($form, &$form_state) {
  * @return
  *   The form structure.
  */
-
-
 function ldap_query_admin_enable_disable($form, &$form_state, $action = NULL, $qid = NULL) {
 
   if ($ldap_query = ldap_query_get_queries($qid, 'all', TRUE)) {
-    $variables = array(
-      'ldap_query' => $ldap_query, 'actions' => FALSE, 'type' => 'detail'
-    );
+    $variables = [
+      'ldap_query' => $ldap_query,
+      'actions' => FALSE,
+      'type' => 'detail',
+    ];
     $form['#prefix'] = "<div>" . theme('ldap_query', $variables) . "</div>";
 
-    $form['qid'] = array(
+    $form['qid'] = [
       '#type' => 'hidden',
       '#value' => $qid,
-    );
-    $form['name'] = array(
+    ];
+    $form['name'] = [
       '#type' => 'hidden',
       '#value' => $ldap_query->name,
-    );
-    $form['action'] = array(
+    ];
+    $form['action'] = [
       '#type' => 'hidden',
       '#value' => $action,
-    );
+    ];
     return confirm_form(
       $form,
-      t('Are you sure you want to') . t($action) . ' ' . t('the LDAP query named <em><strong>%name</strong></em>?', array('%name' => $ldap_query->name)),
+      t('Are you sure you want to') . t($action) . ' ' . t('the LDAP query named <em><strong>%name</strong></em>?', ['%name' => $ldap_query->name]),
       LDAP_QUERY_MENU_BASE_PATH . '/query/list',
       t('<p></p>'),
       t($action),
@@ -238,7 +230,7 @@ function ldap_query_admin_enable_disable_submit($form, &$form_state) {
 
     $ldap_query->status = $status;
     $ldap_query->save('edit');
-    $tokens = array('%name' => $values['name'], '!qid' => $qid, '!action' => t($values['action']) . 'd');
+    $tokens = ['%name' => $values['name'], '!qid' => $qid, '!action' => t($values['action']) . 'd'];
     drupal_set_message(t('LDAP Query Configuration %name (query id = !qid) has been !action.', $tokens));
     $message = t('LDAP Query !action: %name (qid = !qid) ', $tokens);
     watchdog('ldap_query', $message);
@@ -247,14 +239,15 @@ function ldap_query_admin_enable_disable_submit($form, &$form_state) {
 
 }
 
-
+/**
+ *
+ */
 function ldap_query_test($qid) {
 
   $ldap_query = ldap_query_get_queries($qid, 'all', TRUE);
   $results = $ldap_query->query();
-  $display = theme('ldap_query_results', array('results' => $results, 'ldap_query' => $ldap_query, 'show_query' => TRUE));
+  $display = theme('ldap_query_results', ['results' => $results, 'ldap_query' => $ldap_query, 'show_query' => TRUE]);
 
   return $display;
 
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.inc b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.inc
index 2a7e756a..311c8ffc 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.inc
@@ -2,24 +2,23 @@
 
 /**
  * @file
- *
  */
 
 /**
- * see ldap_query_get_servers()
+ * See ldap_query_get_servers()
  */
 function _ldap_query_get_queries($qid, $type, $flatten, $reset) {
   ldap_servers_module_load_include('php', 'ldap_query', 'LdapQueryAdmin.class');
   static $queries;
 
   if ($reset) {
-    $queries = array();
+    $queries = [];
   }
   if (!isset($queries['all'])) {
     $queries['all'] = LdapQueryAdmin::getLdapQueryObjects('all', 'all');
   }
   if (!isset($queries['enabled'])) {
-    $queries['enabled'] = array();
+    $queries['enabled'] = [];
     foreach ($queries['all'] as $_qid => $ldap_query) {
       if ($ldap_query->status == 1) {
         $queries['enabled'][$_qid] = $ldap_query;
@@ -27,7 +26,6 @@ function _ldap_query_get_queries($qid, $type, $flatten, $reset) {
     }
   }
 
-
   if ($qid) {
     if (!isset($queries[$type][$qid])) {
       return FALSE;
@@ -39,30 +37,3 @@ function _ldap_query_get_queries($qid, $type, $flatten, $reset) {
     return $queries[$type];
   }
 }
-
-/**
- * see ldap_query_get_servers()
- */
-function _ldap_query_get_simpletest_queries($qid, $type, $flatten, $reset = TRUE) {
-  require_once('tests/LdapQueryTest.class.php');
-
-  $queries['all'] = LdapQueryTest::getLdapQueryObjects('all', 'all');
-
-  foreach ($queries['all'] as $_sid => $ldap_query) {
-    if ($ldap_query->status == 1) {
-      $queries['enabled'][$_qid] = $ldap_query;
-    }
-  }
-
-
-  if ($sid) {
-    if (!isset($queries[$type][$qid])) {
-      return FALSE;
-    }
-    return ($flatten) ? $queries[$type][$qid] : $queries[$type];
-  }
-
-  if (isset($queries[$type])) {
-    return $queries[$type];
-  }
-}
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info
index 3840384f..e0fd27a3 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info
+++ b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info
@@ -4,6 +4,7 @@ package = Lightweight Directory Access Protocol
 dependencies[] = ldap_servers
 
 core = 7.x
+php = 5.4
 
 files[] = LdapQuery.class.php
 files[] = LdapQueryAdmin.class.php
@@ -17,8 +18,8 @@ files[] = tests/ldap_query.test
 
 configure = admin/config/people/ldap/query
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.install b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.install
index 92a433a7..c122c312 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.install
+++ b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.install
@@ -19,38 +19,38 @@ function ldap_query_uninstall() {
 
 }
 
-
 /**
  * Implements hook_schema().
  */
+
 /**
  * Implements hook_schema().
  */
 function ldap_query_schema() {
 
-  $schema['ldap_query'] = array(
-    'export' => array(
+  $schema['ldap_query'] = [
+    'export' => [
       'key' => 'qid',
       'key name' => 'Query Name',
       'identifier' => 'qid',
       'primary key' => 'query_numeric_id',
-      'api' => array(
+      'api' => [
         'owner' => 'ldap_query',
         'api' => 'ldap_query',
         'minimum_version' => 1,
         'current_version' => 1,
-      ),
-    ),
+      ],
+    ],
 
     'description' => "LDAP Query Data leveraged by other LDAP Modules",
-    'primary key' => array('query_numeric_id'),
-    'foreign keys' => array(
-      'sid' => array(
+    'primary key' => ['query_numeric_id'],
+    'foreign keys' => [
+      'sid' => [
         'table' => 'ldap_servers',
-        'columns' => array('sid' => 'sid'),
-      ),
-    ),
-  );
+        'columns' => ['sid' => 'sid'],
+      ],
+    ],
+  ];
   module_load_include('module', 'ldap_servers');
   ldap_servers_module_load_include('php', 'ldap_query', 'LdapQuery.class');
   $fields = LdapQuery::fields();
@@ -68,15 +68,16 @@ function ldap_query_schema() {
  */
 function ldap_query_update_7100() {
   module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
-  ldap_servers_module_load_include('module', 'ldap_servers', 'ldap_servers'); // get LDAP_SCOPE_SUBTREE constant
-  // make sure 'create_consumers' field is there for old 7.x-1.x-dev versions
+  // Get LDAP_SCOPE_SUBTREE constant.
+  ldap_servers_module_load_include('module', 'ldap_servers', 'ldap_servers');
+  // Make sure 'create_consumers' field is there for old 7.x-1.x-dev versions.
   if (!db_field_exists('ldap_query', 'scope')) {
-    db_add_field('ldap_query', 'scope', array(
+    db_add_field('ldap_query', 'scope', [
       'type' => 'int',
       'size' => 'small',
       'not null' => FALSE,
       'default' => LDAP_SCOPE_SUBTREE,
-    ));
+    ]);
     return t('"scope" field added to ldap_query table');
   }
   else {
@@ -86,28 +87,27 @@ function ldap_query_update_7100() {
 }
 
 /**
- * Make filter field type 'text' for longer filters
+ * Make filter field type 'text' for longer filters.
  */
 function ldap_query_update_7101() {
-  db_change_field('ldap_query', 'filter', 'filter', array(
+  db_change_field('ldap_query', 'filter', 'filter', [
     'type' => 'text',
     'not null' => FALSE,
-  ));
+  ]);
 
   return t('ldap_query table field "filter" changed to type "text"');
 }
 
-
 /**
- * make ldap_query.scope field small int instead of tiny int for ctools bug
+ * Make ldap_query.scope field small int instead of tiny int for ctools bug.
  */
 function ldap_query_update_7102() {
 
-  db_change_field('ldap_query', 'scope', 'scope', array(
+  db_change_field('ldap_query', 'scope', 'scope', [
     'type' => 'int',
     'size' => 'small',
     'not null' => TRUE,
     'default' => 0,
-  ));
+  ]);
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.module b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.module
index 1cb54242..1d0bf620 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.module
+++ b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.module
@@ -6,132 +6,144 @@
 
 define('LDAP_QUERY_MENU_BASE_PATH', 'admin/config/people/ldap');
 define('LDAP_QUERY_INDEX_BASE_PATH', 'admin/config/people/ldap/query');
-define('LDAP_QUERY_MENU_BASE_PATH_PARTS', 4); // for argument offsets
-
+// For argument offsets.
+define('LDAP_QUERY_MENU_BASE_PATH_PARTS', 4);
 
+/**
+ *
+ */
 function ldap_query_menu() {
   $menu_offset = 4;
 
-  $items['admin/config/people/ldap/query'] = array(
+  $items['admin/config/people/ldap/query'] = [
     'title' => 'Queries',
     'page callback' => 'ldap_query_index',
-    'page arguments' => array(),
+    'page arguments' => [],
     'weight' => 6,
     'type' => MENU_LOCAL_TASK,
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_query.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/query/list'] = array(
+  $items['admin/config/people/ldap/query/list'] = [
     'title' => 'Queries',
     'type' => MENU_DEFAULT_LOCAL_TASK,
-  );
+  ];
 
-  $items['admin/config/people/ldap/query/add'] = array(
+  $items['admin/config/people/ldap/query/add'] = [
     'title' => 'Add LDAP Query',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_query_admin_form', 'add'),
+    'page arguments' => ['ldap_query_admin_form', 'add'],
     'type' => MENU_LOCAL_TASK + MENU_CONTEXT_INLINE,
     'weight' => 3,
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_query.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/query/edit/%'] = array(
+  $items['admin/config/people/ldap/query/edit/%'] = [
     'title' => 'Edit LDAP Query',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_query_admin_form', 'edit', $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_query_admin_form', 'edit', $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_query.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/query/test/%'] = array(
+  $items['admin/config/people/ldap/query/test/%'] = [
     'title' => 'Test LDAP Query',
     'page callback' => 'ldap_query_test',
-    'page arguments' => array($menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => [$menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_query.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/query/delete/%'] = array(
+  $items['admin/config/people/ldap/query/delete/%'] = [
     'title' => 'Delete LDAP Query',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_query_admin_delete', $menu_offset + 1, $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_query_admin_delete', $menu_offset + 1, $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_query.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/query/enable/%'] = array(
+  $items['admin/config/people/ldap/query/enable/%'] = [
     'title' => 'Enable LDAP Query',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_query.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/query/disable/%'] = array(
+  $items['admin/config/people/ldap/query/disable/%'] = [
     'title' => 'Enable LDAP Query',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_query.admin.inc',
-  );
+  ];
 
   return $items;
 }
 
-
-
+/**
+ *
+ */
 function ldap_query_theme() {
-  return array(
-    'ldap_query_list' => array(
-      'variables' => array('ldap_query' => NULL, 'actions' => TRUE, 'type' => 'table'),
+  return [
+    'ldap_query_list' => [
+      'variables' => ['ldap_query' => NULL, 'actions' => TRUE, 'type' => 'table'],
       'render element' => 'element',
-      'file' => 'ldap_query.theme.inc'
-    ),
-    'ldap_query' => array(
-      'variables' => array('ldap_server' => NULL, 'actions' => FALSE, 'type' => 'detail'),
+      'file' => 'ldap_query.theme.inc',
+    ],
+    'ldap_query' => [
+      'variables' => ['ldap_server' => NULL, 'actions' => FALSE, 'type' => 'detail'],
       'render element' => 'element',
-      'file' => 'ldap_query.theme.inc'
-    ),
-    'ldap_query_results' => array(
-      'variables' => array('ldap_query' => NULL, 'result' => FALSE, 'show_query' => TRUE),
+      'file' => 'ldap_query.theme.inc',
+    ],
+    'ldap_query_results' => [
+      'variables' => ['ldap_query' => NULL, 'result' => FALSE, 'show_query' => TRUE],
       'render element' => 'element',
-      'file' => 'ldap_query.theme.inc'
-    ),
-  );
+      'file' => 'ldap_query.theme.inc',
+    ],
+  ];
 }
 
+/**
+ *
+ */
 function ldap_query_cache_clear() {
   $discard = ldap_query_get_queries(NULL, 'all', FALSE, TRUE);
 }
+
 /**
+ * Return ldap query objects.
  *
- * return ldap query objects
+ * @param string $qid
+ * @param string $type
+ *   'all', 'enabled',.
+ * @param bool $flatten
+ *   signifies if array or single object returned.  Only works if sid is specified.
+ * @param bool $reset
+ *   do not use cached or static result.
  *
- * @param alphanum $qid
- * @param enum $type 'all', 'enabled',
- * @param boolean $flatten signifies if array or single object returned.  Only works if sid is specified
- * @param boolean $reset do not use cached or static result
- * @return - array of server conf object keyed on sid
- *         - single server conf object (if flatten == TRUE)
+ * @return array
+ *   of server conf object keyed on sid
+ *   - single server conf object (if flatten == TRUE)
  */
 function ldap_query_get_queries($qid = NULL, $type, $flatten = FALSE, $reset = FALSE) {
   ldap_servers_module_load_include('inc', 'ldap_query', 'ldap_query');
-  if (variable_get('ldap_simpletest', FALSE)) {
-    return _ldap_query_get_simpletest_queries($qid, $type, $flatten, $reset);
-  }
-  else {
-    return _ldap_query_get_queries($qid, $type, $flatten, $reset);
-  }
+  return _ldap_query_get_queries($qid, $type, $flatten, $reset);
 }
 
+/**
+ *
+ */
 function ldap_query_fields() {
   ldap_servers_module_load_include('php', 'ldap_query', 'LdapQuery.class');
   return LdapQuery::fields();
 }
 
-
+/**
+ *
+ */
 function ldap_query_help($path, $arg) {
 
   $help = '<h3>' . t('LDAP Query Module') . '</h3><p>' .
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.theme.inc b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.theme.inc
index 62bb582f..c5000016 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.theme.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.theme.inc
@@ -2,8 +2,7 @@
 
 /**
  * @file
- * theming functions for ldap_query module
- *
+ * Theming functions for ldap_query module.
  */
 
 /**
@@ -11,37 +10,40 @@
  *
  * @param $variables
  *   An associative array containing:
- *   - ldap_query: an array of one or more ldap server configurations.
+ *   - ldap_queries: an array of one or more ldap server configurations.
  *   - actions:  true or false indicating include update, delete, etc. links
  *   - type:  'table', 'list', etc for style to render
  *
  * @ingroup themeable
  */
 function theme_ldap_query_list($variables) {
+  /** @var array $ldap_queries */
+  /** @var bool $actions */
+  /** @var string $type */
   extract($variables);
 
-  $table = array(
-    'header' => array(t('Name'), t('Base DN'), t('Filter'), t('Attributes'), t('Enabled')),
-    'attributes' => array('id' => 'ldap_queries', 'class' => 'data'),
-    'colgroups' => array(),
+  $table = [
+    'header' => [t('Name'), t('Base DN'), t('Filter'), t('Attributes'), t('Enabled')],
+    'attributes' => ['id' => 'ldap_queries', 'class' => 'data'],
+    'colgroups' => [],
     'sticky' => FALSE,
     'empty' => '',
     'caption' => 'LDAP Queries',
-  );
+  ];
 
   if ($actions) {
     $table['header'][] = "Operations";
   }
 
   if (count($ldap_queries)) {
-    foreach ($ldap_queries as $qid => $ldap_query ) {
-      $row = array(
+    foreach ($ldap_queries as $qid => $ldap_query) {
+      $row = [
         $ldap_query->name,
         $ldap_query->base_dn_str,
         $ldap_query->filter,
         $ldap_query->attributes_str,
         ($ldap_query->status == 1) ? "Yes" : "No",
-      );
+      ];
       if ($actions) {
         $admin = new LdapQueryAdmin($ldap_query->qid);
         $row[] = join(' | ', $admin->getActions());
@@ -50,7 +52,7 @@ function theme_ldap_query_list($variables) {
     }
   }
   else {
-    $table['rows'] = array();
+    $table['rows'] = [];
   }
   $output = theme('table', $table);
 
@@ -67,18 +69,21 @@ function theme_ldap_query_list($variables) {
  *   - type:  'table', 'list', etc for style to render
  *
  * @ingroup themeable
+ *
+ * @return string
  */
-
 function theme_ldap_query($variables) {
-
-  extract($variables);  // $ldap_query, $actions, $type (see above)
+  /** @var array $ldap_query */
+  /** @var bool $actions */
+  /** @var string $type */
+  extract($variables);
 
   ldap_servers_module_load_include('php', 'ldap_query', 'LdapQuery.class');
-  $properties = array();
+  $properties = [];
   foreach (LdapQuery::fields() as $field_id => $field) {
     $value = $ldap_query->{$field['property_name']};
     if (is_scalar($value)) {
-      $properties[] = $field_id . " = " . $value; // $value";
+      $properties[] = $field_id . " = " . $value;
     }
   }
 
@@ -88,39 +93,49 @@ function theme_ldap_query($variables) {
   }
 
   $output = theme_item_list(
-    array(
+    [
       'items' => $properties,
       'type' => 'ul',
       'title' => 'Query Properties',
-      'attributes' => array()
-      )
+      'attributes' => [],
+    ]
     );
 
   return $output;
 }
 
+/**
+ * @param $variables
+ *
+ * @return string
+ */
 function theme_ldap_query_results($variables) {
-  extract($variables);  // $ldap_query, $results, $show_query
+  // $ldap_query, $results, $show_query.
+  /** @var array $ldap_query */
+  /** @var array $results */
+  /** @var mixed $show_query */
+  extract($variables);
 
-  $query = theme('ldap_query', array('ldap_query' => $ldap_query));
-  $results_text = t('LDAP Query Results: count=%count', array('%count' => $results['count']));
+  $query = theme('ldap_query', ['ldap_query' => $ldap_query]);
+  $results_text = t('LDAP Query Results: count=%count', ['%count' => $results['count']]);
 
   if (!$results['count']) {
     return $query . '<br/>' . $results_text;
   }
 
-  $table = array(
-    'header' => array('DN'),
-    'attributes' => array('id' => 'ldap_query_resultset', 'class' => 'data'),
-    'colgroups' => array(),
+  $table = [
+    'header' => ['DN'],
+    'attributes' => ['id' => 'ldap_query_resultset', 'class' => 'data'],
+    'colgroups' => [],
     'sticky' => FALSE,
     'empty' => '',
     'caption' => $results_text,
-  );
+  ];
   unset($results['count']);
 
-  $attributes_display = array();
-  if (isset($results[0]) && $results[0]) { // searching on all attributes
+  $attributes_display = [];
+  // Searching on all attributes.
+  if (isset($results[0]) && $results[0]) {
     foreach ($results[0] as $k => $v) {
       if (is_numeric($k)) {
         $attributes_display[] = $v;
@@ -128,15 +143,15 @@ function theme_ldap_query_results($variables) {
     }
   }
 
-
   foreach ($attributes_display as $attr) {
     $table['header'][] = $attr;
   }
 
   foreach ($results as $i => $entry) {
-    $row = array($entry['dn']);
+    $row = [$entry['dn']];
     foreach ($attributes_display as $i => $attr_name) {
-      $attr_name = ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_QUERY_ARRAY); // drupal_strtolower($attr_name);
+      // drupal_strtolower($attr_name);
+      $attr_name = ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_QUERY_ARRAY);
       if (!isset($entry[$attr_name])) {
         $row[] = 'no data';
       }
@@ -147,8 +162,6 @@ function theme_ldap_query_results($variables) {
       else {
         $row[] = $entry[$attr_name];
       }
-    //  unset($attr_data['count']);
-
     }
     unset($entry['count']);
     $table['rows'][] = $row;
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/LdapServer.class.php b/drupal7/sites/all/modules/ldap/ldap_servers/LdapServer.class.php
index 4b79af1c..f8c90867 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/LdapServer.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/LdapServer.class.php
@@ -3,27 +3,26 @@
 /**
  * @file
  * Defines server classes and related functions.
- *
  */
 
 /**
- * TODO check if this already exists or find a better place for this function
+ * TODO check if this already exists or find a better place for this function.
  *
  * Formats a ldap-entry ready to be printed on console.
- * TODO describe preconditions for ldap_entry
+ * TODO describe preconditions for ldap_entry.
  */
 function pretty_print_ldap_entry($ldap_entry) {
-  $m = array();
+  $m = [];
   for ($i = 0; $i < $ldap_entry['count']; $i++) {
     $k = $ldap_entry[$i];
     $v = $ldap_entry[$k];
-    if(is_array($v)) {
-      $m2 = array();
+    if (is_array($v)) {
+      $m2 = [];
       $max = $v['count'] > 3 ? 3 : $v['count'];
       for ($j = 0; $j < $max; $j++) {
-	$m2[] = $v[$j];
+        $m2[] = $v[$j];
       }
-      $v = "(".join(", ", $m2).")";
+      $v = "(" . join(", ", $m2) . ")";
     }
     $m[] = $k . ": " . $v;
   }
@@ -31,15 +30,14 @@ function pretty_print_ldap_entry($ldap_entry) {
 }
 
 /**
- * LDAP Server Class
+ * LDAP Server Class.
  *
- *  This class is used to create, work with, and eventually destroy ldap_server
+ * This class is used to create, work with, and eventually destroy ldap_server
  * objects.
  *
  * @todo make bindpw protected
  */
 class LdapServer {
-  // LDAP Settings
 
   const LDAP_CONNECT_ERROR = 0x5b;
   const LDAP_SUCCESS = 0x00;
@@ -56,47 +54,115 @@ class LdapServer {
   public $tls = FALSE;
   public $followrefs = FALSE;
   public $bind_method = 0;
-  public $basedn = array();
-  public $binddn = FALSE; // Default to an anonymous bind.
-  public $bindpw = FALSE; // Default to an anonymous bind.
+  public $basedn = [];
+
+  /**
+   * Default to an anonymous bind.
+   */
+  public $binddn = FALSE;
+
+  /**
+   * Default to an anonymous bind.
+   */
+  public $bindpw = FALSE;
+
   public $user_dn_expression;
   public $user_attr;
-  public $account_name_attr; //lowercase
-  public $mail_attr; //lowercase
+
+  /**
+   * Lowercase.
+   */
+  public $account_name_attr;
+
+  /**
+   * Lowercase.
+   */
+  public $mail_attr;
   public $mail_template;
   public $picture_attr;
-  public $unique_persistent_attr; //lowercase
+
+  /**
+   * Lowercase.
+   */
+  public $unique_persistent_attr;
   public $unique_persistent_attr_binary = FALSE;
   public $ldapToDrupalUserPhp;
   public $testingDrupalUsername;
   public $testingDrupalUserDn;
   public $detailed_watchdog_log;
   public $editPath;
-  public $queriableWithoutUserCredentials = FALSE; // can this server be queried without user credentials provided?
-  public $userAttributeNeededCache = array(); // array of attributes needed keyed on $op such as 'user_update'
+
+  /**
+   * Can this server be queried without user credentials provided?
+   */
+  public $queriableWithoutUserCredentials = FALSE;
+
+  /**
+   * Array of attributes needed keyed on $op such as 'user_update'.
+   */
+  public $userAttributeNeededCache = [];
 
   public $groupFunctionalityUnused = 0;
   public $groupObjectClass;
-  public $groupNested = 0; // 1 | 0
+
+  /**
+   * 1 | 0.
+   */
+  public $groupNested = 0;
   public $groupDeriveFromDn = FALSE;
-  public $groupDeriveFromDnAttr = NULL; //lowercase
-  public $groupUserMembershipsAttrExists = FALSE; // does a user attribute containing groups exist?
-  public $groupUserMembershipsAttr = NULL;   //lowercase     // name of user attribute containing groups
-  public $groupUserMembershipsConfigured = FALSE; // user attribute containing memberships is configured enough to use
 
-  public $groupMembershipsAttr = NULL;  //lowercase // members, uniquemember, memberUid
-  public $groupMembershipsAttrMatchingUserAttr = NULL; //lowercase // dn, cn, etc contained in groupMembershipsAttr
-  public $groupGroupEntryMembershipsConfigured = FALSE; // are groupMembershipsAttrMatchingUserAttr and groupGroupEntryMembershipsConfigured populated
+  /**
+   * Lowercase.
+   */
+  public $groupDeriveFromDnAttr = NULL;
+
+  /**
+   * Does a user attribute containing groups exist?
+   */
+  public $groupUserMembershipsAttrExists = FALSE;
+
+  /**
+   * Lowercase name of user attribute containing groups.
+   */
+  public $groupUserMembershipsAttr = NULL;
+  /**
+   * User attribute containing memberships is configured enough to use.
+   */
+  public $groupUserMembershipsConfigured = FALSE;
+
+  /**
+   * Lowercase // members, uniquemember, memberUid.
+   */
+  public $groupMembershipsAttr = NULL;
+
+
+  /**
+   * Lowercase // dn, cn, etc contained in groupMembershipsAttr.
+   */
+  public $groupMembershipsAttrMatchingUserAttr = NULL;
+
+  /**
+   * Are groupMembershipsAttrMatchingUserAttr and
+   * groupGroupEntryMembershipsConfigured populated.
+   */
+  public $groupGroupEntryMembershipsConfigured = FALSE;
 
   public $groupTestGroupDn = NULL;
   public $groupTestGroupDnWriteable = NULL;
 
-  private $group_properties = array(
-    'groupObjectClass', 'groupNested', 'groupDeriveFromDn', 'groupDeriveFromDnAttr', 'groupUserMembershipsAttrExists',
-    'groupUserMembershipsAttr', 'groupMembershipsAttrMatchingUserAttr', 'groupTestGroupDn', 'groupTestGroupDnWriteable'
-  );
-
-  public $paginationEnabled = FALSE; // (boolean)(function_exists('ldap_control_paged_result_response') && function_exists('ldap_control_paged_result'));
+  private $group_properties = [
+    'groupObjectClass',
+    'groupNested',
+    'groupDeriveFromDn',
+    'groupDeriveFromDnAttr',
+    'groupUserMembershipsAttrExists',
+    'groupUserMembershipsAttr',
+    'groupMembershipsAttrMatchingUserAttr',
+    'groupTestGroupDn',
+    'groupTestGroupDnWriteable',
+  ];
+
+  public $paginationEnabled = FALSE;
   public $searchPagination = FALSE;
   public $searchPageSize = 1000;
   public $searchPageStart = 0;
@@ -105,59 +171,58 @@ class LdapServer {
   public $inDatabase = FALSE;
   public $connection;
 
-
   /**
-   * Direct mapping of db to object properties
+   * Direct mapping of db to object properties.
    *
    * @return array
    */
   public static function field_to_properties_map() {
-    return array(
-    'sid' => 'sid',
-    'numeric_sid' => 'numericSid',
-    'name'  => 'name' ,
-    'status'  => 'status',
-    'ldap_type'  => 'ldap_type',
-    'address'  => 'address',
-    'port'  => 'port',
-    'tls'  => 'tls',
-    'followrefs'  => 'followrefs',
-    'bind_method' => 'bind_method',
-    'basedn'  => 'basedn',
-    'binddn'  => 'binddn',
-    'user_dn_expression' => 'user_dn_expression',
-    'user_attr'  => 'user_attr',
-    'account_name_attr'  => 'account_name_attr',
-    'mail_attr'  => 'mail_attr',
-    'mail_template'  => 'mail_template',
-    'picture_attr'  => 'picture_attr',
-    'unique_persistent_attr' => 'unique_persistent_attr',
-    'unique_persistent_attr_binary' => 'unique_persistent_attr_binary',
-    'ldap_to_drupal_user'  => 'ldapToDrupalUserPhp',
-    'testing_drupal_username'  => 'testingDrupalUsername',
-    'testing_drupal_user_dn'  => 'testingDrupalUserDn',
-
-    'grp_unused' => 'groupFunctionalityUnused',
-    'grp_object_cat' => 'groupObjectClass',
-    'grp_nested' => 'groupNested',
-    'grp_user_memb_attr_exists' => 'groupUserMembershipsAttrExists',
-    'grp_user_memb_attr' => 'groupUserMembershipsAttr',
-    'grp_memb_attr' => 'groupMembershipsAttr',
-    'grp_memb_attr_match_user_attr' => 'groupMembershipsAttrMatchingUserAttr',
-    'grp_derive_from_dn' => 'groupDeriveFromDn',
-    'grp_derive_from_dn_attr' => 'groupDeriveFromDnAttr',
-    'grp_test_grp_dn' => 'groupTestGroupDn',
-    'grp_test_grp_dn_writeable' => 'groupTestGroupDnWriteable',
-
-    'search_pagination' => 'searchPagination',
-    'search_page_size' => 'searchPageSize',
+    return [
+      'sid' => 'sid',
+      'numeric_sid' => 'numericSid',
+      'name'  => 'name' ,
+      'status'  => 'status',
+      'ldap_type'  => 'ldap_type',
+      'address'  => 'address',
+      'port'  => 'port',
+      'tls'  => 'tls',
+      'followrefs'  => 'followrefs',
+      'bind_method' => 'bind_method',
+      'basedn'  => 'basedn',
+      'binddn'  => 'binddn',
+      'user_dn_expression' => 'user_dn_expression',
+      'user_attr'  => 'user_attr',
+      'account_name_attr'  => 'account_name_attr',
+      'mail_attr'  => 'mail_attr',
+      'mail_template'  => 'mail_template',
+      'picture_attr'  => 'picture_attr',
+      'unique_persistent_attr' => 'unique_persistent_attr',
+      'unique_persistent_attr_binary' => 'unique_persistent_attr_binary',
+      'ldap_to_drupal_user'  => 'ldapToDrupalUserPhp',
+      'testing_drupal_username'  => 'testingDrupalUsername',
+      'testing_drupal_user_dn'  => 'testingDrupalUserDn',
+
+      'grp_unused' => 'groupFunctionalityUnused',
+      'grp_object_cat' => 'groupObjectClass',
+      'grp_nested' => 'groupNested',
+      'grp_user_memb_attr_exists' => 'groupUserMembershipsAttrExists',
+      'grp_user_memb_attr' => 'groupUserMembershipsAttr',
+      'grp_memb_attr' => 'groupMembershipsAttr',
+      'grp_memb_attr_match_user_attr' => 'groupMembershipsAttrMatchingUserAttr',
+      'grp_derive_from_dn' => 'groupDeriveFromDn',
+      'grp_derive_from_dn_attr' => 'groupDeriveFromDnAttr',
+      'grp_test_grp_dn' => 'groupTestGroupDn',
+      'grp_test_grp_dn_writeable' => 'groupTestGroupDnWriteable',
+
+      'search_pagination' => 'searchPagination',
+      'search_page_size' => 'searchPageSize',
 
-    );
+    ];
 
   }
 
   /**
-   * Constructor Method
+   * Constructor Method.
    *
    * @param $sid
    */
@@ -169,7 +234,7 @@ class LdapServer {
     $server_record = FALSE;
     if (module_exists('ctools')) {
       ctools_include('export');
-      $result = ctools_export_load_object('ldap_servers', 'names', array($sid));
+      $result = ctools_export_load_object('ldap_servers', 'names', [$sid]);
       if (isset($result[$sid])) {
         $server_record = new stdClass();
         foreach ($result[$sid] as $db_field_name => $value) {
@@ -197,7 +262,7 @@ class LdapServer {
       $this->inDatabase = TRUE;
       $this->sid = $sid;
       $this->detailedWatchdogLog = variable_get('ldap_help_watchdog_detail', 0);
-      foreach ($this->field_to_properties_map() as $db_field_name => $property_name ) {
+      foreach ($this->field_to_properties_map() as $db_field_name => $property_name) {
         if (isset($server_record->$db_field_name)) {
           $this->{$property_name} = $server_record->$db_field_name;
         }
@@ -210,17 +275,18 @@ class LdapServer {
   /**
    * This method sets properties that don't directly map from db record.
    *
-   * It is split out so it can be shared with ldapServerTest.class.php
+   * It is split out so it can be shared with ldapServerTest.class.php.
    *
    * @param $bindpw
    */
   protected function initDerivedProperties($bindpw) {
 
-    // get this->basedn in array format
+    // Get this->basedn in array format.
     if (!$this->basedn) {
-      $this->basedn = array();
+      $this->basedn = [];
     }
-    elseif (is_array($this->basedn)) { // do nothing
+    // Do nothing.
+    elseif (is_array($this->basedn)) {
     }
     else {
       $basedn_unserialized = @unserialize($this->basedn);
@@ -228,10 +294,10 @@ class LdapServer {
         $this->basedn = $basedn_unserialized;
       }
       else {
-        $this->basedn = array();
+        $this->basedn = [];
         $token = is_scalar($basedn_unserialized) ? $basedn_unserialized : print_r($basedn_unserialized, TRUE);
-        debug("basednb desearialization error". $token);
-        watchdog('ldap_servers', 'Failed to deserialize LdapServer::basedn of !basedn', array('!basedn' => $token), WATCHDOG_ERROR);
+        debug("basednb desearialization error" . $token);
+        watchdog('ldap_servers', 'Failed to deserialize LdapServer::basedn of !basedn', ['!basedn' => $token], WATCHDOG_ERROR);
       }
 
     }
@@ -254,9 +320,9 @@ class LdapServer {
       }
     }
 
-    $this->paginationEnabled = (boolean)(ldap_servers_php_supports_pagination() && $this->searchPagination);
+    $this->paginationEnabled = (boolean) (ldap_servers_php_supports_pagination() && $this->searchPagination);
 
-    $this->queriableWithoutUserCredentials = (boolean)(
+    $this->queriableWithoutUserCredentials = (boolean) (
       $this->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT ||
       $this->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER
     );
@@ -267,7 +333,7 @@ class LdapServer {
   }
 
   /**
-   * Destructor Method
+   * Destructor Method.
    */
   public function __destruct() {
     // Close the server connection to be sure.
@@ -275,7 +341,7 @@ class LdapServer {
   }
 
   /**
-   * Invoke Method
+   * Invoke Method.
    */
   public function __invoke() {
     $this->connect();
@@ -283,7 +349,7 @@ class LdapServer {
   }
 
   /**
-   * Connect Method
+   * Connect Method.
    */
   public function connect() {
     if (!function_exists('ldap_connect')) {
@@ -297,7 +363,7 @@ class LdapServer {
     }
 
     ldap_set_option($con, LDAP_OPT_PROTOCOL_VERSION, 3);
-    ldap_set_option($con, LDAP_OPT_REFERRALS, (int)$this->followrefs);
+    ldap_set_option($con, LDAP_OPT_REFERRALS, (int) $this->followrefs);
 
     // Use TLS if we are configured and able to.
     if ($this->tls) {
@@ -315,25 +381,24 @@ class LdapServer {
         return LDAP_CONNECT_ERROR;
       }
       elseif (!ldap_start_tls($con)) {
-        $msg = t("Could not start TLS. (Error %errno: %error).", array('%errno' => ldap_errno($con), '%error' => ldap_error($con)));
+        $msg = t("Could not start TLS. (Error %errno: %error).", ['%errno' => ldap_errno($con), '%error' => ldap_error($con)]);
         watchdog('ldap_servers', $msg);
         return LDAP_CONNECT_ERROR;
       }
     }
 
-  // Store the resulting resource
-  $this->connection = $con;
-  return LDAP_SUCCESS;
+    // Store the resulting resource.
+    $this->connection = $con;
+    return LDAP_SUCCESS;
   }
 
-
   /**
-	 * Bind (authenticate) against an active LDAP database.
-	 *
-	 * @param $userdn
-	 *   The DN to bind against. If NULL, we use $this->binddn
-	 * @param $pass
-	 *   The password search base. If NULL, we use $this->bindpw
+   * Bind (authenticate) against an active LDAP database.
+   *
+   * @param $userdn
+   *   The DN to bind against. If NULL, we use $this->binddn
+   * @param $pass
+   *   The password search base. If NULL, we use $this->bindpw
    *
    * @return
    *   Result of bind; TRUE if successful, FALSE otherwise.
@@ -342,7 +407,7 @@ class LdapServer {
 
     // Ensure that we have an active server connection.
     if (!$this->connection) {
-      watchdog('ldap_servers', "LDAP bind failure for user %user. Not connected to LDAP server.", array('%user' => $userdn));
+      watchdog('ldap_servers', "LDAP bind failure for user %user. Not connected to LDAP server.", ['%user' => $userdn]);
       return LDAP_CONNECT_ERROR;
     }
 
@@ -352,7 +417,7 @@ class LdapServer {
     if ($anon_bind === TRUE) {
       if (@!ldap_bind($this->connection)) {
         if ($this->detailedWatchdogLog) {
-          watchdog('ldap_servers', "LDAP anonymous bind error. Error %errno: %error", array('%errno' => ldap_errno($this->connection), '%error' => ldap_error($this->connection)));
+          watchdog('ldap_servers', "LDAP anonymous bind error. Error %errno: %error", ['%errno' => ldap_errno($this->connection), '%error' => ldap_error($this->connection)]);
         }
         return ldap_errno($this->connection);
       }
@@ -363,16 +428,16 @@ class LdapServer {
 
       if ($this->followrefs) {
         $rebHandler = new LdapServersRebindHandler($userdn, $pass);
-        ldap_set_rebind_proc($this->connection, array($rebHandler, 'rebind_callback'));
+        ldap_set_rebind_proc($this->connection, [$rebHandler, 'rebind_callback']);
       }
 
       if (drupal_strlen($pass) == 0 || drupal_strlen($userdn) == 0) {
-        watchdog('ldap_servers', "LDAP bind failure for user userdn=%userdn, pass=%pass.", array('%userdn' => $userdn, '%pass' => $pass));
+        watchdog('ldap_servers', "LDAP bind failure for user userdn=%userdn, pass=%pass.", ['%userdn' => $userdn, '%pass' => $pass]);
         return LDAP_LOCAL_ERROR;
       }
       if (@!ldap_bind($this->connection, $userdn, $pass)) {
         if ($this->detailedWatchdogLog) {
-          watchdog('ldap_servers', "LDAP bind failure for user %user. Error %errno: %error", array('%user' => $userdn, '%errno' => ldap_errno($this->connection), '%error' => ldap_error($this->connection)));
+          watchdog('ldap_servers', "LDAP bind failure for user %user. Error %errno: %error", ['%user' => $userdn, '%errno' => ldap_errno($this->connection), '%error' => ldap_error($this->connection)]);
         }
         return ldap_errno($this->connection);
       }
@@ -386,8 +451,8 @@ class LdapServer {
    */
   public function disconnect() {
     if (!$this->connection) {
-      // never bound or not currently bound, so no need to disconnect
-      //watchdog('ldap_servers', 'LDAP disconnect failure from '. $this->server_addr . ':' . $this->port);
+      // Never bound or not currently bound, so no need to disconnect
+      // watchdog('ldap_servers', 'LDAP disconnect failure from '. $this->server_addr . ':' . $this->port);.
     }
     else {
       ldap_unbind($this->connection);
@@ -399,25 +464,26 @@ class LdapServer {
    *
    */
   public function connectAndBindIfNotAlready() {
-    if (! $this->connection) {
+    if (!$this->connection) {
       $this->connect();
       $this->bind();
     }
   }
 
   /**
-   * does dn exist for this server?
-   *
+   * Does dn exist for this server?
    *
    * @param string $dn
-   * @param enum $return = 'boolean' or 'ldap_entry'
-   * @param array $attributes in same form as ldap_read $attributes parameter
+   * @param enum $return
+   *   = 'boolean' or 'ldap_entry'.
+   * @param array $attributes
+   *   in same form as ldap_read $attributes parameter.
    *
    * @return bool|array
    */
   public function dnExists($dn, $return = 'boolean', $attributes = NULL) {
 
-    $params = array(
+    $params = [
       'base_dn' => $dn,
       'attributes' => $attributes,
       'attrsonly' => FALSE,
@@ -425,10 +491,10 @@ class LdapServer {
       'sizelimit' => 0,
       'timelimit' => 0,
       'deref' => NULL,
-    );
+    ];
 
     if ($return == 'boolean' || !is_array($attributes)) {
-      $params['attributes'] = array('objectclass');
+      $params['attributes'] = ['objectclass'];
     }
     else {
       $params['attributes'] = $attributes;
@@ -447,7 +513,8 @@ class LdapServer {
   }
 
   /**
-   * @param $ldap_result as ldap link identifier
+   * @param $ldap_result
+   *   as ldap link identifier
    *
    * @return FALSE on error or number of entries.
    *   (if 0 entries will return 0)
@@ -457,13 +524,15 @@ class LdapServer {
   }
 
   /**
-   * create ldap entry.
+   * Create ldap entry.
    *
-   * @param array $attributes should follow the structure of ldap_add functions
+   * @param array $attributes
+   *   should follow the structure of ldap_add functions
    *   entry array: http://us.php.net/manual/en/function.ldap-add.php
    *     $attributes["attribute1"] = "value";
    *     $attributes["attribute2"][0] = "value1";
-   *     $attributes["attribute2"][1] = "value2";
+   *     $attributes["attribute2"][1] = "value2";.
+   *
    * @return boolean result
    */
   public function createLdapEntry($attributes, $dn = NULL) {
@@ -487,7 +556,7 @@ class LdapServer {
     $result = @ldap_add($this->connection, $dn, $attributes);
     if (!$result) {
       $error = "LDAP Server ldap_add(%dn) Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
-      $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
+      $tokens = ['%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))];
       watchdog('ldap_servers', $error, $tokens, WATCHDOG_ERROR);
     }
 
@@ -530,12 +599,13 @@ class LdapServer {
         }
       }
 
-      // identical multivalued attributes
+      // Identical multivalued attributes.
       if (is_array($new_val) && is_array($old_value) && count(array_diff($new_val, $old_value)) == 0) {
         unset($new_entry[$key]);
       }
       elseif ($old_value_is_scalar && !is_array($new_val) && drupal_strtolower($old_value) == drupal_strtolower($new_val)) {
-        unset($new_entry[$key]); // don't change values that aren't changing to avoid false permission constraints
+        // don't change values that aren't changing to avoid false permission constraints.
+        unset($new_entry[$key]);
       }
     }
 
@@ -543,18 +613,20 @@ class LdapServer {
   }
 
   /**
-   * modify attributes of ldap entry
+   * Modify attributes of ldap entry.
    *
-   * @param string $dn DN of entry
-   * @param array $attributes should follow the structure of ldap_add functions
+   * @param string $dn
+   *   DN of entry.
+   * @param array $attributes
+   *   should follow the structure of ldap_add functions
    *   entry array: http://us.php.net/manual/en/function.ldap-add.php
    *     $attributes["attribute1"] = "value";
    *     $attributes["attribute2"][0] = "value1";
-   *     $attributes["attribute2"][1] = "value2";
+   *     $attributes["attribute2"][1] = "value2";.
    *
    * @return TRUE on success FALSE on error
    */
-  public function modifyLdapEntry($dn, $attributes = array(), $old_attributes = FALSE) {
+  public function modifyLdapEntry($dn, $attributes = [], $old_attributes = FALSE) {
 
     $this->connectAndBindIfNotAlready();
 
@@ -562,7 +634,7 @@ class LdapServer {
       $result = @ldap_read($this->connection, $dn, 'objectClass=*');
       if (!$result) {
         $error = "LDAP Server ldap_read(%dn) in LdapServer::modifyLdapEntry() Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
-        $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
+        $tokens = ['%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))];
         watchdog('ldap_servers', $error, $tokens, WATCHDOG_ERROR);
         return FALSE;
       }
@@ -592,12 +664,13 @@ class LdapServer {
         }
       }
 
-      if ($cur_val == '' && $old_value != '') { // remove enpty attributes
+      // Remove enpty attributes.
+      if ($cur_val == '' && $old_value != '') {
         unset($attributes[$key]);
-        $result = @ldap_mod_del($this->connection, $dn, array($key_lcase => $old_value));
+        $result = @ldap_mod_del($this->connection, $dn, [$key_lcase => $old_value]);
         if (!$result) {
           $error = "LDAP Server ldap_mod_del(%dn) in LdapServer::modifyLdapEntry() Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
-          $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
+          $tokens = ['%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))];
           watchdog('ldap_servers', $error, $tokens, WATCHDOG_ERROR);
           return FALSE;
         }
@@ -605,7 +678,8 @@ class LdapServer {
       elseif (is_array($cur_val)) {
         foreach ($cur_val as $mv_key => $mv_cur_val) {
           if ($mv_cur_val == '') {
-            unset($attributes[$key][$mv_key]); // remove empty values in multivalues attributes
+            // Remove empty values in multivalues attributes.
+            unset($attributes[$key][$mv_key]);
           }
           else {
             $attributes[$key][$mv_key] = $mv_cur_val;
@@ -618,7 +692,7 @@ class LdapServer {
       $result = @ldap_modify($this->connection, $dn, $attributes);
       if (!$result) {
         $error = "LDAP Server ldap_modify(%dn) in LdapServer::modifyLdapEntry() Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
-        $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
+        $tokens = ['%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))];
         watchdog('ldap_servers', $error, $tokens, WATCHDOG_ERROR);
         return FALSE;
       }
@@ -643,18 +717,18 @@ class LdapServer {
     $result = @ldap_delete($this->connection, $dn);
     if (!$result) {
       $error = "LDAP Server delete(%dn) in LdapServer::delete() Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
-      $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
+      $tokens = ['%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))];
       watchdog('ldap_servers', $error, $tokens, WATCHDOG_ERROR);
     }
     return $result;
   }
 
   /**
-   * Perform an LDAP search on all base dns and aggregate into one result
+   * Perform an LDAP search on all base dns and aggregate into one result.
    *
    * @param string $filter
-   *   The search filter. such as sAMAccountName=jbarclay.  attribute values (e.g. jbarclay) should be esacaped before calling
-
+   *   The search filter. such as sAMAccountName=jbarclay.  attribute values (e.g. jbarclay) should be esacaped before calling.
+   *
    * @param array $attributes
    *   List of desired attributes. If omitted, we only return "dn".
    *
@@ -666,17 +740,20 @@ class LdapServer {
    */
   public function searchAllBaseDns(
     $filter,
-    $attributes = array(),
+    $attributes = [],
     $attrsonly = 0,
     $sizelimit = 0,
     $timelimit = 0,
     $deref = NULL,
     $scope = LDAP_SCOPE_SUBTREE
     ) {
-    $all_entries = array();
-    foreach ($this->basedn as $base_dn) {  // need to search on all basedns one at a time
-      $entries = $this->search($base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref, $scope);  // no attributes, just dns needed
-      if ($entries === FALSE) { // if error in any search, return false
+    $all_entries = [];
+    // Need to search on all basedns one at a time.
+    foreach ($this->basedn as $base_dn) {
+      // No attributes, just dns needed.
+      $entries = $this->search($base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref, $scope);
+      // If error in any search, return false.
+      if ($entries === FALSE) {
         return FALSE;
       }
       if (count($all_entries) == 0) {
@@ -700,10 +777,10 @@ class LdapServer {
    * Perform an LDAP search.
    *
    * @param string $basedn
-   *   The search base. If NULL, we use $this->basedn. should not be esacaped
+   *   The search base. If NULL, we use $this->basedn. should not be esacaped.
    * @param string $filter
    *   The search filter. such as sAMAccountName=jbarclay.  attribute values
-   * (e.g. jbarclay) should be esacaped before calling
+   *   (e.g. jbarclay) should be esacaped before calling.
    *
    * @param array $attributes
    *   List of desired attributes. If omitted, we only return "dn".
@@ -715,10 +792,16 @@ class LdapServer {
    *   elements if search returns no results),
    *   or FALSE on error.
    */
-  public function search($base_dn = NULL, $filter, $attributes = array(),
-    $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = NULL, $scope = LDAP_SCOPE_SUBTREE) {
+  public function search($base_dn = NULL,
+  $filter,
+  $attributes = [],
+    $attrsonly = 0,
+  $sizelimit = 0,
+  $timelimit = 0,
+  $deref = NULL,
+  $scope = LDAP_SCOPE_SUBTREE) {
 
-     /**
+    /**
       * pagingation issues:
       * -- see documentation queue: http://markmail.org/message/52w24iae3g43ikix#query:+page:1+mid:bez5vpl6smgzmymy+state:results
       * -- wait for php 5.4? https://svn.php.net/repository/php/php-src/tags/php_5_4_0RC6/NEWS (ldap_control_paged_result
@@ -735,7 +818,7 @@ class LdapServer {
     }
 
     $attr_display = is_array($attributes) ? join(',', $attributes) : 'none';
-    $query = 'ldap_search() call: ' . join(",\n", array(
+    $query = 'ldap_search() call: ' . join(",\n", [
       'base_dn: ' . $base_dn,
       'filter = ' . $filter,
       'attributes: ' . $attr_display,
@@ -744,19 +827,19 @@ class LdapServer {
       'timelimit = ' . $timelimit,
       'deref = ' . $deref,
       'scope = ' . $scope,
-      )
+    ]
     );
     if ($this->detailed_watchdog_log) {
-      watchdog('ldap_servers', $query, array());
+      watchdog('ldap_servers', $query, []);
     }
 
     // When checking multiple servers, there's a chance we might not be connected yet.
-    if (! $this->connection) {
+    if (!$this->connection) {
       $this->connect();
       $this->bind();
     }
 
-    $ldap_query_params = array(
+    $ldap_query_params = [
       'connection' => $this->connection,
       'base_dn' => $base_dn,
       'filter' => $filter,
@@ -767,7 +850,7 @@ class LdapServer {
       'deref' => $deref,
       'query_display' => $query,
       'scope' => $scope,
-    );
+    ];
 
     if ($this->searchPagination && $this->paginationEnabled) {
       $aggregated_entries = $this->pagedLdapQuery($ldap_query_params);
@@ -775,15 +858,19 @@ class LdapServer {
     }
     else {
       $result = $this->ldapQuery($scope, $ldap_query_params);
-      if ($result && ($this->countEntries($result) !== FALSE) ) {
+      if ($result && ($this->countEntries($result) !== FALSE)) {
         $entries = ldap_get_entries($this->connection, $result);
         drupal_alter('ldap_server_search_results', $entries, $ldap_query_params);
         return (is_array($entries)) ? $entries : FALSE;
       }
       elseif ($this->ldapErrorNumber()) {
-        $watchdog_tokens = array('%basedn' => $ldap_query_params['base_dn'], '%filter' => $ldap_query_params['filter'],
-          '%attributes' => print_r($ldap_query_params['attributes'], TRUE), '%errmsg' => $this->errorMsg('ldap'),
-          '%errno' => $this->ldapErrorNumber());
+        $watchdog_tokens = [
+          '%basedn' => $ldap_query_params['base_dn'],
+          '%filter' => $ldap_query_params['filter'],
+          '%attributes' => print_r($ldap_query_params['attributes'], TRUE),
+          '%errmsg' => $this->errorMsg('ldap'),
+          '%errno' => $this->ldapErrorNumber(),
+        ];
         watchdog('ldap_servers', "LDAP ldap_search error. basedn: %basedn| filter: %filter| attributes:
           %attributes| errmsg: %errmsg| ldap err no: %errno|", $watchdog_tokens);
         return FALSE;
@@ -795,12 +882,13 @@ class LdapServer {
   }
 
   /**
-   * execute a paged ldap query and return entries as one aggregated array
+   * Execute a paged ldap query and return entries as one aggregated array.
    *
    * $this->searchPageStart and $this->searchPageEnd should be set before calling if
-   *   a particular set of pages is desired
+   *   a particular set of pages is desired.
    *
-   * @param array $ldap_query_params of form:
+   * @param array $ldap_query_params
+   *   of form:
    *   'base_dn' => base_dn,
    *   'filter' =>  filter,
    *   'attributes' => attributes,
@@ -813,21 +901,27 @@ class LdapServer {
    *   (this array of parameters is primarily passed on to ldapQuery() method)
    *
    * @return array of ldap entries or FALSE on error.
-   *
    */
   public function pagedLdapQuery($ldap_query_params) {
 
     if (!($this->searchPagination && $this->paginationEnabled)) {
+      $watchdog_tokens = [
+        '%basedn' => $ldap_query_params['base_dn'],
+        '%filter' => $ldap_query_params['filter'],
+        '%attributes' => print_r($ldap_query_params['attributes'], TRUE),
+        '%errmsg' => $this->errorMsg('ldap'),
+        '%errno' => $this->ldapErrorNumber(),
+      ];
       watchdog('ldap_servers', "LDAP server pagedLdapQuery() called when functionality not available in php install or
         not enabled in ldap server configuration.  error. basedn: %basedn| filter: %filter| attributes:
          %attributes| errmsg: %errmsg| ldap err no: %errno|", $watchdog_tokens);
-      RETURN FALSE;
+      return FALSE;
     }
 
     $page_token = '';
     $page = 0;
     $estimated_entries = 0;
-    $aggregated_entries = array();
+    $aggregated_entries = [];
     $aggregated_entries_count = 0;
     $has_page_results = FALSE;
 
@@ -837,7 +931,7 @@ class LdapServer {
 
       if ($page >= $this->searchPageStart) {
         $skipped_page = FALSE;
-        if ($result && ($this->countEntries($result) !== FALSE) ) {
+        if ($result && ($this->countEntries($result) !== FALSE)) {
           $page_entries = ldap_get_entries($this->connection, $result);
           unset($page_entries['count']);
           $has_page_results = (is_array($page_entries) && count($page_entries) > 0);
@@ -845,12 +939,16 @@ class LdapServer {
           $aggregated_entries_count = count($aggregated_entries);
         }
         elseif ($this->ldapErrorNumber()) {
-          $watchdog_tokens = array('%basedn' => $ldap_query_params['base_dn'], '%filter' => $ldap_query_params['filter'],
-            '%attributes' => print_r($ldap_query_params['attributes'], TRUE), '%errmsg' => $this->errorMsg('ldap'),
-            '%errno' => $this->ldapErrorNumber());
+          $watchdog_tokens = [
+            '%basedn' => $ldap_query_params['base_dn'],
+            '%filter' => $ldap_query_params['filter'],
+            '%attributes' => print_r($ldap_query_params['attributes'], TRUE),
+            '%errmsg' => $this->errorMsg('ldap'),
+            '%errno' => $this->ldapErrorNumber(),
+          ];
           watchdog('ldap_servers', "LDAP ldap_search error. basedn: %basedn| filter: %filter| attributes:
             %attributes| errmsg: %errmsg| ldap err no: %errno|", $watchdog_tokens);
-          RETURN FALSE;
+          return FALSE;
         }
         else {
           return FALSE;
@@ -861,11 +959,11 @@ class LdapServer {
       }
       @ldap_control_paged_result_response($this->connection, $result, $page_token, $estimated_entries);
       if ($ldap_query_params['sizelimit'] && $this->ldapErrorNumber() == LDAP_SIZELIMIT_EXCEEDED) {
-        // false positive error thrown.  do not set result limit error when $sizelimit specified
+        // False positive error thrown.  do not set result limit error when $sizelimit specified.
       }
       elseif ($this->hasError()) {
         watchdog('ldap_servers', 'ldap_control_paged_result_response() function error. LDAP Error: %message, ldap_list() parameters: %query',
-          array('%message' => $this->errorMsg('ldap'), '%query' => $ldap_query_params['query_display']),
+          ['%message' => $this->errorMsg('ldap'), '%query' => $ldap_query_params['query_display']],
           WATCHDOG_ERROR);
       }
 
@@ -873,10 +971,12 @@ class LdapServer {
         $discarded_entries = array_splice($aggregated_entries, $ldap_query_params['sizelimit']);
         break;
       }
-      elseif ($this->searchPageEnd !== NULL && $page >= $this->searchPageEnd) { // user defined pagination has run out
+      // User defined pagination has run out.
+      elseif ($this->searchPageEnd !== NULL && $page >= $this->searchPageEnd) {
         break;
       }
-      elseif ($page_token === NULL || $page_token == '') { // ldap reference pagination has run out
+      // Ldap reference pagination has run out.
+      elseif ($page_token === NULL || $page_token == '') {
         break;
       }
       $page++;
@@ -887,9 +987,10 @@ class LdapServer {
   }
 
   /**
-   * execute ldap query and return ldap records
+   * Execute ldap query and return ldap records.
    *
    * @param scope
+   *
    * @params see pagedLdapQuery $params
    *
    * @return array of ldap entries
@@ -903,11 +1004,11 @@ class LdapServer {
         $result = @ldap_search($this->connection, $params['base_dn'], $params['filter'], $params['attributes'], $params['attrsonly'],
           $params['sizelimit'], $params['timelimit'], $params['deref']);
         if ($params['sizelimit'] && $this->ldapErrorNumber() == LDAP_SIZELIMIT_EXCEEDED) {
-          // false positive error thrown.  do not return result limit error when $sizelimit specified
+          // False positive error thrown.  do not return result limit error when $sizelimit specified.
         }
         elseif ($this->hasError()) {
           watchdog('ldap_servers', 'ldap_search() function error. LDAP Error: %message, ldap_search() parameters: %query',
-            array('%message' => $this->errorMsg('ldap'), '%query' => $params['query_display']),
+            ['%message' => $this->errorMsg('ldap'), '%query' => $params['query_display']],
             WATCHDOG_ERROR);
         }
         break;
@@ -916,11 +1017,11 @@ class LdapServer {
         $result = @ldap_read($this->connection, $params['base_dn'], $params['filter'], $params['attributes'], $params['attrsonly'],
           $params['sizelimit'], $params['timelimit'], $params['deref']);
         if ($params['sizelimit'] && $this->ldapErrorNumber() == LDAP_SIZELIMIT_EXCEEDED) {
-          // false positive error thrown.  do not result limit error when $sizelimit specified
+          // False positive error thrown.  do not result limit error when $sizelimit specified.
         }
         elseif ($this->hasError()) {
           watchdog('ldap_servers', 'ldap_read() function error.  LDAP Error: %message, ldap_read() parameters: %query',
-            array('%message' => $this->errorMsg('ldap'), '%query' => @$params['query_display']),
+            ['%message' => $this->errorMsg('ldap'), '%query' => @$params['query_display']],
             WATCHDOG_ERROR);
         }
         break;
@@ -929,11 +1030,11 @@ class LdapServer {
         $result = @ldap_list($this->connection, $params['base_dn'], $params['filter'], $params['attributes'], $params['attrsonly'],
           $params['sizelimit'], $params['timelimit'], $params['deref']);
         if ($params['sizelimit'] && $this->ldapErrorNumber() == LDAP_SIZELIMIT_EXCEEDED) {
-          // false positive error thrown.  do not result limit error when $sizelimit specified
+          // False positive error thrown.  do not result limit error when $sizelimit specified.
         }
         elseif ($this->hasError()) {
           watchdog('ldap_servers', 'ldap_list() function error. LDAP Error: %message, ldap_list() parameters: %query',
-            array('%message' => $this->errorMsg('ldap'), '%query' => $params['query_display']),
+            ['%message' => $this->errorMsg('ldap'), '%query' => $params['query_display']],
             WATCHDOG_ERROR);
         }
         break;
@@ -942,7 +1043,8 @@ class LdapServer {
   }
 
   /**
-   * @param array $dns Mixed Case
+   * @param array $dns
+   *   Mixed Case.
    * @return array $dns Lower Case
    */
   public function dnArrayToLowerCase($dns) {
@@ -950,7 +1052,7 @@ class LdapServer {
   }
 
   /**
-   * userUserEntityFromPuid.
+   * UserUserEntityFromPuid.
    *
    * @param string $puid
    *   Binary or string as returned from ldap_read or other ldap function.
@@ -961,10 +1063,11 @@ class LdapServer {
 
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', 'user')
-    ->fieldCondition('ldap_user_puid_sid', 'value', $this->sid, '=')
-    ->fieldCondition('ldap_user_puid', 'value', $puid, '=')
-    ->fieldCondition('ldap_user_puid_property', 'value', $this->unique_persistent_attr, '=')
-    ->addMetaData('account', user_load(1)); // run the query as user 1
+      ->fieldCondition('ldap_user_puid_sid', 'value', $this->sid, '=')
+      ->fieldCondition('ldap_user_puid', 'value', $puid, '=')
+      ->fieldCondition('ldap_user_puid_property', 'value', $this->unique_persistent_attr, '=')
+    // Run the query as user 1.
+      ->addMetaData('account', user_load(1));
 
     $result = $query->execute();
 
@@ -976,7 +1079,7 @@ class LdapServer {
       }
       else {
         $uids = join(',', $uids);
-        $tokens = array('%uids' => $uids, '%puid' => $puid, '%sid' => $this->sid, '%ldap_user_puid_property' => $this->unique_persistent_attr);
+        $tokens = ['%uids' => $uids, '%puid' => $puid, '%sid' => $this->sid, '%ldap_user_puid_property' => $this->unique_persistent_attr];
         watchdog('ldap_servers', 'multiple users (uids: %uids) with same puid (puid=%puid, sid=%sid, ldap_user_puid_property=%ldap_user_puid_property)', $tokens, WATCHDOG_ERROR);
         return FALSE;
       }
@@ -1004,7 +1107,8 @@ class LdapServer {
       $watchdog_tokens['%code_result'] = $code_result;
       $ldap_username = $code_result;
       $watchdog_tokens['%ldap_username'] = $ldap_username;
-      $name = $old_name_value;  // important because of global scope of $name
+      // Important because of global scope of $name.
+      $name = $old_name_value;
       if ($this->detailedWatchdogLog) {
         watchdog('ldap_servers', '%drupal_user_name tansformed to %ldap_username by applying code <code>%code</code>', $watchdog_tokens, WATCHDOG_DEBUG);
       }
@@ -1013,19 +1117,18 @@ class LdapServer {
       $ldap_username = $drupal_username;
     }
 
-    // Let other modules alter the ldap name
-    $context = array(
+    // Let other modules alter the ldap name.
+    $context = [
       'ldap_server' => $this,
-    );
+    ];
     drupal_alter('ldap_servers_username_to_ldapname', $ldap_username, $drupal_username, $context);
 
     return $ldap_username;
 
   }
 
-
   /**
-   * userUsernameFromLdapEntry.
+   * UserUsernameFromLdapEntry.
    *
    * @param array $ldap_entry
    *
@@ -1034,11 +1137,10 @@ class LdapServer {
    */
   public function userUsernameFromLdapEntry($ldap_entry) {
 
-
     if ($this->account_name_attr) {
       $accountname = (empty($ldap_entry[$this->account_name_attr][0])) ? FALSE : $ldap_entry[$this->account_name_attr][0];
     }
-    elseif ($this->user_attr)  {
+    elseif ($this->user_attr) {
       $accountname = (empty($ldap_entry[$this->user_attr][0])) ? FALSE : $ldap_entry[$this->user_attr][0];
     }
     else {
@@ -1049,7 +1151,7 @@ class LdapServer {
   }
 
   /**
-   * userUsernameFromDn.
+   * UserUsernameFromDn.
    *
    * @param string $dn
    *
@@ -1058,7 +1160,7 @@ class LdapServer {
    */
   public function userUsernameFromDn($dn) {
 
-    $ldap_entry = @$this->dnExists($dn, 'ldap_entry', array());
+    $ldap_entry = @$this->dnExists($dn, 'ldap_entry', []);
     if (!$ldap_entry || !is_array($ldap_entry)) {
       return FALSE;
     }
@@ -1075,11 +1177,13 @@ class LdapServer {
    */
   public function userEmailFromLdapEntry($ldap_entry) {
 
-    if ($ldap_entry && $this->mail_attr) { // not using template
+    // Not using template.
+    if ($ldap_entry && $this->mail_attr) {
       $mail = isset($ldap_entry[$this->mail_attr][0]) ? $ldap_entry[$this->mail_attr][0] : FALSE;
       return $mail;
     }
-    elseif ($ldap_entry && $this->mail_template) {  // template is of form [cn]@illinois.edu
+    // Template is of form [cn]@illinois.edu.
+    elseif ($ldap_entry && $this->mail_template) {
       ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
       return ldap_servers_token_replace($ldap_entry, $this->mail_template, 'ldap_entry');
     }
@@ -1088,30 +1192,29 @@ class LdapServer {
     }
   }
 
-	/**
-	 * @param array $ldap_entry
-	 *
-	 * @return object|bool
+  /**
+   * @param array $ldap_entry
+   *
+   * @return object|bool
    *   Drupal file object image user's thumbnail or FALSE if none present or
    *   ERROR happens.
-	 */
-	public function userPictureFromLdapEntry($ldap_entry, $drupal_username = FALSE) {
-		if ($ldap_entry && $this->picture_attr) {
-			//Check if ldap entry has been provisioned.
-
-			$image_data = isset($ldap_entry[$this->picture_attr][0]) ? $ldap_entry[$this->picture_attr][0] : FALSE;
-			if (!$image_data) {
-				return FALSE;
-			}
+   */
+  public function userPictureFromLdapEntry($ldap_entry, $drupal_username = FALSE) {
+    if ($ldap_entry && $this->picture_attr) {
+      // Check if ldap entry has been provisioned.
+      $image_data = isset($ldap_entry[$this->picture_attr][0]) ? $ldap_entry[$this->picture_attr][0] : FALSE;
+      if (!$image_data) {
+        return FALSE;
+      }
 
-			$md5thumb = md5($image_data);
+      $md5thumb = md5($image_data);
 
-			/**
-			 * If the existing account already has picture check if it has changed. If
+      /**
+       * If the existing account already has picture check if it has changed. If
        * so remove the old file and create the new one. If a picture is not set
        * but the account has an md5 hash, something is wrong and we exit.
-			 */
-			if ($drupal_username && $account = user_load_by_name($drupal_username)) {
+       */
+      if ($drupal_username && $account = user_load_by_name($drupal_username)) {
         if ($account->uid == 0 || $account->uid == 1) {
           return FALSE;
         }
@@ -1141,24 +1244,25 @@ class LdapServer {
       return $this->savePictureData($image_data, $md5thumb);
     }
     return FALSE;
-	}
-
+  }
 
   /**
    * @param $image_data
    * @param $md5thumb
+   *
+   * @return bool|\stdClass
    */
   private function savePictureData($image_data, $md5thumb) {
-    //Create tmp file to get image format.
+    // Create tmp file to get image format.
     $filename = uniqid();
     $fileuri = file_directory_temp() . '/' . $filename;
     $size = file_put_contents($fileuri, $image_data);
     $info = image_get_info($fileuri);
     unlink($fileuri);
-    // create file object
+    // Create file object.
     $file = file_save_data($image_data, file_default_scheme() . '://' . variable_get('user_picture_path') . '/' . $filename . '.' . $info['extension']);
     $file->md5Sum = $md5thumb;
-    // standard Drupal validators for user pictures
+    // Standard Drupal validators for user pictures.
     $validators = [
       'file_validate_is_image' => [],
       'file_validate_image_resolution' => [variable_get('user_picture_dimensions', '85x85')],
@@ -1176,11 +1280,11 @@ class LdapServer {
     }
   }
 
-
   /**
    * @param array $ldap_entry
    *
-   * @return string user's PUID or permanent user id (within ldap), converted from binary, if applicable
+   * @return string
+   *   user's PUID or permanent user id (within ldap), converted from binary, if applicable
    */
   public function userPuidFromLdapEntry($ldap_entry) {
 
@@ -1202,17 +1306,21 @@ class LdapServer {
   }
 
   /**
-   *  @param mixed $user
-   *    - drupal user object (stdClass Object)
+   * @param mixed $user
+   *   - drupal user object (stdClass Object)
    *    - ldap entry of user (array)
    *    - ldap dn of user (string)
    *    - drupal username of user (string)
    *
-   *  @return array $ldap_user_entry (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
+   * @return array $ldap_user_entry (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
    */
   public function user_lookup($user) {
     return $this->userUserToExistingLdapEntry($user);
   }
+
+  /**
+   *
+   */
   public function userUserToExistingLdapEntry($user) {
 
     if (is_object($user)) {
@@ -1222,7 +1330,8 @@ class LdapServer {
       $user_ldap_entry = $user;
     }
     elseif (is_scalar($user)) {
-      if (strpos($user, '=') === FALSE) { // username
+      // Username.
+      if (strpos($user, '=') === FALSE) {
         $user_ldap_entry = $this->userUserNameToExistingLdapEntry($user);
       }
       else {
@@ -1238,10 +1347,13 @@ class LdapServer {
    * @param string $drupal_user_name
    *
    * @param string or int $prov_event
-   *   This could be anything, particularly when used by other modules.  Other modules should use string like 'mymodule_myevent'
-   *   LDAP_USER_EVENT_ALL signifies get all attributes needed by all other contexts/ops
+   *   This could be anything, particularly when used by other modules.
+   *   Other modules should use string like 'mymodule_myevent'
+   *   LDAP_USER_EVENT_ALL signifies get all attributes needed by all other
+   *   contexts/ops.
    *
-   * @return associative array representing ldap data of a user.  for example of returned value.
+   * @return array
+   *   representing ldap data of a user.  for example of returned value.
    *   'sid' => ldap server id
    *   'mail' => derived from ldap mail (not always populated).
    *   'dn'   => dn of user
@@ -1250,13 +1362,13 @@ class LdapServer {
    */
   public function userUserNameToExistingLdapEntry($drupal_user_name, $ldap_context = NULL) {
 
-    $watchdog_tokens = array('%drupal_user_name' => $drupal_user_name);
+    $watchdog_tokens = ['%drupal_user_name' => $drupal_user_name];
     $ldap_username = $this->userUsernameToLdapNameTransform($drupal_user_name, $watchdog_tokens);
     if (!$ldap_username) {
       return FALSE;
     }
     if (!$ldap_context) {
-      $attributes = array();
+      $attributes = [];
     }
     else {
       $attribute_maps = ldap_servers_attributes_needed($this->sid, $ldap_context);
@@ -1264,16 +1376,19 @@ class LdapServer {
     }
 
     foreach ($this->basedn as $basedn) {
-      if (empty($basedn)) continue;
+      if (empty($basedn)) {
+        continue;
+      }
       $filter = '(' . $this->user_attr . '=' . ldap_server_massage_text($ldap_username, 'attr_value', LDAP_SERVER_MASSAGE_QUERY_LDAP) . ')';
       $result = $this->search($basedn, $filter, $attributes);
-      if (!$result || !isset($result['count']) || !$result['count']) continue;
+      if (!$result || !isset($result['count']) || !$result['count']) {
+        continue;
+      }
 
       // Must find exactly one user for authentication to work.
-
       if ($result['count'] != 1) {
         $count = $result['count'];
-        watchdog('ldap_servers', "Error: !count users found with $filter under $basedn.", array('!count' => $count), WATCHDOG_ERROR);
+        watchdog('ldap_servers', "Error: !count users found with $filter under $basedn.", ['!count' => $count], WATCHDOG_ERROR);
         continue;
       }
       $match = $result[0];
@@ -1285,7 +1400,7 @@ class LdapServer {
       $name_attr = $this->user_attr;
 
       if (isset($match[$name_attr][0])) {
-        // leave name
+        // Leave name.
       }
       elseif (isset($match[drupal_strtolower($name_attr)][0])) {
         $name_attr = drupal_strtolower($name_attr);
@@ -1293,12 +1408,12 @@ class LdapServer {
       }
       else {
         if ($this->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
-          $result = array(
+          $result = [
             'dn' => $match['dn'],
             'mail' => $this->userEmailFromLdapEntry($match),
             'attr' => $match,
             'sid' => $this->sid,
-            );
+          ];
           return $result;
         }
         else {
@@ -1316,12 +1431,12 @@ class LdapServer {
       // loop through all possible options.
       foreach ($match[$name_attr] as $value) {
         if (drupal_strtolower(trim($value)) == drupal_strtolower($ldap_username)) {
-          $result = array(
+          $result = [
             'dn' => $match['dn'],
             'mail' => $this->userEmailFromLdapEntry($match),
             'attr' => $match,
             'sid' => $this->sid,
-          );
+          ];
           return $result;
         }
       }
@@ -1331,36 +1446,44 @@ class LdapServer {
   /**
    * Is a user a member of group?
    *
-   * @param string $group_dn MIXED CASE
+   * @param string $group_dn
+   *   MIXED CASE.
    * @param mixed $user
-   *    - drupal user object (stdClass Object)
+   *   - drupal user object (stdClass Object)
    *    - ldap entry of user (array)
    *    - ldap dn of user (array)
    *    - drupal user name (string)
-   * @param enum $nested = NULL (default to server configuration), TRUE, or FALSE indicating to test for nested groups
+   * @param enum $nested
+   *   = NULL (default to server configuration), TRUE, or FALSE indicating to
+   *   test for nested groups.
+   *
+   * @return bool
    */
   public function groupIsMember($group_dn, $user, $nested = NULL) {
 
     $nested = ($nested === TRUE || $nested === FALSE) ? $nested : $this->groupNested;
     $group_dns = $this->groupMembershipsFromUser($user, 'group_dns', $nested);
-    // while list of group dns is going to be in correct mixed case, $group_dn may not since it may be derived from user entered values
-    // so make sure in_array() is case insensitive
+    // While list of group dns is going to be in correct mixed case, $group_dn may not since it may be derived from user entered values
+    // so make sure in_array() is case insensitive.
     return (is_array($group_dns) && in_array(drupal_strtolower($group_dn), $this->dnArrayToLowerCase($group_dns)));
   }
 
   /**
    * NOT TESTED
-   * add a group entry
+   * add a group entry.
    *
-   * @param string $group_dn as ldap dn
-   * @param array $attributes in key value form
-   *    $attributes = array(
+   * @param string $group_dn
+   *   as ldap dn.
+   * @param array $attributes
+   *   in key value form
+   *   $attributes = array(
    *      "attribute1" = "value",
    *      "attribute2" = array("value1", "value2"),
    *      )
+   *
    * @return boolean success
    */
-  public function groupAddGroup($group_dn, $attributes = array()) {
+  public function groupAddGroup($group_dn, $attributes = []) {
 
     if ($this->dnExists($group_dn, 'boolean')) {
       return FALSE;
@@ -1373,24 +1496,22 @@ class LdapServer {
     /**
      * 2. give other modules a chance to add or alter attributes
      */
-    $context = array(
+    $context = [
       'action' => 'add',
-      'corresponding_drupal_data' => array($group_dn => $attributes),
+      'corresponding_drupal_data' => [$group_dn => $attributes],
       'corresponding_drupal_data_type' => 'group',
-    );
-    $ldap_entries = array($group_dn => $attributes);
+    ];
+    $ldap_entries = [$group_dn => $attributes];
     drupal_alter('ldap_entry_pre_provision', $ldap_entries, $this, $context);
     $attributes = $ldap_entries[$group_dn];
 
-
-     /**
+    /**
      * 4. provision ldap entry
      *   @todo how is error handling done here?
      */
     $ldap_entry_created = $this->createLdapEntry($attributes, $group_dn);
 
-
-     /**
+    /**
      * 5. allow other modules to react to provisioned ldap entry
      *   @todo how is error handling done here?
      */
@@ -1406,12 +1527,15 @@ class LdapServer {
 
   /**
    * NOT TESTED
-   * remove a group entry
+   * remove a group entry.
    *
-   * @param string $group_dn as ldap dn
-   * @param boolean $only_if_group_empty
+   * @param string $group_dn
+   *   as ldap dn.
+   * @param bool $only_if_group_empty
    *   TRUE = group should not be removed if not empty
-   *   FALSE = groups should be deleted regardless of members
+   *   FALSE = groups should be deleted regardless of members.
+   *
+   * @return bool
    */
   public function groupRemoveGroup($group_dn, $only_if_group_empty = TRUE) {
 
@@ -1428,21 +1552,25 @@ class LdapServer {
 
   /**
    * NOT TESTED
-   * add a member to a group
+   * add a member to a group.
    *
-   * @param string $ldap_user_dn as ldap dn
+   * @param string $ldap_user_dn
+   *   as ldap dn.
    * @param mixed $user
-   *    - drupal user object (stdClass Object)
-   *    - ldap entry of user (array) (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
+   *   - drupal user object (stdClass Object)
+   *    - ldap entry of user (array) (with top level keys of 'dn', 'mail',
+   *   'sid' and 'attr' )
    *    - ldap dn of user (array)
    *    - drupal username of user (string)
+   *
+   * @return bool
    */
   public function groupAddMember($group_dn, $user) {
 
     $user_ldap_entry = $this->userUserToExistingLdapEntry($user);
     $result = FALSE;
     if ($user_ldap_entry && $this->groupGroupEntryMembershipsConfigured) {
-      $add = array();
+      $add = [];
       $add[$this->groupMembershipsAttr] = $user_ldap_entry['dn'];
       $this->connectAndBindIfNotAlready();
       $result = @ldap_mod_add($this->connection, $group_dn, $add);
@@ -1453,21 +1581,25 @@ class LdapServer {
 
   /**
    * NOT TESTED
-   * remove a member from a group
+   * remove a member from a group.
    *
-   * @param string $group_dn as ldap dn
+   * @param string $group_dn
+   *   as ldap dn.
    * @param mixed $user
-   *    - drupal user object (stdClass Object)
-   *    - ldap entry of user (array) (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
+   *   - drupal user object (stdClass Object)
+   *    - ldap entry of user (array) (with top level keys of 'dn', 'mail',
+   *   'sid' and 'attr' )
    *    - ldap dn of user (array)
    *    - drupal username of user (string)
+   *
+   * @return bool
    */
   public function groupRemoveMember($group_dn, $user) {
 
     $user_ldap_entry = $this->userUserToExistingLdapEntry($user);
     $result = FALSE;
     if ($user_ldap_entry && $this->groupGroupEntryMembershipsConfigured) {
-      $del = array();
+      $del = [];
       $del[$this->groupMembershipsAttr] = $user_ldap_entry['dn'];
       $this->connectAndBindIfNotAlready();
       $result = @ldap_mod_del($this->connection, $group_dn, $del);
@@ -1475,32 +1607,34 @@ class LdapServer {
     return $result;
   }
 
-
   /**
+   * Get all members of a group.
    *
    * @todo: NOT IMPLEMENTED: nested groups
    *
-   * get all members of a group
-   *
-   * @param string $group_dn as ldap dn
+   * @param string $group_dn
+   *   as ldap dn.
    *
-   * @return FALSE on error otherwise array of group members (could be users or groups)
+   * @return false
+   *   on error otherwise array of group members (could be users or groups)
    */
   public function groupAllMembers($group_dn) {
     if (!$this->groupGroupEntryMembershipsConfigured) {
       return FALSE;
     }
-    $attributes = array($this->groupMembershipsAttr, 'cn');
+    $attributes = [$this->groupMembershipsAttr, 'cn'];
     $group_entry = $this->dnExists($group_dn, 'ldap_entry', $attributes);
     if (!$group_entry) {
       return FALSE;
     }
     else {
-      if (empty($group_entry['cn'])) { // if attributes weren't returned, don't give false  empty group
+      // If attributes weren't returned, don't give false  empty group.
+      if (empty($group_entry['cn'])) {
         return FALSE;
       }
       if (empty($group_entry[$this->groupMembershipsAttr])) {
-        return array(); // if no attribute returned, no members
+        // If no attribute returned, no members.
+        return [];
       }
       $members = $group_entry[$this->groupMembershipsAttr];
       if (isset($members['count'])) {
@@ -1516,17 +1650,25 @@ class LdapServer {
   }
 
   /**
-   *   NOT IMPLEMENTED
+   * NOT IMPLEMENTED
    * recurse through all child groups and add members.
    *
-   * @param array $current_group_entries of ldap group entries that are starting point.  should include at least 1 entry.
-   * @param array $all_group_dns as array of all groups user is a member of.  MIXED CASE VALUES
-   * @param array $tested_group_ids as array of tested group dn, cn, uid, etc.  MIXED CASE VALUES
-   *   whether these value are dn, cn, uid, etc depends on what attribute members, uniquemember, memberUid contains
-   *   whatever attribute is in $this->$tested_group_ids to avoid redundant recursing
-   * @param int $level of recursion
-   * @param int $max_levels as max recursion allowed
-   *
+   * @param array $current_group_entries
+   *   of ldap group entries that are starting point.  should include at least
+   *   1 entry.
+   * @param array $all_group_dns
+   *   as array of all groups user is a member of.  MIXED CASE VALUES.
+   * @param array $tested_group_ids
+   *   as array of tested group dn, cn, uid, etc.  MIXED CASE VALUES
+   *   whether these value are dn, cn, uid, etc depends on what attribute
+   *   members, uniquemember, memberUid contains whatever attribute is in
+   *   $this->$tested_group_ids to avoid redundant recursing.
+   * @param int $level
+   *   of recursion.
+   * @param int $max_levels
+   *   as max recursion allowed.
+   *
+   * @return bool
    */
   public function groupMembersResursive($current_member_entries, &$all_member_dns, &$tested_group_ids, $level, $max_levels, $object_classes = FALSE) {
 
@@ -1538,14 +1680,15 @@ class LdapServer {
     };
 
     foreach ($current_member_entries as $i => $member_entry) {
-      // 1.  Add entry itself if of the correct type to $all_member_dns
+      // 1.  Add entry itself if of the correct type to $all_member_dns.
       $objectClassMatch = (!$object_classes || (count(array_intersect(array_values($member_entry['objectclass']), $object_classes)) > 0));
       $objectIsGroup = in_array($this->groupObjectClass, array_values($member_entry['objectclass']));
-      if ($objectClassMatch && !in_array($member_entry['dn'], $all_member_dns)) { // add member
+      // Add member.
+      if ($objectClassMatch && !in_array($member_entry['dn'], $all_member_dns)) {
         $all_member_dns[] = $member_entry['dn'];
       }
 
-      // 2. If its a group, keep recurse the group for descendants
+      // 2. If its a group, keep recurse the group for descendants.
       if ($objectIsGroup && $level < $max_levels) {
         if ($this->groupMembershipsAttrMatchingUserAttr == 'dn') {
           $group_id = $member_entry['dn'];
@@ -1553,29 +1696,33 @@ class LdapServer {
         else {
           $group_id = $member_entry[$this->groupMembershipsAttrMatchingUserAttr][0];
         }
-        // 3. skip any groups that have already been tested
+        // 3. skip any groups that have already been tested.
         if (!in_array($group_id, $tested_group_ids)) {
           $tested_group_ids[] = $group_id;
           $member_ids = $member_entry[$this->groupMembershipsAttr];
           if (isset($member_ids['count'])) {
             unset($member_ids['count']);
           };
-          $ors = array();
+          $ors = [];
           foreach ($member_ids as $i => $member_id) {
-            $ors[] = $this->groupMembershipsAttr . '=' . ldap_pear_escape_filter_value($member_id); // @todo this would be replaced by query template
+            // @todo this would be replaced by query template
+            $ors[] = $this->groupMembershipsAttr . '=' . ldap_pear_escape_filter_value($member_id);
           }
 
           if (count($ors)) {
-            $query_for_child_members = '(|(' . join(")(", $ors) . '))';  // e.g. (|(cn=group1)(cn=group2)) or   (|(dn=cn=group1,ou=blah...)(dn=cn=group2,ou=blah...))
-            if (count($object_classes)) { // add or on object classe, otherwise get all object classes
-              $object_classes_ors = array('(objectClass=' . $this->groupObjectClass . ')');
+            // e.g. (|(cn=group1)(cn=group2)) or   (|(dn=cn=group1,ou=blah...)(dn=cn=group2,ou=blah...))
+            $query_for_child_members = '(|(' . join(")(", $ors) . '))';
+            // Add or on object classe, otherwise get all object classes.
+            if (count($object_classes)) {
+              $object_classes_ors = ['(objectClass=' . $this->groupObjectClass . ')'];
               foreach ($object_classes as $object_class) {
                 $object_classes_ors[] = '(objectClass=' . $object_class . ')';
               }
               $query_for_child_members = '&(|' . join($object_classes_ors) . ')(' . $query_for_child_members . ')';
             }
-            foreach ($this->basedn as $base_dn) {  // need to search on all basedns one at a time
-              $child_member_entries = $this->search($base_dn, $query_for_child_members, array('objectclass', $this->groupMembershipsAttr, $this->groupMembershipsAttrMatchingUserAttr));
+            // Need to search on all basedns one at a time.
+            foreach ($this->basedn as $base_dn) {
+              $child_member_entries = $this->search($base_dn, $query_for_child_members, ['objectclass', $this->groupMembershipsAttr, $this->groupMembershipsAttrMatchingUserAttr]);
               if ($child_member_entries !== FALSE) {
                 $this->groupMembersResursive($child_member_entries, $all_member_dns, $tested_group_ids, $level + 1, $max_levels, $object_classes);
               }
@@ -1586,9 +1733,8 @@ class LdapServer {
     }
   }
 
-
   /**
-   *  get list of all groups that a user is a member of.
+   * Get list of all groups that a user is a member of.
    *
    *    If $nested = TRUE,
    *    list will include all parent group.  That is if user is a member of "programmer" group
@@ -1597,15 +1743,17 @@ class LdapServer {
    *
    *    If $nested = FALSE, list will only include groups user is in directly.
    *
-   *  @param mixed
-   *    - drupal user object (stdClass Object)
+   * @param mixed
+   *   - drupal user object (stdClass Object)
    *    - ldap entry of user (array) (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
    *    - ldap dn of user (array)
    *    - drupal username of user (string)
-   *  @param enum $return = 'group_dns'
-   *  @param boolean $nested if groups should be recursed or not.
+   * @param mixed $return
+   *   = 'group_dns'.
+   * @param bool $nested
+   *   if groups should be recursed or not.
    *
-   *  @return array of groups dns in mixed case or FALSE on error
+   * @return array of groups dns in mixed case or FALSE on error
    */
   public function groupMembershipsFromUser($user, $return = 'group_dns', $nested = NULL) {
 
@@ -1618,14 +1766,15 @@ class LdapServer {
       $nested = $this->groupNested;
     }
 
-    if ($this->groupUserMembershipsConfigured) { // preferred method
+    // Preferred method.
+    if ($this->groupUserMembershipsConfigured) {
       $group_dns = $this->groupUserMembershipsFromUserAttr($user_ldap_entry, $nested);
     }
     elseif ($this->groupGroupEntryMembershipsConfigured) {
       $group_dns = $this->groupUserMembershipsFromEntry($user_ldap_entry, $nested);
     }
     else {
-      watchdog('ldap_servers', 'groupMembershipsFromUser: Group memberships for server have not been configured.', array(), WATCHDOG_WARNING);
+      watchdog('ldap_servers', 'groupMembershipsFromUser: Group memberships for server have not been configured.', [], WATCHDOG_WARNING);
       return FALSE;
     }
     if ($return == 'group_dns') {
@@ -1634,10 +1783,9 @@ class LdapServer {
 
   }
 
-
   /**
-   *  get list of all groups that a user is a member of by using memberOf attribute first,
-   *    then if nesting is true, using group entries to find parent groups
+   * Get list of all groups that a user is a member of by using memberOf attribute first,
+   *    then if nesting is true, using group entries to find parent groups.
    *
    *    If $nested = TRUE,
    *    list will include all parent group.  That is if user is a member of "programmer" group
@@ -1646,14 +1794,15 @@ class LdapServer {
    *
    *    If $nested = FALSE, list will only include groups user is in directly.
    *
-   *  @param mixed
-   *    - drupal user object (stdClass Object)
+   * @param mixed
+   *   - drupal user object (stdClass Object)
    *    - ldap entry of user (array) (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
    *    - ldap dn of user (array)
    *    - drupal username of user (string)
-   *  @param boolean $nested if groups should be recursed or not.
+   * @param bool $nested
+   *   if groups should be recursed or not.
    *
-   *  @return array of group dns
+   * @return array of group dns
    */
   public function groupUserMembershipsFromUserAttr($user, $nested = NULL) {
 
@@ -1665,24 +1814,26 @@ class LdapServer {
     }
 
     $not_user_ldap_entry = empty($user['attr'][$this->groupUserMembershipsAttr]);
-    if ($not_user_ldap_entry) { // if drupal user passed in, try to get user_ldap_entry
+    // If drupal user passed in, try to get user_ldap_entry.
+    if ($not_user_ldap_entry) {
       $user = $this->userUserToExistingLdapEntry($user);
       $not_user_ldap_entry = empty($user['attr'][$this->groupUserMembershipsAttr]);
       if ($not_user_ldap_entry) {
-        return FALSE; // user's membership attribute is not present.  either misconfigured or query failed
+        // user's membership attribute is not present.  either misconfigured or query failed.
+        return FALSE;
       }
     }
-    // if not exited yet, $user must be user_ldap_entry.
+    // If not exited yet, $user must be user_ldap_entry.
     $user_ldap_entry = $user;
-    $all_group_dns = array();
-    $tested_group_ids = array();
+    $all_group_dns = [];
+    $tested_group_ids = [];
     $level = 0;
 
     $member_group_dns = $user_ldap_entry['attr'][$this->groupUserMembershipsAttr];
     if (isset($member_group_dns['count'])) {
       unset($member_group_dns['count']);
     }
-    $ors = array();
+    $ors = [];
     foreach ($member_group_dns as $i => $member_group_dn) {
       $all_group_dns[] = $member_group_dn;
       if ($nested) {
@@ -1698,13 +1849,17 @@ class LdapServer {
 
     if ($nested && count($ors)) {
       $count = count($ors);
-      for ($i = 0; $i < $count; $i = $i + LDAP_SERVER_LDAP_QUERY_CHUNK) { // only 50 or so per query
+      // Only 50 or so per query.
+      for ($i = 0; $i < $count; $i = $i + LDAP_SERVER_LDAP_QUERY_CHUNK) {
         $current_ors = array_slice($ors, $i, LDAP_SERVER_LDAP_QUERY_CHUNK);
-        $or = '(|(' . join(")(", $current_ors) . '))';  // e.g. (|(cn=group1)(cn=group2)) or   (|(dn=cn=group1,ou=blah...)(dn=cn=group2,ou=blah...))
+        // e.g. (|(cn=group1)(cn=group2)) or   (|(dn=cn=group1,ou=blah...)(dn=cn=group2,ou=blah...))
+        $or = '(|(' . join(")(", $current_ors) . '))';
         $query_for_parent_groups = '(&(objectClass=' . $this->groupObjectClass . ')' . $or . ')';
 
-        foreach ($this->basedn as $base_dn) {  // need to search on all basedns one at a time
-          $group_entries = $this->search($base_dn, $query_for_parent_groups);  // no attributes, just dns needed
+        // Need to search on all basedns one at a time.
+        foreach ($this->basedn as $base_dn) {
+          // No attributes, just dns needed.
+          $group_entries = $this->search($base_dn, $query_for_parent_groups);
           if ($group_entries !== FALSE  && $level < LDAP_SERVER_LDAP_QUERY_RECURSION_LIMIT) {
             $this->groupMembershipsFromEntryRecursive($group_entries, $all_group_dns, $tested_group_ids, $level + 1, LDAP_SERVER_LDAP_QUERY_RECURSION_LIMIT);
           }
@@ -1716,7 +1871,7 @@ class LdapServer {
   }
 
   /**
-   *  get list of all groups that a user is a member of by querying groups
+   * Get list of all groups that a user is a member of by querying groups.
    *
    *    If $nested = TRUE,
    *    list will include all parent group.  That is if user is a member of "programmer" group
@@ -1725,16 +1880,17 @@ class LdapServer {
    *
    *    If $nested = FALSE, list will only include groups user is in directly.
    *
-   *  @param mixed
-   *    - drupal user object (stdClass Object)
+   * @param mixed
+   *   - drupal user object (stdClass Object)
    *    - ldap entry of user (array) (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
    *    - ldap dn of user (array)
    *    - drupal username of user (string)
-   *  @param boolean $nested if groups should be recursed or not.
+   * @param bool $nested
+   *   if groups should be recursed or not.
    *
-   *  @return array of group dns MIXED CASE VALUES
+   * @return array of group dns MIXED CASE VALUES
    *
-   *  @see tests/DeriveFromEntry/ldap_servers.inc for fuller notes and test example
+   * @see tests/DeriveFromEntry/ldap_servers.inc for fuller notes and test example
    */
   public function groupUserMembershipsFromEntry($user, $nested = NULL) {
 
@@ -1747,8 +1903,10 @@ class LdapServer {
 
     $user_ldap_entry = $this->userUserToExistingLdapEntry($user);
 
-    $all_group_dns = array(); // MIXED CASE VALUES
-    $tested_group_ids = array(); // array of dns already tested to avoid excess queries MIXED CASE VALUES
+    // MIXED CASE VALUES.
+    $all_group_dns = [];
+    // Array of dns already tested to avoid excess queries MIXED CASE VALUES.
+    $tested_group_ids = [];
     $level = 0;
 
     if ($this->groupMembershipsAttrMatchingUserAttr == 'dn') {
@@ -1765,8 +1923,10 @@ class LdapServer {
       $group_query = '(&(objectClass=' . $this->groupObjectClass . ')(' . $this->groupMembershipsAttr . "=$member_value))";
     }
 
-    foreach ($this->basedn as $base_dn) {  // need to search on all basedns one at a time
-      $group_entries = $this->search($base_dn, $group_query, array()); // only need dn, so empty array forces return of no attributes
+    // Need to search on all basedns one at a time.
+    foreach ($this->basedn as $base_dn) {
+      // Only need dn, so empty array forces return of no attributes.
+      $group_entries = $this->search($base_dn, $group_query, []);
       if ($group_entries !== FALSE) {
         $max_levels = ($nested) ? LDAP_SERVER_LDAP_QUERY_RECURSION_LIMIT : 0;
         $this->groupMembershipsFromEntryRecursive($group_entries, $all_group_dns, $tested_group_ids, $level, $max_levels);
@@ -1777,20 +1937,25 @@ class LdapServer {
   }
 
   /**
-   * recurse through all groups, adding parent groups to $all_group_dns array.
-   *
-   * @param array $current_group_entries of ldap group entries that are starting point.  should include at least 1 entry.
-   * @param array $all_group_dns as array of all groups user is a member of.  MIXED CASE VALUES
-   * @param array $tested_group_ids as array of tested group dn, cn, uid, etc.  MIXED CASE VALUES
+   * Recurse through all groups, adding parent groups to $all_group_dns array.
+   *
+   * @param array $current_group_entries
+   *   of ldap group entries that are starting point.  should include at least 1 entry.
+   * @param array $all_group_dns
+   *   as array of all groups user is a member of.  MIXED CASE VALUES.
+   * @param array $tested_group_ids
+   *   as array of tested group dn, cn, uid, etc.  MIXED CASE VALUES
    *   whether these value are dn, cn, uid, etc depends on what attribute members, uniquemember, memberUid contains
-   *   whatever attribute is in $this->$tested_group_ids to avoid redundant recursing
-   * @param int $level of recursion
-   * @param int $max_levels as max recursion allowed
+   *   whatever attribute is in $this->$tested_group_ids to avoid redundant recursing.
+   * @param int $level
+   *   of recursion.
+   * @param int $max_levels
+   *   as max recursion allowed
    *
-   * given set of groups entries ($current_group_entries such as it, hr, accounting),
-   * find parent groups (such as staff, people, users) and add them to list of group memberships ($all_group_dns)
+   *   given set of groups entries ($current_group_entries such as it, hr, accounting),
+   *   find parent groups (such as staff, people, users) and add them to list of group memberships ($all_group_dns)
    *
-   * (&(objectClass=[$this->groupObjectClass])(|([$this->groupMembershipsAttr]=groupid1)([$this->groupMembershipsAttr]=groupid2))
+   *   (&(objectClass=[$this->groupObjectClass])(|([$this->groupMembershipsAttr]=groupid1)([$this->groupMembershipsAttr]=groupid2))
    *
    * @return FALSE for error or misconfiguration, otherwise TRUE.  results are passed by reference.
    */
@@ -1803,54 +1968,60 @@ class LdapServer {
       unset($current_group_entries['count']);
     };
 
-    $ors = array();
+    $ors = [];
     foreach ($current_group_entries as $i => $group_entry) {
       if ($this->groupMembershipsAttrMatchingUserAttr == 'dn') {
         $member_id = $group_entry['dn'];
       }
-      else {// maybe cn, uid, etc is held
+      // Maybe cn, uid, etc is held.
+      else {
         $member_id = ldap_servers_get_first_rdn_value_from_dn($group_entry['dn'], $this->groupMembershipsAttrMatchingUserAttr);
-	if(!$member_id) {
-	  if ($this->detailed_watchdog_log) {
-	     watchdog('ldap_servers', 'group_entry: %ge', array('%ge' => pretty_print_ldap_entry($group_entry)));
-	  }
-	  // group not identified by simple checks yet!
-
-	  // examine the entry and see if it matches the configured groupObjectClass
-	  $goc = $group_entry['objectclass']; // TODO do we need to ensure such entry is there?
-	  if(is_array($goc)) {              // TODO is it always an array?
-	    foreach($goc as $g) {
-	      $g = drupal_strtolower($g);
-	      if($g == $this->groupObjectClass) {
-		// found a group, current user must be member in it - so:
-		if ($this->detailed_watchdog_log) {
-		  watchdog('ldap_servers', 'adding %mi', array('%mi' => $member_id));
-		}
-		$member_id = $group_entry['dn'];
-		break;
-	      }
-	    }
-	  }
-	}
+        if (!$member_id) {
+          if ($this->detailed_watchdog_log) {
+            watchdog('ldap_servers', 'group_entry: %ge', ['%ge' => pretty_print_ldap_entry($group_entry)]);
+          }
+          // Group not identified by simple checks yet!
+          // examine the entry and see if it matches the configured groupObjectClass
+          // TODO do we need to ensure such entry is there?
+          $goc = $group_entry['objectclass'];
+          // TODO is it always an array?
+          if (is_array($goc)) {
+            foreach ($goc as $g) {
+              $g = drupal_strtolower($g);
+              if ($g == $this->groupObjectClass) {
+                // Found a group, current user must be member in it - so:
+                if ($this->detailed_watchdog_log) {
+                  watchdog('ldap_servers', 'adding %mi', ['%mi' => $member_id]);
+                }
+                $member_id = $group_entry['dn'];
+                break;
+              }
+            }
+          }
+        }
       }
 
       if ($member_id && !in_array($member_id, $tested_group_ids)) {
         $tested_group_ids[] = $member_id;
         $all_group_dns[] = $group_entry['dn'];
-        // add $group_id (dn, cn, uid) to query
-        $ors[] = $this->groupMembershipsAttr . '=' .  ldap_pear_escape_filter_value($member_id);
+        // Add $group_id (dn, cn, uid) to query.
+        $ors[] = $this->groupMembershipsAttr . '=' . ldap_pear_escape_filter_value($member_id);
       }
     }
 
     if ($level < $max_levels && count($ors)) {
       $count = count($ors);
-      for ($i = 0; $i < $count; $i = $i + LDAP_SERVER_LDAP_QUERY_CHUNK) { // only 50 or so per query
+      // Only 50 or so per query.
+      for ($i = 0; $i < $count; $i = $i + LDAP_SERVER_LDAP_QUERY_CHUNK) {
         $current_ors = array_slice($ors, $i, LDAP_SERVER_LDAP_QUERY_CHUNK);
-        $or = '(|(' . join(")(", $current_ors) . '))';  // e.g. (|(cn=group1)(cn=group2)) or   (|(dn=cn=group1,ou=blah...)(dn=cn=group2,ou=blah...))
+        // e.g. (|(cn=group1)(cn=group2)) or   (|(dn=cn=group1,ou=blah...)(dn=cn=group2,ou=blah...))
+        $or = '(|(' . join(")(", $current_ors) . '))';
         $query_for_parent_groups = '(&(objectClass=' . $this->groupObjectClass . ')' . $or . ')';
 
-        foreach ($this->basedn as $base_dn) {  // need to search on all basedns one at a time
-          $group_entries = $this->search($base_dn, $query_for_parent_groups);  // no attributes, just dns needed
+        // Need to search on all basedns one at a time.
+        foreach ($this->basedn as $base_dn) {
+          // No attributes, just dns needed.
+          $group_entries = $this->search($base_dn, $query_for_parent_groups);
           if ($group_entries !== FALSE) {
             $this->groupMembershipsFromEntryRecursive($group_entries, $all_group_dns, $tested_group_ids, $level + 1, $max_levels);
           }
@@ -1861,17 +2032,16 @@ class LdapServer {
     return TRUE;
   }
 
-
   /**
-   * Get "groups" from derived from DN.  Has limited usefulness
+   * Get "groups" from derived from DN.  Has limited usefulness.
    *
-   *  @param mixed
-   *    - drupal user object (stdClass Object)
+   * @param mixed
+   *   - drupal user object (stdClass Object)
    *    - ldap entry of user (array) (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
    *    - ldap dn of user (array)
    *    - drupal username of user (string)
    *
-   *  @return array of group strings
+   * @return array of group strings
    */
   public function groupUserMembershipsFromDn($user) {
 
@@ -1886,6 +2056,7 @@ class LdapServer {
     }
 
   }
+
   /**
    * Error methods and properties.
    */
@@ -1895,22 +2066,34 @@ class LdapServer {
   protected $_hasError = FALSE;
   protected $_errorName = NULL;
 
+  /**
+   *
+   */
   public function setError($_errorName, $_errorMsgText = NULL) {
     $this->_errorMsgText = $_errorMsgText;
     $this->_errorName = $_errorName;
     $this->_hasError = TRUE;
   }
 
+  /**
+   *
+   */
   public function clearError() {
     $this->_hasError = FALSE;
     $this->_errorMsg = NULL;
     $this->_errorName = NULL;
   }
 
+  /**
+   *
+   */
   public function hasError() {
     return ($this->_hasError || $this->ldapErrorNumber());
   }
 
+  /**
+   *
+   */
   public function errorMsg($type = NULL) {
     if ($type == 'ldap' && $this->connection) {
       return ldap_err2str(ldap_errno($this->connection));
@@ -1923,6 +2106,9 @@ class LdapServer {
     }
   }
 
+  /**
+   *
+   */
   public function errorName($type = NULL) {
     if ($type == 'ldap' && $this->connection) {
       return "LDAP Error: " . ldap_error($this->connection);
@@ -1935,6 +2121,9 @@ class LdapServer {
     }
   }
 
+  /**
+   *
+   */
   public function ldapErrorNumber() {
     if ($this->connection && ldap_errno($this->connection)) {
       return ldap_errno($this->connection);
@@ -1954,22 +2143,29 @@ class LdapServersRebindHandler {
   private $bind_dn = 'Anonymous';
   private $bind_passwd = '';
 
-  public function __construct($bind_user_dn, $bind_user_passwd){
+  /**
+   *
+   */
+  public function __construct($bind_user_dn, $bind_user_passwd) {
     $this->bind_dn = $bind_user_dn;
     $this->bind_passwd = $bind_user_passwd;
   }
 
-  public function rebind_callback($ldap, $referral){
-    // ldap options
+  /**
+   *
+   */
+  public function rebind_callback($ldap, $referral) {
+    // Ldap options.
     ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
     ldap_set_option($ldap, LDAP_OPT_REFERRALS, 1);
-    ldap_set_rebind_proc($ldap, array($this, 'rebind_callback'));
+    ldap_set_rebind_proc($ldap, [$this, 'rebind_callback']);
 
-  // Bind to new host, assumes initial bind dn has access to the referred servers.
+    // Bind to new host, assumes initial bind dn has access to the referred servers.
     if (!ldap_bind($ldap, $this->bind_dn, $this->bind_passwd)) {
       echo "Could not bind to referral server: $referral";
       return 1;
     }
     return 0;
   }
+
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/LdapServerAdmin.class.php b/drupal7/sites/all/modules/ldap/ldap_servers/LdapServerAdmin.class.php
index 7b322178..f0e1bf92 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/LdapServerAdmin.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/LdapServerAdmin.class.php
@@ -2,23 +2,24 @@
 
 /**
  * @file
- * LDAP Server Admin Class
- *
- *
+ * LDAP Server Admin Class.
  */
 
 module_load_include('php', 'ldap_servers', 'LdapServer.class');
-
+/**
+ *
+ */
 class LdapServerAdmin extends LdapServer {
 
   public $bindpw_new = FALSE;
   public $bindpw_clear = FALSE;
 
   /**
-   * @param $type = 'all', 'enabled'
+   * @param $type
+   *   = 'all', 'enabled'
    */
   public static function getLdapServerObjects($sid = NULL, $type = NULL, $class = 'LdapServer', $reset = FALSE) {
-    $servers = array();
+    $servers = [];
     if (module_exists('ctools')) {
       ctools_include('export');
       if ($reset) {
@@ -34,8 +35,8 @@ class LdapServerAdmin extends LdapServer {
       }
       catch (Exception $e) {
         drupal_set_message(t('server index query failed. Message = %message, query= %query',
-          array('%message' => $e->getMessage(), '%query' => $e->query_string)), 'error');
-        return array();
+          ['%message' => $e->getMessage(), '%query' => $e->query_string]), 'error');
+        return [];
       }
     }
     foreach ($select as $result) {
@@ -45,10 +46,16 @@ class LdapServerAdmin extends LdapServer {
 
   }
 
-  function __construct($sid) {
+  /**
+   *
+   */
+  public function __construct($sid) {
     parent::__construct($sid);
   }
 
+  /**
+   *
+   */
   protected function populateFromDrupalForm($op, $values) {
     $this->inDatabase = ($op == 'edit');
     $this->sid = trim($values['sid']);
@@ -92,16 +99,15 @@ class LdapServerAdmin extends LdapServer {
     $this->groupTestGroupDn = trim($values['grp_test_grp_dn']);
     $this->groupTestGroupDnWriteable = trim($values['grp_test_grp_dn_writeable']);
 
-
     $this->searchPagination = ($values['search_pagination']) ? 1 : 0;
     $this->searchPageSize = trim($values['search_page_size']);
 
   }
 
   /**
-   * @param string enum $op 'add', 'update'
+   * @param string enum $op
+   *   'add', 'update'.
    */
-
   public function save($op) {
 
     $values = new stdClass();
@@ -120,12 +126,12 @@ class LdapServerAdmin extends LdapServer {
       $values->bindpw = NULL;
     }
 
-    $values->tls = (int)$this->tls;
-    $values->followrefs = (int)$this->followrefs;
+    $values->tls = (int) $this->tls;
+    $values->followrefs = (int) $this->followrefs;
 
     if (module_exists('ctools')) {
       ctools_include('export');
-      // Populate our object with ctool's properties
+      // Populate our object with ctool's properties.
       $object = ctools_export_crud_new('ldap_servers');
 
       foreach ($object as $property => $value) {
@@ -138,15 +144,18 @@ class LdapServerAdmin extends LdapServer {
       try {
         $values->export_type = NULL;
         $result = ctools_export_crud_save('ldap_servers', $values);
-      } catch (Exception $e) {
+      }
+      catch (Exception $e) {
         $values->export_type = EXPORT_IN_DATABASE;
         $result = ctools_export_crud_save('ldap_servers', $values);
       }
-      
-      ctools_export_load_object_reset('ldap_servers'); // ctools_export_crud_save doesn't invalidate cache
+
+      // ctools_export_crud_save doesn't invalidate cache.
+      ctools_export_load_object_reset('ldap_servers');
 
     }
-    else { // directly via db
+    // Directly via db.
+    else {
       unset($values->numeric_sid);
       if ($op == 'add') {
         $result = drupal_write_record('ldap_servers', $values);
@@ -166,12 +175,16 @@ class LdapServerAdmin extends LdapServer {
     }
   }
 
+  /**
+   *
+   */
   public function delete($sid) {
     if ($sid == $this->sid) {
       $result = db_delete('ldap_servers')->condition('sid', $sid)->execute();
       if (module_exists('ctools')) {
         ctools_include('export');
-        ctools_export_load_object_reset('ldap_servers'); // invalidate cache
+        // Invalidate cache.
+        ctools_export_load_object_reset('ldap_servers');
       }
       $this->inDatabase = FALSE;
       return $result;
@@ -180,66 +193,73 @@ class LdapServerAdmin extends LdapServer {
       return FALSE;
     }
   }
+
+  /**
+   *
+   */
   public function getLdapServerActions() {
-    $switch = ($this->status ) ? 'disable' : 'enable';
-    $actions = array();
+    $switch = ($this->status) ? 'disable' : 'enable';
+    $actions = [];
     $actions[] = l(t('edit'), LDAP_SERVERS_MENU_BASE_PATH . '/servers/edit/' . $this->sid);
     if (property_exists($this, 'type')) {
       if ($this->type == 'Overridden') {
-          $actions[] = l(t('revert'), LDAP_SERVERS_MENU_BASE_PATH . '/servers/delete/' . $this->sid);
+        $actions[] = l(t('revert'), LDAP_SERVERS_MENU_BASE_PATH . '/servers/delete/' . $this->sid);
       }
       if ($this->type == 'Normal') {
-          $actions[] = l(t('delete'), LDAP_SERVERS_MENU_BASE_PATH . '/servers/delete/' . $this->sid);
+        $actions[] = l(t('delete'), LDAP_SERVERS_MENU_BASE_PATH . '/servers/delete/' . $this->sid);
       }
     }
     else {
-        $actions[] = l(t('delete'), LDAP_SERVERS_MENU_BASE_PATH . '/servers/delete/' . $this->sid);
+      $actions[] = l(t('delete'), LDAP_SERVERS_MENU_BASE_PATH . '/servers/delete/' . $this->sid);
     }
     $actions[] = l(t('test'), LDAP_SERVERS_MENU_BASE_PATH . '/servers/test/' . $this->sid);
     $actions[] = l($switch, LDAP_SERVERS_MENU_BASE_PATH . '/servers/' . $switch . '/' . $this->sid);
     return $actions;
   }
 
+  /**
+   *
+   */
   public function drupalForm($op) {
 
-  $form['server'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Connection settings'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-  );
-
-  $form['bind_method'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Binding Method'),
-    '#description' => t('How the Drupal system is authenticated by the LDAP server.'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-  );
-
-  $form['users'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('LDAP User to Drupal User Relationship'),
-    '#description' => t('How are LDAP user entries found based on Drupal username or email?  And vice-versa?
+    $form['server'] = [
+      '#type' => 'fieldset',
+      '#title' => t('Connection settings'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    ];
+
+    $form['bind_method'] = [
+      '#type' => 'fieldset',
+      '#title' => t('Binding Method'),
+      '#description' => t('How the Drupal system is authenticated by the LDAP server.'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    ];
+
+    $form['users'] = [
+      '#type' => 'fieldset',
+      '#title' => t('LDAP User to Drupal User Relationship'),
+      '#description' => t('How are LDAP user entries found based on Drupal username or email?  And vice-versa?
        Needed for LDAP Authentication and Authorization functionality.'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-  );
-
-  $form['groups'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('LDAP Group Configuration'),
-    '#description' => t('How are groups defined on your LDAP server?  This varies slightly from one LDAP implementation to another
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    ];
+
+    $form['groups'] = [
+      '#type' => 'fieldset',
+      '#title' => t('LDAP Group Configuration'),
+      '#description' => t('How are groups defined on your LDAP server?  This varies slightly from one LDAP implementation to another
       such as Active Directory, Novell, OpenLDAP, etc. Check everything that is true and enter all the values you know.'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-  );
-
-  $supports = (ldap_servers_php_supports_pagination()) ? t('support pagination!') : t('NOT support pagination.');
-  $form['pagination'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('LDAP Pagination'),
-    '#description' => t('In PHP 5.4, pagination is supported in ldap queries.
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    ];
+
+    $supports = (ldap_servers_php_supports_pagination()) ? t('support pagination!') : t('NOT support pagination.');
+    $form['pagination'] = [
+      '#type' => 'fieldset',
+      '#title' => t('LDAP Pagination'),
+      '#description' => t('In PHP 5.4, pagination is supported in ldap queries.
       A patch to earlier versions of PHP also supports this.')
       . ' <strong>' . t('This PHP installation appears to') . ' ' . $supports . '</strong> '
       . '<p>' . t('The advantage to pagination support is that if an ldap server is setup to return only
@@ -249,79 +269,80 @@ class LdapServerAdmin extends LdapServer {
       Pagination is most useful when large queries for batch creating or
       synching accounts are used.  If you are not using this server for such
       tasks, its recommended to leave pagination disabled.') . '</p>',
-    '#collapsible' => TRUE,
-    '#collapsed' => !ldap_servers_php_supports_pagination(),
-  );
-
+      '#collapsible' => TRUE,
+      '#collapsed' => !ldap_servers_php_supports_pagination(),
+    ];
 
-  $field_to_prop_maps = $this->field_to_properties_map();
-  foreach ($this->fields() as $field_id => $field) {
-    if (isset($field['form'])) {
+    $field_to_prop_maps = $this->field_to_properties_map();
+    foreach ($this->fields() as $field_id => $field) {
+      if (isset($field['form'])) {
 
-      if (!isset($field['form']['required']) && isset($field['schema']['not null']) && $field['form']['#type'] != 'checkbox') {
-        $field['form']['#required'] = (boolean)$field['schema']['not null'];
-      }
-      if (isset($field['schema']['length']) && !isset($field['form']['#maxlength'])) {
-        $field['form']['#maxlength'] = $field['schema']['length'];
-      }
-      if (isset($field_to_prop_maps[$field_id])) {
-        $field['form']['#default_value'] = $this->{$field_to_prop_maps[$field_id]};
-      }
-      $fieldset = @$field['form']['fieldset'];
-      if ($fieldset) {
-        unset($field['form']['fieldset']);
-        $form[$fieldset][$field_id] = $field['form'];
-      }
-      else {
-        $form[$field_id] = $field['form'];
+        if (!isset($field['form']['required']) && isset($field['schema']['not null']) && $field['form']['#type'] != 'checkbox') {
+          $field['form']['#required'] = (boolean) $field['schema']['not null'];
+        }
+        if (isset($field['schema']['length']) && !isset($field['form']['#maxlength'])) {
+          $field['form']['#maxlength'] = $field['schema']['length'];
+        }
+        if (isset($field_to_prop_maps[$field_id])) {
+          $field['form']['#default_value'] = $this->{$field_to_prop_maps[$field_id]};
+        }
+        $fieldset = @$field['form']['fieldset'];
+        if ($fieldset) {
+          unset($field['form']['fieldset']);
+          $form[$fieldset][$field_id] = $field['form'];
+        }
+        else {
+          $form[$field_id] = $field['form'];
+        }
       }
     }
-  }
 
-  $form['server']['sid']['#disabled'] = ($op == 'edit');
+    $form['server']['sid']['#disabled'] = ($op == 'edit');
 
-  if (!function_exists('ldap_set_rebind_proc')) {
-    $form['server']['followrefs']['#disabled'] = TRUE;
-    $form['server']['followrefs']['#description'] = t('This functionality is disabled because the function ldap_set_rebind_proc can not be found on this server.  Perhaps your version of php does not have this function.  See php.net/manual/en/function.ldap-set-rebind-proc.php') . $form['server']['followrefs']['#description'];
-  }
+    if (!function_exists('ldap_set_rebind_proc')) {
+      $form['server']['followrefs']['#disabled'] = TRUE;
+      $form['server']['followrefs']['#description'] = t('This functionality is disabled because the function ldap_set_rebind_proc can not be found on this server.  Perhaps your version of php does not have this function.  See php.net/manual/en/function.ldap-set-rebind-proc.php') . $form['server']['followrefs']['#description'];
+    }
 
-  $form['server']['tls']['#required'] = FALSE;
-  $form['server']['followrefs']['#required'] = FALSE;
-  $form['bind_method']['bind_method']['#default_value'] = ($this->bind_method) ? $this->bind_method : LDAP_SERVERS_BIND_METHOD_DEFAULT;
-  $form['users']['basedn']['#default_value'] = $this->arrayToLines($this->basedn);
+    $form['server']['tls']['#required'] = FALSE;
+    $form['server']['followrefs']['#required'] = FALSE;
+    $form['bind_method']['bind_method']['#default_value'] = ($this->bind_method) ? $this->bind_method : LDAP_SERVERS_BIND_METHOD_DEFAULT;
+    $form['users']['basedn']['#default_value'] = $this->arrayToLines($this->basedn);
 
-  if ($this->bindpw) {
-    $pwd_directions = t('You currently have a password stored in the database.
+    if ($this->bindpw) {
+      $pwd_directions = t('You currently have a password stored in the database.
       Leave password field empty to leave password unchanged.  Enter a new password
       to replace the current password.  Check the checkbox below to simply
       remove it from the database.');
-    $pwd_class = 'ldap-pwd-present';
-  }
-  else {
-    $pwd_directions = t('No password is currently stored in the database.
-      If you are using a service account, enter one.');
-    if ($this->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT) {
-      $pwd_class = 'ldap-pwd-abscent';
+      $pwd_class = 'ldap-pwd-present';
     }
     else {
-      $pwd_class = 'ldap-pwd-not-applicable';
+      $pwd_directions = t('No password is currently stored in the database.
+      If you are using a service account, enter one.');
+      if ($this->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT) {
+        $pwd_class = 'ldap-pwd-abscent';
+      }
+      else {
+        $pwd_class = 'ldap-pwd-not-applicable';
+      }
     }
-  }
 
-  $action = ($op == 'add') ? 'Add' : 'Update';
-  $form['submit'] = array(
-    '#type' => 'submit',
-    '#value' => $action,
-    '#weight' => 100,
-  );
+    $action = ($op == 'add') ? 'Add' : 'Update';
+    $form['submit'] = [
+      '#type' => 'submit',
+      '#value' => $action,
+      '#weight' => 100,
+    ];
 
-  return $form;
+    return $form;
 
   }
 
-
-  public function drupalFormValidate($op, $values)  {
-    $errors = array();
+  /**
+   *
+   */
+  public function drupalFormValidate($op, $values) {
+    $errors = [];
 
     if ($op == 'delete') {
       if (!$this->sid) {
@@ -332,7 +353,6 @@ class LdapServerAdmin extends LdapServer {
         $errors['status'] = join("<br/>", array_values($warnings));
       }
 
-
     }
     else {
       $this->populateFromDrupalForm($op, $values);
@@ -341,30 +361,33 @@ class LdapServerAdmin extends LdapServer {
     return $errors;
   }
 
+  /**
+   *
+   */
   protected function validate($op) {
-    $errors = array();
+    $errors = [];
     if ($op == 'add') {
       $ldap_servers = $this->getLdapServerObjects(NULL, 'all');
       if (count($ldap_servers)) {
         foreach ($ldap_servers as $sid => $ldap_server) {
           if ($this->name == $ldap_server->name) {
-            $errors['name'] = t('An LDAP server configuration with the  name %name already exists.', array('%name' => $this->name));
+            $errors['name'] = t('An LDAP server configuration with the  name %name already exists.', ['%name' => $this->name]);
           }
           elseif ($this->sid == $ldap_server->sid) {
-            $errors['sid'] = t('An LDAP server configuration with the  id %sid  already exists.', array('%sid' => $this->sid));
+            $errors['sid'] = t('An LDAP server configuration with the  id %sid  already exists.', ['%sid' => $this->sid]);
           }
         }
       }
     }
 
-    if ($this->status == 0) { // check that no modules use this server
+    // Check that no modules use this server.
+    if ($this->status == 0) {
       $warnings = module_invoke_all('ldap_server_in_use', $this->sid, $this->name);
       if (count($warnings)) {
         $errors['status'] = join("<br/>", array_values($warnings));
       }
     }
 
-
     if (!is_numeric($this->port)) {
       $errors['port'] = t('The TCP/IP port must be an integer.');
     }
@@ -391,8 +414,11 @@ class LdapServerAdmin extends LdapServer {
     return $errors;
   }
 
-public function drupalFormWarnings($op, $values, $has_errors = NULL)  {
-    $errors = array();
+  /**
+   *
+   */
+  public function drupalFormWarnings($op, $values, $has_errors = NULL) {
+    $errors = [];
 
     if ($op == 'delete') {
       if (!$this->sid) {
@@ -406,91 +432,62 @@ public function drupalFormWarnings($op, $values, $has_errors = NULL)  {
     return $warnings;
   }
 
+  /**
+   *
+   */
+  protected function warnings($op, $has_errors = NULL) {
 
-protected function warnings($op, $has_errors = NULL) {
-
-    $warnings = array();
+    $warnings = [];
     if ($this->ldap_type) {
       $defaults = ldap_servers_ldaps_option_array();
       if (isset($defaults['user']['user_attr']) && ($this->user_attr != $defaults['user']['user_attr'])) {
-        $tokens = array('%name' => $defaults['name'], '%default' => $defaults['user']['user_attr'], '%user_attr' => $this->user_attr);
+        $tokens = ['%name' => $defaults['name'], '%default' => $defaults['user']['user_attr'], '%user_attr' => $this->user_attr];
         $warnings['user_attr'] = t('The standard UserName attribute in %name is %default.  You have %user_attr. This may be correct
           for your particular LDAP.', $tokens);
       }
 
       if (isset($defaults['user']['mail_attr']) && $this->mail_attr && ($this->mail_attr != $defaults['user']['mail_attr'])) {
-        $tokens = array('%name' => $defaults['name'], '%default' => $defaults['user']['mail_attr'], '%mail_attr' => $this->mail_attr);
+        $tokens = ['%name' => $defaults['name'], '%default' => $defaults['user']['mail_attr'], '%mail_attr' => $this->mail_attr];
         $warnings['mail_attr'] = t('The standard mail attribute in %name is %default.  You have %mail_attr.  This may be correct
           for your particular LDAP.', $tokens);
       }
     }
-  //  if (!$this->status && $has_errors != TRUE) {
-    //  $warnings['status'] =  t('This server configuration is currently disabled.');
-   // }
-
     if (!$this->mail_attr && !$this->mail_template) {
       $warnings['mail_attr'] = t('Mail attribute or Mail Template should be used for most user account functionality.');
     }
 
-   // commented out validation because too many false positives present usability errors.
-   // if ($this->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT) { // Only for service account
-     // $result = ldap_baddn($this->binddn, t('Service Account DN'));
-     // if ($result['boolean'] == FALSE) {
-     //   $warnings['binddn'] =  $result['text'];
-     // }
-   // }
-
-   // foreach ($this->basedn as $basedn) {
-    //  $result = ldap_baddn($basedn, t('User Base DN'));
-     // if ($result['boolean'] == FALSE) {
-     //   $warnings['basedn'] =  $result['text'];
-    //  }
-   // }
-
-   // $result = ldap_badattr($this->user_attr, t('User attribute'));
-   // if ($result['boolean'] == FALSE) {
-    //  $warnings['user_attr'] =  $result['text'];
-   // }
-
-   // if ($this->mail_attr) {
-  //    $result = ldap_badattr($this->mail_attr, t('Mail attribute'));
-   //   if ($result['boolean'] == FALSE) {
-    //    $warnings['mail_attr'] =  $result['text'];
-   //   }
-  //  }
-
-   // $result = ldap_badattr($this->unique_persistent_attr, t('Unique Persistent Attribute'));
-   // if ($result['boolean'] == FALSE) {
-    //  $warnings['unique_persistent_attr'] =  $result['text'];
-   // }
-
     return $warnings;
   }
 
-public function drupalFormSubmit($op, $values) {
+  /**
+   *
+   */
+  public function drupalFormSubmit($op, $values) {
 
-  $this->populateFromDrupalForm($op, $values);
+    $this->populateFromDrupalForm($op, $values);
 
-  if ($values['clear_bindpw']) {
-    $this->bindpw_clear = TRUE;
-  }
+    if ($values['clear_bindpw']) {
+      $this->bindpw_clear = TRUE;
+    }
 
-  if ($op == 'delete') {
-    $this->delete($this);
-  }
-  else { // add or edit
-    try {
-      $save_result = $this->save($op);
+    if ($op == 'delete') {
+      $this->delete($this);
     }
-    catch (Exception $e) {
-      $this->setError('Save Error',
+    // Add or edit.
+    else {
+      try {
+        $save_result = $this->save($op);
+      }
+      catch (Exception $e) {
+        $this->setError('Save Error',
         t('Failed to save object.  Your form data was not saved.'));
+      }
     }
   }
-}
-
-
 
+  /**
+   *
+   */
   protected function arrayToLines($array) {
     $lines = "";
     if (is_array($array)) {
@@ -502,6 +499,9 @@ public function drupalFormSubmit($op, $values) {
     return $lines;
   }
 
+  /**
+   *
+   */
   protected function linesToArray($lines) {
     $lines = trim($lines);
 
@@ -512,159 +512,161 @@ public function drupalFormSubmit($op, $values) {
       }
     }
     else {
-      $array = array();
+      $array = [];
     }
     return $array;
   }
 
-
+  /**
+   *
+   */
   public static function fields() {
 
-     /**
+    /**
      * consumer_type is tag (unique alphanumeric id) of consuming authorization such as
      *   drupal_roles, og_groups, civicrm_memberships
      */
-    $fields = array(
+    $fields = [
 
-      'sid' => array(
-        'form' => array(
+      'sid' => [
+        'form' => [
           'fieldset' => 'server',
           '#type' => 'textfield',
           '#size' => 20,
           '#title' => t('Machine name for this server configuration.'),
           '#description' => t('May only contain alphanumeric characters (a-z, A-Z, 0-9, and _)'),
           '#required' => TRUE,
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 20,
           'not null' => TRUE,
-        )
-      ),
+        ],
+      ],
 
-     'numeric_sid' => array(
-        'schema' => array(
+      'numeric_sid' => [
+        'schema' => [
           'type' => 'serial',
           'unsigned' => TRUE,
           'not null' => TRUE,
           'description' => 'Primary ID field for the table.  Only used internally.',
           'no export' => TRUE,
-        ),
-      ),
+        ],
+      ],
 
-      'name' => array(
-        'form' => array(
+      'name' => [
+        'form' => [
           'fieldset' => 'server',
           '#type' => 'textfield',
           '#size' => 50,
           '#title' => 'Name',
           '#description' => t('Choose a <em><strong>unique</strong></em> name for this server configuration.'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'status' => array(
-        'form' => array(
+      'status' => [
+        'form' => [
           'fieldset' => 'server',
           '#type' => 'checkbox',
           '#title' => t('Enabled'),
           '#description' => t('Disable in order to keep configuration without having it active.'),
           '#required' => FALSE,
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'ldap_type' => array(
-        'form' => array(
+      'ldap_type' => [
+        'form' => [
           'fieldset' => 'server',
           '#type' => 'select',
           '#options' => ldap_servers_ldaps_option_array(),
           '#title' => t('LDAP Server Type'),
           '#description' => t('This field is informative.  It\'s purpose is to assist with default values and give validation warnings.'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 20,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'address' => array(
-        'form' => array(
+      'address' => [
+        'form' => [
           'fieldset' => 'server',
           '#type' => 'textfield',
           '#title' => t('LDAP server'),
           '#description' => t('The domain name or IP address of your LDAP Server such as "ad.unm.edu". For SSL
         use the form ldaps://DOMAIN such as "ldaps://ad.unm.edu"'),
           '#size' => 50,
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'port' => array(
-        'form' => array(
+      'port' => [
+        'form' => [
           'fieldset' => 'server',
           '#type' => 'textfield',
           '#title' => t('LDAP port'),
           '#size' => 5,
           '#description' => t('The TCP/IP port on the above server which accepts LDAP connections. Must be an integer.'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'int',
           'not null' => FALSE,
           'default' => 389,
-        ),
-      ),
+        ],
+      ],
 
-      'tls' => array(
-        'form' => array(
+      'tls' => [
+        'form' => [
           'fieldset' => 'server',
           '#type' => 'checkbox',
           '#title' => t('Use Start-TLS'),
           '#description' => t('Secure the connection between the Drupal and the LDAP servers using TLS.<br /><em>Note: To use START-TLS, you must set the LDAP Port to 389.</em>'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
-
-      'followrefs' => array(
-        'form' => array(
-           'fieldset' => 'server',
-           '#type' => 'checkbox',
-           '#title' => t('Follow LDAP Referrals'),
-           '#description' => t('Makes the LDAP client follow referrals (in the responses from the LDAP server) to other LDAP servers. This requires that the Bind Settings you give, is ALSO valid on these other servers.'),
-          ),
-        'schema' => array(
-           'type' => 'int',
-           'size' => 'tiny',
-           'not null' => FALSE,
-           'default' => 0,
-        ),
-      ),
-
-      'bind_method' => array(
-        'form' => array(
+        ],
+      ],
+
+      'followrefs' => [
+        'form' => [
+          'fieldset' => 'server',
+          '#type' => 'checkbox',
+          '#title' => t('Follow LDAP Referrals'),
+          '#description' => t('Makes the LDAP client follow referrals (in the responses from the LDAP server) to other LDAP servers. This requires that the Bind Settings you give, is ALSO valid on these other servers.'),
+        ],
+        'schema' => [
+          'type' => 'int',
+          'size' => 'tiny',
+          'not null' => FALSE,
+          'default' => 0,
+        ],
+      ],
+
+      'bind_method' => [
+        'form' => [
           'fieldset' => 'bind_method',
           '#type' => 'radios',
           '#title' => t('Binding Method for Searches (such as finding user object or their group memberships)'),
-          '#options' => array(
+          '#options' => [
             LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT => t('Service Account Bind: Use credentials in the
             <strong>Service Account</strong> field to bind to LDAP.  <em>This option is usually a best practice.</em>'),
 
@@ -683,77 +685,76 @@ public function drupalFormSubmit($op, $values) {
 
             LDAP_SERVERS_BIND_METHOD_ANON => t('Anonymous Bind: Use no credentials to bind to LDAP server.<br/>
             <em>This option will not work on most LDAPS connections.</em>'),
-          ),
-        ),
-        'schema' => array(
+          ],
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'small',
           'not null' => FALSE,
           'default' => 0,
           'boolean' => FALSE,
-        ),
-      ),
-
-    'binding_service_acct' => array(
-      'form' => array(
-        'fieldset' => 'bind_method',
-        '#type' => 'markup',
-        '#markup' => t('<label>Service Account</label> Some LDAP configurations
+        ],
+      ],
+
+      'binding_service_acct' => [
+        'form' => [
+          'fieldset' => 'bind_method',
+          '#type' => 'markup',
+          '#markup' => t('<label>Service Account</label> Some LDAP configurations
           prohibit or restrict the results of anonymous searches. These LDAPs require a DN//password pair
           for binding. For security reasons, this pair should belong to an
           LDAP account with stripped down permissions.
           This is also required for provisioning LDAP accounts and groups!'),
-        ),
-      ),
-
+        ],
+      ],
 
-      'binddn' => array(
-        'form' => array(
+      'binddn' => [
+        'form' => [
           'fieldset' => 'bind_method',
           '#type' => 'textfield',
           '#title' => t('DN for non-anonymous search'),
           '#size' => 80,
-          '#states' => array(
-             'enabled' => array(   // action to take.
-               ':input[name=bind_method]' => array('value' => (string)LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'enabled' => [
+              ':input[name=bind_method]' => ['value' => (string) LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 511,
-        ),
-      ),
+        ],
+      ],
 
-      'bindpw' => array(
-        'form' => array(
+      'bindpw' => [
+        'form' => [
           'fieldset' => 'bind_method',
           '#type' => 'password',
           '#title' => t('Password for non-anonymous search'),
           '#size' => 20,
-          '#states' => array(
-             'enabled' => array(   // action to take.
-               ':input[name=bind_method]' => array('value' => (string)LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'enabled' => [
+              ':input[name=bind_method]' => ['value' => (string) LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
-        ),
-      ),
+        ],
+      ],
 
-      'clear_bindpw' => array(
-        'form' => array(
+      'clear_bindpw' => [
+        'form' => [
           'fieldset' => 'bind_method',
           '#type' => 'checkbox',
           '#title' => t('Clear existing password from database.  Check this when switching away from Service Account Binding.'),
           '#default_value' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'basedn' => array(
-        'form' => array(
+      'basedn' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textarea',
           '#cols' => 50,
@@ -764,61 +765,61 @@ public function drupalFormSubmit($op, $values) {
             Keep in mind that every additional basedn likely doubles the number of queries.  Place the
             more heavily used one first and consider using one higher base DN rather than 2 or more lower base DNs.
             Enter one per line in case if you need more than one.') . '</div>',
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'text',
           'serialize' => TRUE,
-        ),
-      ),
+        ],
+      ],
 
-      'user_attr' => array(
-        'form' => array(
+      'user_attr' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('AuthName attribute'),
           '#description' => t('The attribute that holds the users\' login name. (eg. <code>cn</code> for eDir or <code>sAMAccountName</code> for Active Directory).'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'account_name_attr' => array(
-        'form' => array(
+      'account_name_attr' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('AccountName attribute'),
           '#description' => t('The attribute that holds the unique account name. Defaults to the same as the AuthName attribute.'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
           'default' => '',
-        ),
-      ),
+        ],
+      ],
 
-      'mail_attr' => array(
-        'form' => array(
+      'mail_attr' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('Email attribute'),
           '#description' => t('The attribute that holds the users\' email address. (eg. <code>mail</code>). Leave empty if no such attribute exists'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'mail_template' => array(
-        'form' => array(
+      'mail_template' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textfield',
           '#size' => 30,
@@ -829,31 +830,31 @@ public function drupalFormSubmit($op, $values) {
             such as <code>[cn]@mycompany.com</code>.
             See http://drupal.org/node/997082 for additional documentation on ldap tokens.
             '),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
-
-    'picture_attr' => array(
-      		'form' => array(
-      				'fieldset' => 'users',
-      				'#type' => 'textfield',
-      				'#size' => 30,
-      				'#title' => t('Thumbnail attribute'),
-      				'#description' => t('The attribute that holds the users\' thumnail image. (eg. <code>thumbnailPhoto</code>). Leave empty if no such attribute exists'),
-      		),
-      		'schema' => array(
-      				'type' => 'varchar',
-      				'length' => 255,
-      				'not null' => FALSE,
-      		),
-      ),
-  
-      'unique_persistent_attr' => array(
-        'form' => array(
+        ],
+      ],
+
+      'picture_attr' => [
+        'form' => [
+          'fieldset' => 'users',
+          '#type' => 'textfield',
+          '#size' => 30,
+          '#title' => t('Thumbnail attribute'),
+          '#description' => t('The attribute that holds the users\' thumnail image. (eg. <code>thumbnailPhoto</code>). Leave empty if no such attribute exists'),
+        ],
+        'schema' => [
+          'type' => 'varchar',
+          'length' => 255,
+          'not null' => FALSE,
+        ],
+      ],
+
+      'unique_persistent_attr' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textfield',
           '#size' => 30,
@@ -864,17 +865,17 @@ public function drupalFormSubmit($op, $values) {
             enter a unique and persistent ldap attribute for users.  In cases
             where DN does not change, enter "dn" here.
             If no such attribute exists, leave this blank.'
-            ),
-        ),
-        'schema' => array(
+          ),
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 64,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'unique_persistent_attr_binary' => array(
-        'form' => array(
+      'unique_persistent_attr_binary' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'checkbox',
           '#title' => t('Does the <em>Persistent and Unique User ID
@@ -883,17 +884,17 @@ public function drupalFormSubmit($op, $values) {
              attribute such as objectSid in ActiveDirectory for the PUID.<br>
              If you don\'t want this consider switching to another attribute,
              such as samaccountname.'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'user_dn_expression' => array(
-        'form' => array(
+      'user_dn_expression' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textfield',
           '#size' => 80,
@@ -902,16 +903,16 @@ public function drupalFormSubmit($op, $values) {
             Typically it will be:<br/> <code>cn=%username,%basedn</code>
              which might evaluate to <code>cn=jdoe,ou=campus accounts,dc=ad,dc=mycampus,dc=edu</code>
              Base DNs are entered above.'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'ldap_to_drupal_user' => array(
-        'form' => array(
+      'ldap_to_drupal_user' => [
+        'form' => [
           'fieldset' => 'users',
           '#disabled' => (!module_exists('php')),
           '#type' => 'textarea',
@@ -925,81 +926,81 @@ public function drupalFormSubmit($op, $values) {
             Careful, bad PHP code here will break your site. If left empty, no name transformation will be done.
             <br/>Example:<br/>Given the user will logon with jdoe@xyz.com and you want the ldap UserName attribute to be
             jdoe.<br/><code>$parts = explode(\'@\', $name); if (count($parts) == 2) {print $parts[0]};</code>'),
-          ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 1024,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-     'testing_drupal_username' => array(
-        'form' => array(
+      'testing_drupal_username' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('Testing Drupal Username'),
           '#description' => t('This is optional and used for testing this server\'s configuration against an actual username.  The user need not exist in Drupal and testing will not affect the user\'s LDAP or Drupal Account.'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-     'testing_drupal_user_dn' => array(
-        'form' => array(
+      'testing_drupal_user_dn' => [
+        'form' => [
           'fieldset' => 'users',
           '#type' => 'textfield',
           '#size' => 120,
           '#title' => t('DN of testing username, e.g. cn=hpotter,ou=people,dc=hogwarts,dc=edu'),
           '#description' => t('This is optional and used for testing this server\'s configuration against an actual username.  The user need not exist in Drupal and testing will not affect the user\'s LDAP or Drupal Account.'),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'grp_unused' => array(
-        'form' => array(
+      'grp_unused' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'checkbox',
           '#title' => t('Groups are not relevant to this Drupal site.  This is generally true if LDAP Groups, LDAP Authorization, etc are not it use.'),
           '#disabled' => FALSE,
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-     'grp_object_cat' => array(
-        'form' => array(
+      'grp_object_cat' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('Name of Group Object Class'),
           '#description' => t('e.g. groupOfNames, groupOfUniqueNames, group.'),
-          '#states' => array(
-              'visible' => array(   // action to take.
-                ':input[name=grp_unused]' => array('checked' => FALSE),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 64,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'grp_nested' => array(
-        'form' => array(
+      'grp_nested' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'checkbox',
           '#title' => t('Nested groups are used in my LDAP'),
@@ -1007,207 +1008,207 @@ public function drupalFormSubmit($op, $values) {
           '#description' => t('If a user is a member of group A and group A is a member of group B,
              user should be considered to be in group A and B.  If your LDAP has nested groups, but you
              want to ignore nesting, leave this unchecked.'),
-          '#states' => array(
-              'visible' => array(   // action to take.
-                ':input[name=grp_unused]' => array('checked' => FALSE),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'grp_user_memb_attr_exists' => array(
-        'form' => array(
+      'grp_user_memb_attr_exists' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'checkbox',
           '#title' => t('A user LDAP attribute such as <code>memberOf</code> exists that contains a list of their groups.
             Active Directory and openLdap with memberOf overlay fit this model.'),
           '#disabled' => FALSE,
-          '#states' => array(
-             'visible' => array(   // action to take.
-               ':input[name=grp_unused]' => array('checked' => FALSE),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'grp_user_memb_attr' => array(
-        'form' => array(
+      'grp_user_memb_attr' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('Attribute in User Entry Containing Groups'),
           '#description' => t('e.g. memberOf'),
-          '#states' => array(
-            'enabled' => array(   // action to take.
-              ':input[name=grp_user_memb_attr_exists]' => array('checked' => TRUE),
-            ),
-              'visible' => array(   // action to take.
-              ':input[name=grp_unused]' => array('checked' => FALSE),
-            ),
-          ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'enabled' => [
+              ':input[name=grp_user_memb_attr_exists]' => ['checked' => TRUE],
+            ],
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'grp_memb_attr' => array(
-        'form' => array(
+      'grp_memb_attr' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('LDAP Group Entry Attribute Holding User\'s DN, CN, etc.'),
           '#description' => t('e.g uniquemember, memberUid'),
-          '#states' => array(
-              'visible' => array(   // action to take.
-                ':input[name=grp_unused]' => array('checked' => FALSE),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'grp_memb_attr_match_user_attr' => array(
-        'form' => array(
+      'grp_memb_attr_match_user_attr' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('User attribute held in "LDAP Group Entry Attribute Holding..."'),
           '#description' => t('This is almost always "dn" (which technically isn\'t an attribute).  Sometimes its "cn".'),
-          '#states' => array(
-              'visible' => array(   // action to take.
-                ':input[name=grp_unused]' => array('checked' => FALSE),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'grp_derive_from_dn' => array(
-        'form' => array(
+      'grp_derive_from_dn' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'checkbox',
           '#title' => t('Groups are derived from user\'s LDAP entry DN.') . '<em>' .
-            t('This
+          t('This
             group definition has very limited functionality and most modules will
             not take this into account.  LDAP Authorization will.') . '</em>',
           '#disabled' => FALSE,
-          '#states' => array(
-              'visible' => array(   // action to take.
-                ':input[name=grp_unused]' => array('checked' => FALSE),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-      'grp_derive_from_dn_attr' => array(
-        'form' => array(
+      'grp_derive_from_dn_attr' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'textfield',
           '#size' => 30,
           '#title' => t('Attribute of the User\'s LDAP Entry DN which contains the group'),
           '#description' => t('e.g. ou'),
-          '#states' => array(
-            'enabled' => array(   // action to take.
-              ':input[name=grp_derive_from_dn]' => array('checked' => TRUE),
-            ),
-              'visible' => array(   // action to take.
-              ':input[name=grp_unused]' => array('checked' => FALSE),
-            ),
-          ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'enabled' => [
+              ':input[name=grp_derive_from_dn]' => ['checked' => TRUE],
+            ],
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-     'grp_test_grp_dn' => array(
-        'form' => array(
+      'grp_test_grp_dn' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'textfield',
           '#size' => 120,
           '#title' => t('Testing LDAP Group DN'),
           '#description' => t('This is optional and can be useful for debugging and validating forms.'),
-          '#states' => array(
-              'visible' => array(   // action to take.
-                ':input[name=grp_unused]' => array('checked' => FALSE),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-     'grp_test_grp_dn_writeable' => array(
-        'form' => array(
+      'grp_test_grp_dn_writeable' => [
+        'form' => [
           'fieldset' => 'groups',
           '#type' => 'textfield',
           '#size' => 120,
           '#title' => t('Testing LDAP Group DN that is writable.  WARNING the test script for the server will create, delete, and add members to this group!'),
           '#description' => t('This is optional and can be useful for debugging and validating forms.'),
-          '#states' => array(
-              'visible' => array(   // action to take.
-                ':input[name=grp_unused]' => array('checked' => FALSE),
-              ),
-            ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name=grp_unused]' => ['checked' => FALSE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'varchar',
           'length' => 255,
           'not null' => FALSE,
-        ),
-      ),
+        ],
+      ],
 
-      'search_pagination' => array(
-        'form' => array(
+      'search_pagination' => [
+        'form' => [
           'fieldset' => 'pagination',
           '#type' => 'checkbox',
           '#title' => t('Use LDAP Pagination.'),
           '#disabled' => !ldap_servers_php_supports_pagination(),
-        ),
-        'schema' => array(
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'tiny',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-     'search_page_size' => array(
-        'form' => array(
+      'search_page_size' => [
+        'form' => [
           'fieldset' => 'pagination',
           '#type' => 'textfield',
           '#size' => 10,
@@ -1218,31 +1219,32 @@ public function drupalFormSubmit($op, $values) {
             1000 is a good guess when unsure. Other modules such as LDAP Query
             or LDAP Feeds will be allowed to set a smaller page size, but not
             a larger one.'),
-          '#states' => array(
-            'visible' => array(   // action to take.
-              ':input[name="search_pagination"]' => array('checked' => TRUE),
-            ),
-      ),
-        ),
-        'schema' => array(
+          '#states' => [
+            'visible' => [
+              ':input[name="search_pagination"]' => ['checked' => TRUE],
+            ],
+          ],
+        ],
+        'schema' => [
           'type' => 'int',
           'size' => 'medium',
           'not null' => FALSE,
           'default' => 1000,
-        ),
-      ),
+        ],
+      ],
 
-      'weight' => array(
-        'schema' => array(
+      'weight' => [
+        'schema' => [
           'type' => 'int',
           'not null' => FALSE,
           'default' => 0,
-        ),
-      ),
+        ],
+      ],
 
-    );
+    ];
 
-  return $fields;
+    return $fields;
 
   }
+
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.admin.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.admin.inc
index 23ee1d8e..ba7def78 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.admin.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.admin.inc
@@ -2,15 +2,18 @@
 
 /**
  * @file
- * Defines functions for administrative interface for servers
- *
+ * Defines functions for administrative interface for servers.
  */
 
+/**
+ *
+ */
 function ldap_servers_edit_index() {
 
   return ldap_servers_servers_list(NULL, TRUE);
 
 }
+
 /**
  * LDAP servers list.
  *
@@ -18,23 +21,23 @@ function ldap_servers_edit_index() {
  *   server id.  if empty list all servers
  * @param $actions
  *   True or False indicating if server edit, delete, enable, disable, etc links should show
+ *
  * @return
  *   The HTML table with the servers list.
  */
 function ldap_servers_servers_list($sid = NULL, $actions = FALSE) {
 
-  $variables = array(
+  $variables = [
     'ldap_servers' => $ldap_server = ldap_servers_get_servers($sid, 'all'),
     'action' => TRUE,
     'type' => 'table',
-    );
+  ];
 
   $html = theme('ldap_servers_list', $variables);
 
   return $html;
 }
 
-
 /**
  * Implements the LDAP server edit page.
  *
@@ -48,7 +51,6 @@ function ldap_servers_servers_list($sid = NULL, $actions = FALSE) {
  * @return
  *   The form structure.
  */
-
 function ldap_servers_admin_form($form, &$form_state, $op = NULL, $sid = NULL) {
   ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class');
   $server = new LdapServerAdmin($sid);
@@ -69,12 +71,12 @@ function ldap_servers_admin_form_validate($form, &$form_state) {
   foreach ($errors as $error_name => $error_text) {
     form_set_error($error_name, t($error_text));
   }
-  $warnings = $server->drupalFormWarnings($op, $form_state['values'], (boolean)(count($errors) > 0));
+  $warnings = $server->drupalFormWarnings($op, $form_state['values'], (boolean) (count($errors) > 0));
   foreach ($warnings as $warning_name => $warning_text) {
     drupal_set_message($warning_text, 'warning');
   }
 
-  $form_state['ldap_warnings'] = (boolean)(count($warnings) > 0);
+  $form_state['ldap_warnings'] = (boolean) (count($warnings) > 0);
 
 }
 
@@ -87,14 +89,15 @@ function ldap_servers_admin_form_submit($form, &$form_state) {
   $verb = ($op == 'edit') ? 'edited' : $op . 'ed';
   ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class');
   $server = new LdapServerAdmin($form_state['values']['sid']);
-  $server->drupalFormSubmit($op, $form_state['values']);  // add form data to object and save or create
+  // Add form data to object and save or create.
+  $server->drupalFormSubmit($op, $form_state['values']);
 
   if ($server->hasError() == FALSE) {
-    drupal_set_message(t('LDAP Server %name !verb.', array('!verb' => $verb, '%name' => $server->name)), 'status');
+    drupal_set_message(t('LDAP Server %name !verb.', ['!verb' => $verb, '%name' => $server->name]), 'status');
     ldap_servers_cache_clear();
     if ($form_state['ldap_warnings'] && $op != 'add') {
-      // do nothing, but don't redirect away from form.
-      // if there are warnings, want them to see form even if its been saved
+      // Do nothing, but don't redirect away from form.
+      // if there are warnings, want them to see form even if its been saved.
     }
     else {
       drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/servers');
@@ -122,19 +125,20 @@ function ldap_servers_admin_delete($form, &$form_state, $op = NULL, $sid = NULL)
 
   if ($sid && ($ldap_server = ldap_servers_get_servers($sid, 'all', TRUE))) {
     // array()
-
-    $variables = array(
-      'ldap_server' => $ldap_server, 'actions' => FALSE, 'type' => 'detail'
-    );
+    $variables = [
+      'ldap_server' => $ldap_server,
+      'actions' => FALSE,
+      'type' => 'detail',
+    ];
     $form['#prefix'] = '<div>' . theme('ldap_servers_server', $variables) . '</div>';
-    $form['sid'] = array(
+    $form['sid'] = [
       '#type' => 'hidden',
       '#value' => $sid,
-    );
-    $form['name'] = array(
+    ];
+    $form['name'] = [
       '#type' => 'hidden',
       '#value' => $ldap_server->name,
-    );
+    ];
 
     $warnings = module_invoke_all('ldap_server_in_use', $sid, $ldap_server->name);
     if (count($warnings)) {
@@ -146,7 +150,7 @@ function ldap_servers_admin_delete($form, &$form_state, $op = NULL, $sid = NULL)
         $form,
         'Delete Confirmation Form',
         LDAP_SERVERS_MENU_BASE_PATH . '/servers/list',
-          '<p>' . t('Are you sure you want to delete the LDAP server named <em><strong>%name</strong></em> ?', array('%name' => $ldap_server->name)) . '</p><p>' .
+          '<p>' . t('Are you sure you want to delete the LDAP server named <em><strong>%name</strong></em> ?', ['%name' => $ldap_server->name]) . '</p><p>' .
           t('This action cannot be undone.') . '</p>',
         t('Delete'),
         t('Cancel')
@@ -166,7 +170,7 @@ function ldap_servers_admin_delete_submit($form, &$form_state) {
   $ldap_server = new LdapServerAdmin($sid);
   if ($values['confirm'] && $sid) {
     if ($result = $ldap_server->delete($sid)) {
-      $tokens = array('%name' => $ldap_server->name, '!sid' => $sid);
+      $tokens = ['%name' => $ldap_server->name, '!sid' => $sid];
       drupal_set_message(t('LDAP Server %name (server id = !sid) has been deleted.', $tokens), 'status');
       watchdog('ldap_servers', 'LDAP Server deleted: %name (sid = !sid) ', $tokens);
     }
@@ -181,7 +185,6 @@ function ldap_servers_admin_delete_submit($form, &$form_state) {
   drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/servers/list');
 }
 
-
 /**
  * Implements the LDAP server delete page.
  *
@@ -193,31 +196,31 @@ function ldap_servers_admin_delete_submit($form, &$form_state) {
  * @return
  *   The form structure.
  */
-
-
 function ldap_servers_admin_enable_disable($form, &$form_state, $action = NULL, $sid = NULL) {
 
   if ($ldap_server = ldap_servers_get_servers($sid, 'all', TRUE)) {
-    $variables = array(
-      'ldap_server' => $ldap_server, 'actions' => FALSE, 'type' => 'detail'
-    );
+    $variables = [
+      'ldap_server' => $ldap_server,
+      'actions' => FALSE,
+      'type' => 'detail',
+    ];
     $form['#prefix'] = "<div>" . theme('ldap_servers_server', $variables) . "</div>";
 
-    $form['sid'] = array(
+    $form['sid'] = [
       '#type' => 'hidden',
       '#value' => $sid,
-    );
-    $form['name'] = array(
+    ];
+    $form['name'] = [
       '#type' => 'hidden',
       '#value' => $ldap_server->name,
-    );
-    $form['action'] = array(
+    ];
+    $form['action'] = [
       '#type' => 'hidden',
       '#value' => $action,
-    );
+    ];
     return confirm_form(
       $form,
-      t('Are you sure you want to') . t($action) . ' ' . t('the LDAP server named <em><strong>%name</strong></em>?', array('%name' => $ldap_server->name)),
+      t('Are you sure you want to') . t($action) . ' ' . t('the LDAP server named <em><strong>%name</strong></em>?', ['%name' => $ldap_server->name]),
       LDAP_SERVERS_MENU_BASE_PATH . '/servers/list',
       t('<p></p>'),
       t($action),
@@ -241,7 +244,7 @@ function ldap_servers_admin_enable_disable_submit($form, &$form_state) {
 
     $ldap_server->status = $status;
     $ldap_server->save('edit');
-    $tokens = array('%name' => $values['name'], '!sid' => $sid, '!action' => t($values['action']) . 'd');
+    $tokens = ['%name' => $values['name'], '!sid' => $sid, '!action' => t($values['action']) . 'd'];
     drupal_set_message(t('LDAP Server Configuration %name (server id = !sid) has been !action.', $tokens));
     $message = t('LDAP Server !action: %name (sid = !sid) ', $tokens);
     watchdog('ldap_servers', $message);
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.api.php b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.api.php
index 51587090..12aa08f1 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.api.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.api.php
@@ -2,38 +2,34 @@
 
 /**
  * @file
- * Hooks provided by ldap_servers module
+ * Hooks provided by ldap_servers module.
  */
 
 /**
  * Allows other modules to periodically affect an ldap associated user
  * or its corresponding ldap entry.
  *
- * when cron runs a batch of ldap associated drupal accounts
+ * When cron runs a batch of ldap associated drupal accounts
  * will be looked at and marked as tested.  over the course
- * of time all ldap related users will be looked at
+ * of time all ldap related users will be looked at.
  *
  * Each module implementing this hook is responsible for
  * altering ldap entries and drupal user objects; simply
  * altering the variables will have no affect on the actual
  * ldap entry or drupal user
  */
-
 function hook_ldap_servers_user_cron(&$users) {
 
-
-
 }
 
 /**
- * helper hook to see if a batch of ldap users
- * needs to be queried
+ * Helper hook to see if a batch of ldap users
+ * needs to be queried.
  *
- * if a module implements hook_ldap_servers_user_cron,
+ * If a module implements hook_ldap_servers_user_cron,
  * but currently does not need to process user cron batches,
- * it should return FALSE
+ * it should return FALSE.
  */
-
 function hook_ldap_servers_user_cron_needed() {
   return TRUE;
 }
@@ -41,46 +37,42 @@ function hook_ldap_servers_user_cron_needed() {
 /**
  * Allows other modules to alter ldap entry or perform other necessary
  *   LDAP operations before entires are provisioned.
- * This should be invoked before provisioning ldap entries
+ * This should be invoked before provisioning ldap entries.
  *
- * @param array $ldap_entries as array keyed on lowercase dn of entry with
+ * @param array $ldap_entries
+ *   as array keyed on lowercase dn of entry with
  *   value of array in format used in ldap_add or ldap_modify function
  *   e.g.
  *   $ldap_entries['cn=jkool,ou=guest accounts,dc=ad,dc=myuniversity,dc=edu'] = array(
  *    "attribute1" => array("value"),
  *    "attribute2" => array("value1", "value2"),
- *  );
+ *   );.
  *
- * @param LdapServer $ldap_server as ldap server configuration object that is
- *   performing provisioning
+ * @param LdapServer $ldap_server
+ *   as ldap server configuration object that is
+ *   performing provisioning.
  *
- * @param array $context with the following key/values:
+ * @param array $context
+ *   with the following key/values:
  *   'action' => add|modify|delete
  *
  *   'corresponding_drupal_data' => if ldap entries have corresponding drupal objects, such
  *     as ldap user entries and drupal user objects; ldap groups and drupal roles; etc
- *     this will be array keyed on lowercase dn with values of objects
- *     e.g.
- *     $context['corresponding_drupal_data'] = array(
+ *     this will be array keyed on lowercase dn with values of objects, e.g. :
+ *     [
  *      'cn=jkool,ou=guest accounts,dc=ad,dc=myuniversity,dc=edu' => drupal user object1,
- *      'cn=jfun,ou=guest accounts,dc=ad,dc=myuniversity,dc=edu'  => drupal user object2,
- *     )
- *
+ *      'cn=jfun,ou=guest accounts,dc=ad,dc=myuniversity,dc=edu  => drupal user object2,
+ *     ]
  *    'corresponding_drupal_data_type' => 'user', 'role', etc.
- *
- *  );
  */
-
 function hook_ldap_entry_pre_provision_alter(&$ldap_entries, $ldap_server, $context) {
 
-
-
 }
 
 /**
  * Allows modules to react to provisioning of ldap entries.
  *
- * This should be invoked after provisioning ldap entries
+ * This should be invoked after provisioning ldap entries.
  *
  * -- same signature as hook_ldap_entry_pre_provision_alter with ldap entries not passed by reference
  * -- ldap entries are not queried after provisioning, so $ldap_entries are in form
@@ -89,20 +81,15 @@ function hook_ldap_entry_pre_provision_alter(&$ldap_entries, $ldap_server, $cont
  *    $context['provisioned_ldap_entries][<dn>] => ldap entry array in format of an ldap query
  *    returned from ldap_get_entries() with 'count' keys
  */
-
 function hook_ldap_entry_post_provision(&$ldap_entries, $ldap_server, $context) {
 
-
-
 }
 
-
-
 /**
  * Perform alterations of ldap attributes before query is made.
  *
  * To avoid excessive attributes in an ldap query, modules should
- * alter attributes needed based on $op parameter
+ * alter attributes needed based on $op parameter.
  *
  * @param array $attributes
  *   array of attributes to be returned from ldap queries where:
@@ -111,16 +98,17 @@ function hook_ldap_entry_post_provision(&$ldap_entries, $ldap_server, $context)
  *       - 'conversion' => NULL,
  *       - 'values' => array(0 => 'john', 1 => 'johnny'))
  *
- * @param array $params context array with some or all of the following key/values
+ * @param array $params
+ *   context array with some or all of the following key/values
  *   'sid' => drupal account object,
  *   'ldap_context' => ,
- *   'direction' =>
- *
+ *   'direction' =>.
  */
 function hook_ldap_attributes_needed_alter(&$attributes, $params) {
 
-  $attributes['dn'] = ldap_servers_set_attribute_map(@$attributes['dn'], 'ldap_dn') ;
-  if ($params['sid']) { // puid attributes are server specific
+  $attributes['dn'] = ldap_servers_set_attribute_map(@$attributes['dn'], 'ldap_dn');
+  // Puid attributes are server specific.
+  if ($params['sid']) {
     $ldap_server = (is_object($params['sid'])) ? $params['sid'] : ldap_servers_get_servers($params['sid'], 'enabled', TRUE);
 
     switch ($op) {
@@ -132,45 +120,42 @@ function hook_ldap_attributes_needed_alter(&$attributes, $params) {
           $attributes[$ldap_server->user_attr] = ldap_servers_set_attribute_map();
         }
         if (!isset($attributes[$ldap_server->mail_attr])) {
-          $attributes[$ldap_server->mail_attr] = ldap_servers_set_attribute_map(); // set default values for an attribute, force data_type
+          // Set default values for an attribute, force data_type.
+          $attributes[$ldap_server->mail_attr] = ldap_servers_set_attribute_map();
         }
 
         ldap_servers_token_extract_attributes($attributes, $ldap_server_obj->mail_template);
         $attributes[$ldap_server->unique_persistent_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->unique_persistent_attr]);
 
-      break;
+        break;
     }
   }
 }
 
-
 /**
  * Perform alterations of $ldap_user variable.
  *
- *
- * @param array $ldap_user see README.developers.txt for structure
- * @param array $params context array with some or all of the following key/values
+ * @param array $ldap_user
+ *   see README.developers.txt for structure.
+ * @param array $params
+ *   context array with some or all of the following key/values
  *   'account' => drupal account object,
  *   'ldap_context' => ,
  *   'module' =>  module calling alter, e.g. 'ldap_user',
- *   'function' => function calling alter, e.g. 'provisionLdapEntry'
- *
+ *   'function' => function calling alter, e.g. 'provisionLdapEntry'.
  */
-
 function hook_ldap_user_alter(&$ldap_entry, $params) {
 
-
 }
 
 /**
  * Allow the results from the ldap search answer to be modified
  * The query parameters are provided as context infomation
  * (readonly)
- *
  */
 function hook_ldap_server_search_results_alter(&$entries, $ldap_query_params) {
-  // look for a specific part of the $results array
-  // and maybe change it
+  // Look for a specific part of the $results array
+  // and maybe change it.
 }
 
 /**
@@ -187,7 +172,7 @@ function hook_ldap_server_search_results_alter(&$entries, $ldap_query_params) {
  *   - ldap_server: The LDAP server that is invoking the hook
  */
 function hook_user_ldap_servers_username_to_ldapname_alter(&$ldap_username, $drupal_username, $context) {
-  // Alter the name only if it has not been altered already, ie php eval code
+  // Alter the name only if it has not been altered already, ie php eval code.
   if ($ldap_username == $drupal_username) {
     $authname = ldap_user_get_authname($ldap_username);
     if (!empty($authname)) {
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.drush.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.drush.inc
index 1527af0f..c25f848d 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.drush.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.drush.inc
@@ -2,7 +2,7 @@
 
 /**
  * @file
- *   LDAP module drush integration.
+ * LDAP module drush integration.
  */
 
 /**
@@ -14,27 +14,29 @@
  * @see drush_parse_command()
  */
 function ldap_servers_drush_command() {
-  $items['ldap-servers-set-password'] = array(
+  $items['ldap-servers-set-password'] = [
     'description' => 'Set the password of an otherwise already configured LDAP server.',
-    'aliases' => array('lssp'),
-    'arguments' => array(
-      'ldap_sid' => 'The configured LDAP server ID.'
-    ),
-    'options' => array(
-      'password' => 'The password to set for the server.'
-    ),
-    'examples' => array(
+    'aliases' => ['lssp'],
+    'arguments' => [
+      'ldap_sid' => 'The configured LDAP server ID.',
+    ],
+    'options' => [
+      'password' => 'The password to set for the server.',
+    ],
+    'examples' => [
       'drush lssp LDAP_SERVER_ID --password="PASSWORD"' => 'Sets the password for LDAP_SERVER_ID. Replace LDAP_SERVER_ID with the "Machine name for this configuration." of
         the server found at /admin/config/people/ldap/servers, and replace PASSWORD with your password.',
-    ),
-  );
+    ],
+  ];
   return $items;
 }
 
 /**
  * Callback for the ldap-servers-set-password command.
  *
- * @param string $ldap_sid The server ID for which to set the password.
+ * @param string $ldap_sid
+ *   The server ID for which to set the password.
+ *
  * @option string --password Used to provide the password via an option in the Drush command.
  *
  * @return
@@ -52,14 +54,14 @@ function drush_ldap_servers_set_password($ldap_sid = NULL) {
     // Retrieves the password from the --password option set in the drush command.
     $ldap_server->bindpw = drush_get_option('password');
     if (!isset($ldap_server->bindpw)) {
-      return drupal_set_message(dt('No password was provided for @ldap_sid. A password has not been set.', array('@ldap_sid' => $ldap_sid)));
+      return drupal_set_message(dt('No password was provided for @ldap_sid. A password has not been set.', ['@ldap_sid' => $ldap_sid]));
     }
     // Save the server configuration with the password.
     $ldap_server->save('edit');
     // Notify of success.
-    return drupal_set_message(dt('Password for @ldap_sid has been set.', array('@ldap_sid' => $ldap_sid)));
+    return drupal_set_message(dt('Password for @ldap_sid has been set.', ['@ldap_sid' => $ldap_sid]));
   }
   // Provided server ID does not match any of the existing server IDs.
   return drush_set_error(dt('@ldap_sid does not match the server ID of any configured servers.  Use the "Machine name for this server configuration." found on the edit screen for that server.',
-    array('@ldap_sid' => $ldap_sid)));
+    ['@ldap_sid' => $ldap_sid]));
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.encryption.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.encryption.inc
index f3c34f62..ba3f4faa 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.encryption.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.encryption.inc
@@ -3,195 +3,97 @@
 /**
  * @file
  * Provides functions for encryption/decryption.
- * http://stackoverflow.com/questions/2448256/php-mcrypt-encrypting-decrypting-file
  */
 
-define('LDAP_SERVERS_MODE', 'CTR');
 /**
- * Return a random salt of a given length for crypt-style passwords
+ * Return a random salt of a given length for crypt-style passwords.
  *
  * @param int length
  *   The requested length.
  *
  * @return string
  *   A (fairly) random salt of the requested length.
- *
  */
-function ldap_servers_random_salt( $length ) {
+function ldap_servers_random_salt($length) {
   $possible = '0123456789' . 'abcdefghijklmnopqrstuvwxyz' . 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . './';
   $salt = "";
 
-  mt_srand((double)microtime() * 1000000);
-  while ( strlen( $salt ) < $length ) {
-    $salt .= substr( $possible, ( rand() % strlen( $possible ) ), 1 );
+  mt_srand((double) microtime() * 1000000);
+  while (strlen($salt) < $length) {
+    $salt .= substr($possible, (rand() % strlen($possible)), 1);
   }
 
   return $salt;
 }
 
+/**
+ * Encryption options available.
+ *
+ * @return array
+ *   Options.
+ */
+function _ldap_servers_encrypt_types() {
+  $options = [
+    LDAP_SERVERS_ENC_TYPE_CLEARTEXT => 'Clear text',
+  ];
 
-function _ldap_servers_encrypt_types($type = 'all') {
-
-  $hashes = array();
-  $encrypts = array();
-  if (extension_loaded('mcrypt')) {  // only support with extension
-
-    /**
-      LDAP_SERVERS_ENC_TYPE_MD5C => 'MD5 Crypt',
-      LDAP_SERVERS_ENC_TYPE_SALTED_MD5 => 'Salted MD5',
-      LDAP_SERVERS_ENC_TYPE_SHA => 'SHA',
-      LDAP_SERVERS_ENC_TYPE_SALTED_SHA => 'SHA Salted',
-    );
-    */
-
-   /** $encrypts = array(
-      LDAP_SERVERS_ENC_TYPE_EXTENDED_DES => 'Extended DES',
-      LDAP_SERVERS_ENC_TYPE_BLOWFISH => 'Blowfish',
-      LDAP_SERVERS_ENC_TYPE_SALTED_CRYPT => 'Salted Crypt',
-    ); */
-
-    $encrypts = array(
-      LDAP_SERVERS_ENC_TYPE_CLEARTEXT => 'No Encryption'
-    );
-    if (function_exists('mcrypt_module_open')) {
-      $encrypts[LDAP_SERVERS_ENC_TYPE_BLOWFISH] = 'Blowfish';
-    }
-
-  }
-
- // $hashes[LDAP_SERVERS_ENC_TYPE_MD5] = 'MD5';
-//  $encrypts[LDAP_SERVERS_ENC_TYPE_CRYPT] = 'Crypt';
-
-  if ($type == 'encrypt') {
-    return $encrypts;
-  }
-
-  if ($type == 'hash') {
-    return $hashes;
+  if (extension_loaded('openssl')) {
+    $options[LDAP_SERVERS_ENC_TYPE_OPENSSL] = 'OpenSSL';
   }
 
-  return array_merge($hashes, $encrypts);
-
-
+  return $options;
 }
+
 /**
- * Encrypt Password Method
+ * Encrypt string.
  *
- * @param string clear_txt
- *   Plaintext password.
+ * @param $input
+ *   Clear text.
+ * @param null $encryption_enabled
+ *   OpenSSL or clear text.
  *
  * @return string
- *   Encrypted text, formatted for use as an LDAP password.
- *
- * @link http://php.net/manual/en/function.mcrypt-generic-init.php
+ *   Plain or encrypted.
  */
-function _ldap_servers_encrypt_has_mcrypt_and_warn() {
-  if (!function_exists('mcrypt_module_open')) {
-    watchdog('ldap_servers', 'Encryption is set to blowfish, but mcrypt module in not installed', array(), WATCHDOG_ERROR);
-    return FALSE;
-  }
-  else {
-    return TRUE;
-  }
-}
+function _ldap_servers_encrypt($input, $encryption_enabled = NULL) {
 
-function _ldap_servers_encrypt($clear_txt, $enc_type = NULL) {
-
-  if (!$enc_type) {
-    $enc_type = variable_get('ldap_servers_encryption' , LDAP_SERVERS_ENC_TYPE_CLEARTEXT);
+  if (!$encryption_enabled) {
+    $encryption_enabled = variable_get('ldap_servers_encryption', LDAP_SERVERS_ENC_TYPE_CLEARTEXT);
   }
 
-  if ($enc_type == LDAP_SERVERS_ENC_TYPE_CLEARTEXT) {
-    return $clear_txt;
+  if ($encryption_enabled == LDAP_SERVERS_ENC_TYPE_CLEARTEXT) {
+    return $input;
   }
 
   $key = variable_get('ldap_servers_encrypt_key', drupal_get_hash_salt());
+  $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(LDAP_SERVERS_CYPHER_MODE));
+  $encrypted_data = openssl_encrypt($input, LDAP_SERVERS_CYPHER_MODE, $key, 0, $iv);
 
-  switch ($enc_type) {
-
-    case LDAP_SERVERS_ENC_TYPE_BLOWFISH: // Blowfish
-        // Open mcrypt module.
-      if (_ldap_servers_encrypt_has_mcrypt_and_warn()) {
-        $td = mcrypt_module_open('blowfish', '', LDAP_SERVERS_CYPHER_MODE, '');
-        // Determine maximum mycrypt key length.
-        $key_length = mcrypt_enc_get_key_size($td);
-        // Shorten key to allowed length.
-        $key = substr($key, 0, $key_length);
-        // Create the initialization vector.
-        $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
-        // Encrypt the text.
-        mcrypt_generic_init($td, $key, $iv);
-        $crypttext = mcrypt_generic($td, $clear_txt);
-        mcrypt_generic_deinit($td);
-        // Build the encrypted string.
-        $cipher_txt = $iv . $crypttext;
-        // Close the module.
-        mcrypt_module_close($td);
-      }
-      break;
-
-    default: // Cleartext
-      $cipher_txt = $clear_txt;
-  }
-
-  return base64_encode($cipher_txt);
+  return base64_encode($encrypted_data . '::' . $iv);
 }
 
 /**
- * Encrypt Decrypt Method
+ * Decrypt string.
  *
- * @param string $cipher_txt
- *   ciphered text.
+ * @param string $input
+ *   Clear text or encrypted text.
+ * @param null $encryption_enabled
+ *   OpenSSL or clear text.
  *
  * @return string
- *   clear text
- *
- * http://stackoverflow.com/questions/2448256/php-mcrypt-encrypting-decrypting-file
+ *   Clear text.
  */
+function _ldap_servers_decrypt($input, $encryption_enabled = NULL) {
 
-function _ldap_servers_decrypt($cipher_txt, $enc_type = NULL) {
-
-  $key = variable_get('ldap_servers_encrypt_key', drupal_get_hash_salt());
-  if (!$enc_type) {
-    $enc_type = variable_get('ldap_servers_encryption' , LDAP_SERVERS_ENC_TYPE_CLEARTEXT);
-  }
-  if ($enc_type == LDAP_SERVERS_ENC_TYPE_CLEARTEXT) {
-    return $cipher_txt;
+  if (!$encryption_enabled) {
+    $encryption_enabled = variable_get('ldap_servers_encryption', LDAP_SERVERS_ENC_TYPE_CLEARTEXT);
   }
 
-  $cipher_txt = base64_decode($cipher_txt);
-  switch ($enc_type) {
-
-    case LDAP_SERVERS_ENC_TYPE_BLOWFISH: // Blowfish
-      if (_ldap_servers_encrypt_has_mcrypt_and_warn()) {
-        $clear_txt = "";
-        // Open mcrypt module.
-        $td = mcrypt_module_open('blowfish', '', LDAP_SERVERS_CYPHER_MODE, '');
-        // Determine maximum mycrypt key length.
-        $key_length = mcrypt_enc_get_key_size($td);
-        // Shorten key to allowed length.
-        $key = substr($key, 0, $key_length);
-        // Determine the algorithm IV.
-        $ivsize = mcrypt_enc_get_iv_size($td);
-        // Process if the decoded cipher text is sufficient.
-        if (strlen($cipher_txt) > $ivsize) {
-          // Split apart IV and text.
-          $iv = substr($cipher_txt, 0, $ivsize);
-          $cipher_txt = substr($cipher_txt, $ivsize);
-          // If the IV exists, decrypt the text.
-          if ($iv) {
-            mcrypt_generic_init($td, $key, $iv);
-            $clear_txt = mdecrypt_generic($td, $cipher_txt);
-            mcrypt_generic_deinit($td);
-          }
-        }
-        // Close the module.
-        mcrypt_module_close($td);
-      }
-      break;
-
-    default: // Cleartext
-      $clear_txt = $cipher_txt;
+  if ($encryption_enabled == LDAP_SERVERS_ENC_TYPE_CLEARTEXT) {
+    return $input;
   }
-  return $clear_txt;
+
+  $key = variable_get('ldap_servers_encrypt_key', drupal_get_hash_salt());
+  list($encrypted_data, $iv) = explode('::', base64_decode($input), 2);
+  return openssl_decrypt($encrypted_data, LDAP_SERVERS_CYPHER_MODE, $key, 0, $iv);
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.functions.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.functions.inc
index 041a178d..b94bedf6 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.functions.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.functions.inc
@@ -2,28 +2,27 @@
 
 /**
  * @file
- * collection of functions that don't belong in server object
+ * Collection of functions that don't belong in server object.
  */
 
 /**
-  * Modify an LDAP Entry
-  *
-  * this has been depracated in favor or $ldap_server->modifyLdapEntry($dn, $attributes)
-  * which handles empty attributes better.
-  *
-  */
+ * Modify an LDAP Entry.
+ *
+ * This has been depracated in favor or $ldap_server->modifyLdapEntry($dn, $attributes)
+ * which handles empty attributes better.
+ */
 function ldap_user_modify($dn, $attributes, $ldap_server) {
   $result = ldap_modify($ldap_server->connection, $dn, $attributes);
   if (!$result) {
     $error = "LDAP Server ldap_modify(%dn) in ldap_user_modify() Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
-    $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
+    $tokens = ['%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))];
     watchdog('ldap_servers', $error, $tokens, WATCHDOG_ERROR);
   }
   return $result;
 }
 
 /**
- * Modify a password
+ * Modify a password.
  */
 function ldap_password_modify($userdn, $new_password, $ldap_server) {
 
@@ -34,12 +33,12 @@ function ldap_password_modify($userdn, $new_password, $ldap_server) {
     $new_pass .= "{$new_password{$i}}\000";
   }
 
-  $status = ldap_mod_replace($ldap_server->connection, $userdn, array('unicodePwd' => $new_pass));
+  $status = ldap_mod_replace($ldap_server->connection, $userdn, ['unicodePwd' => $new_pass]);
   if (!$status) {
     watchdog(
       'ldap_servers',
       'Error: password_modify() failed to modify ldap password w/ base DN "!dn"',
-      array('!dn' => $userdn),
+      ['!dn' => $userdn],
       WATCHDOG_ERROR
     );
   }
@@ -48,14 +47,15 @@ function ldap_password_modify($userdn, $new_password, $ldap_server) {
 }
 
 /**
- * Converts a password to the format that Active Directory supports (for the 
+ * Converts a password to the format that Active Directory supports (for the
  * purpose of changing or setting).  Note that AD needs the field to be called
  * unicodePwd (as opposed to userPassword)
- * 
+ *
  * @param string $password
- *    The password that is being formatted for Active Directory unicodePwd field
+ *   The password that is being formatted for Active Directory unicodePwd field.
+ *
  * @return string
- *    $password surrounded with quotes and in UTF-16LE encoding
+ *   $password surrounded with quotes and in UTF-16LE encoding
  */
 function ldap_servers_convert_password_for_active_directory_unicodePwd($password) {
   // This function can be called with $attributes['unicodePwd'] as an array.
@@ -65,28 +65,26 @@ function ldap_servers_convert_password_for_active_directory_unicodePwd($password
   else {
     // Presumably there is no use case for there being more than one password in
     // the $attributes array, hence it will be at index 0 and we return in kind.
-    return array(mb_convert_encoding("\"{$password[0]}\"", "UTF-16LE"));
+    return [mb_convert_encoding("\"{$password[0]}\"", "UTF-16LE")];
   }
 }
 
 /**
- *
- *  this attempts to find bad dns, but should only be used as warnings
+ * This attempts to find bad dns, but should only be used as warnings
  *  as the ldap spec allows for any old character to be escaped and ldap
  *  implementations may not follow the spec.
  *
- *  http://www.ietf.org/rfc/rfc2253.txt
- *
+ *  Http://www.ietf.org/rfc/rfc2253.txt.
  */
 function ldap_baddn($dn, $dn_name) {
-  $result = array();
+  $result = [];
   $valid_attr_name = '[_a-zA-Z\d\s]';
   $valid_attr_values = '[_\-a-zA-Z\d\s]';
   $regex = '/^(' . $valid_attr_name . '*\=' . $valid_attr_values . '*[,]{1})*(' . $valid_attr_name . '*\=' . $valid_attr_values . '*){1}$/';
   $match = (preg_match($regex, $dn)) ? TRUE : FALSE;
   $result['boolean'] = $match;
   if (!$match) {
-    $tokens = array('%dn' => htmlspecialchars($dn), '%dn_name' => $dn_name);
+    $tokens = ['%dn' => htmlspecialchars($dn), '%dn_name' => $dn_name];
     $result['text'] = t('Possible invalid format for:', $tokens)
     . '<em>' . $tokens['%dn'] . '</em>.<br/>  ' .
     t('The format may be correct for your ldap, but please double check.', $tokens);
@@ -95,23 +93,20 @@ function ldap_baddn($dn, $dn_name) {
 }
 
 /**
- *
- *  this attempts to find bad dns, but should only be used as warningswe
+ * This attempts to find bad dns, but should only be used as warningswe
  *  as the ldap spec allows for any old character to be escaped and ldap
  *  implementations may not follow the spec.
  *
- *  http://www.ietf.org/rfc/rfc2253.txt
- *
+ *  Http://www.ietf.org/rfc/rfc2253.txt.
  */
-
 function ldap_badattr($attr, $attr_name) {
-  $result = array();
+  $result = [];
   $valid_attr_name = '[_a-zA-Z\d\s]';
   $regex = '/^(' . $valid_attr_name . '){1,}$/';
   $match = (preg_match($regex, $attr)) ? TRUE : FALSE;
   $result['boolean'] = $match;
   if (!$match) {
-    $tokens = array('%attr' => htmlspecialchars($attr), '%attr_name' => $attr_name);
+    $tokens = ['%attr' => htmlspecialchars($attr), '%attr_name' => $attr_name];
     $result['text'] = t('Possible invalid format for %attr_name:', $tokens) . ' <code><em>' . $tokens['%attr']
       . '</em></code><br/>' . t('The format may be correct for your ldap, but please double check.', $tokens);
   }
@@ -119,13 +114,15 @@ function ldap_badattr($attr, $attr_name) {
 }
 
 /**
- * get array of required attributes for an ldap query
-
- * @param string $sid server id or ldap server object being used
- * @param string $direction LDAP_USER_PROV_DIRECTION_* constant
- * @param string $ldap_context
- * @param boolean $reset cache
+ * Get array of required attributes for an ldap query.
  *
+ * @param string $sid
+ *   server id or ldap server object being used.
+ * @param string $direction
+ *   LDAP_USER_PROV_DIRECTION_* constant.
+ * @param string $ldap_context
+ * @param bool $reset
+ *   cache.
  */
 function ldap_servers_attributes_needed($sid, $ldap_context = 'all', $reset = TRUE) {
 
@@ -133,13 +130,13 @@ function ldap_servers_attributes_needed($sid, $ldap_context = 'all', $reset = TR
   $sid = is_object($sid) ? $sid->sid : $sid;
   $static_cache_id = ($sid) ? $ldap_context . '__' . $sid : $ldap_context;
   if (!is_array($attributes)) {
-    $attributes = array();
+    $attributes = [];
   }
   if (!isset($attributes[$static_cache_id]) || $reset) {
-    $params = array(
+    $params = [
       'sid' => $sid,
       'ldap_context' => $ldap_context,
-    );
+    ];
     drupal_alter('ldap_attributes_needed', $attributes[$static_cache_id], $params);
   }
   $return = $attributes[$static_cache_id];
@@ -147,17 +144,22 @@ function ldap_servers_attributes_needed($sid, $ldap_context = 'all', $reset = TR
   return $return;
 }
 
-
 /**
- * function to massage (change case, escape, unescape) ldap attribute names
- * and values.  The primary purpose of this is to articulate and ensure consistency
- * across ldap modules.
+ * Function to massage (change case, escape, unescape) ldap attribute names
+ * and values.  The primary purpose of this is to articulate and ensure
+ * consistency across ldap modules.
+ *
+ * @param mixed $value
+ *   to be massaged.
+ * @param string $value_type
+ *   = 'attr_name' or 'attr_value;.
+ * @param enum $context
+ *   ...see LDAP_SERVER_MASSAGE_* constants
  *
- * @param mixed $value to be massaged
- * @param enum $value_type = 'attr_name' or 'attr_value;
- * @param enum $context...see LDAP_SERVER_MASSAGE_* constants
+ *   .e.g. ldap_server_massage_text($value, 'attr_value',
+ *   LDAP_SERVER_MASSAGE_QUERY_LDAP)
  *
- * .e.g. ldap_server_massage_text($value, 'attr_value', LDAP_SERVER_MASSAGE_QUERY_LDAP)
+ * @return array|mixed|string
  */
 function ldap_server_massage_text($value, $value_type, $context) {
 
@@ -187,15 +189,16 @@ function ldap_server_massage_text($value, $value_type, $context) {
       case LDAP_SERVER_MASSAGE_STORE_ARRAY:
       case LDAP_SERVER_MASSAGE_STORE_PROPERTY:
 
-      break;
+        break;
 
     }
   }
-  elseif ($value_type == 'attr_name') { // attr_name
+  // attr_name.
+  elseif ($value_type == 'attr_name') {
     switch ($context) {
 
       case LDAP_SERVER_MASSAGE_DISPLAY:
-      break;
+        break;
 
       case LDAP_SERVER_MASSAGE_TOKEN_REPLACE:
 
@@ -217,9 +220,9 @@ function ldap_server_massage_text($value, $value_type, $context) {
           }
         }
         else {
-         // neither scalar nor array $value
+          // Neither scalar nor array $value.
         }
-      break;
+        break;
 
     }
   }
@@ -228,214 +231,227 @@ function ldap_server_massage_text($value, $value_type, $context) {
 
 }
 
- /**
-    * from pear net_ldap2-2.0.11
-    *
-    * Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters.
-    *
-    * Any control characters with an ACII code < 32 as well as the characters with special meaning in
-    * LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a
-    * backslash followed by two hex digits representing the hexadecimal value of the character.
-    *
-    * @param array $values Array of values to escape
-    *
-    * @static
-    * @return array Array $values, but escaped
-    */
-    function ldap_pear_escape_filter_value($values = array()) {
-        // Parameter validation
-        $is_scalar = is_scalar($values);
-        if ($is_scalar) {
-            $values = array($values);
-        }
-        if ($values === NULL) {
-          return NULL;
-        }
-
-       foreach ($values as $key => $val) {
-            // Escaping of filter meta characters
-            $val = str_replace('\\', '\5c', $val);
-            $val = str_replace('*', '\2a', $val);
-            $val = str_replace('(', '\28', $val);
-            $val = str_replace(')', '\29', $val);
+/**
+ * From pear net_ldap2-2.0.11.
+ *
+ * Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters.
+ *
+ * Any control characters with an ACII code < 32 as well as the characters with special meaning in
+ * LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a
+ * backslash followed by two hex digits representing the hexadecimal value of the character.
+ *
+ * @param array $values
+ *   Array of values to escape.
+ *
+ * @static
+ *
+ * @return array Array $values, but escaped
+ */
+function ldap_pear_escape_filter_value($values = []) {
+  // Parameter validation.
+  $is_scalar = is_scalar($values);
+  if ($is_scalar) {
+    $values = [$values];
+  }
+  if ($values === NULL) {
+    return NULL;
+  }
 
-            // ASCII < 32 escaping
-            $val = ldap_pear_asc2hex32($val);
+  foreach ($values as $key => $val) {
+    // Escaping of filter meta characters.
+    $val = str_replace('\\', '\5c', $val);
+    $val = str_replace('*', '\2a', $val);
+    $val = str_replace('(', '\28', $val);
+    $val = str_replace(')', '\29', $val);
 
-            if (null === $val) {
-              $val = '\0';
-            }  // apply escaped "null" if string is empty
+    // ASCII < 32 escaping.
+    $val = ldap_pear_asc2hex32($val);
 
-            $values[$key] = $val;
-       }
+    if (NULL === $val) {
+      $val = '\0';
+    }  // apply escaped "null" if string is empty
 
-        return ($is_scalar) ? $values[0] : $values;
-    }
+    $values[$key] = $val;
+  }
 
-    /**
-    * Undoes the conversion done by {@link escape_filter_value()}.
-    *
-    * Converts any sequences of a backslash followed by two hex digits into the corresponding character.
-    *
-    * @param array $values Array of values to escape
-    *
-    * @static
-    * @return array Array $values, but unescaped
-    */
-    function ldap_pear_unescape_filter_value($values = array()) {
-        // Parameter validation
-        $is_scalar = is_scalar($values);
-        if (!is_array($values)) {
-            $values = array($values);
-        }
+  return ($is_scalar) ? $values[0] : $values;
+}
 
-        foreach ($values as $key => $value) {
-            // Translate hex code into ascii
-            $values[$key] = ldap_pear_hex2asc($value);
-        }
+/**
+ * Undoes the conversion done by {@link escape_filter_value()}.
+ *
+ * Converts any sequences of a backslash followed by two hex digits into the corresponding character.
+ *
+ * @param array $values
+ *   Array of values to escape.
+ *
+ * @static
+ *
+ * @return array Array $values, but unescaped
+ */
+function ldap_pear_unescape_filter_value($values = []) {
+  // Parameter validation.
+  $is_scalar = is_scalar($values);
+  if (!is_array($values)) {
+    $values = [$values];
+  }
 
-        return ($is_scalar) ? $values[0] : $values;
-    }
+  foreach ($values as $key => $value) {
+    // Translate hex code into ascii.
+    $values[$key] = ldap_pear_hex2asc($value);
+  }
 
+  return ($is_scalar) ? $values[0] : $values;
+}
 
- /**
-    * Escapes a DN value according to RFC 2253
-    *
-    * Escapes the given VALUES according to RFC 2253 so that they can be safely used in LDAP DNs.
-    * The characters ",", "+", """, "\", "<", ">", ";", "#", "=" with a special meaning in RFC 2252
-    * are preceeded by ba backslash. Control characters with an ASCII code < 32 are represented as \hexpair.
-    * Finally all leading and trailing spaces are converted to sequences of \20.
-    *
-    * @param array $values An array containing the DN values that should be escaped
-    *
-    * @static
-    * @return array The array $values, but escaped
-    */
-    function ldap_pear_escape_dn_value($values = array()) {
-        // Parameter validation
-        $is_scalar = is_scalar($values);
-
-        if (!is_array($values)) {
-            $values = array($values);
-        }
+/**
+ * Escapes a DN value according to RFC 2253.
+ *
+ * Escapes the given VALUES according to RFC 2253 so that they can be safely used in LDAP DNs.
+ * The characters ",", "+", """, "\", "<", ">", ";", "#", "=" with a special meaning in RFC 2252
+ * are preceeded by ba backslash. Control characters with an ASCII code < 32 are represented as \hexpair.
+ * Finally all leading and trailing spaces are converted to sequences of \20.
+ *
+ * @param array $values
+ *   An array containing the DN values that should be escaped.
+ *
+ * @static
+ *
+ * @return array The array $values, but escaped
+ */
+function ldap_pear_escape_dn_value($values = []) {
+  // Parameter validation.
+  $is_scalar = is_scalar($values);
 
-        foreach ($values as $key => $val) {
-            // Escaping of filter meta characters
-            $val = str_replace('\\', '\\\\', $val);
-            $val = str_replace(',', '\,', $val);
-            $val = str_replace('+', '\+', $val);
-            $val = str_replace('"', '\"', $val);
-            $val = str_replace('<', '\<', $val);
-            $val = str_replace('>', '\>', $val);
-            $val = str_replace(';', '\;', $val);
-            $val = str_replace('#', '\#', $val);
-            $val = str_replace('=', '\=', $val);
-
-            // ASCII < 32 escaping
-            $val = ldap_pear_asc2hex32($val);
-
-            // Convert all leading and trailing spaces to sequences of \20.
-            if (preg_match('/^(\s*)(.+?)(\s*)$/', $val, $matches)) {
-                $val = $matches[2];
-                for ($i = 0; $i < strlen($matches[1]); $i++) {
-                    $val = '\20' . $val;
-                }
-                for ($i = 0; $i < strlen($matches[3]); $i++) {
-                    $val = $val . '\20';
-                }
-            }
-
-            if (null === $val) $val = '\0';  // apply escaped "null" if string is empty
-
-            $values[$key] = $val;
-        }
+  if (!is_array($values)) {
+    $values = [$values];
+  }
 
-        return ($is_scalar) ? $values[0] : $values;
+  foreach ($values as $key => $val) {
+    // Escaping of filter meta characters.
+    $val = str_replace('\\', '\\\\', $val);
+    $val = str_replace(',', '\,', $val);
+    $val = str_replace('+', '\+', $val);
+    $val = str_replace('"', '\"', $val);
+    $val = str_replace('<', '\<', $val);
+    $val = str_replace('>', '\>', $val);
+    $val = str_replace(';', '\;', $val);
+    $val = str_replace('#', '\#', $val);
+    $val = str_replace('=', '\=', $val);
+
+    // ASCII < 32 escaping.
+    $val = ldap_pear_asc2hex32($val);
+
+    // Convert all leading and trailing spaces to sequences of \20.
+    if (preg_match('/^(\s*)(.+?)(\s*)$/', $val, $matches)) {
+      $val = $matches[2];
+      for ($i = 0; $i < strlen($matches[1]); $i++) {
+        $val = '\20' . $val;
+      }
+      for ($i = 0; $i < strlen($matches[3]); $i++) {
+        $val = $val . '\20';
+      }
     }
 
-    /**
-    * Undoes the conversion done by escape_dn_value().
-    *
-    * Any escape sequence starting with a baskslash - hexpair or special character -
-    * will be transformed back to the corresponding character.
-    *
-    * @param array $values Array of DN Values
-    *
-    * @return array Same as $values, but unescaped
-    * @static
-    */
-    function ldap_pear_unescape_dn_value($values = array()) {
-      $is_scalar = is_scalar($values);
-
-        // Parameter validation
-        if (!is_array($values)) {
-            $values = array($values);
-        }
+    // Apply escaped "null" if string is empty.
+    if (NULL === $val) {
+      $val = '\0';
+    }
 
-        foreach ($values as $key => $val) {
-            // strip slashes from special chars
-            $val = str_replace('\\\\', '\\', $val);
-            $val = str_replace('\,', ',', $val);
-            $val = str_replace('\+', '+', $val);
-            $val = str_replace('\"', '"', $val);
-            $val = str_replace('\<', '<', $val);
-            $val = str_replace('\>', '>', $val);
-            $val = str_replace('\;', ';', $val);
-            $val = str_replace('\#', '#', $val);
-            $val = str_replace('\=', '=', $val);
-
-            // Translate hex code into ascii
-            $values[$key] = ldap_pear_hex2asc($val);
-        }
+    $values[$key] = $val;
+  }
 
-      return ($is_scalar) ? $values[0] : $values;
-    }
+  return ($is_scalar) ? $values[0] : $values;
+}
 
+/**
+ * Undoes the conversion done by escape_dn_value().
+ *
+ * Any escape sequence starting with a baskslash - hexpair or special character -
+ * will be transformed back to the corresponding character.
+ *
+ * @param array $values
+ *   Array of DN Values.
+ *
+ * @return array Same as $values, but unescaped
+ *
+ * @static
+ */
+function ldap_pear_unescape_dn_value($values = []) {
+  $is_scalar = is_scalar($values);
 
+  // Parameter validation.
+  if (!is_array($values)) {
+    $values = [$values];
+  }
 
-    /**
-    * Converts all Hex expressions ("\HEX") to their original ASCII characters
-    *
-    * @param string $string String to convert
-    *
-    * @static
-    * @author beni@php.net, heavily based on work from DavidSmith@byu.net
-    * @return string
-    */
+  foreach ($values as $key => $val) {
+    // Strip slashes from special chars.
+    $val = str_replace('\\\\', '\\', $val);
+    $val = str_replace('\,', ',', $val);
+    $val = str_replace('\+', '+', $val);
+    $val = str_replace('\"', '"', $val);
+    $val = str_replace('\<', '<', $val);
+    $val = str_replace('\>', '>', $val);
+    $val = str_replace('\;', ';', $val);
+    $val = str_replace('\#', '#', $val);
+    $val = str_replace('\=', '=', $val);
+
+    // Translate hex code into ascii.
+    $values[$key] = ldap_pear_hex2asc($val);
+  }
 
-    function ldap_pear_hex2asc($string) {
+  return ($is_scalar) ? $values[0] : $values;
+}
 
-      if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
-        $string = preg_replace_callback(
-          "/\\\([0-9A-Fa-f]{2})/",
-          function ($m){
-            return chr(hexdec($m[1]));
-          },
-          $string);
-      }
-      else {
-        $string = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $string);
-      }
+/**
+ * Converts all Hex expressions ("\HEX") to their original ASCII characters.
+ *
+ * @param string $string
+ *   String to convert.
+ *
+ * @static
+ * @author beni@php.net, heavily based on work from DavidSmith@byu.net
+ *
+ * @return string
+ */
+function ldap_pear_hex2asc($string) {
+
+  if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
+    $string = preg_replace_callback(
+    "/\\\([0-9A-Fa-f]{2})/",
+    function ($m) {
+      return chr(hexdec($m[1]));
+    },
+        $string);
+  }
+  else {
+    $string = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $string);
+  }
 
-      return $string;
-    }
+  return $string;
+}
 
-    /**
-    * Converts all ASCII chars < 32 to "\HEX"
-    *
-    * @param string $string String to convert
-    *
-    * @static
-    * @return string
-    */
-    function ldap_pear_asc2hex32($string) {
-        for ($i = 0; $i < strlen($string); $i++) {
-            $char = substr($string, $i, 1);
-            if (ord($char) < 32) {
-                $hex = dechex(ord($char));
-                if (strlen($hex) == 1) $hex = '0' . $hex;
-                $string = str_replace($char, '\\' . $hex, $string);
-            }
-        }
-        return $string;
+/**
+ * Converts all ASCII chars < 32 to "\HEX".
+ *
+ * @param string $string
+ *   String to convert.
+ *
+ * @static
+ *
+ * @return string
+ */
+function ldap_pear_asc2hex32($string) {
+  for ($i = 0; $i < strlen($string); $i++) {
+    $char = substr($string, $i, 1);
+    if (ord($char) < 32) {
+      $hex = dechex(ord($char));
+      if (strlen($hex) == 1) {
+        $hex = '0' . $hex;
+      }
+      $string = str_replace($char, '\\' . $hex, $string);
     }
+  }
+  return $string;
+}
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info
index 343fddda..a9617042 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info
@@ -18,8 +18,8 @@ files[] = ldap_servers.theme.inc
 files[] = tests/ldap_servers.test
 configure = admin/config/people/ldap/servers
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install
index 94b4a958..af9e32e0 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install
@@ -26,7 +26,7 @@ function ldap_servers_uninstall() {
  * Implements hook_requirements().
  */
 function ldap_servers_requirements($phase) {
-  $requirements = array();
+  $requirements = [];
   $t = get_t();
 
   if ($phase == 'install') {
@@ -54,15 +54,14 @@ function ldap_servers_requirements($phase) {
       LDAP Servers is not automatic.  LDAP Servers will need to be configured by hand.
       See http://drupal.org/node/1023016. This message will go away when the ldapauth database table is removed.');
   }
-  // check that ldapauth not installed.
-
+  // Check that ldapauth not installed.
   // Check enabled LDAP servers are configured and Drupal can connect to them.
   if ($phase == 'runtime') {
-    $requirements['ldap_servers_enabled'] = array(
+    $requirements['ldap_servers_enabled'] = [
       'title' => $t('LDAP Server status'),
       'value' => $t('Disabled'),
       'severity' => REQUIREMENT_WARNING,
-    );
+    ];
 
     $servers = ldap_servers_get_servers(NULL, 'enabled');
     if (!empty($servers)) {
@@ -70,15 +69,15 @@ function ldap_servers_requirements($phase) {
 
       foreach ($servers as $server) {
         $server_req_key = 'ldap_servers_sid_' . $server->sid;
-        $server_tokens = array(
+        $server_tokens = [
           '@host' => $server->address,
           '@sid' => $server->sid,
-        );
-        $requirements[$server_req_key] = array(
+        ];
+        $requirements[$server_req_key] = [
           'title' => $t('LDAP Server status: @sid (@host)', $server_tokens),
           'value' => $t('Connection: Failed, check logs for details.', $server_tokens),
           'severity' => REQUIREMENT_ERROR,
-        );
+        ];
 
         try {
           $connect_result = $server->connect();
@@ -88,7 +87,8 @@ function ldap_servers_requirements($phase) {
               // The user has already logged in and so their is no dn or password
               // to check since LDAP doesn't store passwords.
               $bind_result = $server->bind(NULL, NULL, TRUE);
-            } else {
+            }
+            else {
               $bind_result = $server->bind();
             }
             if ($bind_result == LDAP_SUCCESS) {
@@ -112,25 +112,26 @@ function ldap_servers_requirements($phase) {
  */
 function ldap_servers_schema() {
   module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
-  module_load_include('module', 'ldap_servers', 'ldap_servers'); // to get the LDAP_SERVERS_ENC_TYPE_CLEARTEXT constants issue#1209576
+  // To get the LDAP_SERVERS_ENC_TYPE_CLEARTEXT constants issue#1209576.
+  module_load_include('module', 'ldap_servers', 'ldap_servers');
   module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class');
 
-  $schema['ldap_servers'] = array(
-    'export' => array(
+  $schema['ldap_servers'] = [
+    'export' => [
       'key' => 'sid',
       'key name' => 'Server ID',
       'primary key' => 'numeric_sid',
       'identifier' => 'ldap_servers_conf',
-      'api' => array(
+      'api' => [
         'owner' => 'ldap_servers',
         'api' => 'ldap_servers',
         'minimum_version' => 1,
         'current_version' => 1,
-        ),
-      ),
-    'primary key' => array('numeric_sid'),
-    'unique keys' => array('name' => array('name')),
-  );
+      ],
+    ],
+    'primary key' => ['numeric_sid'],
+    'unique keys' => ['name' => ['name']],
+  ];
 
   $fields = LdapServerAdmin::fields();
   foreach ($fields as $name => $props) {
@@ -144,16 +145,15 @@ function ldap_servers_schema() {
 }
 
 /**
- * rename ldap_servers type field to ldap_type
+ * Rename ldap_servers type field to ldap_type.
  */
-
 function ldap_servers_update_7100() {
   if (!ldap_servers_db_field_exists('ldap_servers', 'ldap_type') && ldap_servers_db_field_exists('ldap_servers', 'type')) {
-    db_change_field('ldap_servers', 'type', 'ldap_type', array(
+    db_change_field('ldap_servers', 'type', 'ldap_type', [
       'type' => 'varchar',
       'length' => 20,
-      'not null' => FALSE
-    ));
+      'not null' => FALSE,
+    ]);
   }
 
   return t('ldap_servers table field "type" renamed to "ldap_type"');
@@ -161,70 +161,67 @@ function ldap_servers_update_7100() {
 }
 
 /**
- * ldap_server table field changes
+ * Ldap_server table field changes.
  */
-
 function ldap_servers_update_7101() {
 
   db_add_field(
     'ldap_servers',
     'allow_conflicting_drupal_accts',
-    array(
+    [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    )
+    ]
   );
 
   db_add_field(
     'ldap_servers',
     'unique_persistent_attr',
-    array(
+    [
       'type' => 'varchar',
       'length' => '64',
       'not null' => FALSE,
-    )
+    ]
   );
 
   db_add_field(
     'ldap_servers',
     'mail_template',
-    array(
+    [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    )
+    ]
   );
 
-  db_change_field('ldap_servers', 'ldap_to_drupal_user', 'ldap_to_drupal_user', array(
+  db_change_field('ldap_servers', 'ldap_to_drupal_user', 'ldap_to_drupal_user', [
     'type' => 'varchar',
     'length' => 1024,
-    'not null' => FALSE
-  ));
+    'not null' => FALSE,
+  ]);
 
-  db_change_field('ldap_servers', 'binddn', 'binddn', array(
+  db_change_field('ldap_servers', 'binddn', 'binddn', [
     'type' => 'varchar',
     'length' => 511,
-  ));
-
+  ]);
 
   return t('Updated LDAP Server to include "allow_conflicting_drupal_accts" and "unique_persistent_attr" fields.');
 }
 
-
 /**
- * add bind_method field to ldap_servers table
+ * Add bind_method field to ldap_servers table.
  */
 function ldap_servers_update_7102() {
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'bind_method')) {
-    db_add_field('ldap_servers', 'bind_method', array(
+    db_add_field('ldap_servers', 'bind_method', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => TRUE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"bind_method" field added to ldap_servers table');
   }
 
@@ -232,90 +229,85 @@ function ldap_servers_update_7102() {
 }
 
 /**
- * add group_object_category field to ldap_servers table
+ * Add group_object_category field to ldap_servers table.
  */
 function ldap_servers_update_7103() {
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'group_object_category')) {
-    db_add_field('ldap_servers', 'group_object_category', array(
+    db_add_field('ldap_servers', 'group_object_category', [
       'type' => 'varchar',
       'length' => 64,
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"group_object_category" field added to ldap_servers table');
   }
 
   return ($msg) ? $msg : t('No database changes made.');
 }
 
-
 /**
- * add pagination fields to ldap_servers table
+ * Add pagination fields to ldap_servers table.
  */
 function ldap_servers_update_7104() {
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'search_pagination')) {
-    db_add_field('ldap_servers', 'search_pagination', array(
+    db_add_field('ldap_servers', 'search_pagination', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"search_pagination" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'search_page_size')) {
-    db_add_field('ldap_servers', 'search_page_size', array(
+    db_add_field('ldap_servers', 'search_page_size', [
       'type' => 'int',
       'size' => 'medium',
       'not null' => FALSE,
       'default' => 1000,
-    ));
+    ]);
     $msg .= '<br/>' . t('"search_page_size" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'unique_persistent_attr_binary')) {
-    db_add_field('ldap_servers', 'unique_persistent_attr_binary', array(
+    db_add_field('ldap_servers', 'unique_persistent_attr_binary', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"unique_persistent_attr_binary" field added to ldap_servers table');
   }
 
-
-
   return ($msg) ? $msg : t('No database changes made.');
 }
 
 /**
- * enable ldap_user module
+ * Enable ldap_user module.
  */
 function ldap_servers_update_7105() {
 
   if (!module_exists('ldap_user')) {
-    module_enable(array('ldap_user'));
+    module_enable(['ldap_user']);
     $msg = t('LDAP User module enabled.  Some authentication and authorization functionality shifted to LDAP User module.');
   }
 
   return ($msg) ? $msg : t('LDAP User module was already enabled.  No action taken.');
 }
 
-
-
 /**
- * add account_name_attr field to ldap_servers table
+ * Add account_name_attr field to ldap_servers table.
  */
 function ldap_servers_update_7106() {
   if (!ldap_servers_db_field_exists('ldap_servers', 'account_name_attr')) {
-    db_add_field('ldap_servers', 'account_name_attr', array(
-    'description' => 'The attribute to be used as the account name if not the user_attr',
-    'type' => 'varchar',
-    'length' => 255,
-    'not null' => FALSE,
-    'default' => '',
-  ));
+    db_add_field('ldap_servers', 'account_name_attr', [
+      'description' => 'The attribute to be used as the account name if not the user_attr',
+      'type' => 'varchar',
+      'length' => 255,
+      'not null' => FALSE,
+      'default' => '',
+    ]);
     $msg = t('"account_name_attr" field added to ldap_servers table');
   }
 
@@ -323,7 +315,7 @@ function ldap_servers_update_7106() {
 }
 
 /**
- *  remove allow_conflicting_drupal_accts from ldap_servers table
+ * Remove allow_conflicting_drupal_accts from ldap_servers table.
  */
 function ldap_servers_update_7107() {
   if (ldap_servers_db_field_exists('ldap_servers', 'allow_conflicting_drupal_accts')) {
@@ -333,216 +325,216 @@ function ldap_servers_update_7107() {
   return ($msg) ? $msg : t('No database changes made.');
 }
 
-
-
+/**
+ *
+ */
 function ldap_servers_db_field_exists($table, $field_name) {
-  if (!db_field_exists($table, $field_name) && !db_field_exists($table, drupal_strtolower($field_name)) ) {
-    return false;
+  if (!db_field_exists($table, $field_name) && !db_field_exists($table, drupal_strtolower($field_name))) {
+    return FALSE;
   }
   else {
-    return true;
+    return TRUE;
   }
 }
+
 /**
- * add group related fields to ldap_servers table
+ * Add group related fields to ldap_servers table.
  */
 function ldap_servers_update_7108() {
 
-  foreach (array('groupFunctionalityUnused', 'groupNested', 'groupSearchAll', 'groupUserMembershipsAttrExists', 'groupDeriveFromDn', 'groupUserMembershipsAttrExists') as $tinyint_field_name) {
-    if (!ldap_servers_db_field_exists('ldap_servers', $tinyint_field_name))  {
-      db_add_field('ldap_servers', $tinyint_field_name, array(
+  foreach (['groupFunctionalityUnused', 'groupNested', 'groupSearchAll', 'groupUserMembershipsAttrExists', 'groupDeriveFromDn', 'groupUserMembershipsAttrExists'] as $tinyint_field_name) {
+    if (!ldap_servers_db_field_exists('ldap_servers', $tinyint_field_name)) {
+      db_add_field('ldap_servers', $tinyint_field_name, [
         'type' => 'int',
         'size' => 'tiny',
         'not null' => FALSE,
         'default' => 0,
-      ));
-      $msg = t('"!name" field added to ldap_servers table', array('!name' => $tinyint_field_name));
+      ]);
+      $msg = t('"!name" field added to ldap_servers table', ['!name' => $tinyint_field_name]);
     }
   }
-  foreach (array('groupUserMembershipsAttr', 'groupMembershipsAttr', 'groupTestGroupDn', 'groupUserMembershipsAttr', 'groupMembershipsAttrMatchingUserAttr') as $varchar255field_name) {
+  foreach (['groupUserMembershipsAttr', 'groupMembershipsAttr', 'groupTestGroupDn', 'groupUserMembershipsAttr', 'groupMembershipsAttrMatchingUserAttr'] as $varchar255field_name) {
     if (!ldap_servers_db_field_exists('ldap_servers', $varchar255field_name) && !ldap_servers_db_field_exists('ldap_servers', drupal_strtolower($varchar255field_name))) {
-      db_add_field('ldap_servers', $varchar255field_name, array(
+      db_add_field('ldap_servers', $varchar255field_name, [
         'type' => 'varchar',
         'length' => '255',
         'not null' => FALSE,
-      ));
-      $msg = t('"!name" field added to ldap_servers table', array('!name' => $varchar255field_name));
+      ]);
+      $msg = t('"!name" field added to ldap_servers table', ['!name' => $varchar255field_name]);
     }
   }
 }
 
-
 /**
- * adjust group related fields to ldap_servers table
+ * Adjust group related fields to ldap_servers table.
  */
 function ldap_servers_update_7109() {
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupNested')) {
-    db_add_field('ldap_servers', 'groupNested', array(
+    db_add_field('ldap_servers', 'groupNested', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"groupNested" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupUseFirstAttr')) {
-    db_add_field('ldap_servers', 'groupUseFirstAttr', array(
+    db_add_field('ldap_servers', 'groupUseFirstAttr', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    ));
+    ]);
     $msg .= '<br/>' . t('"groupUseFirstAttr" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupSearchAll')) {
-    db_add_field('ldap_servers', 'groupSearchAll', array(
+    db_add_field('ldap_servers', 'groupSearchAll', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"groupSearchAll" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupUserMembershipsAttrExists')) {
-    db_add_field('ldap_servers', 'groupUserMembershipsAttrExists', array(
+    db_add_field('ldap_servers', 'groupUserMembershipsAttrExists', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"groupUserMembershipsAttrExists" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupUserMembershipsAttr')) {
-    db_add_field('ldap_servers', 'groupUserMembershipsAttr', array(
+    db_add_field('ldap_servers', 'groupUserMembershipsAttr', [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"groupUserMembershipsAttr" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupMembershipsAttr')) {
-    db_add_field('ldap_servers', 'groupMembershipsAttr', array(
+    db_add_field('ldap_servers', 'groupMembershipsAttr', [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"groupMembershipsAttr" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupMembershipsAttrMatchingUserAttr')) {
-    db_add_field('ldap_servers', 'groupMembershipsAttrMatchingUserAttr', array(
+    db_add_field('ldap_servers', 'groupMembershipsAttrMatchingUserAttr', [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"groupMembershipsAttrMatchingUserAttr" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupUserMembershipsAttrExists')) {
-    db_add_field('ldap_servers', 'groupUserMembershipsAttrExists', array(
+    db_add_field('ldap_servers', 'groupUserMembershipsAttrExists', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"groupUserMembershipsAttrExists" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupUserMembershipsAttr')) {
-    db_add_field('ldap_servers', 'groupUserMembershipsAttr', array(
+    db_add_field('ldap_servers', 'groupUserMembershipsAttr', [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"groupUserMembershipsAttr" field added to ldap_servers table');
   }
 
 }
 
 /**
- * adjust group related fields to ldap_servers table
+ * Adjust group related fields to ldap_servers table.
  */
 function ldap_servers_update_7110() {
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupFunctionalityUnused')) {
-    db_add_field('ldap_servers', 'groupFunctionalityUnused', array(
+    db_add_field('ldap_servers', 'groupFunctionalityUnused', [
       'type' => 'int',
       'size' => 'tiny',
       'not null' => FALSE,
       'default' => 0,
-    ));
+    ]);
     $msg = t('"groupFunctionalityUnused" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupTestGroupDn')) {
-    db_add_field('ldap_servers', 'groupTestGroupDn', array(
+    db_add_field('ldap_servers', 'groupTestGroupDn', [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"groupTestGroupDn" field added to ldap_servers table');
   }
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupTestGroupDnWriteable')) {
-    db_add_field('ldap_servers', 'groupTestGroupDnWriteable', array(
+    db_add_field('ldap_servers', 'groupTestGroupDnWriteable', [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"groupTestGroupDnWriteable" field added to ldap_servers table');
   }
 
 }
 
 /**
- * add field groupTestGroupDnWriteable to ldap_servers table
+ * Add field groupTestGroupDnWriteable to ldap_servers table.
  */
 function ldap_servers_update_7111() {
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'groupTestGroupDnWriteable')) {
-    db_add_field('ldap_servers', 'groupTestGroupDnWriteable', array(
+    db_add_field('ldap_servers', 'groupTestGroupDnWriteable', [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"groupTestGroupDnWriteable" field added to ldap_servers table');
   }
 
 }
 
 /**
- * add field testingDrupalUserDn to ldap_servers table
+ * Add field testingDrupalUserDn to ldap_servers table.
  */
 function ldap_servers_update_7112() {
 
   if (!ldap_servers_db_field_exists('ldap_servers', 'testingDrupalUserDn')) {
-    db_add_field('ldap_servers', 'testingDrupalUserDn', array(
+    db_add_field('ldap_servers', 'testingDrupalUserDn', [
       'type' => 'varchar',
       'length' => '255',
       'not null' => FALSE,
-    ));
+    ]);
     $msg = t('"testingDrupalUserDn" field added to ldap_servers table');
   }
 
 }
 
-
 /**
- * upgrade as much as feasible for 7.1 to 7.2 branch
+ * Upgrade as much as feasible for 7.1 to 7.2 branch.
  */
 function ldap_servers_update_7201() {
 
-  $change_log = array();
+  $change_log = [];
 
-  // 1. ldap_user is now required for ldap_authentication and ldap_authorization
+  // 1. ldap_user is now required for ldap_authentication and ldap_authorization.
   if (module_exists('ldap_authentication') || module_exists('ldap_authorization')) {
-    module_enable(array('ldap_user'), TRUE);
+    module_enable(['ldap_user'], TRUE);
     $change_log[] = t('LDAP User Module Enabled');
   }
 
@@ -592,8 +584,7 @@ function ldap_servers_update_7201() {
    *
    */
 
-
-  // 2.  add any missing fields from schema
+  // 2.  add any missing fields from schema.
   ldap_servers_install_update_schema(ldap_servers_schema(), $change_log);
   if (module_exists('ldap_authorization')) {
     ldap_servers_install_update_schema(ldap_authorization_schema(), $change_log);
@@ -602,9 +593,9 @@ function ldap_servers_update_7201() {
     ldap_servers_install_update_schema(ldap_query_schema(), $change_log);
   }
 
-  // 3.  move configuration data that has changed location within ldap modules
-  $field_changes = array();
-  $ldap_server_records = array();
+  // 3.  move configuration data that has changed location within ldap modules.
+  $field_changes = [];
+  $ldap_server_records = [];
   $select = db_select('ldap_servers')
     ->fields('ldap_servers')
     ->execute();
@@ -617,10 +608,10 @@ function ldap_servers_update_7201() {
     $select = db_select('ldap_authorization', 'authz')
       ->fields('authz')
       ->execute();
-    // pick best ldap authorization conf to use to configure ldap server
+    // Pick best ldap authorization conf to use to configure ldap server.
     $max_weight = -1;
     foreach ($select as $record) {
-      $weight = (int)($record->status) + (int)($record->consumer_type == 'drupal_role');
+      $weight = (int) ($record->status) + (int) ($record->consumer_type == 'drupal_role');
       if ($weight > $max_weight) {
         $max_weight = $weight;
         $ldap_authorization_record = $record;
@@ -640,8 +631,10 @@ function ldap_servers_update_7201() {
           $field_changes['ldap_servers'][$sid]['groupUserMembershipsAttr'] = $ldap_authorization_record->derive_from_attr_attr;
         }
         if ($ldap_authorization_record->derive_from_entry) {
-          $field_changes['ldap_servers'][$sid]['groupMembershipsAttr'] = $ldap_authorization_record->derive_from_entry_attr; // eg members
-          $field_changes['ldap_servers'][$sid]['groupMembershipsAttrMatchingUserAttr'] = $ldap_authorization_record->derive_from_entry_entries_attr; // eg dn
+          // Eg members.
+          $field_changes['ldap_servers'][$sid]['groupMembershipsAttr'] = $ldap_authorization_record->derive_from_entry_attr;
+          // Eg dn.
+          $field_changes['ldap_servers'][$sid]['groupMembershipsAttrMatchingUserAttr'] = $ldap_authorization_record->derive_from_entry_entries_attr;
         }
         if ($ldap_authorization_record->derive_from_entry_nested) {
           $field_changes['ldap_servers'][$sid]['groupNested'] = 1;
@@ -665,11 +658,11 @@ function ldap_servers_update_7201() {
         continue;
       }
       if (count($field_data)) {
-        $change_log[] = t("!table_name where !id_field_name = !id values updated", array(
+        $change_log[] = t("!table_name where !id_field_name = !id values updated", [
           '!table_name' => $table_name,
           '!id_field_name' => $id_field_name,
           '!id' => $id,
-          ));
+        ]);
         $num_updated = db_update($table_name)
           ->fields($field_data)
           ->condition($id_field_name, $id, '=')
@@ -678,8 +671,8 @@ function ldap_servers_update_7201() {
     }
   }
 
-  // 4.  remove ldap_authorization fields that are unused
-  $ldap_authorization_fields_to_remove = array(
+  // 4.  remove ldap_authorization fields that are unused.
+  $ldap_authorization_fields_to_remove = [
     'derive_from_dn',
     'derive_from_dn_attr',
     'derive_from_attr',
@@ -691,29 +684,27 @@ function ldap_servers_update_7201() {
     'derive_from_entry_search_all',
     'derive_from_entry_use_first_attr',
     'derive_from_attr_use_first_attr',
-  );
+  ];
 
   foreach ($ldap_authorization_fields_to_remove as $ldap_authorization_field) {
     db_drop_field('ldap_authorization', $ldap_authorization_field);
   }
-  $change_log[] = t("ldap_authorization table fields removed: !fields_removed", array('!fields_removed' => join(', ', $ldap_authorization_fields_to_remove)));
-
+  $change_log[] = t("ldap_authorization table fields removed: !fields_removed", ['!fields_removed' => join(', ', $ldap_authorization_fields_to_remove)]);
 
-  //5. ldap_authentication and ldap_user changes are in variables, not tables
-
-  $ldap_authentication_conf_data = variable_get('ldap_authentication_conf', array());
+  // 5. ldap_authentication and ldap_user changes are in variables, not tables.
+  $ldap_authentication_conf_data = variable_get('ldap_authentication_conf', []);
   if (!is_array($ldap_authentication_conf_data['sids'])) {
-    $ldap_authentication_conf_data['sids'] = array();
+    $ldap_authentication_conf_data['sids'] = [];
   }
 
-  $ldap_user_conf_data = variable_get('ldap_user_conf', array());
+  $ldap_user_conf_data = variable_get('ldap_user_conf', []);
 
   $ldap_authentication_sids = array_keys($ldap_authentication_conf_data['sids']);
   if (count($ldap_authentication_sids) == 1) {
     $ldap_user_conf_data['drupalAcctProvisionServer'] = $ldap_authentication_sids[0];
   }
 
-  // conflict log vs resolve moved from ldap_authentication to ldap_user
+  // Conflict log vs resolve moved from ldap_authentication to ldap_user.
   if (!empty($ldap_authentication_conf_data['authenticationMode'])) {
     if ($ldap_authentication_conf_data['loginConflictResolve'] == LDAP_AUTHENTICATION_CONFLICT_LOG) {
       $ldap_user_conf_data['userConflictResolve'] = LDAP_USER_CONFLICT_LOG;
@@ -731,7 +722,6 @@ function ldap_servers_update_7201() {
     $change_log[] = t('ldap_authentication_conf -> userConflictResolve set to') . LDAP_USER_CONFLICT_RESOLVE_DEFAULT;
   }
 
-
   if (isset($ldap_authentication_conf_data['acctCreation'])) {
     $ldap_user_conf_data['acctCreation'] = $ldap_authentication_conf_data['acctCreation'];
     $change_log[] = t('ldap_user_conf -> acctCreation set to value in ldap_authentication_conf -> acctCreation');
@@ -754,38 +744,38 @@ function ldap_servers_update_7201() {
   $summary = '<h2>' . t('Please check through all the LDAP module configuration pages.
     The update from 7.x-1.x to 7.x-2.x is not automatable!  The configuration pages
     must be read through and configured.') . '</h2>' .
-    theme('item_list', array(
+    theme('item_list', [
       'items' => $change_log,
       'type' => 'ul',
-      'title' => 'Changes in 7.x-1.x to 7.x-2.x update')
+      'title' => 'Changes in 7.x-1.x to 7.x-2.x update',
+    ]
     );
 
-  watchdog('ldap_servers', $summary, array(), WATCHDOG_INFO);
+  watchdog('ldap_servers', $summary, [], WATCHDOG_INFO);
   return $summary;
 
-
 }
 
 /**
- * make ldap_servers.bind_method field small int instead of tiny int for ctools bug
+ * Make ldap_servers.bind_method field small int instead of tiny int for ctools bug.
  */
 function ldap_servers_update_7202() {
 
-  db_change_field('ldap_servers', 'bind_method', 'bind_method', array(
+  db_change_field('ldap_servers', 'bind_method', 'bind_method', [
     'type' => 'int',
     'size' => 'small',
     'not null' => TRUE,
     'default' => 0,
-  ));
+  ]);
 
 }
 
 /**
- * make all schema field names lowercase in ldap server to deal with cronic case sensitivity issues
+ * Make all schema field names lowercase in ldap server to deal with cronic case sensitivity issues.
  */
 function ldap_servers_update_7203() {
   $schema = ldap_servers_schema();
-    $changes = array(
+  $changes = [
     'testingDrupalUserDn' => 'testing_drupal_user_dn',
     'group_object_category' => 'grp_object_cat',
     'groupFunctionalityUnused' => 'grp_unused',
@@ -797,8 +787,8 @@ function ldap_servers_update_7203() {
     'groupDeriveFromDn' => 'grp_derive_from_dn',
     'groupDeriveFromDnAttr' => 'grp_derive_from_dn_attr',
     'groupTestGroupDn' => 'grp_test_grp_dn',
-    'groupTestGroupDnWriteable' => 'grp_test_grp_dn_writeable'
-  );
+    'groupTestGroupDnWriteable' => 'grp_test_grp_dn_writeable',
+  ];
   foreach ($changes as $old_field_name => $new_field_name) {
     $field_schema = $schema['ldap_servers']['fields'][$new_field_name];
     if (ldap_servers_db_field_exists('ldap_servers', $old_field_name)) {
@@ -814,25 +804,24 @@ function ldap_servers_update_7203() {
 }
 
 /**
- * Add picture_attr field in schema
+ * Add picture_attr field in schema.
  */
 function ldap_servers_update_7204() {
   if (!ldap_servers_db_field_exists('ldap_servers', 'picture_attr')) {
     db_add_field(
       'ldap_servers',
       'picture_attr',
-      array(
+      [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
-      )
+      ]
     );
   }
 }
 
-
 /**
- * fix any double serialized ldap server basedns
+ * Fix any double serialized ldap server basedns.
  */
 function ldap_servers_update_7205() {
 
@@ -840,7 +829,7 @@ function ldap_servers_update_7205() {
   $ldap_servers = ldap_servers_get_servers();
   foreach ($ldap_servers as $sid => $ldap_server) {
     if ($ldap_server->basedn && is_scalar($ldap_server->basedn)) {
-      // these are still serialized after being loaded from db/ctools so were double serialized
+      // These are still serialized after being loaded from db/ctools so were double serialized.
       $ldap_server->basedn = unserialize($ldap_server->basedn);
       $ldap_server->save();
     }
@@ -848,21 +837,20 @@ function ldap_servers_update_7205() {
 
 }
 
-
 /**
- * Add LDAP Referrals fields in schema
+ * Add LDAP Referrals fields in schema.
  */
 function ldap_servers_update_7206() {
   if (!ldap_servers_db_field_exists('ldap_servers', 'followrefs')) {
     db_add_field(
       'ldap_servers',
       'followrefs',
-      array(
+      [
         'type' => 'int',
         'size' => 'tiny',
         'not null' => FALSE,
         'default' => 0,
-      )
+      ]
     );
   }
 }
@@ -871,10 +859,10 @@ function ldap_servers_update_7206() {
  * Fixes a typo in an LDAP variable name.
  */
 function ldap_servers_update_7207() {
-    if (!is_null($old_var = variable_get('ldap_servers_require_ssl_for_credentails'))) {
-      variable_set('ldap_servers_require_ssl_for_credentials', $old_var);
-      variable_del('ldap_servers_require_ssl_for_credentails');
-    }
+  if (!is_null($old_var = variable_get('ldap_servers_require_ssl_for_credentails'))) {
+    variable_set('ldap_servers_require_ssl_for_credentials', $old_var);
+    variable_del('ldap_servers_require_ssl_for_credentails');
+  }
 }
 
 /**
@@ -886,13 +874,29 @@ function ldap_servers_update_7208() {
 
 }
 
+/**
+ *
+ */
 function ldap_servers_install_update_schema($schema, &$change_log) {
   foreach ($schema as $table_name => $table_schema) {
     foreach ($table_schema['fields'] as $field_name => $field_schema) {
       if (!ldap_servers_db_field_exists($table_name, $field_name)) {
         db_add_field($table_name, $field_name, $field_schema);
-        $change_log[] = t("!field_name field added to !table_name table", array('!field_name' => $field_name, '!table_name' => $table_name));
+        $change_log[] = t("!field_name field added to !table_name table", ['!field_name' => $field_name, '!table_name' => $table_name]);
       }
     }
   }
 }
+
+/**
+ * Change mcrypt to openssl.
+ */
+function ldap_servers_update_7209() {
+  if (variable_get('ldap_servers_encryption') != LDAP_SERVERS_ENC_TYPE_CLEARTEXT) {
+    variable_set('ldap_servers_encryption', LDAP_SERVERS_ENC_TYPE_OPENSSL);
+    if (!extension_loaded('openssl')) {
+      watchdog('ldap', 'Warning: OpenSSL missing, no alternative for encryption.');
+    }
+    return t('Encryption backend has changed, please re-enter your service account credentials.');
+  }
+}
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module
index 71e925e0..a020e8b6 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module
@@ -17,7 +17,8 @@ define('LDAP_TEST_QUERY_CONTEXT', 999);
 define('LDAP_SERVERS_PROJECT_TAG', 'ldap');
 define('LDAP_SERVERS_MENU_BASE_PATH', 'admin/config/people/ldap');
 define('LDAP_SERVERS_INDEX_BASE_PATH', 'admin/config/people/ldap/servers');
-define('LDAP_SERVERS_MENU_BASE_PATH_PARTS', 4); // for argument offsets
+// For argument offsets.
+define('LDAP_SERVERS_MENU_BASE_PATH_PARTS', 4);
 define('LDAP_SERVERS_DRUPAL_HELP_URL', 'http://drupal.org/node/997082');
 
 define('LDAP_SERVERS_TOKEN_PRE', '[');
@@ -25,18 +26,9 @@ define('LDAP_SERVERS_TOKEN_POST', ']');
 define('LDAP_SERVERS_TOKEN_DEL', ':');
 define('LDAP_SERVERS_TOKEN_MODIFIER_DEL', ';');
 
-define('LDAP_SERVERS_ENC_TYPE_MD5', 1);
-define('LDAP_SERVERS_ENC_TYPE_CRYPT', 2);
-define('LDAP_SERVERS_ENC_TYPE_SALTED_CRYPT', 3);
-define('LDAP_SERVERS_ENC_TYPE_EXTENDED_DES', 4);
-define('LDAP_SERVERS_ENC_TYPE_MD5C', 5);
-define('LDAP_SERVERS_ENC_TYPE_BLOWFISH', 6);
-define('LDAP_SERVERS_ENC_TYPE_SALTED_MD5', 7);
-define('LDAP_SERVERS_ENC_TYPE_SHA', 8);
-define('LDAP_SERVERS_ENC_TYPE_SALTED_SHA', 9);
 define('LDAP_SERVERS_ENC_TYPE_CLEARTEXT', 10);
-
-define('LDAP_SERVERS_CYPHER_MODE', 'cfb');
+define('LDAP_SERVERS_ENC_TYPE_OPENSSL', 20);
+define('LDAP_SERVERS_CYPHER_MODE', 'aes-256-cbc');
 
 define('LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT', 1);
 define('LDAP_SERVERS_BIND_METHOD_USER', 2);
@@ -48,18 +40,28 @@ define('LDAP_SERVERS_DERIVE_GROUP_FROM_DN', 1);
 define('LDAP_SERVERS_DERIVE_GROUP_FROM_ATTRIBUTE', 2);
 define('LDAP_SERVERS_DERIVE_GROUP_FROM_ENTRY', 4);
 
-define('LDAP_SERVER_MASSAGE_DISPLAY', 1); //  ... value is being displayed in UI
-define('LDAP_SERVER_MASSAGE_TOKEN_REPLACE', 2); // ... value is about to be used to generate token (e.g. [...] to be replaced
-
-define('LDAP_SERVER_MASSAGE_QUERY_LDAP', 5); //  ...value is about to be used in ldap query
-define('LDAP_SERVER_MASSAGE_QUERY_DB', 6); //  ...value is about to be in an sql query
-define('LDAP_SERVER_MASSAGE_QUERY_ARRAY', 7); //  ...value is about to be found in array values
-define('LDAP_SERVER_MASSAGE_QUERY_PROPERTY', 8); //  ...value is about to be found in object property values
-
-define('LDAP_SERVER_MASSAGE_STORE_LDAP', 13); // ...value is about to be stored in ldap entry
-define('LDAP_SERVER_MASSAGE_STORE_DB', 14); // ...value is about to be stored in db
-define('LDAP_SERVER_MASSAGE_STORE_ARRAY', 15); // ...value is about to be stored in array
-define('LDAP_SERVER_MASSAGE_STORE_PROPERTY', 16); // ...value is about to be stored in object property
+// ... value is being displayed in UI.
+define('LDAP_SERVER_MASSAGE_DISPLAY', 1);
+// ... value is about to be used to generate token (e.g. [...] to be replaced.
+define('LDAP_SERVER_MASSAGE_TOKEN_REPLACE', 2);
+
+// ...value is about to be used in ldap query.
+define('LDAP_SERVER_MASSAGE_QUERY_LDAP', 5);
+// ...value is about to be in an sql query.
+define('LDAP_SERVER_MASSAGE_QUERY_DB', 6);
+// ...value is about to be found in array values.
+define('LDAP_SERVER_MASSAGE_QUERY_ARRAY', 7);
+// ...value is about to be found in object property values.
+define('LDAP_SERVER_MASSAGE_QUERY_PROPERTY', 8);
+
+// ...value is about to be stored in ldap entry.
+define('LDAP_SERVER_MASSAGE_STORE_LDAP', 13);
+// ...value is about to be stored in db.
+define('LDAP_SERVER_MASSAGE_STORE_DB', 14);
+// ...value is about to be stored in array.
+define('LDAP_SERVER_MASSAGE_STORE_ARRAY', 15);
+// ...value is about to be stored in object property.
+define('LDAP_SERVER_MASSAGE_STORE_PROPERTY', 16);
 
 define('LDAP_SERVER_GROUPS_RECURSE_DEPTH', 20);
 
@@ -74,10 +76,11 @@ define('LDAP_COMPARE_FALSE', 0x05);
 define('LDAP_COMPARE_TRUE', 0x06);
 define('LDAP_AUTH_METHOD_NOT_SUPPORTED', 0x07);
 define('LDAP_STRONG_AUTH_REQUIRED', 0x08);
-//NotusedinLDAPv3);
+
+// Not used in LDAPv3.
 define('LDAP_PARTIAL_RESULTS', 0x09);
 
-//Next5newinLDAPv3);
+// Next 5 new in LDAPv3.
 define('LDAP_REFERRAL', 0x0a);
 define('LDAP_ADMINLIMIT_EXCEEDED', 0x0b);
 define('LDAP_UNAVAILABLE_CRITICAL_EXTENSION', 0x0c);
@@ -97,8 +100,9 @@ define('LDAP_INVALID_DN_SYNTAX', 0x22);
 
 define('LDAP_IS_LEAF', 0x23);
 define('LDAP_ALIAS_DEREF_PROBLEM', 0x24);
-if ( ! defined('LDAP_DEREF_NEVER') )
+if (!defined('LDAP_DEREF_NEVER')) {
   define('LDAP_DEREF_NEVER', 0x25);
+}
 
 define('LDAP_INAPPROPRIATE_AUTH', 0x30);
 define('LDAP_INVALID_CREDENTIALS', 0x31);
@@ -118,11 +122,12 @@ define('LDAP_NOT_ALLOWED_ON_RDN', 0x43);
 define('LDAP_ALREADY_EXISTS', 0x44);
 define('LDAP_NO_OBJECT_CLASS_MODS', 0x45);
 define('LDAP_RESULTS_TOO_LARGE', 0x46);
-//NexttwoforLDAPv3);
+
+// Next two for LDAPv3.
 define('LDAP_AFFECTS_MULTIPLE_DSAS', 0x47);
 define('LDAP_OTHER', 0x50);
 
-//UsedbysomeAPIs);
+// Used by someAPIs.
 define('LDAP_SERVER_DOWN', 0x51);
 define('LDAP_LOCAL_ERROR', 0x52);
 define('LDAP_ENCODING_ERROR', 0x53);
@@ -134,7 +139,7 @@ define('LDAP_USER_CANCELLED', 0x58);
 define('LDAP_PARAM_ERROR', 0x59);
 define('LDAP_NO_MEMORY', 0x5a);
 
-//PreliminaryLDAPv3codes);
+// PreliminaryLDAPv3 codes.
 define('LDAP_CONNECT_ERROR', 0x5b);
 define('LDAP_NOT_SUPPORTED', 0x5c);
 define('LDAP_CONTROL_NOT_FOUND', 0x5d);
@@ -156,235 +161,239 @@ function ldap_servers_init() {
 }
 
 /**
- * Advertise the current ldap api version
+ * Advertise the current ldap api version.
  */
 function ldap_api_version() {
   return '2.0';
 }
 
+/**
+ *
+ */
 function ldap_servers_menu() {
   $menu_offset = 4;
 
-  $items['admin/config/people/ldap'] = array(
+  $items['admin/config/people/ldap'] = [
     'title' => 'LDAP Configuration',
     'description' => 'LDAP authentication, authorization, provisioning, etc.',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_servers_settings'),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_servers_settings'],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_servers.settings.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/settings'] = array(
+  $items['admin/config/people/ldap/settings'] = [
     'title' => '1. Settings',
     'weight' => -2,
     'type' => MENU_DEFAULT_LOCAL_TASK,
-  );
+  ];
 
-  $items['admin/config/people/ldap/servers'] = array(
+  $items['admin/config/people/ldap/servers'] = [
     'title' => '2. Servers',
     'page callback' => 'ldap_servers_edit_index',
     'weight' => -1,
     'type' => MENU_LOCAL_TASK,
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_servers.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/servers/list'] = array(
+  $items['admin/config/people/ldap/servers/list'] = [
     'title' => 'List',
     'type' => MENU_DEFAULT_LOCAL_TASK,
-  );
+  ];
 
-  $items['admin/config/people/ldap/servers/add'] = array(
+  $items['admin/config/people/ldap/servers/add'] = [
     'title' => 'Add LDAP Server Configuration',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_servers_admin_form', 'add'),
+    'page arguments' => ['ldap_servers_admin_form', 'add'],
     'type' => MENU_LOCAL_TASK + MENU_CONTEXT_INLINE,
     'weight' => 3,
-    'access arguments' => array('administer site configuration'),
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_servers.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/servers/edit/%'] = array(
+  $items['admin/config/people/ldap/servers/edit/%'] = [
     'title' => 'Edit LDAP Server Configuration',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_servers_admin_form', 'edit', $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_servers_admin_form', 'edit', $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_servers.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/servers/test/%'] = array(
+  $items['admin/config/people/ldap/servers/test/%'] = [
     'title' => 'Test LDAP Server Configuration',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_servers_test_form', $menu_offset + 1, $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_servers_test_form', $menu_offset + 1, $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_servers.test_form.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/servers/delete/%'] = array(
+  $items['admin/config/people/ldap/servers/delete/%'] = [
     'title' => 'Delete LDAP Server',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_servers_admin_delete', $menu_offset + 1, $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_servers_admin_delete', $menu_offset + 1, $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_servers.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/servers/enable/%'] = array(
+  $items['admin/config/people/ldap/servers/enable/%'] = [
     'title' => 'Enable LDAP Server',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_servers_admin_enable_disable', $menu_offset + 1, $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_servers_admin_enable_disable', $menu_offset + 1, $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_servers.admin.inc',
-  );
+  ];
 
-  $items['admin/config/people/ldap/servers/disable/%'] = array(
+  $items['admin/config/people/ldap/servers/disable/%'] = [
     'title' => 'Enable LDAP Server',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_servers_admin_enable_disable', $menu_offset + 1, $menu_offset + 2),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_servers_admin_enable_disable', $menu_offset + 1, $menu_offset + 2],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_servers.admin.inc',
-  );
+  ];
 
   return $items;
 }
 
-
 /**
  * Implements hook_theme().
  */
 function ldap_servers_theme() {
-  return array(
-    'ldap_servers_list' => array(
-      'variables' => array('ldap_servers' => NULL, 'actions' => TRUE, 'type' => 'table'),
+  return [
+    'ldap_servers_list' => [
+      'variables' => ['ldap_servers' => NULL, 'actions' => TRUE, 'type' => 'table'],
       'render element' => 'element',
-      'file' => 'ldap_servers.theme.inc'
-    ),
-    'ldap_servers_server' => array(
-      'variables' => array('ldap_server' => NULL, 'actions' => FALSE, 'type' => 'detail'),
+      'file' => 'ldap_servers.theme.inc',
+    ],
+    'ldap_servers_server' => [
+      'variables' => ['ldap_server' => NULL, 'actions' => FALSE, 'type' => 'detail'],
       'render element' => 'element',
-      'file' => 'ldap_servers.theme.inc'
-    ),
-    'ldap_server_token_table' => array(
-      'variables' => array('tokens' => array()),
+      'file' => 'ldap_servers.theme.inc',
+    ],
+    'ldap_server_token_table' => [
+      'variables' => ['tokens' => []],
       'render element' => 'element',
-      'file' => 'ldap_servers.theme.inc'
-    ),
-    'ldap_server_ldap_entry_table' => array(
-      'variables' => array('entry' => array()),
+      'file' => 'ldap_servers.theme.inc',
+    ],
+    'ldap_server_ldap_entry_table' => [
+      'variables' => ['entry' => []],
       'render element' => 'element',
-      'file' => 'ldap_servers.theme.inc'
-    ),
-  );
+      'file' => 'ldap_servers.theme.inc',
+    ],
+  ];
 }
 
+/**
+ * Implements hook_cron().
+ */
+function ldap_servers_cron() {
+  // If any modules implement hook_ldap_servers_user_cron().
+  // user entity query to find most recent 100 entries that have not been processed
+  // query for these and pass to modules implementing hook_ldap_server_maintenance()
+  // update user field to have current date as date most recently checked.
+}
 
-  /**
-    * Implements hook_cron().
-    */
-  function ldap_servers_cron() {
-    // if any modules implement hook_ldap_servers_user_cron().
-    // user entity query to find most recent 100 entries that have not been processed
-    // query for these and pass to modules implementing hook_ldap_server_maintenance()
-    // update user field to have current date as date most recently checked
+/**
+ * Get mixed case match from case insensitive search.
+ *
+ * @param string mixed case $key
+ * @param array mixed case $array
+ *
+ * @return string matching key in mixed case or FALSE
+ */
+function ldap_server_find_key($key, $array) {
+  $keys = array_combine(array_change_key_case($array), $array);
+  if (isset($keys[drupal_strtolower($key)])) {
+    return $keys[drupal_strtolower($key)];
   }
-
-  /** get mixed case match from case insensitive search
-   *
-   * @param string mixed case $key
-   * @param array mixed case $array
-   * @return string matching key in mixed case or FALSE
-   */
-  function ldap_server_find_key($key, $array) {
-    $keys = array_combine(array_change_key_case($array), $array);
-    if (isset($keys[drupal_strtolower($key)])) {
-      return $keys[drupal_strtolower($key)];
-    }
-    else {
-      return FALSE;
-    }
+  else {
+    return FALSE;
   }
+}
 
-  /**
-   * Implements hook_ldap_attributes_needed_alter().
-   */
-  function ldap_servers_ldap_attributes_needed_alter(&$attributes, $params) {
+/**
+ * Implements hook_ldap_attributes_needed_alter().
+ */
+function ldap_servers_ldap_attributes_needed_alter(&$attributes, $params) {
 
-    $attributes['dn'] = ldap_servers_set_attribute_map(@$attributes['dn'], 'ldap_dn'); // force this data type
+  // Force this data type.
+  $attributes['dn'] = ldap_servers_set_attribute_map(@$attributes['dn'], 'ldap_dn');
 
-    if ($params['sid'] && $params['sid']) { // puid attributes are server specific
-      if (is_scalar($params['sid'])) {
-        $ldap_server = ldap_servers_get_servers($params['sid'], 'enabled', TRUE);
-      }
-      else {
-        $ldap_server = $params['sid'];
-      }
-      // mail, unique_persistent_attr, user_attr, mail_template, and user_dn_expression are needed for all functionality
-      if (!isset($attributes[$ldap_server->mail_attr])) {
-        $attributes[$ldap_server->mail_attr] = ldap_servers_set_attribute_map();
-      }
-      if ($ldap_server->picture_attr && !isset($attributes[$ldap_server->picture_attr])) {
-        $attributes[$ldap_server->picture_attr] = ldap_servers_set_attribute_map();
-      }
-      if ($ldap_server->unique_persistent_attr && !isset($attributes[$ldap_server->unique_persistent_attr])) {
-        $attributes[$ldap_server->unique_persistent_attr] = ldap_servers_set_attribute_map();
-      }
-      if ($ldap_server->groupUserMembershipsAttr && !isset($attributes[$ldap_server->groupUserMembershipsAttr])) {
-        $attributes[$ldap_server->groupUserMembershipsAttr] = ldap_servers_set_attribute_map();
-      }
-      if ($ldap_server->user_dn_expression) {
-        ldap_servers_token_extract_attributes($attributes, $ldap_server->user_dn_expression, TRUE);
-      }
-      if ($ldap_server->mail_template) {
-        ldap_servers_token_extract_attributes($attributes, $ldap_server->mail_template);
-      }
-      if (!isset($attributes[$ldap_server->user_attr])) {
-        $attributes[$ldap_server->user_attr] = ldap_servers_set_attribute_map();
-      }
+  // Puid attributes are server specific.
+  if ($params['sid'] && $params['sid']) {
+    if (is_scalar($params['sid'])) {
+      $ldap_server = ldap_servers_get_servers($params['sid'], 'enabled', TRUE);
+    }
+    else {
+      $ldap_server = $params['sid'];
+    }
+    // mail, unique_persistent_attr, user_attr, mail_template, and user_dn_expression are needed for all functionality.
+    if (!isset($attributes[$ldap_server->mail_attr])) {
+      $attributes[$ldap_server->mail_attr] = ldap_servers_set_attribute_map();
+    }
+    if ($ldap_server->picture_attr && !isset($attributes[$ldap_server->picture_attr])) {
+      $attributes[$ldap_server->picture_attr] = ldap_servers_set_attribute_map();
+    }
+    if ($ldap_server->unique_persistent_attr && !isset($attributes[$ldap_server->unique_persistent_attr])) {
+      $attributes[$ldap_server->unique_persistent_attr] = ldap_servers_set_attribute_map();
+    }
+    if ($ldap_server->groupUserMembershipsAttr && !isset($attributes[$ldap_server->groupUserMembershipsAttr])) {
+      $attributes[$ldap_server->groupUserMembershipsAttr] = ldap_servers_set_attribute_map();
+    }
+    if ($ldap_server->user_dn_expression) {
+      ldap_servers_token_extract_attributes($attributes, $ldap_server->user_dn_expression, TRUE);
+    }
+    if ($ldap_server->mail_template) {
+      ldap_servers_token_extract_attributes($attributes, $ldap_server->mail_template);
+    }
+    if (!isset($attributes[$ldap_server->user_attr])) {
+      $attributes[$ldap_server->user_attr] = ldap_servers_set_attribute_map();
     }
   }
-
+}
 
 /**
  * Implements hook_ldap_user_attrs_list_alter().
  */
-
 function ldap_servers_ldap_user_attrs_list_alter(&$available_user_attrs, &$params) {
 
   if (isset($params['ldap_server']) && $params['ldap_server']) {
     $ldap_server = $params['ldap_server'];
   }
   else {
-    return; // without a server id, ldap_servers module has nothing to offer
+    // Without a server id, ldap_servers module has nothing to offer.
+    return;
   }
-  $ldap_user_conf  = $params['ldap_user_conf'];
+  $ldap_user_conf = $params['ldap_user_conf'];
   $direction = $params['direction'];
 
-  $tokens = array(
+  $tokens = [
     '!edit_link' => l($ldap_server->editPath, $ldap_server->editPath),
     '!sid' => $ldap_server->sid,
-  );
+  ];
 
   $server_edit_path = 'admin/config/people/ldap/servers/edit/' . $ldap_server->sid;
 
   if ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
 
     /** these 4 user fields indentify where in ldap and which ldap server they are associated with.
-     they are required for a Drupal account to be "ldap associated" regardless of if any other
-     fields/properties are provisioned or synched
+     * they are required for a Drupal account to be "ldap associated" regardless of if any other
+     * fields/properties are provisioned or synched
     */
 
     if ($ldap_server->unique_persistent_attr) {
-      foreach (array(
+      foreach ([
         'field.ldap_user_puid_sid',
         'field.ldap_user_puid',
         'field.ldap_user_puid_property',
-        ) as $i => $property_id) {
+      ] as $i => $property_id) {
         $property_token = '[' . $property_id . ']';
         if (!isset($available_user_attrs[$property_token]) || !is_array($available_user_attrs[$property_token])) {
-          $available_user_attrs[$property_token] = array();
+          $available_user_attrs[$property_token] = [];
         }
       }
 
-      $available_user_attrs['[field.ldap_user_puid_sid]'] = array(
+      $available_user_attrs['[field.ldap_user_puid_sid]'] = [
         'name' => t('Field: sid providing PUID'),
         'configurable_to_drupal' => 0,
         'configurable_to_ldap' => 1,
@@ -392,12 +401,12 @@ function ldap_servers_ldap_user_attrs_list_alter(&$available_user_attrs, &$param
         'notes' => 'not configurable',
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
         'enabled' => TRUE,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER],
         'config_module' => 'ldap_servers',
         'prov_module' => 'ldap_user',
-      ) + $available_user_attrs['[field.ldap_user_puid_sid]'];
+      ] + $available_user_attrs['[field.ldap_user_puid_sid]'];
 
-      $available_user_attrs['[field.ldap_user_puid]'] = array(
+      $available_user_attrs['[field.ldap_user_puid]'] = [
         'name' => t('Field: PUID', $tokens),
         'configurable_to_drupal' => 0,
         'configurable_to_ldap' => 1,
@@ -406,13 +415,13 @@ function ldap_servers_ldap_user_attrs_list_alter(&$available_user_attrs, &$param
         'convert' => $ldap_server->unique_persistent_attr_binary,
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
         'enabled' => TRUE,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER],
         'config_module' => 'ldap_servers',
         'prov_module' => 'ldap_user',
-      ) + $available_user_attrs['[field.ldap_user_puid]'];
+      ] + $available_user_attrs['[field.ldap_user_puid]'];
 
       $available_user_attrs['[field.ldap_user_puid_property]'] =
-      array(
+      [
         'name' => t('Field: PUID Attribute', $tokens),
         'configurable_to_drupal' => 0,
         'configurable_to_ldap' => 1,
@@ -420,18 +429,18 @@ function ldap_servers_ldap_user_attrs_list_alter(&$available_user_attrs, &$param
         'notes' => 'configure at ' . $server_edit_path,
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
         'enabled' => TRUE,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER],
         'config_module' => 'ldap_servers',
         'prov_module' => 'ldap_user',
-      ) + $available_user_attrs['[field.ldap_user_puid_property]'];
+      ] + $available_user_attrs['[field.ldap_user_puid_property]'];
     }
 
     $token = '[field.ldap_user_current_dn]';
     if (!isset($available_user_attrs[$token]) || !is_array($available_user_attrs[$token])) {
-      $available_user_attrs[$token] = array();
+      $available_user_attrs[$token] = [];
     }
     $available_user_attrs[$token] =
-    array(
+    [
       'name' => t('Field: Most Recent DN', $tokens),
       'configurable_to_drupal' => 0,
       'configurable_to_ldap' => 0,
@@ -439,67 +448,66 @@ function ldap_servers_ldap_user_attrs_list_alter(&$available_user_attrs, &$param
       'notes' => 'not configurable',
       'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
       'enabled' => TRUE,
-      'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+      'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
       'config_module' => 'ldap_servers',
       'prov_module' => 'ldap_user',
-    ) + $available_user_attrs[$token];
+    ] + $available_user_attrs[$token];
 
     if ($ldap_user_conf->provisionsDrupalAccountsFromLdap) {
       if (!isset($available_user_attrs['[property.name]']) || !is_array($available_user_attrs['[property.name]'])) {
-        $available_user_attrs['[property.name]'] = array();
+        $available_user_attrs['[property.name]'] = [];
       }
-      $available_user_attrs['[property.name]'] = array(
+      $available_user_attrs['[property.name]'] = [
         'name' => 'Property: Username',
         'source' => '[' . $ldap_server->user_attr . ']',
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
         'enabled' => TRUE,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
         'config_module' => 'ldap_servers',
         'prov_module' => 'ldap_user',
-      ) + $available_user_attrs['[property.name]'];
+      ] + $available_user_attrs['[property.name]'];
 
       if (!isset($available_user_attrs['[property.mail]']) || !is_array($available_user_attrs['[property.mail]'])) {
-        $available_user_attrs['[property.mail]'] = array();
+        $available_user_attrs['[property.mail]'] = [];
       }
-      $available_user_attrs['[property.mail]'] = array(
+      $available_user_attrs['[property.mail]'] = [
         'name' => 'Property: Email',
         'source' => ($ldap_server->mail_template) ? $ldap_server->mail_template : '[' . $ldap_server->mail_attr . ']',
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
         'enabled' => TRUE,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
         'config_module' => 'ldap_servers',
         'prov_module' => 'ldap_user',
-      ) + $available_user_attrs['[property.mail]'];
+      ] + $available_user_attrs['[property.mail]'];
 
       if ($ldap_server->picture_attr) {
         if (!isset($available_user_attrs['[property.picture]']) || !is_array($available_user_attrs['[property.picture]'])) {
-          $available_user_attrs['[property.picture]'] = array();
+          $available_user_attrs['[property.picture]'] = [];
         }
-        $available_user_attrs['[property.picture]'] = array(
-            'name' => 'Property: Picture',
-            'source' => '[' . $ldap_server->picture_attr . ']',
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-            'enabled' => TRUE,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
-            'config_module' => 'ldap_servers',
-            'prov_module' => 'ldap_user',
-        ) + $available_user_attrs['[property.picture]'];
+        $available_user_attrs['[property.picture]'] = [
+          'name' => 'Property: Picture',
+          'source' => '[' . $ldap_server->picture_attr . ']',
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
+          'enabled' => TRUE,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
+          'config_module' => 'ldap_servers',
+          'prov_module' => 'ldap_user',
+        ] + $available_user_attrs['[property.picture]'];
       }
     }
   }
 }
 
 /**
- * flush server static cache
+ * Flush server static cache.
  */
-
 function ldap_servers_flush_server_cache() {
-  $discard = ldap_servers_get_servers(NULL, 'all', FALSE, TRUE); // flush server cache
+  // Flush server cache.
+  $discard = ldap_servers_get_servers(NULL, 'all', FALSE, TRUE);
 }
 
-
 /**
- * function to replace module_load_include such that when
+ * Function to replace module_load_include such that when
  * something is not included, drupal will exit instead
  * of attempting something half baked.
  */
@@ -512,15 +520,19 @@ function ldap_servers_module_load_include($type, $module, $name = NULL) {
 }
 
 /**
+ * Return ldap server conf objects.
  *
- * return ldap server conf objects
+ * @param string $sid
+ * @param string $type
+ *   All', 'enabled'.
+ * @param bool $flatten
+ *   signifies if array or single object returned.  Only works if sid is specified.
+ * @param bool $reset
+ *   do not use cached or static result.
  *
- * @param alphanum $sid
- * @param enum $type 'all', 'enabled',
- * @param boolean $flatten signifies if array or single object returned.  Only works if sid is specified
- * @param boolean $reset do not use cached or static result
- * @return - array of server conf object keyed on sid
- *         - single server conf object (if flatten == TRUE)
+ * @return array
+ *   Of server conf object keyed on sid
+ *   - single server conf object (if flatten == TRUE)
  */
 function ldap_servers_get_servers($sid = NULL, $type = NULL, $flatten = FALSE, $reset = FALSE) {
   if (variable_get('ldap_simpletest', FALSE)) {
@@ -531,23 +543,22 @@ function ldap_servers_get_servers($sid = NULL, $type = NULL, $flatten = FALSE, $
   }
 }
 
-
 /**
- * see ldap_servers_get_servers()
+ * See ldap_servers_get_servers()
  */
 function _ldap_servers_get_servers($sid, $type, $flatten, $reset) {
   ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class');
   static $servers;
   $type = ($type) ? $type : 'all';
   if ($reset) {
-    $servers = array();
+    $servers = [];
   }
   if (!isset($servers['all'])) {
     $servers['all'] = LdapServerAdmin::getLdapServerObjects('all', NULL, 'LdapServer', $reset);
   }
 
   if (!isset($servers['enabled'])) {
-    $servers['enabled'] = array();
+    $servers['enabled'] = [];
     foreach ($servers['all'] as $_sid => $ldap_server) {
       if ($ldap_server->status == 1) {
         $servers['enabled'][$_sid] = $ldap_server;
@@ -559,7 +570,7 @@ function _ldap_servers_get_servers($sid, $type, $flatten, $reset) {
     if (!isset($servers[$type][$sid])) {
       return FALSE;
     }
-    return ($flatten) ? $servers[$type][$sid] : array($sid => $servers[$type][$sid]);
+    return ($flatten) ? $servers[$type][$sid] : [$sid => $servers[$type][$sid]];
   }
 
   if (isset($servers[$type])) {
@@ -568,7 +579,7 @@ function _ldap_servers_get_servers($sid, $type, $flatten, $reset) {
 }
 
 /**
- * see ldap_servers_get_servers()
+ * See ldap_servers_get_servers()
  */
 function _ldap_servers_get_simpletest_servers($sid, $type = NULL, $flatten, $reset = TRUE) {
 
@@ -576,7 +587,9 @@ function _ldap_servers_get_simpletest_servers($sid, $type = NULL, $flatten, $res
     $type = 'all';
   }
 
-  //two flavors of mock servers exist.  ultimately v2 will be used in all simpletests
+  $servers = [];
+
+  // Two flavors of mock servers exist.  ultimately v2 will be used in all simpletests.
   if (variable_get('ldap_simpletest', 0) == 2) {
     ldap_servers_module_load_include('php', 'ldap_test', 'LdapServerTest.class');
     $servers['all'] = LdapServerTest::getLdapServerObjects(NULL, 'all', FALSE);
@@ -591,13 +604,17 @@ function _ldap_servers_get_simpletest_servers($sid, $type = NULL, $flatten, $res
     if (!isset($servers[$type][$sid])) {
       return FALSE;
     }
-    return ($flatten) ? $servers[$type][$sid] : array($sid => $servers[$type][$sid]);
+    return ($flatten) ? $servers[$type][$sid] : [$sid => $servers[$type][$sid]];
   }
 
   if (isset($servers[$type])) {
     return $servers[$type];
   }
 }
+
+/**
+ *
+ */
 function ldap_servers_debug($variable) {
   if (variable_get('ldap_simpletest', FALSE) && function_exists('dpm')) {
     dpm($variable);
@@ -606,6 +623,10 @@ function ldap_servers_debug($variable) {
     debug($variable);
   }
 }
+
+/**
+ *
+ */
 function ldap_servers_cache_clear() {
   $discard = ldap_servers_get_servers(NULL, 'all', FALSE, TRUE);
   if (module_exists('ctools')) {
@@ -614,25 +635,27 @@ function ldap_servers_cache_clear() {
 }
 
 /**
- * function to convert microsoft style guids to strings
+ * Function to convert microsoft style guids to strings.
  */
 function ldap_servers_msguid($value) {
 
   $hex_string = bin2hex($value);
   // (MS?) GUID are displayed with first three GUID parts as "big endian"
   // Doing this so String value matches what other LDAP tool displays for AD.
-  $value = strtoupper(substr( $hex_string, 6, 2) . substr( $hex_string, 4, 2) .
-  substr( $hex_string, 2, 2) . substr( $hex_string, 0, 2) . '-' .
-  substr( $hex_string, 10, 2) . substr( $hex_string, 8, 2) . '-' .
-  substr( $hex_string, 14, 2) . substr( $hex_string, 12, 2) . '-' .
-  substr( $hex_string, 16, 4) . '-' . substr( $hex_string, 20, 12));
+  $value = strtoupper(substr($hex_string, 6, 2) . substr($hex_string, 4, 2) .
+  substr($hex_string, 2, 2) . substr($hex_string, 0, 2) . '-' .
+  substr($hex_string, 10, 2) . substr($hex_string, 8, 2) . '-' .
+  substr($hex_string, 14, 2) . substr($hex_string, 12, 2) . '-' .
+  substr($hex_string, 16, 4) . '-' . substr($hex_string, 20, 12));
 
   return $value;
 }
 
- /**
- * Create a "binary safe" string for use in LDAP filters
+/**
+ * Create a "binary safe" string for use in LDAP filters.
+ *
  * @param $value
+ *
  * @return string
  */
 function ldap_servers_binary_filter($value) {
@@ -647,7 +670,7 @@ function ldap_servers_binary_filter($value) {
       substr($hex_string, 16, 4) . substr($hex_string, 20, 12);
   }
 
-  for ($i = 0; $i < strlen($value); $i = $i + 2 ) {
+  for ($i = 0; $i < strlen($value); $i = $i + 2) {
     $match .= '\\' . substr($value, $i, 2);
   }
 
@@ -655,9 +678,9 @@ function ldap_servers_binary_filter($value) {
 }
 
 /**
- * general binary conversion function for guids
+ * General binary conversion function for guids
  * tries to determine which approach based on length
- * of string
+ * of string.
  */
 function ldap_servers_binary($value) {
   if (strlen($value) == 16) {
@@ -670,14 +693,17 @@ function ldap_servers_binary($value) {
 }
 
 /**
- * @todo needs caching element.  several modules could potentially call this in the same
- * page request.
+ * @todo needs caching element.  several modules could potentially call this in
+ *   the same page request.
  *
- * @param std object $drupal_user is drupal $user object
- * @param string $sid is a server id
- * @param scalar $ldap_context
+ * @param object $drupal_user
+ *   is drupal $user object.
+ * @param string $sid
+ *   is a server id.
+ * @param mixed $ldap_context
+ *
+ * @return bool
  */
-
 function ldap_servers_get_user_ldap_data($drupal_user, $sid = NULL, $ldap_context = NULL) {
   if (is_object($drupal_user) && property_exists($drupal_user, 'uid') &&
       function_exists('ldap_user_get_authname') && ($authname = ldap_user_get_authname($drupal_user))) {
@@ -686,16 +712,16 @@ function ldap_servers_get_user_ldap_data($drupal_user, $sid = NULL, $ldap_contex
   else {
     $drupal_username = (is_object($drupal_user)) ? $drupal_user->name : $drupal_user;
   }
-  //Sometimes we have username instead of a drupal user object
-  //For example, when using LDAP user test form (admin/config/people/ldap/user/test)
-  //But we can still load the user by using $drupal_username  if $drupal_user is not an object
-  if ( !(is_object($drupal_user)) ) {
+  // Sometimes we have username instead of a drupal user object
+  // For example, when using LDAP user test form (admin/config/people/ldap/user/test)
+  // But we can still load the user by using $drupal_username  if $drupal_user is not an object.
+  if (!(is_object($drupal_user))) {
     $user_object = user_load_by_name($drupal_username);
     if (is_object($user_object) && property_exists($user_object, 'uid')) {
       $drupal_user = $user_object;
     }
   }
-  // if no explicit $sid, find most appropriate one
+  // If no explicit $sid, find most appropriate one.
   if (module_exists('ldap_user') && (!$sid || $sid == LDAP_USER_AUTH_SERVER_SID)) {
     if (property_exists($drupal_user, 'ldap_user_puid_sid') &&
         !empty($drupal_user->ldap_user_puid_sid[LANGUAGE_NONE][0]['value'])
@@ -719,7 +745,7 @@ function ldap_servers_get_user_ldap_data($drupal_user, $sid = NULL, $ldap_contex
   $ldap_server = ($sid) ? ldap_servers_get_servers($sid, 'enabled', TRUE) : FALSE;
 
   if ($ldap_server === FALSE) {
-    watchdog('ldap_servers', 'Failed to load server object %sid in _ldap_servers_get_user_ldap_data', array('%sid' => $sid), WATCHDOG_ERROR);
+    watchdog('ldap_servers', 'Failed to load server object %sid in _ldap_servers_get_user_ldap_data', ['%sid' => $sid], WATCHDOG_ERROR);
     return FALSE;
   }
 
@@ -736,9 +762,11 @@ function ldap_servers_get_user_ldap_data($drupal_user, $sid = NULL, $ldap_contex
 }
 
 /**
- * @param array $attribute_map for a given attribute in form array('values' => array(), 'data_type' => NULL) as outlined in ldap_user/README.developers.txt
- * @param enum string $conversion as type of conversion to do @see ldap_servers_convert_attribute().  e.g. base64_encode, bin2hex, msguid, md5
- * @param array $values in form array(<ordinal> => <value> | NULL) where NULL indicates value is needed for provisioning or other operations.
+ * @param array|null $attribute
+ * @param string $conversion
+ *   as type of conversion to do @see ldap_servers_convert_attribute().  e.g. base64_encode, bin2hex, msguid, md5.
+ * @param array $values
+ *   in form array(<ordinal> => <value> | NULL) where NULL indicates value is needed for provisioning or other operations.
  *
  * @return array $attribute_map with converted values.  If nothing passed in create empty array in proper structure.
  *   array('values' => array(
@@ -746,92 +774,114 @@ function ldap_servers_get_user_ldap_data($drupal_user, $sid = NULL, $ldap_contex
  *      1 => 'johnny'
  *      )
  *   );
- ))
+ *   ))
  */
-
 function ldap_servers_set_attribute_map($attribute = NULL, $conversion = NULL, $values = NULL) {
 
-  $attribute = (is_array($attribute)) ? $attribute : array();
+  $attribute = (is_array($attribute)) ? $attribute : [];
   $attribute['conversion'] = $conversion;
   if (!$values && (!isset($attribute['values']) || !is_array($attribute['values']))) {
-    $attribute['values'] = array(0 => NULL);
+    $attribute['values'] = [0 => NULL];
   }
-  elseif (is_array($values)) { //merge into array overwriting ordinals
+  // Merge into array overwriting ordinals.
+  elseif (is_array($values)) {
     foreach ($values as $ordinal => $value) {
       if ($conversion) {
         $value = ldap_servers_convert_attribute($value, $conversion);
       }
-      $attribute['values'][(int)$ordinal] = $value;
+      $attribute['values'][(int) $ordinal] = $value;
     }
   }
   return $attribute;
 }
 
 /**
- * @param string $value as value to be converted
- * @param string $conversion such as base64_encode, bin2hex, msguid, md5
+ * @param string $value
+ *   as value to be converted.
+ * @param string $conversion
+ *   such as base64_encode, bin2hex, msguid, md5.
  * @return converted $value
  */
 function ldap_servers_convert_attribute($value, $conversion = NULL) {
 
-      if ($conversion) {
+  if ($conversion) {
 
-        switch ($conversion) {
-          case 'base64_encode':
-            $value = base64_encode($value);
-            break;
+    switch ($conversion) {
+      case 'base64_encode':
+        $value = base64_encode($value);
+        break;
 
-          case 'bin2hex':
-            $value = bin2hex($value);
-            break;
+      case 'bin2hex':
+        $value = bin2hex($value);
+        break;
 
-          case 'msguid':
-            $value = ldap_servers_msguid($value);
-            break;
+      case 'msguid':
+        $value = ldap_servers_msguid($value);
+        break;
 
-          case 'binary':
-            $value = ldap_servers_binary($value);
-            break;
+      case 'binary':
+        $value = ldap_servers_binary($value);
+        break;
 
-          case 'md5':
-            $value = '{md5}' . base64_encode(pack('H*', md5($value)));
-            break;
-        }
+      case 'md5':
+        $value = '{md5}' . base64_encode(pack('H*', md5($value)));
+        break;
+    }
 
-      }
+  }
 
   return $value;
 }
 
+/**
+ *
+ */
 function ldap_servers_ldap_extension_summary($op = 'data') {
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.status');
   return _ldap_servers_ldap_extension_summary($op);
 }
 
+/**
+ *
+ */
 function ldap_servers_ldap_extension_loaded() {
   return extension_loaded('ldap');
 }
 
+/**
+ *
+ */
 function ldap_servers_encrypt($text, $encryption = NULL) {
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.encryption');
   return _ldap_servers_encrypt($text, $encryption);
 }
 
-function ldap_servers_encrypt_types($category = 'all') {
+/**
+ *
+ */
+function ldap_servers_encrypt_types() {
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.encryption');
-  return _ldap_servers_encrypt_types($category);
+  return _ldap_servers_encrypt_types();
 }
 
+/**
+ *
+ */
 function ldap_servers_decrypt($encrypted, $encryption = NULL) {
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.encryption');
   return _ldap_servers_decrypt($encrypted, $encryption);
 }
 
+/**
+ *
+ */
 function ldap_servers_php_supports_pagination() {
-  return (boolean)(function_exists('ldap_control_paged_result_response') && function_exists('ldap_control_paged_result'));
+  return (boolean) (function_exists('ldap_control_paged_result_response') && function_exists('ldap_control_paged_result'));
 }
 
-
+/**
+ *
+ */
 function ldap_servers_help($path, $arg) {
 
   $servers_help = '<p>' . t('LDAP Servers store "LDAP server configurations" so other modules can connect to them and leverage their data.') . ' ';
@@ -842,7 +892,7 @@ function ldap_servers_help($path, $arg) {
     case 'admin/config/people/ldap/servers':
       return $servers_help;
 
-   case 'admin/help#ldap_servers':
+    case 'admin/help#ldap_servers':
       $servers_help .= '<h3>' . t('Configuration - Settings') . '</h3>';
       $servers_help .= '<dl>';
       $servers_help .= '<dt>' . t('ENCRYPTION') . '</dt>';
@@ -897,7 +947,6 @@ function ldap_servers_help($path, $arg) {
   }
 }
 
-
 /**
  * @return list of ldap configuration classes and names
  */
@@ -905,35 +954,35 @@ function ldap_servers_ldap_servers_types() {
 
   $path = drupal_get_path('module', 'ldap_servers') . '/ldap_types';
 
-  $types['default'] = array(
+  $types['default'] = [
     'class' => t('LdapTypeDefault'),
     'directory_path' => $path,
     'name' => 'Default LDAP',
-  );
+  ];
 
-  $types['ad'] = array(
+  $types['ad'] = [
     'class' => t('LdapTypeActiveDirectory'),
     'directory_path' => $path,
     'name' => 'Active Directory',
-  );
+  ];
 
-  $types['novell_edir'] = array(
+  $types['novell_edir'] = [
     'class' => t('LdapTypeNovell'),
     'directory_path' => $path,
     'name' => 'Novell',
-  );
+  ];
 
-  $types['openldap'] = array(
+  $types['openldap'] = [
     'class' => t('LdapTypeOpenLdap'),
     'directory_path' => $path,
     'name' => 'Open LDAP',
-  );
+  ];
 
-  $types['opendir'] = array(
+  $types['opendir'] = [
     'class' => t('LdapTypeOpenDirectory'),
     'directory_path' => $path,
     'name' => 'Apple Open Directory',
-  );
+  ];
 
   drupal_alter('ldap_servers_ldap_types', $types);
   return $types;
@@ -941,8 +990,11 @@ function ldap_servers_ldap_servers_types() {
 }
 
 /**
- * @param string or array ldap type id or conf array
- * @return options for ldap type pulldown
+ * @param string $ldap_conf
+ *   or array ldap type id or conf array.
+ *
+ * @return mixed
+ *   options for ldap type pulldown
  */
 function ldap_servers_get_ldap_type_object($ldap_conf) {
 
@@ -951,23 +1003,25 @@ function ldap_servers_get_ldap_type_object($ldap_conf) {
     $ldap_conf = $ldap_confs[$ldap_conf];
   }
 
-  require_once($ldap_conf['directory_path'] . '/' . $ldap_conf['class'] . 'class.php');
+  require_once $ldap_conf['directory_path'] . '/' . $ldap_conf['class'] . 'class.php';
   $ldap_type_class = new $ldap_conf['class']();
   return $ldap_type_class;
 
 }
 
 /**
- * given a dn (such as cn=jdoe,ou=people)
+ * Given a dn (such as cn=jdoe,ou=people)
  * and an rdn (such as cn)
  * determine that rdn value (such as jdoe)
  *
  * @param string $dn
  * @param string $rdn
+ *
  * @return string value of rdn
  */
 function ldap_servers_get_first_rdn_value_from_dn($dn, $rdn) {
-  $pairs = ldap_explode_dn($dn, 0); // escapes attribute values, need to be unescaped later
+  // Escapes attribute values, need to be unescaped later.
+  $pairs = ldap_explode_dn($dn, 0);
   $count = array_shift($pairs);
   $rdn = drupal_strtolower($rdn);
   $rdn_value = FALSE;
@@ -982,19 +1036,21 @@ function ldap_servers_get_first_rdn_value_from_dn($dn, $rdn) {
 }
 
 /**
- * given a dn (such as cn=jdoe,ou=people)
+ * Given a dn (such as cn=jdoe,ou=people)
  * and an rdn (such as cn)
  * determine that rdn value (such as jdoe)
  *
  * @param string $dn
  * @param string $rdn
+ *
  * @return array of all values of rdn
  */
 function ldap_servers_get_all_rdn_values_from_dn($dn, $rdn) {
-  $pairs = ldap_explode_dn($dn, 0); // escapes attribute values, need to be unescaped later
+  // Escapes attribute values, need to be unescaped later.
+  $pairs = ldap_explode_dn($dn, 0);
   $count = array_shift($pairs);
   $rdn = drupal_strtolower($rdn);
-  $rdn_values = array();
+  $rdn_values = [];
   foreach ($pairs as $p) {
     $pair = explode('=', $p);
     if (drupal_strtolower(trim($pair[0])) == $rdn) {
@@ -1004,13 +1060,13 @@ function ldap_servers_get_all_rdn_values_from_dn($dn, $rdn) {
   return $rdn_values;
 }
 
-
 /**
- * @return options for ldap type pulldown
+ * @return array
+ *   options for ldap type pulldown
  */
 function ldap_servers_ldaps_option_array() {
 
-  $options = array();
+  $options = [];
   foreach (ldap_servers_ldap_servers_types() as $ldap_id => $conf) {
     $options[$ldap_id] = $conf['name'];
   }
@@ -1019,24 +1075,28 @@ function ldap_servers_ldaps_option_array() {
 }
 
 /**
- * @param string $ldap_type indicating ldap type 'default','ad','novell_edir', 'openldap'
- * @param boolean $reset clear static array
- * @param boolean $flatted indicating if only one ldap type returned, skip top level array key
+ * @param string $ldap_type
+ *   indicating ldap type 'default','ad','novell_edir', 'openldap'.
+ * @param bool $reset
+ *   clear static array.
+ * @param bool $flatten
+ *   indicating if only one ldap type returned, skip top level array key.
  *
- * @return one or more ldap type objects
+ * @return mixed
+ *   one or more ldap type objects
  */
 function ldap_servers_get_types($ldap_type = NULL, $reset = FALSE, $flatten = FALSE) {
   static $ldap_types;
   if ($reset || !is_array($ldap_types)) {
     $ldap_types = module_invoke_all('ldap_servers_type');
     if ($ldap_type) {
-      require_once($ldap_types[$ldap_type]['directory_path'] . '/' . $ldap_types[$ldap_type]['class'] . '.class.php');
-      $ldap_types[$ldap_type] = new $ldap_types[$ldap_type]['class'] . '.class.php';
+      require_once $ldap_types[$ldap_type]['directory_path'] . '/' . $ldap_types[$ldap_type]['class'] . '.class.php';
+      $ldap_types[$ldap_type] = new $ldap_types[$ldap_type]['class']() . '.class.php';
     }
     else {
       foreach ($ldap_types as $ldap_type_id => $ldap_class_info) {
-        require_once($ldap_class_info['directory_path'] . '/' . $ldap_class_info['class'] . '.class.php');
-        $ldap_types[$ldap_type_id] = new $ldap_class_info['class'];
+        require_once $ldap_class_info['directory_path'] . '/' . $ldap_class_info['class'] . '.class.php';
+        $ldap_types[$ldap_type_id] = new $ldap_class_info['class']();
       }
     }
   }
@@ -1048,7 +1108,9 @@ function ldap_servers_get_types($ldap_type = NULL, $reset = FALSE, $flatten = FA
   }
 }
 
-
+/**
+ *
+ */
 function ldap_servers_no_enabled_servers_msg($action) {
 
   $servers = ldap_servers_get_servers(NULL, 'enabled');
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.settings.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.settings.inc
index 3e76ebdd..0aa53c21 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.settings.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.settings.inc
@@ -2,59 +2,58 @@
 
 /**
  * @file
- * admin interface for general ldap api settings
- *
+ * Admin interface for general ldap api settings.
  */
 
+/**
+ *
+ */
 function ldap_servers_settings() {
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
 
-  if (! ldap_servers_ldap_extension_loaded()) {
+  if (!ldap_servers_ldap_extension_loaded()) {
     drupal_set_message(t('PHP LDAP Extension is not loaded.'), "warning");
   }
 
   $form['#title'] = "Configure LDAP Preferences";
 
+  $options = ldap_servers_encrypt_types();
 
-  $options = ldap_servers_encrypt_types('encrypt');
-
-   /**  when this is changed, need to decrypt and possibly encrypt pwd in newly selected format
+  /**  when this is changed, need to decrypt and possibly encrypt pwd in newly selected format
     *   ... thus default needs to be "No Encryption" to avoid confusion.
     */
 
-  $form['previous_encryption'] = array('#type' => 'hidden', '#default_value' => variable_get('ldap_servers_encryption', LDAP_SERVERS_ENC_TYPE_CLEARTEXT));
-  $form['encryption'] = array('#type' => 'fieldset', '#title' => t('Encryption'));
-  $form['encryption']['ldap_servers_encryption'] = array(
+  $form['previous_encryption'] = ['#type' => 'hidden', '#default_value' => variable_get('ldap_servers_encryption', LDAP_SERVERS_ENC_TYPE_CLEARTEXT)];
+  $form['encryption'] = ['#type' => 'fieldset', '#title' => t('Encryption')];
+  $form['encryption']['ldap_servers_encryption'] = [
     '#type' => 'select',
     '#options' => $options,
-    '#title' => t('Encrypt Stored LDAP Passwords?'),
+    '#title' => t('Obfuscate LDAP Passwords?'),
     '#default_value' => variable_get('ldap_servers_encryption', LDAP_SERVERS_ENC_TYPE_CLEARTEXT),
-    '#description' => t('With encryption, passwords will be stored in encrypted form.
-    This is two way encryption because the actual password needs to used to bind to LDAP.
-    So it offers minimal defense if someone gets in the filespace.  It mainly helps avoid the accidental
-    discovery of a clear text password.'),
-    );
+    '#description' => t('With obfuscation enabled, passwords will be stored in encrypted form and decrypted with the site hash.'),
+  ];
 
-
-    // $options will be empty if server does not support mcrypt.
   // Disable the form field and explain this to the user.
-  if (empty($options)) {
-    $form['encryption']['ldap_servers_encryption']['#options'] = array(LDAP_SERVERS_ENC_TYPE_CLEARTEXT => t('Not available.'));
+  if (count($options) == 1) {
     $form['encryption']['ldap_servers_encryption']['#disabled'] = TRUE;
-    $form['encryption']['ldap_servers_encryption']['#description'] .= ' <strong>' . t('Encryption is not supported on this web server.') . '</strong>';
+    $form['encryption']['ldap_servers_encryption']['#description'] = ' <strong>' . t('Obfuscation is not supported on this web server.') . '</strong>';
   }
 
   $form = system_settings_form($form);
-  array_unshift($form['#submit'], 'ldap_servers_settings_submit');  // needs to be first
+  // Needs to be first.
+  array_unshift($form['#submit'], 'ldap_servers_settings_submit');
   return $form;
 }
 
+/**
+ *
+ */
 function ldap_servers_settings_submit($form, &$form_state) {
   if ($form_state['submitted']) {
     $new_encyption = $form_state['values']['ldap_servers_encryption'];
     $old_encyption = $form_state['values']['previous_encryption'];
 
-    // use db instead of functions to avoid classes encryption and decryption
+    // Use db instead of functions to avoid classes encryption and decryption.
     if ($new_encyption != $old_encyption) {
       $servers = db_query("SELECT sid, bindpw FROM {ldap_servers} WHERE bindpw is not NULL AND bindpw <> ''")->fetchAllAssoc('sid');
       foreach ($servers as $sid => $server) {
@@ -65,7 +64,7 @@ function ldap_servers_settings_submit($form, &$form_state) {
         else {
           $rencrypted = '';
         }
-        db_query("UPDATE {ldap_servers} SET bindpw = :bindpw WHERE sid = :sid", array(':bindpw' => $rencrypted, ':sid' => $sid));
+        db_query("UPDATE {ldap_servers} SET bindpw = :bindpw WHERE sid = :sid", [':bindpw' => $rencrypted, ':sid' => $sid]);
       }
     }
   }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.test_form.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.test_form.inc
index 29a0b0dc..b7be34ef 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.test_form.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.test_form.inc
@@ -23,111 +23,112 @@ module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
  * @return
  *   The form structure.
  */
-
 function ldap_servers_test_form($form, &$form_state, $op = NULL, $sid = NULL) {
 
   $ldap_server = ldap_servers_get_servers($sid, 'all', TRUE);
 
-  drupal_set_title(t('Test LDAP Server Configuration: !server', array('!server' => $ldap_server->name)));
+  drupal_set_title(t('Test LDAP Server Configuration: !server', ['!server' => $ldap_server->name]));
 
   $form['#prefix'] = t('This form tests an LDAP configuration to see if
     it can bind and basic user and group functions.  It also shows token examples
     and a sample user.  The only data this function will modify is the test LDAP group, which will be deleted and added');
 
-  $variables = array(
-    'ldap_server' => $ldap_server, 'actions' => FALSE, 'type' => 'detail'
-  );
+  $variables = [
+    'ldap_server' => $ldap_server,
+    'actions' => FALSE,
+    'type' => 'detail',
+  ];
 
-  $form['server_variables'] = array(
+  $form['server_variables'] = [
     '#markup' => theme('ldap_servers_server', $variables),
-  );
+  ];
 
-  $form['sid'] = array(
+  $form['sid'] = [
     '#type' => 'hidden',
     '#default_value' => $sid,
-  );
+  ];
 
-  $form['binding']['bindpw'] = array(
+  $form['binding']['bindpw'] = [
     '#type' => 'password',
     '#title' => t('Password for non-anonymous search'),
     '#size' => 20,
     '#maxlength' => 255,
     '#description' => t('Leave empty to test with currently stored password.'),
-  );
+  ];
 
-  $form['testing_drupal_username'] = array(
+  $form['testing_drupal_username'] = [
     '#type' => 'textfield',
     '#title' => t('Testing Drupal Username'),
     '#default_value' => $ldap_server->testingDrupalUsername,
     '#size' => 30,
     '#maxlength' => 255,
     '#description' => t('This is optional and used for testing this server\'s configuration against an actual username.  The user need not exist in Drupal and testing will not affect the user\'s LDAP or Drupal Account.'),
-  );
+  ];
 
-  $form['testingDrupalUserDn'] = array(
+  $form['testingDrupalUserDn'] = [
     '#type' => 'textfield',
     '#title' => t('Testing Drupal DN'),
     '#default_value' => $ldap_server->testingDrupalUserDn,
     '#size' => 120,
     '#maxlength' => 255,
     '#description' => t('This is optional and used for testing this server\'s configuration against an actual username.  The user need not exist in Drupal and testing will not affect the user\'s LDAP or Drupal Account.'),
-  );
+  ];
 
-  $form['grp_test_grp_dn'] = array(
+  $form['grp_test_grp_dn'] = [
     '#type' => 'textfield',
     '#title' => t('Testing Group DN'),
     '#default_value' => $ldap_server->groupTestGroupDn,
     '#size' => 120,
     '#maxlength' => 255,
     '#description' => t('This is optional and used for testing this server\'s group configuration.'),
-  );
+  ];
 
-  $form['grp_test_grp_dn_writeable'] = array(
+  $form['grp_test_grp_dn_writeable'] = [
     '#type' => 'textfield',
     '#title' => t('Testing Group DN that is writeable. Warning!  In test, this group will be deleted, created, have members added to it!'),
     '#default_value' => $ldap_server->groupTestGroupDnWriteable,
     '#size' => 120,
     '#maxlength' => 255,
     '#description' => t('This is optional and used for testing this server\'s group configuration.'),
-  );
+  ];
 
   if ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
-    $form['testing_drupal_userpw'] = array(
+    $form['testing_drupal_userpw'] = [
       '#type' => 'password',
       '#title' => t('Testing Drupal User Password'),
       '#size' => 30,
       '#maxlength' => 255,
       '#description' => t('This is optional and used for testing this server\'s configuration against the username above.'),
-    );
+    ];
   }
 
-  $form['submit'] = array(
+  $form['submit'] = [
     '#type' => 'submit',
     '#value' => 'Test',
     '#weight' => 100,
-  );
+  ];
 
   if (!empty($form_state['ldap_server_test_data'])) {
     $test_data = $form_state['ldap_server_test_data'];
 
     if (isset($test_data['username']) && isset($test_data['ldap_user'])) {
       $form['#prefix'] = theme('ldap_server_ldap_entry_table',
-        array(
+        [
           'entry' => $test_data['ldap_user']['attr'],
           'username' => $test_data['username'],
           'dn' => $test_data['ldap_user']['dn'],
-        ));
+        ]);
     }
 
-    $titles = array(
+    $titles = [
       'basic' => 'Test Results',
       'group1' => 'Group Create, Delete, Add Member, Remove Member Tests',
       'group2' => 'User Group Membership Functions Test',
       'tokens' => 'User Token Samples',
       'groupfromDN' => 'Groups Derived From User DN',
-    );
+    ];
     foreach ($test_data['results_tables'] as $table_name => $table_data) {
-      $form['#prefix'] .= '<h2>' . $titles[$table_name] . '</h2>' . theme('table', array('header' => array('Test', 'Result'), 'rows' => $table_data));
+      $form['#prefix'] .= '<h2>' . $titles[$table_name] . '</h2>' . theme('table', ['header' => ['Test', 'Result'], 'rows' => $table_data]);
     }
 
     if (function_exists('dpm') && !empty($test_data['username'])) {
@@ -150,6 +151,9 @@ function ldap_servers_test_form($form, &$form_state, $op = NULL, $sid = NULL) {
   return $form;
 }
 
+/**
+ *
+ */
 function ldap_servers_string_binary_check($input) {
   if (preg_match('~[^\x20-\x7E\t\r\n]~', $input) > 0) {
     $truncatedString = truncate_utf8($input, 200);
@@ -169,7 +173,7 @@ function ldap_servers_test_form_validate($form, &$form_state) {
     form_set_error(NULL, t('No server id found in form'));
   }
   elseif (!$ldap_server = ldap_servers_get_servers($values['sid'], 'all', TRUE)) {
-    form_set_error(NULL, t('Failed to create server object for server with server id=%sid', array('%sid' => $values['sid'])));
+    form_set_error(NULL, t('Failed to create server object for server with server id=%sid', ['%sid' => $values['sid']]));
   }
 }
 
@@ -178,7 +182,7 @@ function ldap_servers_test_form_validate($form, &$form_state) {
  */
 function ldap_servers_test_form_submit($form, &$form_state) {
 
-  //Pass data back to form builder
+  // Pass data back to form builder.
   $form_state['rebuild'] = TRUE;
 
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
@@ -188,9 +192,8 @@ function ldap_servers_test_form_submit($form, &$form_state) {
   $sid = $values['sid'];
   $ldap_server = ldap_servers_get_servers($sid, 'all', TRUE);
 
-  //$result = t('<h1>Test of name </h2>',$server_conf);
-  $results = array();
-  $results_tables = array();
+  $results = [];
+  $results_tables = [];
   if ($values['bindpw']) {
     $bindpw = $values['bindpw'];
     $bindpw_type = t('entered in form.');
@@ -201,69 +204,71 @@ function ldap_servers_test_form_submit($form, &$form_state) {
   }
 
   if ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT) {
-    $results_tables['basic'][] = array(t('Binding with DN for non-anonymous search (%bind_dn).  Using password ',
-      array('%bind_dn' => $ldap_server->binddn)) . ' ' . $bindpw_type);
+    $results_tables['basic'][] = [
+      t('Binding with DN for non-anonymous search (%bind_dn).  Using password ',
+      ['%bind_dn' => $ldap_server->binddn]) . ' ' . $bindpw_type,
+    ];
   }
   else {
-    $results_tables['basic'][] = array(t('Binding with null DN for anonymous search.'));
+    $results_tables['basic'][] = [t('Binding with null DN for anonymous search.')];
   }
 
   if (@$values['grp_test_grp_dn_writeable'] && @$values['grp_test_grp_dn']) {
     $user_test_dn = @$values['grp_test_grp_dn'];
     $group_create_test_dn = $values['grp_test_grp_dn_writeable'];
-    $group_create_test_attr = array(
-      'objectClass' => array($ldap_server->groupObjectClass, 'top'),
-    );
+    $group_create_test_attr = [
+      'objectClass' => [$ldap_server->groupObjectClass, 'top'],
+    ];
 
-    // 1. delete test group if it exists
-    if ($ldap_server->dnExists($group_create_test_dn, 'ldap_entry', array('cn', 'member'))) {
+    // 1. delete test group if it exists.
+    if ($ldap_server->dnExists($group_create_test_dn, 'ldap_entry', ['cn', 'member'])) {
       $result = $ldap_server->groupRemoveGroup($group_create_test_dn, FALSE);
     }
 
-    $group_exists = $ldap_server->dnExists($group_create_test_dn, 'ldap_entry', array('cn', 'member'));
+    $group_exists = $ldap_server->dnExists($group_create_test_dn, 'ldap_entry', ['cn', 'member']);
     $result = ($group_exists === FALSE) ? "PASS" : "FAIL";
-    $results_tables['group1'][] = array("Starting test without group: $group_create_test_dn ", $result);
+    $results_tables['group1'][] = ["Starting test without group: $group_create_test_dn ", $result];
 
-    // 2. make sure call to members in empty group returns false
+    // 2. make sure call to members in empty group returns false.
     $result = $ldap_server->groupAllMembers($group_create_test_dn);
     $result = ($result === FALSE) ? "PASS" : 'FAIL';
-    $results_tables['group1'][] = array("LdapServer::groupAllMembers($group_create_test_dn) call on nonexistent group returns FALSE", $result);
+    $results_tables['group1'][] = ["LdapServer::groupAllMembers($group_create_test_dn) call on nonexistent group returns FALSE", $result];
 
-    // 3. add group
+    // 3. add group.
     $result = $ldap_server->groupAddGroup($group_create_test_dn, $group_create_test_attr);
     $result = ($result) ? "PASS" : 'FAIL';
     $attr = serialize($group_create_test_attr);
-    $results_tables['group1'][] = array("LdapServer::groupAddGroup($group_create_test_dn, $attr)", $result);
+    $results_tables['group1'][] = ["LdapServer::groupAddGroup($group_create_test_dn, $attr)", $result];
 
-    // 4. call to all members in an empty group returns emtpy array, not FALSE
+    // 4. call to all members in an empty group returns emtpy array, not FALSE.
     $result = $ldap_server->groupAllMembers($group_create_test_dn);
     $result = (is_array($result) && count($result) == 0) ? 'PASS' : 'FAIL';
-    $results_tables['group1'][] = array("LdapServer::groupAllMembers($group_create_test_dn) returns empty array for empty group ", $result);
+    $results_tables['group1'][] = ["LdapServer::groupAllMembers($group_create_test_dn) returns empty array for empty group ", $result];
 
-    // 5. add member to group
+    // 5. add member to group.
     $result = $ldap_server->groupAddMember($group_create_test_dn, $user_test_dn);
     $result = is_array($ldap_server->groupAllMembers($group_create_test_dn)) ? 'PASS' : 'FAIL';
-    $results_tables['group1'][] = array("LdapServer::groupAddMember($group_create_test_dn, $user_test_dn)", $result);
+    $results_tables['group1'][] = ["LdapServer::groupAddMember($group_create_test_dn, $user_test_dn)", $result];
 
-   // 6. try to remove group with member in it
+    // 6. try to remove group with member in it.
     $only_if_group_empty = TRUE;
     $result = $ldap_server->groupRemoveGroup($group_create_test_dn, $only_if_group_empty);
     $result = ($result) ? 'FAIL' : 'PASS';
-    $results_tables['group1'][] = array("LdapServer::groupRemoveGroup($group_create_test_dn, $only_if_group_empty)", $result);
+    $results_tables['group1'][] = ["LdapServer::groupRemoveGroup($group_create_test_dn, $only_if_group_empty)", $result];
 
-   // 7. remove group member
+    // 7. remove group member.
     $result = $ldap_server->groupRemoveMember($group_create_test_dn, $user_test_dn);
     $result = $ldap_server->groupAllMembers($group_create_test_dn);
     $result = (is_array($result) && count($result) == 0) ? 'PASS' : 'FAIL';
-    $results_tables['group1'][] = array("LdapServer::groupRemoveMember($group_create_test_dn, $user_test_dn)", $result);
+    $results_tables['group1'][] = ["LdapServer::groupRemoveMember($group_create_test_dn, $user_test_dn)", $result];
 
     $only_if_group_empty = TRUE;
     $result = $ldap_server->groupRemoveGroup($group_create_test_dn, $only_if_group_empty);
-    $result = ($ldap_server->dnExists($group_create_test_dn, 'ldap_entry', array('cn', 'member'))) ? "FAIL" : 'PASS';
-    $results_tables['group1'][] = array("LdapServer::groupRemoveGroup($group_create_test_dn, $only_if_group_empty)", $result);
+    $result = ($ldap_server->dnExists($group_create_test_dn, 'ldap_entry', ['cn', 'member'])) ? "FAIL" : 'PASS';
+    $results_tables['group1'][] = ["LdapServer::groupRemoveGroup($group_create_test_dn, $only_if_group_empty)", $result];
   }
 
-  // connect to ldap
+  // Connect to ldap.
   list($has_errors, $more_results) = ldap_servers_test_binding_credentials($ldap_server, $bindpw, $results_tables);
   $results = array_merge($results, $more_results);
   if ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
@@ -276,16 +281,18 @@ function ldap_servers_test_form_submit($form, &$form_state) {
           $mapping[] = "$key = " . $value[0];
         }
       }
-      $results_tables['basic'][] = array(theme_item_list(array('items' => $mapping, 'title' => t('Attributes available to anonymous search', array('%bind_dn' => $ldap_server->binddn)) , 'type' => 'ul', 'attributes' => array())));
+      $results_tables['basic'][] = [theme_item_list(['items' => $mapping, 'title' => t('Attributes available to anonymous search', ['%bind_dn' => $ldap_server->binddn]), 'type' => 'ul', 'attributes' => []])];
     }
-    $results_tables['basic'][] = array(t('Binding with DN (%bind_dn).  Using supplied password ',
-      array('%bind_dn' => $ldap_user['dn'])));
+    $results_tables['basic'][] = [
+      t('Binding with DN (%bind_dn).  Using supplied password ',
+      ['%bind_dn' => $ldap_user['dn']]),
+    ];
     $result = $ldap_server->bind($ldap_user['dn'], $values['testing_drupal_userpw'], FALSE);
     if ($result == LDAP_SUCCESS) {
-      $results_tables['basic'][] = array(t('Successfully bound to server'), 'PASS');
+      $results_tables['basic'][] = [t('Successfully bound to server'), 'PASS'];
     }
     else {
-      $results_tables['basic'][] = array(t('Failed to bind to server. ldap error #') . $result . ' ' . $ldap_server->errorMsg('ldap'), 'FAIL') ;
+      $results_tables['basic'][] = [t('Failed to bind to server. ldap error #') . $result . ' ' . $ldap_server->errorMsg('ldap'), 'FAIL'];
     }
   }
 
@@ -298,74 +305,78 @@ function ldap_servers_test_form_submit($form, &$form_state) {
     }
     $user = isset($values['testing_drupal_username']) ? $values['testing_drupal_username'] : NULL;
 
-    foreach (array(FALSE, TRUE) as $nested) { //FALSE
+    // FALSE.
+    foreach ([FALSE, TRUE] as $nested) {
       $nested_display = ($nested) ? 'Yes' : 'No';
       if ($user) {
-        // this is the parent function that will call FromUserAttr or FromEntry
+        // This is the parent function that will call FromUserAttr or FromEntry.
         $memberships = $ldap_server->groupMembershipsFromUser($user, 'group_dns', $nested);
-        $result = theme('item_list', array('items' => $memberships, 'type' => 'ul'));
-        $results_tables['group2'][] = array("ldap_server->groupMembershipsFromUser($user, 'group_dns', nested=$nested_display)<br/>count=" . count($memberships), $result);
+        $result = theme('item_list', ['items' => $memberships, 'type' => 'ul']);
+        $results_tables['group2'][] = ["ldap_server->groupMembershipsFromUser($user, 'group_dns', nested=$nested_display)<br/>count=" . count($memberships), $result];
 
         $result = ($ldap_server->groupIsMember($group_dn, $user, $nested)) ? 'Yes' : 'No';
-        $group_results[] = array("ldap_server->groupIsMember($group_dn, $user, nested=$nested_display)", $result);
+        $group_results[] = ["ldap_server->groupIsMember($group_dn, $user, nested=$nested_display)", $result];
 
         if ($ldap_server->groupUserMembershipsConfigured) {
           $groupusermembershipsfromuserattr = $ldap_server->groupUserMembershipsFromUserAttr($user, $nested);
           $count = count($groupusermembershipsfromuserattr);
-          $result = theme('item_list', array('items' => $groupusermembershipsfromuserattr, 'type' => 'ul'));
+          $result = theme('item_list', ['items' => $groupusermembershipsfromuserattr, 'type' => 'ul']);
         }
         else {
-          $groupusermembershipsfromuserattr = array();
+          $groupusermembershipsfromuserattr = [];
           $result = "'A user LDAP attribute such as memberOf exists that contains a list of their group' is not configured.";
         }
-        $results_tables['group2'][] = array("ldap_server->groupUserMembershipsFromUserAttr($user, nested=$nested_display)<br/> count=" .
-            count($groupusermembershipsfromuserattr) , $result);
+        $results_tables['group2'][] = [
+          "ldap_server->groupUserMembershipsFromUserAttr($user, nested=$nested_display)<br/> count=" .
+          count($groupusermembershipsfromuserattr), $result,
+        ];
 
         if ($ldap_server->groupGroupEntryMembershipsConfigured) {
           $groupusermembershipsfromentry = $ldap_server->groupUserMembershipsFromEntry($user, $nested);
-          $result = theme('item_list', array('items' => $groupusermembershipsfromentry, 'type' => 'ul'));
+          $result = theme('item_list', ['items' => $groupusermembershipsfromentry, 'type' => 'ul']);
         }
         else {
-          $groupusermembershipsfromentry = array();
+          $groupusermembershipsfromentry = [];
           $result = "Groups by entry not configured.";
         }
-        $results_tables['group2'][] = array("ldap_server->groupUserMembershipsFromEntry($user, nested=$nested_display)<br/>count=" .
-          count($groupusermembershipsfromentry) , $result);
+        $results_tables['group2'][] = [
+          "ldap_server->groupUserMembershipsFromEntry($user, nested=$nested_display)<br/>count=" .
+          count($groupusermembershipsfromentry), $result,
+        ];
 
         if (count($groupusermembershipsfromentry) && count($groupusermembershipsfromuserattr)) {
           $diff1 = array_diff($groupusermembershipsfromuserattr, $groupusermembershipsfromentry);
           $diff2 = array_diff($groupusermembershipsfromentry, $groupusermembershipsfromuserattr);
-          $result1 = theme('item_list', array('items' => $diff1, 'type' => 'ul'));
-          $result2 = theme('item_list', array('items' => $diff2, 'type' => 'ul'));
-          $results_tables['group2'][] = array("groupUserMembershipsFromEntry and FromUserAttr Diff)", $result1);
-          $results_tables['group2'][] = array("FromUserAttr and groupUserMembershipsFromEntry Diff)", $result2);
+          $result1 = theme('item_list', ['items' => $diff1, 'type' => 'ul']);
+          $result2 = theme('item_list', ['items' => $diff2, 'type' => 'ul']);
+          $results_tables['group2'][] = ["groupUserMembershipsFromEntry and FromUserAttr Diff)", $result1];
+          $results_tables['group2'][] = ["FromUserAttr and groupUserMembershipsFromEntry Diff)", $result2];
         }
       }
     }
 
-
     if ($groups_from_dn = $ldap_server->groupUserMembershipsFromDn($user)) {
-      $results_tables['groupfromDN'][] = array("Groups from DN", theme('item_list', array('items' => $groups_from_dn, 'type' => 'ul')));
+      $results_tables['groupfromDN'][] = ["Groups from DN", theme('item_list', ['items' => $groups_from_dn, 'type' => 'ul'])];
     }
 
   }
 
   list($has_errors, $more_results, $ldap_user) = ldap_servers_test_user_mapping($values['testing_drupal_username'], $ldap_server);
 
-  $tokens = ($ldap_user && isset($ldap_user['attr'])) ? ldap_servers_token_tokenize_entry($ldap_user['attr'], 'all') : array();
+  $tokens = ($ldap_user && isset($ldap_user['attr'])) ? ldap_servers_token_tokenize_entry($ldap_user['attr'], 'all') : [];
   foreach ($tokens as $key => $value) {
-    $results_tables['tokens'][] = array($key, ldap_servers_string_binary_check($value));
+    $results_tables['tokens'][] = [$key, ldap_servers_string_binary_check($value)];
   }
-  $form_state['ldap_server_test_data'] = array(
+  $form_state['ldap_server_test_data'] = [
     'username' => $values['testing_drupal_username'],
     'results_tables' => $results_tables,
-  );
+  ];
 
   if (isset($ldap_user)) {
     $form_state['ldap_server_test_data']['ldap_user'] = $ldap_user;
   }
 
-  if (isset($group_entry) ) {
+  if (isset($group_entry)) {
     $form_state['ldap_server_test_data']['group_entry'] = $group_entry;
   }
 
@@ -374,49 +385,53 @@ function ldap_servers_test_form_submit($form, &$form_state) {
 /**
  * Submit hook for the LDAP server form.
  */
-
-
 function ldap_servers_test_binding_credentials(&$ldap_server, $bindpw, &$results_tables) {
 
   $errors = FALSE;
-  $results = array();
+  $results = [];
 
   $ldap_result = $ldap_server->connect();
   if ($ldap_result != LDAP_SUCCESS) {
-    $results_tables['basic'][] = array(t('Failed to connect to LDAP server.  See watchdog error logs for details.') .
-                                    $ldap_server->errorMsg('ldap'));
+    $results_tables['basic'][] = [
+      t('Failed to connect to LDAP server.  See watchdog error logs for details.') .
+      $ldap_server->errorMsg('ldap'),
+    ];
     $errors = TRUE;
   }
 
   if (!$errors) {
     $bind_result = $ldap_server->bind($ldap_server->binddn, $bindpw, FALSE);
     if ($bind_result == LDAP_SUCCESS) {
-      $results_tables['basic'][] = array(t('Successfully bound to server'));
+      $results_tables['basic'][] = [t('Successfully bound to server')];
     }
     else {
-      $results_tables['basic'][] = array(t('Failed to bind to server. ldap error #') . $bind_result . ' ' . $ldap_server->errorMsg('ldap')) ;
+      $results_tables['basic'][] = [t('Failed to bind to server. ldap error #') . $bind_result . ' ' . $ldap_server->errorMsg('ldap')];
       $errors = TRUE;
     }
   }
-  return array($errors, $results);
+  return [$errors, $results];
 }
 
+/**
+ *
+ */
 function ldap_servers_test_user_mapping($drupal_username, &$ldap_server, $ldap_context = NULL) {
 
   $ldap_user = $ldap_server->userUserNameToExistingLdapEntry($drupal_username, $ldap_context);
   $errors = FALSE;
-  if (!$ldap_user ) {
+  if (!$ldap_user) {
     $results[] = t('Failed to find test user %username by searching on  %user_attr = %username.',
-      array(
+      [
         '%username' => $drupal_username,
-        '%user_attr' => $ldap_server->user_attr )
+        '%user_attr' => $ldap_server->user_attr,
+      ]
       )
       . ' ' . t('Error Message:') . ' ' . $ldap_server->errorMsg('ldap');
     $errors = TRUE;
   }
   else {
     $results[] = t('Found test user %username by searching on  %user_attr = %username.',
-      array('%username' => $drupal_username, '%user_attr' => $ldap_server->user_attr ));
+      ['%username' => $drupal_username, '%user_attr' => $ldap_server->user_attr]);
   }
-  return array($errors, $results, $ldap_user);
+  return [$errors, $results, $ldap_user];
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc
index 28eb34dc..5613aeee 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc
@@ -2,8 +2,7 @@
 
 /**
  * @file
- * theming functions for ldap_servers module
- *
+ * Theming functions for ldap_servers module.
  */
 
 /**
@@ -16,30 +15,35 @@
  *   - type:  'table', 'list', etc for style to render
  *
  * @ingroup themeable
+ *
+ * @return string
  */
 function theme_ldap_servers_list($variables) {
+  /** @var array $ldap_servers */
+  /** @var bool $actions */
+  /** @var string $type */
   extract($variables);
 
-  $table = array(
-    'header' => array(t('Name'), t('Type'), t('Enabled'), t('Server Address')),
-    'attributes' => array('id' => 'ldap_servers_servers', 'class' => 'data'),
-    'colgroups' => array(),
+  $table = [
+    'header' => [t('Name'), t('Type'), t('Enabled'), t('Server Address')],
+    'attributes' => ['id' => 'ldap_servers_servers', 'class' => 'data'],
+    'colgroups' => [],
     'sticky' => FALSE,
     'empty' => '',
     'caption' => 'LDAP Server Configurations',
-  );
+  ];
 
   if ($actions) {
     $table['header'][] = "Operations";
   }
   if (count($ldap_servers)) {
-    foreach ($ldap_servers as $sid => $ldap_server ) {
-      $row = array(
+    foreach ($ldap_servers as $sid => $ldap_server) {
+      $row = [
         $ldap_server->name,
         $ldap_server->ldap_type,
         ($ldap_server->status == 1) ? "Yes" : "No",
-        $ldap_server->address
-          );
+        $ldap_server->address,
+      ];
       if ($actions) {
         $admin = new LdapServerAdmin($ldap_server->sid);
         $row[] = join(' | ', $admin->getLdapServerActions());
@@ -48,7 +52,7 @@ function theme_ldap_servers_list($variables) {
     }
   }
   else {
-    $table['rows'] = array();
+    $table['rows'] = [];
   }
   $output = theme('table', $table);
 
@@ -60,18 +64,22 @@ function theme_ldap_servers_list($variables) {
  *
  * @param $variables
  *   An associative array containing:
- *   - ldap_servers_config: an array of one or more ldap server configurations.
+ *   - ldap_server: an array of one or more ldap server configurations.
  *   - actions:  true or false indicating include update, delete, etc. links
  *   - type:  'table', 'list', etc for style to render
  *
  * @ingroup themeable
+ *
+ * @return string
  */
-
 function theme_ldap_servers_server($variables) {
-  extract($variables);  // $ldap_server, $actions, $type (see above)
+  /** @var array $ldap_server */
+  /** @var bool $actions */
+  /** @var string $type */
+  extract($variables);
 
   ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServer.class');
-  $properties = array();
+  $properties = [];
   foreach (LdapServer::field_to_properties_map() as $field_name => $property_name) {
     $properties[] = "$field_name = " . print_r($ldap_server->$property_name, TRUE);
   }
@@ -82,47 +90,53 @@ function theme_ldap_servers_server($variables) {
   }
 
   $output = theme_item_list(
-    array(
+    [
       'items' => $properties,
       'type' => 'ul',
       'title' => 'Server Properties',
-      'attributes' => array()
-      )
+      'attributes' => [],
+    ]
     );
 
   return $output;
 }
 
+/**
+ *
+ */
 function theme_ldap_server_token_table($variables) {
-  $header = array(
-    array('data' => 'Token', 'sort' => 'asc'),
-    array('data' => 'Value'),
-  );
+  $header = [
+    ['data' => 'Token', 'sort' => 'asc'],
+    ['data' => 'Value'],
+  ];
   foreach ($variables['tokens'] as $token => $value) {
-    $rows[] = array('data' => array($token, $value));
+    $rows[] = ['data' => [$token, $value]];
   }
   $token_table = '<div class="content"><h2>' . t('Available Tokens') . '</h2>' .
-    theme_table(array('colgroups' => NULL, 'caption' => 'tokens', 'header' => $header, 'rows' => $rows, 'sticky' => TRUE, 'attributes' => array(), 'empty' => 'No data')) .
+    theme_table(['colgroups' => NULL, 'caption' => 'tokens', 'header' => $header, 'rows' => $rows, 'sticky' => TRUE, 'attributes' => [], 'empty' => 'No data']) .
     '</div>';
 
   return $token_table;
 }
 
+/**
+ *
+ */
 function theme_ldap_server_ldap_entry_table($variables) {
   if (!isset($variables['entry']) || !is_array($variables['entry'])) {
     return '<p>' . t('No Entry Returned.') . t('</p>');
   }
 
-  $header = array('Attribute Name', 'Instance', 'Value', 'token');
-  $rows = array();
+  $header = ['Attribute Name', 'Instance', 'Value', 'token'];
+  $rows = [];
   foreach ($variables['entry'] as $key => $value) {
     if (is_numeric($key) || $key == 'count') {
     }
-    elseif (count($value) > 1) {
-      $count = (int)$value['count'];
+    elseif (is_array($value) && count($value) > 1) {
+      $count = (int) $value['count'];
       foreach ($value as $i => $value2) {
 
-        if ((string)$i == 'count') {
+        if ((string) $i == 'count') {
           continue;
         }
         elseif ($i == 0 && $count == 1) {
@@ -140,10 +154,23 @@ function theme_ldap_server_ldap_entry_table($variables) {
         else {
           $token = "";
         }
-        $rows[] = array('data' => array($key, $i, ldap_servers_string_binary_check($value2), $token));
+        $rows[] = ['data' => [$key, $i, ldap_servers_string_binary_check($value2), $token]];
       }
     }
   }
-  $entry_table = '<div class="content"><h2>' . t('LDAP Entry for %username (dn: %dn)', array('%dn' => $variables['dn'], '%username' => $variables['username'])) . '</h2>' . theme('table', array('colgroups' => NULL, 'caption' => 'ldap entry array', 'header' => $header, 'rows' => $rows, 'sticky' => TRUE, 'attributes' => array(), 'empty' => 'No data')) . '</div>';
+  $heading = sprintf('<h2>%s</h2>', t('LDAP Entry for %username (dn: %dn)', [
+    '%dn' => $variables['dn'],
+    '%username' => $variables['username'],
+  ]));
+  $table = theme('table', [
+    'colgroups' => NULL,
+    'caption' => 'ldap entry array',
+    'header' => $header,
+    'rows' => $rows,
+    'sticky' => TRUE,
+    'attributes' => [],
+    'empty' => 'No data',
+  ]);
+  $entry_table = '<div class="content">' . $heading . $table . '</div>';
   return $entry_table;
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.tokens.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.tokens.inc
index 38a09079..28fa62e4 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.tokens.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.tokens.inc
@@ -2,13 +2,16 @@
 
 /**
  * @file
- * collection of functions related to ldap tokens
+ * Collection of functions related to ldap tokens.
  */
 
 /**
- * @param string $attr_name such 'field_user_lname', 'name', 'mail', 'dn'
- * @param string $attr_type such as 'field', 'property', etc.  NULL for ldap attributes
- * @param string $attr_ordinal 0, 1, 2, etc.  not used in general
+ * @param string $attr_name
+ *   such 'field_user_lname', 'name', 'mail', 'dn'.
+ * @param string $attr_type
+ *   such as 'field', 'property', etc.  NULL for ldap attributes.
+ * @param string $attr_ordinal
+ *   0, 1, 2, etc.  not used in general.
  *
  * @return string such as 'field.field_user_lname', 'samaccountname', etc.
  */
@@ -25,13 +28,15 @@ function ldap_servers_make_token($attr_name, $attr_type = NULL, $ordinal = NULL)
 }
 
 /**
- * @param $user_attr_key of form <attr_type>.<attr_name>[:<instance>]
+ * @param $user_attr_key
+ *   of form <attr_type>.<attr_name>[:<instance>]
  *   such as field.lname, property.mail, field.aliases:2
  *
  * @return array array($attr_type, $attr_name, $attr_ordinal) such as array('field','field_user_lname', NULL)
  */
 function ldap_servers_parse_user_attr_name($user_attr_key) {
-  $user_attr_key = trim($user_attr_key, LDAP_SERVERS_TOKEN_PRE . LDAP_SERVERS_TOKEN_POST); // make sure no [] are on attribute
+  // Make sure no [] are on attribute.
+  $user_attr_key = trim($user_attr_key, LDAP_SERVERS_TOKEN_PRE . LDAP_SERVERS_TOKEN_POST);
   $parts = explode('.', $user_attr_key);
   $attr_type = $parts[0];
   $attr_name = (isset($parts[1])) ? $parts[1] : FALSE;
@@ -44,34 +49,52 @@ function ldap_servers_parse_user_attr_name($user_attr_key) {
       $attr_ordinal = $attr_name_parts[1];
     }
   }
-  return array($attr_type, $attr_name, $attr_ordinal);
+  return [$attr_type, $attr_name, $attr_ordinal];
 }
 
 /**
- * @param array $ldap_entry
- * @param string $text such as "[dn]", "[cn]@my.org", "[displayName] [sn]", "Drupal Provisioned"
- * @return string $text with tokens replaced or NULL if replacement not available
+ * @param array
+ * @param string $text
+ *
+ * @return string
  */
 
-function ldap_servers_token_replace($resource, $text, $resource_type = 'ldap_entry') { // user_account
+/**
+ * User_account.
+ *
+ * @param $resource
+ *   $ldap_entry
+ * @param $text
+ *   such as "[dn]", "[cn]@my.org", "[displayName] [sn]", "Drupal Provisioned"
+ * @param string $resource_type
+ *
+ * @return string|string[]|null
+ *   $text with tokens replaced or NULL if replacement not available
+ */
+function ldap_servers_token_replace($resource, $text, $resource_type = 'ldap_entry') {
 
-  $desired_tokens = ldap_servers_token_tokens_needed_for_template($text);  // desired tokens are of form "cn","mail", etc.
+  // Desired tokens are of form "cn","mail", etc.
+  $desired_tokens = ldap_servers_token_tokens_needed_for_template($text);
 
   if (empty($desired_tokens)) {
-    return $text; // if no tokens exist in text, return text itself.  It is literal value
+    // If no tokens exist in text, return text itself.  It is literal value.
+    return $text;
   }
 
+  $tokens = [];
+
+  // @TODO: Should really be if/else if only those two exist.
   switch ($resource_type) {
     case 'ldap_entry':
-    $tokens = ldap_servers_token_tokenize_entry($resource, $desired_tokens, LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST);
-    break;
+      $tokens = ldap_servers_token_tokenize_entry($resource, $desired_tokens, LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST);
+      break;
 
     case 'user_account':
-    $tokens = ldap_servers_token_tokenize_user_account($resource, $desired_tokens, LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST);
-    break;
+      $tokens = ldap_servers_token_tokenize_user_account($resource, $desired_tokens, LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST);
+      break;
   }
 
-  // add lowercase tokens to avoid case sensitivity
+  // Add lowercase tokens to avoid case sensitivity.
   foreach ($tokens as $attribute => $value) {
     $tokens[drupal_strtolower($attribute)] = $value;
   }
@@ -82,24 +105,30 @@ function ldap_servers_token_replace($resource, $text, $resource_type = 'ldap_ent
     $tokens[drupal_strtolower($text)] = '';
   }
 
-  $attributes = array_keys($tokens); //array of attributes (sn, givenname, etc)
-  $values = array_values($tokens); //array of attribute values (Lincoln, Abe, etc)
+  // Array of attributes (sn, givenname, etc)
+  $attributes = array_keys($tokens);
+  // Array of attribute values (Lincoln, Abe, etc)
+  $values = array_values($tokens);
   $result = str_replace($attributes, $values, $text);
 
-  $result = preg_replace('/\[[^\]]*]/', '', $result);  // strip out any unreplaced tokens
-  return ($result == '') ? NULL : $result; // return NULL if $result is empty, else $result
+  // Strip out any unreplaced tokens.
+  $result = preg_replace('/\[[^\]]*]/', '', $result);
+  // Return NULL if $result is empty, else $result.
+  return ($result == '') ? NULL : $result;
 }
 
 /**
- * @param array $attributes array of attributes passed by reference
- * @param string $text with tokens in it
+ * @param array $attributes
+ *   array of attributes passed by reference.
+ * @param string $text
+ *   with tokens in it
  *
- * by reference return add ldap attribute triplet $attribute_maps[<attr_name>] = (<attr_name>, <ordinal>, <data_type>) to $attributes
+ *   by reference return add ldap attribute triplet $attribute_maps[<attr_name>] = (<attr_name>, <ordinal>, <data_type>) to $attributes.
  */
 function ldap_servers_token_extract_attributes(&$attribute_maps, $text) {
   $tokens = ldap_servers_token_tokens_needed_for_template($text);
   foreach ($tokens as $token) {
-    $token = str_replace(array(LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST), array('', ''), $token);
+    $token = str_replace([LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST], ['', ''], $token);
     $parts = explode(LDAP_SERVERS_TOKEN_DEL, $token);
     $ordinal = (isset($parts[1]) && $parts[1]) ? $parts[1] : 0;
     $attr_name = $parts[0];
@@ -113,19 +142,18 @@ function ldap_servers_token_extract_attributes(&$attribute_maps, $text) {
     else {
       $conversion = NULL;
     }
-    $attribute_maps[$attr_name] = ldap_servers_set_attribute_map(@$attribute_maps[$attr_name], $conversion, array($ordinal => NULL));
+    $attribute_maps[$attr_name] = ldap_servers_set_attribute_map(@$attribute_maps[$attr_name], $conversion, [$ordinal => NULL]);
   }
 }
 
 /**
- * @param string $token or token expression with singular token in it, eg. [dn], [dn;binary], [titles:0;binary] [cn]@mycompany.com
- *
- *
+ * @param string $token
+ *   or token expression with singular token in it, eg. [dn], [dn;binary], [titles:0;binary] [cn]@mycompany.com.
  *
  * @return array(<attr_name>, <ordinal>, <conversion>)
  */
 function ldap_servers_token_extract_parts($token) {
-  $attributes = array();
+  $attributes = [];
   ldap_servers_token_extract_attributes($attributes, $token);
   if (is_array($attributes)) {
     $keys = array_keys($attributes);
@@ -133,73 +161,70 @@ function ldap_servers_token_extract_parts($token) {
     $attr_data = $attributes[$attr_name];
     $ordinals = array_keys($attr_data['values']);
     $ordinal = $ordinals[0];
-    return array($attr_name, $ordinal, $attr_data['conversion']);
+    return [$attr_name, $ordinal, $attr_data['conversion']];
   }
   else {
-    return array(NULL, NULL, NULL);
+    return [NULL, NULL, NULL];
   }
 
 }
 
-
-
 /**
- * Turn an ldap entry into a token array suitable for the t() function
+ * Turn an ldap entry into a token array suitable for the t() function.
+ *
  * @param ldap entry array $ldap_entry
  * @param string prefix token prefix such as !,%,[
  * @param string suffix token suffix such as ]
- * @param $token_keys either an array of key names such as array('cn', 'dn') or string 'all' to return all tokens.
+ * @param $token_keys
+ *   either an array of key names such as array('cn', 'dn') or string 'all' to return all tokens.
+ *
  * @return token array suitable for t() functions of with lowercase keys as exemplified below
-
-
-$ldap_entry should be in form of single entry returned from ldap_search() function:
-
-    'dn' => 'cn=jdoe,ou=campus accounts,ou=toledo campus,dc=ad,dc=myuniversity,dc=edu',
-    'mail' => array( 0 => 'jdoe@myuniversity.edu', 'count' => 1),
-    'sAMAccountName' => array( 0 => 'jdoe', 'count' => 1),
-
-should return tokens such as:
-
-    -- from dn attribute
-    [cn] = jdoe
-    [cn:0] = jdoe
-    [cn:last] => jdoe
-    [cn:reverse:0] = jdoe
-    [ou] = campus accounts
-    [ou:0] = campus accounts
-    [ou:1] = toledo campus
-    [ou:last] = toledo campus
-    [ou:reverse:0] = toledo campus
-    [ou:reverse:1] = campus accounts
-    [dc] = ad
-    [dc:0] = ad
-    [dc:1] = myuniversity
-    [dc:2] = edu
-    [dc:last] = edu
-    [dc:reverse:0] = edu
-    [dc:reverse:1] = myuniversity
-    [dc:reverse:2] = ad
-
-    -- from other attributes
-    [mail] = jdoe@myuniversity.edu
-    [mail:0] = jdoe@myuniversity.edu
-    [mail:last] = jdoe@myuniversity.edu
-    [samaccountname] = jdoe
-    [samaccountname:0] = jdoe
-    [samaccountname:last] = jdoe
-
-    [guid:0;base64_encode] = apply base64_encode() function to value
-    [guid:0;bin2hex] = apply bin2hex() function to value
-    [guid:0;msguid] = apply ldap_servers_msguid() function to value
-    [guid:0;binary] = apply ldap_servers_binary() function to value. this is the most generic binary function
-
+ *
+ *   $ldap_entry should be in form of single entry returned from ldap_search() function:
+ *
+ *   'dn' => 'cn=jdoe,ou=campus accounts,ou=toledo campus,dc=ad,dc=myuniversity,dc=edu',
+ *   'mail' => array( 0 => 'jdoe@myuniversity.edu', 'count' => 1),
+ *   'sAMAccountName' => array( 0 => 'jdoe', 'count' => 1),
+ *   should return tokens such as:
+ *
+ *   -- from dn attribute
+ *   [cn] = jdoe
+ *   [cn:0] = jdoe
+ *   [cn:last] => jdoe
+ *   [cn:reverse:0] = jdoe
+ *   [ou] = campus accounts
+ *   [ou:0] = campus accounts
+ *   [ou:1] = toledo campus
+ *   [ou:last] = toledo campus
+ *   [ou:reverse:0] = toledo campus
+ *   [ou:reverse:1] = campus accounts
+ *   [dc] = ad
+ *   [dc:0] = ad
+ *   [dc:1] = myuniversity
+ *   [dc:2] = edu
+ *   [dc:last] = edu
+ *   [dc:reverse:0] = edu
+ *   [dc:reverse:1] = myuniversity
+ *   [dc:reverse:2] = ad
+ *
+ *   -- from other attributes
+ *   [mail] = jdoe@myuniversity.edu
+ *   [mail:0] = jdoe@myuniversity.edu
+ *   [mail:last] = jdoe@myuniversity.edu
+ *   [samaccountname] = jdoe
+ *   [samaccountname:0] = jdoe
+ *   [samaccountname:last] = jdoe
+ *
+ *   [guid:0;base64_encode] = apply base64_encode() function to value
+ *   [guid:0;bin2hex] = apply bin2hex() function to value
+ *   [guid:0;msguid] = apply ldap_servers_msguid() function to value
+ *   [guid:0;binary] = apply ldap_servers_binary() function to value. this is the most generic binary function
  */
-
 function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pre = LDAP_SERVERS_TOKEN_PRE, $post = LDAP_SERVERS_TOKEN_POST) {
 
   $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
-  $tokens = array();
-  $watchdog_tokens = array();
+  $tokens = [];
+  $watchdog_tokens = [];
   if (function_exists('debug_backtrace') && $backtrace = debug_backtrace()) {
     $watchdog_tokens['%calling_function'] = $backtrace[1]['function'];
   }
@@ -207,19 +232,21 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
     if ($detailed_watchdog_log) {
       watchdog('ldap_servers', 'skipped tokenization of ldap entry because no ldap entry provided when called from %calling_function.', $watchdog_tokens, WATCHDOG_DEBUG);
     }
-    return $tokens; // empty array
+    // Empty array.
+    return $tokens;
   }
-      
-  // add lowercase keyed entries to ldap array
+
+  // Add lowercase keyed entries to ldap array.
   foreach ($ldap_entry as $key => $values) {
     $ldap_entry[drupal_strtolower($key)] = $values;
   }
 
   // 1. tokenize dn
-  $dn_parts = ldap_explode_dn($ldap_entry['dn'], 0); // escapes attribute values, need to be unescaped later.
+  // escapes attribute values, need to be unescaped later.
+  $dn_parts = ldap_explode_dn($ldap_entry['dn'], 0);
   unset($dn_parts['count']);
-  $parts_count = array();
-  $parts_last_value = array();
+  $parts_count = [];
+  $parts_last_value = [];
   foreach ($dn_parts as $pair) {
     list($attr_name, $attr_value) = explode('=', $pair);
     $attr_value = ldap_pear_unescape_dn_value($attr_value);
@@ -231,13 +258,14 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
         $watchdog_tokens['%attr_name'] = $attr_name;
         watchdog('ldap_servers', 'skipped tokenization of attribute %attr_name because the value would not pass check_plain function.', $watchdog_tokens, WATCHDOG_DEBUG);
       }
-      continue; // don't tokenize data that can't pass check_plain
+      // don't tokenize data that can't pass check_plain.
+      continue;
     }
     if (!isset($parts_count[$attr_name])) {
       $tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . $post] = $attr_value;
       $parts_count[$attr_name] = 0;
     }
-    $tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . LDAP_SERVERS_TOKEN_DEL . (int)$parts_count[$attr_name] . $post] = $attr_value;
+    $tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . LDAP_SERVERS_TOKEN_DEL . (int) $parts_count[$attr_name] . $post] = $attr_value;
 
     $parts_last_value[$attr_name] = $attr_value;
     $parts_count[$attr_name]++;
@@ -256,7 +284,7 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
     $tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . LDAP_SERVERS_TOKEN_DEL . 'last' . $post] = $parts_last_value[$attr_name];
   }
 
-  // tokenize other attributes
+  // Tokenize other attributes.
   if ($token_keys == 'all') {
     $token_keys = array_keys($ldap_entry);
     $token_keys = array_filter($token_keys, "is_string");
@@ -282,7 +310,7 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
   }
   else {
     foreach ($token_keys as $full_token_key) {
-      // $token_key = 'dn', 'mail', 'mail:0', 'mail:last', 'dept:1', 'guid:0;tobase64etc.
+      // Token key = 'dn', 'mail', 'mail:0', 'mail:last', 'dept:1', 'guid:0' etc.
       $value = NULL;
 
       $conversion = FALSE;
@@ -300,7 +328,8 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
       $ordinal_key = isset($parts[1]) ? $parts[1] : 0;
       $i = NULL;
 
-      if ($attr_name == 'dn' || !isset($ldap_entry[$attr_name])) { // don't use empty() since a 0, "", etc value may be a desired value
+      // don't use empty() since a 0, "", etc value may be a desired value.
+      if ($attr_name == 'dn' || !isset($ldap_entry[$attr_name])) {
         continue;
       }
       else {
@@ -313,7 +342,8 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
           $value = $ldap_entry[$attr_name][$ordinal_key];
         }
         else {
-          continue;  // don't add token if case not covered
+          // don't add token if case not covered.
+          continue;
         }
       }
 
@@ -338,7 +368,6 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
         }
       }
 
-
       $tokens[$pre . $full_token_key . $post] = $value;
       if ($full_token_key != drupal_strtolower($full_token_key)) {
         $tokens[$pre . drupal_strtolower($full_token_key) . $post] = $value;
@@ -346,7 +375,7 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
     }
   }
 
-  // include the dn.  it will not be handled correctly by previous loops
+  // Include the dn.  it will not be handled correctly by previous loops.
   $tokens[$pre . 'dn' . $post] = check_plain($ldap_entry['dn']);
   return $tokens;
 }
@@ -354,29 +383,29 @@ function ldap_servers_token_tokenize_entry($ldap_entry, $token_keys = 'all', $pr
 /**
  *
  * @param drupal user object $user_account
- * @param array or 'all' $token_keys 'all' signifies return
+ * @param array or 'all' $token_keys
+ *   'all' signifies return
  *   all token/value pairs available; otherwise array lists
  *   token keys (e.g. property.name ...NOT [property.name])
- * @param string $pre prefix of token
- * @param string $post suffix of token
+ * @param string $pre
+ *   prefix of token.
+ * @param string $post
+ *   suffix of token.
  *
  *
  * @return should return token/value pairs in array such as
  *   'status' => 1
  *   'uid' => 17
  */
-
 function ldap_servers_token_tokenize_user_account($user_account, $token_keys = 'all', $pre = LDAP_SERVERS_TOKEN_PRE, $post = LDAP_SERVERS_TOKEN_POST) {
 
   $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
-  $tokens = array();
-
-  $user_entered_password_available = (boolean)ldap_user_ldap_provision_pwd('get');
-  // ldapUserPwd((property_exists($user_account, 'ldapUserPwd') && $user_account->ldapUserPwd));
+  $tokens = [];
 
+  $user_entered_password_available = (boolean) ldap_user_ldap_provision_pwd('get');
   if ($token_keys == 'all') {
-    // add lowercase keyed entries to ldap array
-    foreach ((array)$user_account as $property_name => $value) {
+    // Add lowercase keyed entries to ldap array.
+    foreach ((array) $user_account as $property_name => $value) {
       if (is_scalar($value) && $property_name != 'password') {
         $token_keys[] = 'property.' . $property_name;
         if (drupal_strtolower($property_name) != $property_name) {
@@ -390,11 +419,11 @@ function ldap_servers_token_tokenize_user_account($user_account, $token_keys = '
         }
       }
       else {
-        // field or property with no value, so no token can be generated
+        // Field or property with no value, so no token can be generated.
       }
     }
     $ldap_user_conf_admin = new LdapUserConfAdmin();
-    if ($ldap_user_conf->setsLdapPassword) {
+    if ($ldap_user_conf_admin->setsLdapPassword) {
       $token_keys[] = 'password.random';
       $token_keys[] = 'password.user-random';
     }
@@ -411,11 +440,11 @@ function ldap_servers_token_tokenize_user_account($user_account, $token_keys = '
     switch ($attr_type) {
       case 'field':
         $value = @is_scalar($user_account->{$attr_name}[LANGUAGE_NONE][0]['value']) ? $user_account->{$attr_name}[LANGUAGE_NONE][0]['value'] : '';
-      break;
+        break;
 
       case 'property':
         $value = @is_scalar($user_account->{$attr_name}) ? $user_account->{$attr_name} : '';
-      break;
+        break;
 
       case 'password':
 
@@ -440,7 +469,7 @@ function ldap_servers_token_tokenize_user_account($user_account, $token_keys = '
         if (empty($value)) {
           $skip = TRUE;
         }
-      break;
+        break;
     }
 
     if (!$skip) {
@@ -451,7 +480,7 @@ function ldap_servers_token_tokenize_user_account($user_account, $token_keys = '
           break;
 
         case 'to-md5':
-          $value = "{MD5}" . base64_encode( pack( "H*", md5( $value ) ) );
+          $value = "{MD5}" . base64_encode(pack("H*", md5($value)));
           break;
 
         case 'to-lowercase':
@@ -469,7 +498,8 @@ function ldap_servers_token_tokenize_user_account($user_account, $token_keys = '
 }
 
 /**
- * @param string $template in form [cn]@myuniversity.edu
+ * @param string $template
+ *   in form [cn]@myuniversity.edu.
  * @return array of all tokens in the template such as array('cn')
  */
 function ldap_servers_token_tokens_needed_for_template($template, $pre = LDAP_SERVERS_TOKEN_PRE, $post = LDAP_SERVERS_TOKEN_POST) {
@@ -483,11 +513,14 @@ function ldap_servers_token_tokens_needed_for_template($template, $pre = LDAP_SE
 
 }
 
+/**
+ *
+ */
 function ldap_servers_token_show_sample_user_tokens($sid) {
 
   $ldap_server = ldap_servers_get_servers($sid, 'all', TRUE);
   $test_username = $ldap_server->testingDrupalUsername;
-  if (!$test_username || ! (
+  if (!$test_username || !(
     $ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT ||
     $ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_ANON
       )
@@ -496,11 +529,11 @@ function ldap_servers_token_show_sample_user_tokens($sid) {
   }
 
   if ($ldap_user = $ldap_server->userUserNameToExistingLdapEntry($test_username)) {
-    $table = theme('ldap_server_ldap_entry_table', array(
+    $table = theme('ldap_server_ldap_entry_table', [
       'entry' => $ldap_user['attr'],
       'username' => $test_username,
       'dn' => $ldap_user['dn'],
-      ));
+    ]);
   }
   else {
     $table = '<p>' . t('No sample user data found') . '</p>';
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.user_data_remove.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.user_data_remove.inc
index b30c172c..dae418fb 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.user_data_remove.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.user_data_remove.inc
@@ -1,60 +1,66 @@
 <?php
 
 /**
-* @file
-* collection of functions related to removing user data
-*/
+ * @file
+ * Collection of functions related to removing user data.
+ */
 
+/**
+ *
+ */
 function ldap_severs_user_data_setup_batch($consumer_type = NULL) {
 
   $max_uid = db_query("SELECT max(uid) FROM {users}")->fetchField();
   $step = 100;
-  $operations = array();
+  $operations = [];
   for ($uid = 2; $uid <= $max_uid; $uid += $step) {
-    $operations[] = array("ldap_servers_empty_user_data", array($uid, $step, $consumer_type));
+    $operations[] = ["ldap_servers_empty_user_data", [$uid, $step, $consumer_type]];
   }
-   
-  //put all that information into our batch array
-  return array(
+
+  // Put all that information into our batch array.
+  return [
     'operations' => $operations,
-    'title' => t('Empty LDAP Authorization Data in user->data[ldap_authorizations][%consumer_id]', array('%consumer_id' => $consumer_type)),
+    'title' => t('Empty LDAP Authorization Data in user->data[ldap_authorizations][%consumer_id]', ['%consumer_id' => $consumer_type]),
     'init_message' => t('Initializing'),
     'error_message' => t('An error occurred'),
-    'finished' => t('Finished.')
-  );
-  
-}
+    'finished' => t('Finished.'),
+  ];
 
+}
 
 /**
- * function to remove $user->data['ldap_authorizations'] on uninstall
- * which is called from ldap_authorization uninstall batches
- *
+ * Function to remove $user->data['ldap_authorizations'] on uninstall
+ * which is called from ldap_authorization uninstall batches.
  */
-function ldap_servers_empty_user_data($start, $step, $consumer_type, &$context) { 
-  
+function ldap_servers_empty_user_data($start, $step, $consumer_type, &$context) {
+
   $query = new EntityFieldQuery();
   $query->entityCondition('entity_type', 'user')
-    ->entityCondition('entity_id', array($start, $start + $step - 1), 'BETWEEN');
+    ->entityCondition('entity_id', [$start, $start + $step - 1], 'BETWEEN');
   $results = $query->execute();
 
   if (isset($results['user'])) {
     foreach ($results['user'] as $uid => $entity_data) {
       if ($uid > 1 && $account = user_load($uid, TRUE)) {
-        if ($consumer_type == NULL && isset($account->data['ldap_authorizations'])) { // remove all authorization data
+        // Remove all authorization data.
+        if ($consumer_type == NULL && isset($account->data['ldap_authorizations'])) {
           $names[] = $account->name;
           unset($account->data['ldap_authorizations']);
-          $updated_account = user_save($account, array('data' => $account->data));
+          $updated_account = user_save($account, ['data' => $account->data]);
         }
-        elseif ($consumer_type != NULL && isset($account->data['ldap_authorizations'][$consumer_type])) { // remove only a particular consumers authorization data
+        // Remove only a particular consumers authorization data.
+        elseif ($consumer_type != NULL && isset($account->data['ldap_authorizations'][$consumer_type])) {
           unset($account->data['ldap_authorizations'][$consumer_type]);
-          $updated_account = user_save($account, array('data' => $account->data));
+          $updated_account = user_save($account, ['data' => $account->data]);
         }
       }
     }
   }
 }
 
+/**
+ *
+ */
 function ldap_authorization_generate_users() {
   $response = "";
   for ($i = 1; $i < 1000; $i++) {
@@ -65,13 +71,13 @@ function ldap_authorization_generate_users() {
     $account = new stdClass();
     $account->is_new = TRUE;
     $account->name = "user" . $i;
-    $user_edit = array(
-      'data' => array('ldap_authorizations' => array('og_group' => 7, 'drupal_role' => 8))
-    );
-    
+    $user_edit = [
+      'data' => ['ldap_authorizations' => ['og_group' => 7, 'drupal_role' => 8]],
+    ];
+
     $user_response = user_save($account, $user_edit);
     $response .= $user_response->name . "<br/>";
   }
   return $response;
-  
+
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeAbstract.class.php b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeAbstract.class.php
index 767c7a9d..7c69cfa3 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeAbstract.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeAbstract.class.php
@@ -2,18 +2,22 @@
 
 /**
  * @file
- * abstract class to represent an ldap implementation type
+ * Abstract class to represent an ldap implementation type
  * such as active directory, open ldap, novell, etc.
- *
  */
 
+/**
+ *
+ */
 abstract class LdapTypeAbstract {
 
   public $name;
   public $typeId;
   public $description;
 
-  // ldap_servers configuration
+  /**
+   * Ldap_servers configuration.
+   */
   public $port = 389;
   public $tls = 0;
   public $encrypted = 0;
@@ -22,18 +26,22 @@ abstract class LdapTypeAbstract {
   public $groupObjectClassDefault = NULL;
   public $groupDerivationModelDefault = NULL;
 
-  // ldap_authorization configuration
+  /**
+   * Ldap_authorization configuration.
+   */
   public $deriveFromDn = FALSE;
   public $deriveFromAttr = FALSE;
   public $deriveFromEntry = FALSE;
   public $groupMembershipsAttr = NULL;
-  public $groupMembershipsAttrMatchingUserAttr = FALSE; // can be removed in 2.0 branch
+  /**
+   * Can be removed in 2.0 branch.
+   */
+  public $groupMembershipsAttrMatchingUserAttr = FALSE;
 
- /**
-   * Constructor Method
-   *
+  /**
+   * Constructor Method.
    */
-  function __construct($params = array()) {
+  public function __construct($params = []) {
     foreach ($params as $k => $v) {
       if (property_exists($this, $k)) {
         $this->{$k} = $v;
@@ -41,7 +49,4 @@ abstract class LdapTypeAbstract {
     }
   }
 
-
-
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeActiveDirectory.class.php b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeActiveDirectory.class.php
index e7c5d07c..93d097ef 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeActiveDirectory.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeActiveDirectory.class.php
@@ -2,36 +2,42 @@
 
 /**
  * @file
- * Active Directory LDAP Implementation Details
- *
- * see http://msdn.microsoft.com/en-us/library/windows/desktop/ms675085(v=vs.85).aspx
+ * Active Directory LDAP Implementation Details.
  *
+ * See http://msdn.microsoft.com/en-us/library/windows/desktop/ms675085(v=vs.85).aspx.
  */
 
 module_load_include('php', 'ldap_servers', 'ldap_types/LdapTypeAbstract.class');
-
+/**
+ *
+ */
 class LdapTypeActiveDirectory extends LdapTypeAbstract {
 
-  // generic properties
+  /**
+   * Generic properties.
+   */
   public $name = 'Active Directory LDAP';
   public $typeId = 'ActiveDirectory';
   public $description = 'Microsoft Active Directory';
 
-  // ldap_servers configuration
+  /**
+   * Ldap_servers configuration.
+   */
   public $port = 389;
   public $tls = 1;
   public $encrypted = 0;
   public $user_attr = 'sAMAccountName';
   public $mail_attr = 'mail';
 
-  /** the following pairs all work in Active Directory,
+  /**
+   * The following pairs all work in Active Directory,
    * but there is no assurance that any of them will survive
    * domain merges and migrations.  Its best to pick a true user id
-   * such as a numeric one given to the user by the organization
+   * such as a numeric one given to the user by the organization.
    *
-   * uidNumber  - not binary
+   * UidNumber  - not binary
    * objectSid  - binary
-   * objectGuid - binary
+   * objectGuid - binary.
    */
 
   public $unique_persistent_attr = 'uidNumber';
@@ -41,11 +47,11 @@ class LdapTypeActiveDirectory extends LdapTypeAbstract {
 
   public $groupObjectClassDefault = 'group';
 
-  // ldap_authorization configuration
+  /**
+   * Ldap_authorization configuration.
+   */
   public $groupDerivationModelDefault = LDAP_SERVERS_DERIVE_GROUP_FROM_ATTRIBUTE;
   public $deriveFromAttr = TRUE;
   public $groupUserMembershipsAttr = 'memberOf';
 
-
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeDefault.class.php b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeDefault.class.php
index 8c118de8..20cd1420 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeDefault.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeDefault.class.php
@@ -2,12 +2,13 @@
 
 /**
  * @file
- * Generic LDAP Implementation Details
- *
+ * Generic LDAP Implementation Details.
  */
 
 module_load_include('php', 'ldap_servers', 'ldap_types/LdapTypeAbstract.class');
-
+/**
+ *
+ */
 class LdapTypeDefault extends LdapTypeAbstract {
 
   public $name = 'Default LDAP';
@@ -20,11 +21,10 @@ class LdapTypeDefault extends LdapTypeAbstract {
   public $mail_attr = 'mail';
   public $supportsNestGroups = FALSE;
 
- /**
-   * Constructor Method
-   *
+  /**
+   * Constructor Method.
    */
-  function __construct($params = array()) {
+  public function __construct($params = []) {
     foreach ($params as $k => $v) {
       if (property_exists($this, $k)) {
         $this->{$k} = $v;
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeNovell.class.php b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeNovell.class.php
index 899780cc..6baf7e56 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeNovell.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeNovell.class.php
@@ -2,12 +2,13 @@
 
 /**
  * @file
- * Active Directory LDAP Implementation Details
- *
+ * Active Directory LDAP Implementation Details.
  */
 
 ldap_servers_module_load_include('php', 'ldap_servers', 'ldap_types/LdapTypeAbstract.class');
-
+/**
+ *
+ */
 class LdapTypeNovell extends LdapTypeAbstract {
 
   public $documentation = 'http://www.novell.com/documentation/edir873/index.html?page=/documentation/edir873/edir873/data/h0000007.html';
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeOpenDirectory.class.php b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeOpenDirectory.class.php
index e38ade73..328b5fad 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeOpenDirectory.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeOpenDirectory.class.php
@@ -2,12 +2,13 @@
 
 /**
  * @file
- * Active Directory LDAP Implementation Details
- *
+ * Active Directory LDAP Implementation Details.
  */
 
-require_once(drupal_get_path('module', 'ldap_servers') . '/ldap_types/LdapTypeAbstract.class.php');
-
+require_once drupal_get_path('module', 'ldap_servers') . '/ldap_types/LdapTypeAbstract.class.php';
+/**
+ *
+ */
 class LdapTypeOpenDirectory extends LdapTypeAbstract {
 
   public $documentation = 'http://help.apple.com/advancedserveradmin/mac/10.7/#apdBF94D320-3293-41E0-B7DA-123F857C4032';
@@ -18,20 +19,41 @@ class LdapTypeOpenDirectory extends LdapTypeAbstract {
   public $port = 389;
   public $tls = FALSE;
 
-  // user ldap entry properties
+  /**
+   * User ldap entry properties.
+   */
   public $user_dn_expression;
   public $user_attr = 'uid';
-  public $account_name_attr; //lowercase
-  public $mail_attr = 'mail'; //lowercase
+  /**
+   * Lowercase.
+   */
+  public $account_name_attr;
+  /**
+   * Lowercase.
+   */
+  public $mail_attr = 'mail';
   public $unique_persistent_attr = 'apple-generateduid';
   public $unique_persistent_attr_binary = FALSE;
   public $userObjectClass = 'apple-user';
 
   public $groupObjectClass = 'apple-group';
-  public $groupMembershipsAttr = 'apple-group-memberguid';  //lowercase // members, uniquemember, memberUid
-  public $groupMembershipsAttrMatchingUserAttr = 'apple-generateduid'; //lowercase // dn, cn, etc contained in groupMembershipsAttr
-  public $groupMembersGroupsAttr = 'apple-group-nestedgroup';  //lowercase // members, uniquemember, memberUid
-  public $groupMembersGroupsAttrMatchingGroupAttr = 'apple-generateduid'; //lowercase // dn, cn, etc contained in groupMembershipsAttr
-
+  /**
+   * Lowercase // members, uniquemember, memberUid.
+   */
+  public $groupMembershipsAttr = 'apple-group-memberguid';
+
+  /**
+   * Lowercase // dn, cn, etc contained in groupMembershipsAttr.
+   */
+  public $groupMembershipsAttrMatchingUserAttr = 'apple-generateduid';
+
+  /**
+   * Lowercase // members, uniquemember, memberUid.
+   */
+  public $groupMembersGroupsAttr = 'apple-group-nestedgroup';
+  /**
+   * Lowercase // dn, cn, etc contained in groupMembershipsAttr.
+   */
+  public $groupMembersGroupsAttrMatchingGroupAttr = 'apple-generateduid';
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeOpenLdap.class.php b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeOpenLdap.class.php
index a940e3dd..4a6c0c58 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeOpenLdap.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_types/LdapTypeOpenLdap.class.php
@@ -2,23 +2,29 @@
 
 /**
  * @file
- * OpenLDAP LDAP Implementation Details
+ * OpenLDAP LDAP Implementation Details.
  *
- * see: http://www.zytrax.com/books/ldap/
+ * See: http://www.zytrax.com/books/ldap/
  *      http://www.openldap.org/doc/
  */
 
-require_once(drupal_get_path('module', 'ldap_servers') . '/ldap_types/LdapTypeAbstract.class.php');
-
+require_once drupal_get_path('module', 'ldap_servers') . '/ldap_types/LdapTypeAbstract.class.php';
+/**
+ *
+ */
 class LdapTypeOpenLdap extends LdapTypeAbstract {
 
-  // generic properties
+  /**
+   * Generic properties.
+   */
   public $documentation = '';
   public $name = 'openLDAP LDAP';
   public $typeId = 'OpenLdap';
   public $description = 'openLDAP LDAP';
 
-  // ldap_servers configuration
+  /**
+   * Ldap_servers configuration.
+   */
   public $tls = 0;
   public $encrypted = 0;
   public $user_attr = 'cn';
@@ -27,10 +33,11 @@ class LdapTypeOpenLdap extends LdapTypeAbstract {
   public $unique_persistent_attr_binary = FALSE;
   public $groupObjectClassDefault = 'groupofnames';
 
-  // ldap_authorization configuration
+  /**
+   * Ldap_authorization configuration.
+   */
   public $groupDerivationModelDefault = LDAP_SERVERS_DERIVE_GROUP_FROM_ENTRY;
   public $groupMembershipsAttr = 'member';
   public $groupMembershipsAttrMatchingUserAttr = 'dn';
 
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/tests/ldap_servers.test b/drupal7/sites/all/modules/ldap/ldap_servers/tests/ldap_servers.test
index 7abc5820..d2773529 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/tests/ldap_servers.test
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/tests/ldap_servers.test
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * simpletest for ldap servers
+ * Simpletest for ldap servers.
  */
 
 if (function_exists('ldap_servers_module_load_include')) {
@@ -11,19 +11,28 @@ if (function_exists('ldap_servers_module_load_include')) {
 else {
   module_load_include('php', 'ldap_test', 'LdapTestCase.class');
 }
-
+/**
+ *
+ */
 class LdapServersTestCase extends LdapTestCase {
+
+  /**
+   *
+   */
   public static function getInfo() {
-    return array(
+    return [
       'name' => 'LDAP Servers Tests',
       'description' => 'Test ldap servers.  Servers module is primarily a storage
         tool for ldap server configuration, so most of testing is just form and db testing.
         there are some api like functions that are also tested.',
-      'group' => 'LDAP Servers'
-    );
+      'group' => 'LDAP Servers',
+    ];
   }
 
-  function __construct($test_id = NULL) {
+  /**
+   *
+   */
+  public function __construct($test_id = NULL) {
     parent::__construct($test_id);
   }
 
@@ -31,35 +40,41 @@ class LdapServersTestCase extends LdapTestCase {
   protected $ldap_test_data;
 
   /**
-   *  create one or more server configurations in such as way
-   *  that this setUp can be a prerequisite for ldap_authentication and ldap_authorization
+   * Create one or more server configurations in such as way
+   *  that this setUp can be a prerequisite for ldap_authentication and ldap_authorization.
    */
-
-  function setUp() {
-    parent::setUp(array('ldap_test'));
+  public function setUp() {
+    parent::setUp(['ldap_test']);
     variable_set('ldap_simpletest', 2);
   }
 
-  function tearDown() {
+  /**
+   *
+   */
+  public function tearDown() {
     parent::tearDown();
     variable_del('ldap_help_watchdog_detail');
     variable_del('ldap_simpletest');
   }
 
+  /**
+   *
+   */
   public function testApiFunctions() {
 
     $group = 'ldap_servers: functions';
 
-    foreach (array('openldap1', 'activedirectory1') as $sid) { // , 'activedirectory1'
+    // , 'activedirectory1'.
+    foreach (['openldap1', 'activedirectory1'] as $sid) {
       $ldap_type = ($sid == 'openldap1') ? 'Open Ldap' : 'Active Directory';
-      $this->prepTestData('hogwarts', array($sid));
+      $this->prepTestData('hogwarts', [$sid]);
 
       $group = "ldap_servers: functions: $ldap_type";
-      $test_data = variable_get('ldap_test_server__' . $sid, array());
+      $test_data = variable_get('ldap_test_server__' . $sid, []);
       ldap_servers_module_load_include('php', 'ldap_test', 'LdapServerTest.class');
       $ldap_server = LdapServerTest::getLdapServerObjects($sid, NULL, TRUE);
 
-      // check against csv data rather than ldap array to make sure csv to ldap conversion is correct
+      // Check against csv data rather than ldap array to make sure csv to ldap conversion is correct.
       $user_csv_entry = $test_data['csv']['users']['101'];
       $user_dn = $user_csv_entry['dn'];
       $user_cn = $user_csv_entry['cn'];
@@ -68,7 +83,7 @@ class LdapServersTestCase extends LdapTestCase {
       $username = $ldap_server->userUsernameFromLdapEntry($user_ldap_entry);
       $this->assertTrue($username == $user_csv_entry['cn'], 'LdapServer::userUsernameFromLdapEntry works when LdapServer::user_attr attribute used', $group);
 
-      $bogus_ldap_entry = array();
+      $bogus_ldap_entry = [];
       $username = $ldap_server->userUsernameFromLdapEntry($bogus_ldap_entry);
       $this->assertTrue($username === FALSE, 'LdapServer::userUsernameFromLdapEntry fails correctly', $group);
 
@@ -78,24 +93,24 @@ class LdapServersTestCase extends LdapTestCase {
       $username = $ldap_server->userUsernameFromDn('bogus dn');
       $this->assertTrue($username === FALSE, 'LdapServer::userUsernameFromDn fails correctly', $group);
 
-      $desired = array();
-      $desired[0] = array(
+      $desired = [];
+      $desired[0] = [
         0 => 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu',
         1 => 'cn=students,ou=groups,dc=hogwarts,dc=edu',
         2 => 'cn=honors students,ou=groups,dc=hogwarts,dc=edu',
-      );
-      $desired[1] = array_merge($desired[0], array('cn=users,ou=groups,dc=hogwarts,dc=edu'));
+      ];
+      $desired[1] = array_merge($desired[0], ['cn=users,ou=groups,dc=hogwarts,dc=edu']);
 
-      foreach (array(0, 1) as $nested) {
+      foreach ([0, 1] as $nested) {
 
         $nested_display = ($nested) ? 'nested' : 'not nested';
         $desired_count = ($nested) ? 4 : 3;
-        $ldap_module_user_entry = array('attr' => $user_ldap_entry, 'dn' => $user_dn);
+        $ldap_module_user_entry = ['attr' => $user_ldap_entry, 'dn' => $user_dn];
         $groups_desired = $desired[$nested];
 
-        $suffix = ",desired=$desired_count, nested=" . (boolean)$nested;
+        $suffix = ",desired=$desired_count, nested=" . (boolean) $nested;
 
-        // test parent function groupMembershipsFromUser
+        // Test parent function groupMembershipsFromUser.
         $groups = $ldap_server->groupMembershipsFromUser($ldap_module_user_entry, 'group_dns', $nested);
         $count = count($groups);
         $diff1 = array_diff($groups_desired, $groups);
@@ -106,7 +121,7 @@ class LdapServersTestCase extends LdapTestCase {
           debug('groupMembershipsFromUser');debug($groups);  debug($diff1);  debug($diff2);  debug($groups_desired);
         }
 
-        // test parent groupUserMembershipsFromUserAttr, for openldap should be false, for ad should work
+        // Test parent groupUserMembershipsFromUserAttr, for openldap should be false, for ad should work.
         $groups = $ldap_server->groupUserMembershipsFromUserAttr($ldap_module_user_entry, $nested);
         $count = is_array($groups) ? count($groups) : $count;
         $pass = $count === FALSE;
@@ -128,22 +143,25 @@ class LdapServersTestCase extends LdapTestCase {
         $pass = (count($diff1) == 0 && count($diff2) == 0 && $count == $desired_count);
         $this->assertTrue($pass, "LdapServer::groupUserMembershipsFromEntry $nested_display works", $group . $suffix);
         if (!$pass) {
-          debug('groupUserMembershipsFromEntry'); debug($groups);  debug($diff1);  debug($diff2);  debug($groups_desired );
+          debug('groupUserMembershipsFromEntry'); debug($groups);  debug($diff1);  debug($diff2);  debug($groups_desired);
         }
       }
     }
   }
 
-
+  /**
+   *
+   */
   public function testInstall() {
     // TODO: Fix failing tests, excluding to make branch pass.
     return;
     $group = 'ldap_servers: install and uninstall';
-    $install_tables = array('ldap_servers');
-    // disable, uninstall, and enable/install module
-    $modules = array($this->module_name);
-    $ldap_module_uninstall_sequence = array('ldap_authentication', 'ldap_test', 'ldap_user', 'ldap_group', 'ldap_servers');
-    module_disable($ldap_module_uninstall_sequence); // disable dependent modules
+    $install_tables = ['ldap_servers'];
+    // disable, uninstall, and enable/install module.
+    $modules = [$this->module_name];
+    $ldap_module_uninstall_sequence = ['ldap_authentication', 'ldap_test', 'ldap_user', 'ldap_group', 'ldap_servers'];
+    // Disable dependent modules.
+    module_disable($ldap_module_uninstall_sequence);
     drupal_uninstall_modules($ldap_module_uninstall_sequence);
     module_enable($modules, TRUE);
     foreach ($install_tables as $table) {
@@ -152,48 +170,48 @@ class LdapServersTestCase extends LdapTestCase {
     $var_created = $this->assertTrue(TRUE, 'ldap_servers_encryption variable initialized', $group);
     $var_created = $this->assertTrue(variable_get('ldap_servers_encrypt_key', drupal_get_hash_salt()), 'ldap_servers_encrypt_key variable initialized', $group);
 
-    module_disable($modules, TRUE); // disable dependent modules
-    drupal_uninstall_modules($modules, TRUE); // unistall dependent modules
+    // Disable dependent modules.
+    module_disable($modules, TRUE);
+    // Unistall dependent modules.
+    drupal_uninstall_modules($modules, TRUE);
     foreach ($install_tables as $table) {
       $this->assertFalse(db_table_exists($table), $table . ' table removed', $group);
     }
     $var_created = $this->assertFalse(variable_get('ldap_servers_encryption', FALSE), 'ldap_servers_encryption variable removed', $group);
     $var_created = $this->assertFalse(variable_get('ldap_servers_encrypt_key', FALSE), 'ldap_servers_encrypt_key variable removed', $group);
 
-
-    // test tokens, see http://drupal.org/node/1245736
-    $ldap_entry = array(
+    // Test tokens, see http://drupal.org/node/1245736
+    $ldap_entry = [
       'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
-      'mail' => array( 0 => 'hpotter@hogwarts.edu', 'count' => 1),
-      'sAMAccountName' => array( 0 => 'hpotter', 'count' => 1),
-      'house' => array( 0 => 'Gryffindor', 1 => 'Privet Drive', 'count' => 2),
-      'guid' => array( 0 => 'sdafsdfsdf', 'count' => 1),
+      'mail' => [0 => 'hpotter@hogwarts.edu', 'count' => 1],
+      'sAMAccountName' => [0 => 'hpotter', 'count' => 1],
+      'house' => [0 => 'Gryffindor', 1 => 'Privet Drive', 'count' => 2],
+      'guid' => [0 => 'sdafsdfsdf', 'count' => 1],
       'count' => 3,
-    );
+    ];
 
     $this->ldapTestId = 'ldap_server.tokens';
 
     $dn = ldap_servers_token_replace($ldap_entry, '[dn]');
-    $this->assertTrue( $dn == $ldap_entry['dn'], t('[dn] token worked on ldap_servers_token_replace().'), $this->ldapTestId);
+    $this->assertTrue($dn == $ldap_entry['dn'], t('[dn] token worked on ldap_servers_token_replace().'), $this->ldapTestId);
 
     $house0 = ldap_servers_token_replace($ldap_entry, '[house:0]');
-    $this->assertTrue( $house0 == $ldap_entry['house'][0], t("[house:0] token worked ($house0) on ldap_servers_token_replace()."), $this->ldapTestId);
+    $this->assertTrue($house0 == $ldap_entry['house'][0], t("[house:0] token worked ($house0) on ldap_servers_token_replace()."), $this->ldapTestId);
 
     $mixed = ldap_servers_token_replace($ldap_entry, 'thisold[house:0]');
-    $this->assertTrue( $mixed == 'thisold' . $ldap_entry['house'][0], t("thisold[house:0] token worked ($mixed) on ldap_servers_token_replace()."), $this->ldapTestId);
+    $this->assertTrue($mixed == 'thisold' . $ldap_entry['house'][0], t("thisold[house:0] token worked ($mixed) on ldap_servers_token_replace()."), $this->ldapTestId);
 
     $compound = ldap_servers_token_replace($ldap_entry, '[samaccountname:0][house:0]');
-    $this->assertTrue( $compound == $ldap_entry['sAMAccountName'][0] . $ldap_entry['house'][0], t("[samaccountname:0][house:0] compound token worked ($mixed) on ldap_servers_token_replace()."), $this->ldapTestId);
-
+    $this->assertTrue($compound == $ldap_entry['sAMAccountName'][0] . $ldap_entry['house'][0], t("[samaccountname:0][house:0] compound token worked ($mixed) on ldap_servers_token_replace()."), $this->ldapTestId);
 
     $literalvalue = ldap_servers_token_replace($ldap_entry, 'literalvalue');
-    $this->assertTrue( $literalvalue == 'literalvalue', t("'literalvalue' token worked ($literalvalue) on ldap_servers_token_replace()."), $this->ldapTestId);
+    $this->assertTrue($literalvalue == 'literalvalue', t("'literalvalue' token worked ($literalvalue) on ldap_servers_token_replace()."), $this->ldapTestId);
 
     $house0 = ldap_servers_token_replace($ldap_entry, '[house]');
-    $this->assertTrue( $house0 == $ldap_entry['house'][0], t("[house] token worked ($house0) on ldap_servers_token_replace()."), $this->ldapTestId);
+    $this->assertTrue($house0 == $ldap_entry['house'][0], t("[house] token worked ($house0) on ldap_servers_token_replace()."), $this->ldapTestId);
 
     $house1 = ldap_servers_token_replace($ldap_entry, '[house:last]');
-    $this->assertTrue( $house1 == $ldap_entry['house'][1], t('[house:last] token worked on ldap_servers_token_replace().'), $this->ldapTestId);
+    $this->assertTrue($house1 == $ldap_entry['house'][1], t('[house:last] token worked on ldap_servers_token_replace().'), $this->ldapTestId);
 
     $sAMAccountName = ldap_servers_token_replace($ldap_entry, '[samaccountname:0]');
     $this->assertTrue($sAMAccountName == $ldap_entry['sAMAccountName'][0], t('[samaccountname:0] token worked on ldap_servers_token_replace().'), $this->ldapTestId);
@@ -218,88 +236,80 @@ class LdapServersTestCase extends LdapTestCase {
 
     $binary = ldap_servers_token_replace($ldap_entry, '[guid;binary]');
     $this->assertTrue($binary == ldap_servers_binary($ldap_entry['guid'][0]), t('[guid;binary] token worked on ldap_servers_token_replace().'), $this->ldapTestId);
-
-    /**
-     * @todo test tokens for 'user_account'
-     *
-    $account = new stdClass();
-    $account->
-    ldap_servers_token_replace($account, '[property.name]', 'user_account');
-     */
-
     module_enable($modules, TRUE);
   }
 
+  /**
+   *
+   */
   public function testUIForms() {
 
-    foreach (array(1) as $ctools_enabled) {
+    foreach ([1] as $ctools_enabled) {
       $this->ldapTestId = "testUIForms.ctools.$ctools_enabled";
       if ($ctools_enabled) {
-        module_enable(array('ctools'));
-      }
-      else {
-        // module_disable(array('ctools'));
+        module_enable(['ctools']);
       }
 
       $ldap_simpletest_initial = variable_get('ldap_simpletest', 2);
-      variable_del('ldap_simpletest'); // need to be out of fake server mode to test ui.
-      $this->privileged_user = $this->drupalCreateUser(array(
+      // Need to be out of fake server mode to test ui.
+      variable_del('ldap_simpletest');
+      $this->privileged_user = $this->drupalCreateUser([
         'administer site configuration',
-        ));
+      ]);
       $this->drupalLogin($this->privileged_user);
 
       $sid = 'server1';
-      $server_data = array();
-      $server_data[$sid] = array(
-        'sid'        => array($sid, $sid),
-        'name'       => array("Server $sid", "My Server $sid"),
-        'status'     => array(1, 1),
-        'ldap_type'  => array('openldap', 'ad'),
-        'address'    => array("${sid}.ldap.fake", "${sid}.ldap.fake"),
-        'port'       => array(389, 7000),
-        'tls'        => array(TRUE, FALSE),
-        'bind_method' => array(1, 3),
-        'binddn'  => array('cn=service-account,ou=people,dc=hogwarts,dc=edu', ''),
-        'bindpw'  => array('sdfsdafsdfasdf', 'sdfsdafsdfasdf'),
-        'user_attr' => array('sAMAccountName', 'blah'),
-        'account_name_attr' => array('sAMAccountName', 'blah'),
-        'mail_attr' => array('mail', ''),
-        'mail_template' => array('' , '[email]'),
-        'unique_persistent_attr' => array('dn', 'uniqueregistryid'),
-        'unique_persistent_attr_binary' => array(1, 1, 1, 1),
-        'user_dn_expression' => array('cn=%cn,%basedn', 'cn=%username,%basedn'),
-        'ldap_to_drupal_user' => array('code', 'different code'),
-
-        'testing_drupal_username' => array('hpotter', 'hpotter'),
-        'testing_drupal_user_dn' => array('cn=hpotter,ou=people,dc=hogwarts,dc=edu', 'cn=hpotter,ou=people,dc=hogwarts,dc=edu'),
-
-        'grp_unused' => array(FALSE, FALSE),
-        'grp_object_cat' => array('group', 'group'),
-        'grp_nested' => array(FALSE, FALSE),
-
-        'grp_user_memb_attr_exists' => array(1, 1),
-        'grp_user_memb_attr' => array('memberof', 'memberof'),
-
-        'grp_memb_attr' => array('member', 'member'),
-        'grp_memb_attr_match_user_attr' => array('dn', 'dn'),
-
-        'grp_derive_from_dn' => array(1, 1),
-        'grp_derive_from_dn_attr' => array('ou', 'ou'),
-
-        'grp_test_grp_dn' => array('cn=students,ou=groups,dc=hogwarts,dc=edu', 'cn=students,ou=groups,dc=hogwarts,dc=edu'),
-        'grp_test_grp_dn_writeable' => array('cn=students,ou=groups,dc=hogwarts,dc=edu', 'cn=students,ou=groups,dc=hogwarts,dc=edu'),
-
-      );
-
-      $lcase_transformed = array(
+      $server_data = [];
+      $server_data[$sid] = [
+        'sid'        => [$sid, $sid],
+        'name'       => ["Server $sid", "My Server $sid"],
+        'status'     => [1, 1],
+        'ldap_type'  => ['openldap', 'ad'],
+        'address'    => ["${sid}.ldap.fake", "${sid}.ldap.fake"],
+        'port'       => [389, 7000],
+        'tls'        => [TRUE, FALSE],
+        'bind_method' => [1, 3],
+        'binddn'  => ['cn=service-account,ou=people,dc=hogwarts,dc=edu', ''],
+        'bindpw'  => ['sdfsdafsdfasdf', 'sdfsdafsdfasdf'],
+        'user_attr' => ['sAMAccountName', 'blah'],
+        'account_name_attr' => ['sAMAccountName', 'blah'],
+        'mail_attr' => ['mail', ''],
+        'mail_template' => ['' , '[email]'],
+        'unique_persistent_attr' => ['dn', 'uniqueregistryid'],
+        'unique_persistent_attr_binary' => [1, 1, 1, 1],
+        'user_dn_expression' => ['cn=%cn,%basedn', 'cn=%username,%basedn'],
+        'ldap_to_drupal_user' => ['code', 'different code'],
+
+        'testing_drupal_username' => ['hpotter', 'hpotter'],
+        'testing_drupal_user_dn' => ['cn=hpotter,ou=people,dc=hogwarts,dc=edu', 'cn=hpotter,ou=people,dc=hogwarts,dc=edu'],
+
+        'grp_unused' => [FALSE, FALSE],
+        'grp_object_cat' => ['group', 'group'],
+        'grp_nested' => [FALSE, FALSE],
+
+        'grp_user_memb_attr_exists' => [1, 1],
+        'grp_user_memb_attr' => ['memberof', 'memberof'],
+
+        'grp_memb_attr' => ['member', 'member'],
+        'grp_memb_attr_match_user_attr' => ['dn', 'dn'],
+
+        'grp_derive_from_dn' => [1, 1],
+        'grp_derive_from_dn_attr' => ['ou', 'ou'],
+
+        'grp_test_grp_dn' => ['cn=students,ou=groups,dc=hogwarts,dc=edu', 'cn=students,ou=groups,dc=hogwarts,dc=edu'],
+        'grp_test_grp_dn_writeable' => ['cn=students,ou=groups,dc=hogwarts,dc=edu', 'cn=students,ou=groups,dc=hogwarts,dc=edu'],
+
+      ];
+
+      $lcase_transformed = [
         'user_attr',
         'account_name_attr',
         'mail_attr',
         'unique_persistent_attr',
         'grp_user_memb_attr',
         'grp_memb_attr_match_user_attr',
-        'grp_derive_from_dn_attr'
-        );
+        'grp_derive_from_dn_attr',
+      ];
 
       if (!module_exists('php')) {
         unset($server_data[$sid]['ldap_to_drupal_user']);
@@ -308,7 +318,7 @@ class LdapServersTestCase extends LdapTestCase {
       /** add server conf test **/
       $this->drupalGet('admin/config/people/ldap/servers/add');
 
-      $edit = array();
+      $edit = [];
       foreach ($server_data['server1'] as $input_name => $input_values) {
         $edit[$input_name] = $input_values[0];
       }
@@ -318,9 +328,8 @@ class LdapServersTestCase extends LdapTestCase {
       $ldap_servers = ldap_servers_get_servers(NULL, 'all', FALSE, TRUE);
       $this->assertTrue(count(array_keys($ldap_servers)) == 1, 'Add form for ldap server added server.', $this->ldapTestId . ' Add Server');
       $this->assertText('LDAP Server Server server1 added', 'Add form confirmation message', $this->ldapTestId . ' Add Server');
-      // assert one ldap server exists in db table
-
-      // assert load of server has correct properties for each input
+      // Assert one ldap server exists in db table
+      // Assert load of server has correct properties for each input.
       $mismatches = $this->compareFormToProperties($ldap_servers['server1'], $server_data['server1'], 0, $field_to_prop_map, $lcase_transformed);
       if (count($mismatches)) {
         debug('mismatches between ldap server properties and form submitted values');
@@ -330,12 +339,11 @@ class LdapServersTestCase extends LdapTestCase {
       }
       $this->assertTrue(count($mismatches) == 0, 'Add form for ldap server properties match values submitted.', $this->ldapTestId . ' Add Server');
 
-
       /** update server conf test **/
 
       $this->drupalGet('admin/config/people/ldap/servers/edit/server1');
 
-      $edit = array();
+      $edit = [];
       foreach ($server_data['server1'] as $input_name => $input_values) {
         if ($input_values[1] !== NULL) {
           $edit[$input_name] = $input_values[1];
@@ -346,10 +354,9 @@ class LdapServersTestCase extends LdapTestCase {
       $this->drupalPost('admin/config/people/ldap/servers/edit/server1', $edit, t('Update'));
       $ldap_servers = ldap_servers_get_servers(NULL, 'all', FALSE, TRUE);
       $this->assertTrue(count(array_keys($ldap_servers)) == 1, 'Update form for ldap server didnt delete or add another server.', $this->ldapTestId . '.Update Server');
-      // assert confirmation message without error
+      // Assert confirmation message without error
       // assert one ldap server exists in db table
-      // assert load of server has correct properties for each input
-     // unset($server_data['server1']['bindpw']);
+      // assert load of server has correct properties for each input.
       $mismatches = $this->compareFormToProperties($ldap_servers['server1'], $server_data['server1'], 1, $field_to_prop_map, $lcase_transformed);
       if (count($mismatches)) {
         debug('mismatches between ldap server properties and form submitted values'); debug($mismatches);
@@ -358,24 +365,31 @@ class LdapServersTestCase extends LdapTestCase {
 
       /** delete server conf test **/
       $this->drupalGet('admin/config/people/ldap/servers/delete/server1');
-      $this->drupalPost('admin/config/people/ldap/servers/delete/server1', array(), t('Delete'));
+      $this->drupalPost('admin/config/people/ldap/servers/delete/server1', [], t('Delete'));
 
       $ldap_servers = ldap_servers_get_servers(NULL, 'all', FALSE, TRUE);
 
       $this->assertTrue(count(array_keys($ldap_servers)) == 0, 'Delete form for ldap server deleted server.', $this->ldapTestId . '.Delete Server');
 
-      variable_set('ldap_simpletest', $ldap_simpletest_initial); // return to fake server mode
+      // Return to fake server mode.
+      variable_set('ldap_simpletest', $ldap_simpletest_initial);
     }
   }
 
+  /**
+   *
+   */
   public function serverConfCount() {
     $records = db_query('SELECT * FROM {ldap_servers}')->fetchAllAssoc('sid');
     return count(array_keys($records));
   }
 
+  /**
+   *
+   */
   public function compareFormToProperties($object, $data, $item_id, $map, $lcase_transformed) {
 
-    $mismatches = array();
+    $mismatches = [];
     foreach ($data as $field_id => $values) {
       $field_id = drupal_strtolower($field_id);
       if (!isset($map[$field_id])) {
@@ -387,9 +401,10 @@ class LdapServersTestCase extends LdapTestCase {
       }
       $property_value = $object->{$property};
 
-      $field_value = isset($values[$item_id + 2]) ? $values[$item_id + 2] : $values[$item_id]; // for cases where string input is not same as array.
+      // For cases where string input is not same as array.
+      $field_value = isset($values[$item_id + 2]) ? $values[$item_id + 2] : $values[$item_id];
 
-      if ($field_id == 'bindpw') {  //
+      if ($field_id == 'bindpw') {
         continue;
       }
       if ($field_id == 'basedn') {
@@ -423,5 +438,4 @@ class LdapServersTestCase extends LdapTestCase {
     return $mismatches;
   }
 
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/LdapServerTest.class.php b/drupal7/sites/all/modules/ldap/ldap_test/LdapServerTest.class.php
index f7ffb3ae..a2fe3883 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/LdapServerTest.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_test/LdapServerTest.class.php
@@ -2,12 +2,11 @@
 
 /**
  * @file
- * Simpletest ldapServer class for testing without an actual ldap server
- *
+ * Simpletest ldapServer class for testing without an actual ldap server.
  */
 
 /**
- * LDAP Server Class
+ * LDAP Server Class.
  *
  *  This class is used to create, work with, and eventually destroy ldap_server
  * objects.
@@ -16,28 +15,36 @@
  */
 
 ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServer.class');
-
+/**
+ *
+ */
 class LdapServerTest extends LdapServer {
 
   public $entries;
   public $methodResponses;
   public $searchResults;
-  public $binddn = FALSE; // Default to an anonymous bind.
-  public $bindpw = FALSE; // Default to an anonymous bind.
+  /**
+   * Default to an anonymous bind.
+   */
+  public $binddn = FALSE;
+  /**
+   * Default to an anonymous bind.
+   */
+  public $bindpw = FALSE;
 
   /**
-   * Constructor Method
+   * Constructor Method.
    *
-   * can take array of form property_name => property_value
+   * Can take array of form property_name => property_value
    * or $sid, where sid is used to derive the include file.
    */
-  function __construct($sid) {
+  public function __construct($sid) {
     if (!is_scalar($sid)) {
       $test_data = $sid;
       $sid = $test_data['sid'];
     }
     else {
-      $test_data = variable_get('ldap_test_server__' . $sid, array());
+      $test_data = variable_get('ldap_test_server__' . $sid, []);
     }
 
     $bindpw = (isset($test_data['bindpw'])) ? $test_data['bindpw'] : 'goodpwd';
@@ -46,42 +53,49 @@ class LdapServerTest extends LdapServer {
     $this->initDerivedProperties($bindpw);
   }
 
+  /**
+   *
+   */
   public function refreshFakeData() {
-    $test_data = variable_get('ldap_test_server__' . $this->sid, array());
-    $this->methodResponses = (is_array($test_data) && isset($test_data['methodResponses'])) ? $test_data['methodResponses'] : array();
-    $this->entries = (is_array($test_data) && isset($test_data['ldap'])) ? $test_data['ldap'] : array();
-    $this->searchResults = (isset($test_data['search_results'])) ? $test_data['search_results'] : array();
+    $test_data = variable_get('ldap_test_server__' . $this->sid, []);
+    $this->methodResponses = (is_array($test_data) && isset($test_data['methodResponses'])) ? $test_data['methodResponses'] : [];
+    $this->entries = (is_array($test_data) && isset($test_data['ldap'])) ? $test_data['ldap'] : [];
+    $this->searchResults = (isset($test_data['search_results'])) ? $test_data['search_results'] : [];
     $this->detailedWatchdogLog = variable_get('ldap_help_watchdog_detail', 0);
-    foreach ($test_data['properties'] as $property_name => $property_value ) {
+    foreach ($test_data['properties'] as $property_name => $property_value) {
       $this->{$property_name} = $property_value;
     }
-  //  $this->basedn = unserialize($this->basedn);
     if (isset($test_data['bindpw']) && $test_data['bindpw'] != '') {
       $this->bindpw = ldap_servers_decrypt($this->bindpw);
     }
   }
 
   /**
-   * Destructor Method
+   * Destructor Method.
    */
-  function __destruct() {
-     // if alterations to server configuration must be maintained throughout simpletest, variable_set('ldap_authorization_test_server__'. $sid, array());
+  public function __destruct() {
+    // If alterations to server configuration must be maintained throughout
+    // simpletest, Call:
+    // variable_set('ldap_authorization_test_server__'. $sid, []);.
   }
 
   /**
-   * Connect Method
+   * Connect Method.
    */
-  function connect() {
+  public function connect() {
     return $this->methodResponses['connect'];
   }
 
-
-  function bind($userdn = NULL, $pass = NULL, $anon_bind = FALSE) {
+  /**
+   *
+   */
+  public function bind($userdn = NULL, $pass = NULL, $anon_bind = FALSE) {
     $userdn = ($userdn != NULL) ? $userdn : $this->binddn;
     $pass = ($pass != NULL) ? $pass : $this->bindpw;
 
-    if (! isset($this->entries[$userdn])) {
-      $ldap_errno = LDAP_NO_SUCH_OBJECT;  // 0x20 or 32
+    if (!isset($this->entries[$userdn])) {
+      // 0x20 or 32.
+      $ldap_errno = LDAP_NO_SUCH_OBJECT;
       if (function_exists('ldap_err2str')) {
         $ldap_error = ldap_err2str($ldap_errno);
       }
@@ -96,7 +110,7 @@ class LdapServerTest extends LdapServer {
       if (!$pass) {
         debug("Simpletest failure for $userdn.  No password submitted");
       }
-      if (! isset($this->entries[$userdn]['password'][0])) {
+      if (!isset($this->entries[$userdn]['password'][0])) {
         debug("Simpletest failure for $userdn.  No password in entry to test for bind"); debug($this->entries[$userdn]);
       }
       $ldap_errno = LDAP_INVALID_CREDENTIALS;
@@ -108,7 +122,7 @@ class LdapServerTest extends LdapServer {
       }
     }
 
-    $watchdog_tokens = array('%user' => $userdn, '%errno' => $ldap_errno, '%error' => $ldap_error);
+    $watchdog_tokens = ['%user' => $userdn, '%errno' => $ldap_errno, '%error' => $ldap_error];
     watchdog('ldap_servers', "LDAP bind failure for user %user. Error %errno: %error", $watchdog_tokens);
     return $ldap_errno;
 
@@ -117,7 +131,7 @@ class LdapServerTest extends LdapServer {
   /**
    * Disconnect (unbind) from an active LDAP server.
    */
-  function disconnect() {
+  public function disconnect() {
 
   }
 
@@ -125,9 +139,9 @@ class LdapServerTest extends LdapServer {
    * Perform an LDAP search.
    *
    * @param string $filter
-   *   The search filter. such as sAMAccountName=jbarclay
+   *   The search filter. such as sAMAccountName=jbarclay.
    * @param string $basedn
-   *   The search base. If NULL, we use $this->basedn
+   *   The search base. If NULL, we use $this->basedn.
    * @param array $attributes
    *   List of desired attributes. If omitted, we only return "dn".
    *
@@ -135,15 +149,16 @@ class LdapServerTest extends LdapServer {
    *   An array of matching entries->attributes, or FALSE if the search is
    *   empty.
    */
-  function search($base_dn = NULL, $filter, $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER, $scope = LDAP_SCOPE_SUBTREE) {
+  public function search($base_dn = NULL, $filter, $attributes = [], $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER, $scope = LDAP_SCOPE_SUBTREE) {
 
-    $lcase_attribute = array();
+    $lcase_attribute = [];
     foreach ($attributes as $i => $attribute_name) {
       $lcase_attribute[] = drupal_strtolower($attribute_name);
     }
     $attributes = $lcase_attribute;
 
-    $filter = trim(str_replace(array("\n", "  "), array('', ''), $filter)); // for test matching simplicity remove line breaks and tab spacing
+    // For test matching simplicity remove line breaks and tab spacing.
+    $filter = trim(str_replace(["\n", "  "], ['', ''], $filter));
 
     if ($base_dn == NULL) {
       if (count($this->basedn) == 1) {
@@ -177,11 +192,11 @@ class LdapServerTest extends LdapServer {
      */
     $base_dn = drupal_strtolower($base_dn);
     $filter = trim($filter, "()");
-    $subqueries = array();
+    $subqueries = [];
     $operand = FALSE;
 
     if (strpos($filter, '&') === 0) {
-     /**
+      /**
      * case 2.A.: filter of form (&(<attribute>=<value>)(<attribute>=<value>)(<attribute>=<value>))
      *  such as (&(samaccountname=hpotter)(samaccountname=hpotter)(samaccountname=hpotter))
      */
@@ -194,7 +209,7 @@ class LdapServerTest extends LdapServer {
       }
     }
     elseif (strpos($filter, '|') === 0) {
-     /**
+      /**
      * case 2.B: filter of form (|(<attribute>=<value>)(<attribute>=<value>)(<attribute>=<value>))
      *  such as (|(samaccountname=hpotter)(samaccountname=hpotter)(samaccountname=hpotter))
      */
@@ -208,7 +223,7 @@ class LdapServerTest extends LdapServer {
       }
     }
     elseif (count(explode('=', $filter)) == 2) {
-     /**
+      /**
      * case 2.C.: filter of form (<attribute>=<value>)
      *  such as (samaccountname=hpotter)
      */
@@ -219,11 +234,8 @@ class LdapServerTest extends LdapServer {
       return FALSE;
     }
 
-
-
-
-    // need to perform feaux ldap search here with data in
-    $results = array();
+    // Need to perform feaux ldap search here with data in.
+    $results = [];
 
     if ($operand == '|') {
       foreach ($subqueries as $i => $subquery) {
@@ -232,18 +244,18 @@ class LdapServerTest extends LdapServer {
         foreach ($this->entries as $dn => $entry) {
           $dn_lcase = drupal_strtolower($dn);
 
-          // if not in basedn, skip
+          // If not in basedn, skip
           // eg. basedn ou=campus accounts,dc=ad,dc=myuniversity,dc=edu
           // should be leftmost string in:
-          // cn=jdoe,ou=campus accounts,dc=ad,dc=myuniversity,dc=edu
-          //$pos = strpos($dn_lcase, $base_dn);
+          // cn=jdoe,ou=campus accounts,dc=ad,dc=myuniversity,dc=edu.
           $substring = strrev(substr(strrev($dn_lcase), 0, strlen($base_dn)));
           $cascmp = strcasecmp($base_dn, $substring);
           if ($cascmp !== 0) {
 
-            continue; // not in basedn
+            // Not in basedn.
+            continue;
           }
-          // if doesn't filter attribute has no data, continue
+          // If doesn't filter attribute has no data, continue.
           $attr_value_to_compare = FALSE;
           foreach ($entry as $attr_name => $attr_value) {
             if (drupal_strtolower($attr_name) == $filter_attribute) {
@@ -258,7 +270,7 @@ class LdapServerTest extends LdapServer {
           // match!
           $entry['dn'] = $dn;
           if ($attributes) {
-            $selected_data = array();
+            $selected_data = [];
             foreach ($attributes as $i => $attr_name) {
               $selected_data[$attr_name] = (isset($entry[$attr_name])) ? $entry[$attr_name] : NULL;
             }
@@ -270,10 +282,12 @@ class LdapServerTest extends LdapServer {
         }
       }
     }
-    elseif ($operand == '&') { // reverse the loops
+    // Reverse the loops.
+    elseif ($operand == '&') {
       foreach ($this->entries as $dn => $entry) {
         $dn_lcase = drupal_strtolower($dn);
-        $match = TRUE; // until 1 subquery fails
+        // Until 1 subquery fails.
+        $match = TRUE;
         foreach ($subqueries as $i => $subquery) {
           $filter_attribute = drupal_strtolower($subquery[0]);
           $filter_value = $subquery[1];
@@ -282,9 +296,10 @@ class LdapServerTest extends LdapServer {
           $cascmp = strcasecmp($base_dn, $substring);
           if ($cascmp !== 0) {
             $match = FALSE;
-            break; // not in basedn
+            // Not in basedn.
+            break;
           }
-          // if doesn't filter attribute has no data, continue
+          // If doesn't filter attribute has no data, continue.
           $attr_value_to_compare = FALSE;
           foreach ($entry as $attr_name => $attr_value) {
             if (drupal_strtolower($attr_name) == $filter_attribute) {
@@ -294,14 +309,15 @@ class LdapServerTest extends LdapServer {
           }
           if (!$attr_value_to_compare || drupal_strtolower($attr_value_to_compare[0]) != $filter_value) {
             $match = FALSE;
-            break; // not in basedn
+            // Not in basedn.
+            break;
           }
 
         }
         if ($match === TRUE) {
           $entry['dn'] = $dn;
           if ($attributes) {
-            $selected_data = array();
+            $selected_data = [];
             foreach ($attributes as $i => $attr_name) {
               $selected_data[$attr_name] = (isset($entry[$attr_name])) ? $entry[$attr_name] : NULL;
             }
@@ -318,17 +334,18 @@ class LdapServerTest extends LdapServer {
     return $results;
   }
 
-/**
- * does dn exist for this server?
- *
- * @param string $dn
- * @param enum $return = 'boolean' or 'ldap_entry'
- *
- * @param return FALSE or ldap entry array
- */
-  function dnExists($find_dn, $return = 'boolean', $attributes = array('objectclass')) {
+  /**
+   * Does dn exist for this server?
+   *
+   * @param string $dn
+   * @param enum $return
+   *   = 'boolean' or 'ldap_entry'.
+   *
+   * @param return FALSE or ldap entry array
+   */
+  public function dnExists($find_dn, $return = 'boolean', $attributes = ['objectclass']) {
     $this->refreshFakeData();
-    $test_data = variable_get('ldap_test_server__' . $this->sid, array());
+    $test_data = variable_get('ldap_test_server__' . $this->sid, []);
     foreach ($this->entries as $entry_dn => $entry) {
       $match = (strcasecmp($entry_dn, $find_dn) == 0);
 
@@ -336,22 +353,28 @@ class LdapServerTest extends LdapServer {
         return ($return == 'boolean') ? TRUE : $entry;
       }
     }
-    return FALSE; // not match found in loop
+    // Not match found in loop.
+    return FALSE;
 
   }
 
+  /**
+   *
+   */
   public function countEntries($ldap_result) {
     return ldap_count_entries($this->connection, $ldap_result);
   }
 
-
+  /**
+   *
+   */
   public static function getLdapServerObjects($sid = NULL, $type = NULL, $flatten = FALSE) {
-    $servers = array();
+    $servers = [];
     if ($sid) {
       $servers[$sid] = new LdapServerTest($sid);
     }
     else {
-      $server_ids = variable_get('ldap_test_servers', array());
+      $server_ids = variable_get('ldap_test_servers', []);
       foreach ($server_ids as $sid => $_sid) {
         $servers[$sid] = new LdapServerTest($sid);
       }
@@ -365,21 +388,21 @@ class LdapServerTest extends LdapServer {
     }
   }
 
-
   /**
-   * create ldap entry.
+   * Create ldap entry.
    *
-   * @param array $ldap_entry should follow the structure of ldap_add functions
+   * @param array $ldap_entry
+   *   should follow the structure of ldap_add functions
    *   entry array: http://us.php.net/manual/en/function.ldap-add.php
-        $attributes["attribute1"] = "value";
-        $attributes["attribute2"][0] = "value1";
-        $attributes["attribute2"][1] = "value2";
+   *   $attributes["attribute1"] = "value";
+   *   $attributes["attribute2"][0] = "value1";
+   *   $attributes["attribute2"][1] = "value2";.
+   *
    * @return boolean result
    */
-
   public function createLdapEntry($ldap_entry, $dn = NULL) {
     $result = FALSE;
-    $test_data = variable_get('ldap_test_server__' . $this->sid, array());
+    $test_data = variable_get('ldap_test_server__' . $this->sid, []);
 
     if (isset($ldap_entry['dn'])) {
       $dn = $ldap_entry['dn'];
@@ -396,11 +419,14 @@ class LdapServerTest extends LdapServer {
     return $result;
   }
 
-  function modifyLdapEntry($dn, $attributes = NULL, $old_attributes = FALSE) {
+  /**
+   *
+   */
+  public function modifyLdapEntry($dn, $attributes = NULL, $old_attributes = FALSE) {
     if (!$attributes) {
-      $attributes = array();
+      $attributes = [];
     }
-    $test_data = variable_get('ldap_test_server__' . $this->sid, array());
+    $test_data = variable_get('ldap_test_server__' . $this->sid, []);
     if (!isset($test_data['entries'][$dn])) {
       return FALSE;
     }
@@ -441,19 +467,18 @@ class LdapServerTest extends LdapServer {
 
   }
 
-    /**
+  /**
    * Perform an LDAP delete.
    *
    * @param string $dn
    *
    * @return boolean result per ldap_delete
    */
-
   public function delete($dn) {
 
-    $test_data = variable_get('ldap_test_server__' . $this->sid, array());
+    $test_data = variable_get('ldap_test_server__' . $this->sid, []);
     $deleted = FALSE;
-    foreach (array('entries', 'users', 'groups', 'ldap') as $test_data_sub_array) {
+    foreach (['entries', 'users', 'groups', 'ldap'] as $test_data_sub_array) {
       if (isset($test_data[$test_data_sub_array][$dn])) {
         unset($test_data[$test_data_sub_array][$dn]);
         $deleted = TRUE;
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/LdapTestCase.class.php b/drupal7/sites/all/modules/ldap/ldap_test/LdapTestCase.class.php
index 430a3b48..c195ec1b 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/LdapTestCase.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_test/LdapTestCase.class.php
@@ -1,21 +1,22 @@
 <?php
 
-
-
 /**
  * @file
- * simpletest class for LDAP simpletests
- *
+ * Simpletest class for LDAP simpletests.
  */
 
 module_load_include('php', 'ldap_test', 'LdapTestFunctions.class');
-
+/**
+ *
+ */
 class LdapTestCase extends DrupalWebTestCase {
 
   public $testFunctions;
   public $module_name;
 
-  // storage for test data
+  /**
+   * Storage for test data.
+   */
   public $useFeatureData;
   public $featurePath;
   public $featureName;
@@ -24,16 +25,25 @@ class LdapTestCase extends DrupalWebTestCase {
   public $ldapTestId;
   public $authorizationData;
   public $authenticationData;
-  public $testData = array();
+  public $testData = [];
 
-  public $sid; // current, or only, sid
+  /**
+   * Current, or only, sid.
+   */
+  public $sid;
 
-  function __construct($test_id = NULL) {
+  /**
+   *
+   */
+  public function __construct($test_id = NULL) {
     parent::__construct($test_id);
     $this->testFunctions = new LdapTestFunctions();
   }
 
-  function setUp() {
+  /**
+   *
+   */
+  public function setUp() {
     $modules = func_get_args();
     if (isset($modules[0]) && is_array($modules[0])) {
       $modules = $modules[0];
@@ -45,29 +55,38 @@ class LdapTestCase extends DrupalWebTestCase {
 
   }
 
-  function tearDown() {
+  /**
+   *
+   */
+  public function tearDown() {
     parent::tearDown();
     variable_del('ldap_help_watchdog_detail');
     variable_del('ldap_simpletest');
   }
 
   /**
-   * setup configuration and fake test data for all ldap modules
+   * Setup configuration and fake test data for all ldap modules.
    *
-   * @param  string $test_ldap_id name of directory in ldap_test where data is (e.g. hogwarts)
+   * @param string $test_ldap_id
+   *   name of directory in ldap_test where data is (e.g. hogwarts)
    *
-   * the following params are ids that indicate what config data in /ldap_test/<module_name>.conf.inc to use
-   * for example if $ldap_user_conf_id = 'ad_authentication', the array /ldap_test/ldap_user.conf.inc with the key
-   *  'ad_authentication' will be used for the user module cofiguration
+   *   the following params are ids that indicate what config data in /ldap_test/<module_name>.conf.inc to use
+   *   for example if $ldap_user_conf_id = 'ad_authentication', the array /ldap_test/ldap_user.conf.inc with the key
+   *   'ad_authentication' will be used for the user module cofiguration.
    *
-   * @param array $sids to setup
+   * @param array $sids
+   *   to setup.
    * @param string $ldap_user_conf_id
-   * @param string $ldap_authentication_conf_id = NULL,
-   * @param string $ldap_authorization_conf_id = NULL,
-   * @param string $ldap_feeds_conf_id = NULL,
-   * @param string $ldap_query_conf_id = NULL
+   * @param string $ldap_authentication_conf_id
+   *   = NULL,.
+   * @param string $ldap_authorization_conf_id
+   *   = NULL,.
+   * @param string $ldap_feeds_conf_id
+   *   = NULL,.
+   * @param string $ldap_query_conf_id
+   *   = NULL.
    */
-  function prepTestData(
+  public function prepTestData(
       $test_ldap_id,
       $sids,
       $ldap_user_conf_id = NULL,
@@ -102,7 +121,7 @@ class LdapTestCase extends DrupalWebTestCase {
   }
 
   /**
-   * attempt to derive a testid from backtrace
+   * Attempt to derive a testid from backtrace.
    */
   public function testId($description = NULL, $method = NULL) {
 
@@ -113,7 +132,8 @@ class LdapTestCase extends DrupalWebTestCase {
       $test_id = NULL;
       $i = 0;
     }
-    elseif ($test_id)  { // default test id
+    // Default test id.
+    elseif ($test_id) {
       $i++;
       return $test_id . '.' . $i;
     }
@@ -127,44 +147,51 @@ class LdapTestCase extends DrupalWebTestCase {
       $method = str_replace('test', '', $method, $count);
     }
 
-    $test_id = join(".", array($this->module_name, $method, $description));
+    $test_id = join(".", [$this->module_name, $method, $description]);
     return $test_id;
 
   }
+
+  /**
+   *
+   */
   public function removeUserFromGroup(&$test_data, $user_dn, $group_dn, $domain = "dc=hogwarts,dc=edu") {
 
-      $filter = "(&(objectClass=group)(member=$user_dn))";
-      if (!empty($test_data['search_results'][$filter][$domain]) &&
+    $filter = "(&(objectClass=group)(member=$user_dn))";
+    if (!empty($test_data['search_results'][$filter][$domain]) &&
             in_array($group_dn, $test_data['search_results'][$filter][$domain])) {
-        $test_data['search_results'][$filter][$domain] = array_diff($test_data['search_results'][$filter][$domain], array($group_dn));
-        $test_data['search_results'][$filter][$domain]['count'] = count($test_data['search_results'][$filter][$domain] - 1);
-      }
+      $test_data['search_results'][$filter][$domain] = array_diff($test_data['search_results'][$filter][$domain], [$group_dn]);
+      $test_data['search_results'][$filter][$domain]['count'] = count($test_data['search_results'][$filter][$domain] - 1);
+    }
 
-      if (!empty($test_data['users'][$user_dn]['attr']['memberof']) && in_array($group_dn, $test_data['users'][$user_dn]['attr']['memberof'])) {
-        $test_data['users'][$user_dn]['attr']['memberof'] = array_diff($test_data['users'][$user_dn]['attr']['memberof'], array($group_dn));
-        $test_data['users'][$user_dn]['attr']['memberof']['count'] = count($test_data['users'][$user_dn]['attr']['memberof'] - 1);
-      }
+    if (!empty($test_data['users'][$user_dn]['attr']['memberof']) && in_array($group_dn, $test_data['users'][$user_dn]['attr']['memberof'])) {
+      $test_data['users'][$user_dn]['attr']['memberof'] = array_diff($test_data['users'][$user_dn]['attr']['memberof'], [$group_dn]);
+      $test_data['users'][$user_dn]['attr']['memberof']['count'] = count($test_data['users'][$user_dn]['attr']['memberof'] - 1);
+    }
 
-      if (!empty($test_data['ldap'][$user_dn]['memberof']) && in_array($group_dn, $test_data['ldap'][$user_dn]['memberof'])) {
-        $test_data['ldap'][$user_dn]['memberof'] = array_diff($test_data['ldap'][$user_dn]['memberof'], array($group_dn));
-        $test_data['ldap'][$user_dn]['memberof']['count'] = count($test_data['ldap'][$user_dn]['memberof']) - 1;
-      }
+    if (!empty($test_data['ldap'][$user_dn]['memberof']) && in_array($group_dn, $test_data['ldap'][$user_dn]['memberof'])) {
+      $test_data['ldap'][$user_dn]['memberof'] = array_diff($test_data['ldap'][$user_dn]['memberof'], [$group_dn]);
+      $test_data['ldap'][$user_dn]['memberof']['count'] = count($test_data['ldap'][$user_dn]['memberof']) - 1;
+    }
 
-      if (!empty($test_data['groups'][$group_dn]['attr']['member']) && in_array($group_dn, $test_data['groups'][$group_dn]['attr']['member']) ) {
-        $members = array_diff($test_data['groups'][$group_dn]['attr']['member'], array($group_dn));
-        $test_data['groups'][$group_dn]['attr']['member'] = $members;
-        $test_data['groups'][$group_dn]['attr']['member'][$i]['count'] = count($members - 1);
-      }
+    if (!empty($test_data['groups'][$group_dn]['attr']['member']) && in_array($group_dn, $test_data['groups'][$group_dn]['attr']['member'])) {
+      $members = array_diff($test_data['groups'][$group_dn]['attr']['member'], [$group_dn]);
+      $test_data['groups'][$group_dn]['attr']['member'] = $members;
+      $test_data['groups'][$group_dn]['attr']['member'][$i]['count'] = count($members - 1);
     }
+  }
 
+  /**
+   *
+   */
   public function AttemptLogonNewUser($name, $goodpwd = TRUE) {
 
     $this->drupalLogout();
 
-    $edit = array(
+    $edit = [
       'name' => $name,
       'pass' => ($goodpwd) ? "goodpwd" : "badpwd",
-    );
+    ];
     $user = user_load_by_name($name);
     if ($user) {
       user_delete($user->uid);
@@ -173,12 +200,11 @@ class LdapTestCase extends DrupalWebTestCase {
   }
 
   /**
-   * keep user entity fields function for ldap_user
+   * Keep user entity fields function for ldap_user
    * in base class instead of user test class in case
-   * module integration testing is needed
+   * module integration testing is needed.
    */
-
-  function createTestUserFields() {
+  public function createTestUserFields() {
     foreach ($this->ldap_user_test_entity_fields() as $field_id => $field_conf) {
       $field_info = field_info_field($field_id);
       if (!$field_info) {
@@ -189,147 +215,152 @@ class LdapTestCase extends DrupalWebTestCase {
     }
   }
 
-  function ldap_user_test_entity_fields() {
+  /**
+   *
+   */
+  public function ldap_user_test_entity_fields() {
 
-    $fields = array();
+    $fields = [];
 
-    $fields['field_lname']['field'] = array(
+    $fields['field_lname']['field'] = [
       'field_name' => 'field_lname',
       'type' => 'text',
-      'settings' => array(
+      'settings' => [
         'max_length' => 64,
-      )
-    );
+      ],
+    ];
 
-    $fields['field_lname']['instance'] = array(
+    $fields['field_lname']['instance'] = [
       'field_name' => 'field_lname',
       'entity_type' => 'user',
       'label' => 'Last Name',
       'bundle' => 'user',
       'required' => FALSE,
-      'widget' => array(
+      'widget' => [
         'type' => 'text_textfield',
-      ),
-      'display' => array(
-        'default' => array(
+      ],
+      'display' => [
+        'default' => [
           'type' => 'text_default',
-        ),
-      ),
-      'settings' => array('user_register_form' => FALSE)
-    );
+        ],
+      ],
+      'settings' => ['user_register_form' => FALSE],
+    ];
 
-  $fields['field_department']['field'] = array(
+    $fields['field_department']['field'] = [
       'field_name' => 'field_department',
       'type' => 'text',
-      'settings' => array(
+      'settings' => [
         'max_length' => 64,
-      )
-    );
+      ],
+    ];
 
-    $fields['field_department']['instance'] = array(
+    $fields['field_department']['instance'] = [
       'field_name' => 'field_department',
       'entity_type' => 'user',
       'label' => 'Department',
       'bundle' => 'user',
       'required' => FALSE,
-      'widget' => array(
+      'widget' => [
         'type' => 'text_textfield',
-      ),
-      'display' => array(
-        'default' => array(
+      ],
+      'display' => [
+        'default' => [
           'type' => 'text_default',
-        ),
-      ),
-      'settings' => array('user_register_form' => FALSE)
-    );
+        ],
+      ],
+      'settings' => ['user_register_form' => FALSE],
+    ];
 
-
-    $fields['field_fname']['field'] = array(
+    $fields['field_fname']['field'] = [
       'field_name' => 'field_fname',
       'type' => 'text',
-      'settings' => array(
+      'settings' => [
         'max_length' => 64,
-      )
-    );
+      ],
+    ];
 
-    $fields['field_fname']['instance'] = array(
+    $fields['field_fname']['instance'] = [
       'field_name' => 'field_fname',
       'entity_type' => 'user',
       'label' => 'Last Name',
       'bundle' => 'user',
       'required' => FALSE,
-      'widget' => array(
+      'widget' => [
         'type' => 'text_textfield',
-      ),
-      'display' => array(
-        'default' => array(
+      ],
+      'display' => [
+        'default' => [
           'type' => 'text_default',
-        ),
-      ),
-      'settings' => array('user_register_form' => FALSE)
-    );
+        ],
+      ],
+      'settings' => ['user_register_form' => FALSE],
+    ];
 
-    // display name for testing compound tokens
-    $fields['field_display_name']['field'] = array(
+    // Display name for testing compound tokens.
+    $fields['field_display_name']['field'] = [
       'field_name' => 'field_display_name',
       'type' => 'text',
-      'settings' => array(
+      'settings' => [
         'max_length' => 64,
-      )
-    );
+      ],
+    ];
 
-    $fields['field_display_name']['instance'] = array(
+    $fields['field_display_name']['instance'] = [
       'field_name' => 'field_display_name',
       'entity_type' => 'user',
       'label' => 'Display Name',
       'bundle' => 'user',
       'required' => FALSE,
-      'widget' => array(
+      'widget' => [
         'type' => 'text_textfield',
-      ),
-      'display' => array(
-        'default' => array(
+      ],
+      'display' => [
+        'default' => [
           'type' => 'text_default',
-        ),
-      ),
-      'settings' => array('user_register_form' => FALSE)
-    );
+        ],
+      ],
+      'settings' => ['user_register_form' => FALSE],
+    ];
 
-    // display name for testing compound tokens
-    $fields['field_binary_test']['field'] = array(
+    // Display name for testing compound tokens.
+    $fields['field_binary_test']['field'] = [
       'field_name' => 'field_binary_test',
       'type' => 'text',
       'size' => 'big',
-    );
+    ];
 
-    $fields['field_binary_test']['instance'] = array(
+    $fields['field_binary_test']['instance'] = [
       'field_name' => 'field_binary_test',
       'entity_type' => 'user',
       'label' => 'Binary Field',
       'bundle' => 'user',
       'required' => FALSE,
-      'widget' => array(
+      'widget' => [
         'type' => 'text_textfield',
-      ),
-      'display' => array(
-        'default' => array(
+      ],
+      'display' => [
+        'default' => [
           'type' => 'text_default',
-        ),
-      ),
-      'settings' => array('user_register_form' => FALSE)
-    );
+        ],
+      ],
+      'settings' => ['user_register_form' => FALSE],
+    ];
 
     return $fields;
 
   }
 
+  /**
+   *
+   */
   public function checkConsumerConfSetup($conf_id) {
 
     $authorization_data = ldap_test_ldap_authorization_data();
     $props_set_correctly = TRUE;
 
     foreach ($authorization_data[$conf_id] as $consumer_type => $conf) {
-      $props_set_display = array();
+      $props_set_display = [];
       foreach ($conf as $prop => $values) {
         if (!property_exists($this->consumerAdminConf[$consumer_type], $prop)) {
           $props_set_correctly = FALSE;
@@ -347,13 +378,15 @@ class LdapTestCase extends DrupalWebTestCase {
       }
     }
 
-    return array($props_set_display, $props_set_correctly);
+    return [$props_set_display, $props_set_correctly];
   }
 
-
+  /**
+   *
+   */
   public function compareFormToProperties($object, $data, $item_id, $map, $lcase_transformed) {
 
-    $mismatches = array();
+    $mismatches = [];
     foreach ($data as $field_id => $values) {
       $field_id = drupal_strtolower($field_id);
       if (!isset($map[$field_id])) {
@@ -365,7 +398,8 @@ class LdapTestCase extends DrupalWebTestCase {
       }
       $property_value = $object->{$property};
 
-      $field_value = isset($values[$item_id + 2]) ? $values[$item_id + 2] : $values[$item_id]; // for cases where string input is not same as array.
+      // For cases where string input is not same as array.
+      $field_value = isset($values[$item_id + 2]) ? $values[$item_id + 2] : $values[$item_id];
 
       if (in_array($field_id, $lcase_transformed) && is_scalar($field_value)) {
         $field_value = drupal_strtolower($field_value);
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/LdapTestFunctions.class.php b/drupal7/sites/all/modules/ldap/ldap_test/LdapTestFunctions.class.php
index 41c987bb..6219cbc3 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/LdapTestFunctions.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_test/LdapTestFunctions.class.php
@@ -2,25 +2,31 @@
 
 /**
  * @file
- *
- * utility functions for ldap simpletests
+ * Utility functions for ldap simpletests.
  * @todo could be moved into LdapTestCase.class.php
- *
  */
 
-require_once('ldap_servers.conf.inc');
-require_once('ldap_user.conf.inc');
-require_once('ldap_authentication.conf.inc');
-require_once('ldap_authorization.conf.inc');
-
-class LdapTestFunctions  {
+require_once 'ldap_servers.conf.inc';
+require_once 'ldap_user.conf.inc';
+require_once 'ldap_authentication.conf.inc';
+require_once 'ldap_authorization.conf.inc';
+/**
+ *
+ */
+class LdapTestFunctions {
 
-  public $data = array();
-  public $ldapData = array();  // data in ldap array format, but keyed on dn
-  public $csvTables = array();
+  public $data = [];
+  /**
+   * Data in ldap array format, but keyed on dn.
+   */
+  public $ldapData = [];
+  public $csvTables = [];
   public $ldapTypeConf;
 
-  function __construct() {
+  /**
+   *
+   */
+  public function __construct() {
     module_load_include('module', 'ldap_servers');
     $this->data['ldap_servers'] = ldap_test_ldap_servers_data();
     module_load_include('module', 'ldap_user');
@@ -31,7 +37,10 @@ class LdapTestFunctions  {
     $this->data['ldap_authentication'] = ldap_test_ldap_authentication_data();
   }
 
-  function configureLdapServers($sids, $feetures = FALSE, $feature_name = NULL) {
+  /**
+   *
+   */
+  public function configureLdapServers($sids, $feetures = FALSE, $feature_name = NULL) {
     foreach ($sids as $i => $sid) {
       $current_sids[$sid] = $sid;
       variable_set('ldap_test_server__' . $sid, $this->data['ldap_servers'][$sid]);
@@ -39,28 +48,40 @@ class LdapTestFunctions  {
     variable_set('ldap_test_servers', $current_sids);
   }
 
-  function setFakeServerProperty($sid, $prop, $value) {
-    $test_data = variable_get('ldap_test_server__' . $sid, array());
+  /**
+   *
+   */
+  public function setFakeServerProperty($sid, $prop, $value) {
+    $test_data = variable_get('ldap_test_server__' . $sid, []);
     $test_data['properties'][$prop] = $value;
     variable_set('ldap_test_server__' . $sid, $test_data);
   }
 
-  function setFakeServerUserAttribute($sid, $dn, $attr_name, $attr_value, $i=0) {
+  /**
+   *
+   */
+  public function setFakeServerUserAttribute($sid, $dn, $attr_name, $attr_value, $i = 0) {
     $attr_name = drupal_strtolower($attr_name);
-    $test_data = variable_get('ldap_test_server__' . $sid, array());
+    $test_data = variable_get('ldap_test_server__' . $sid, []);
 
     $test_data['entries'][$dn][$attr_name][$i] = $attr_value;
-    $count_set = (int)isset($test_data['entries'][$dn][$attr_name]['count']);
-    $test_data['entries'][$dn][$attr_name]['count'] = count($test_data['entries'][$dn][$attr_name]) - $count_set; // don't count the 'count'
+    $count_set = (int) isset($test_data['entries'][$dn][$attr_name]['count']);
+    // don't count the 'count'.
+    $test_data['entries'][$dn][$attr_name]['count'] = count($test_data['entries'][$dn][$attr_name]) - $count_set;
 
     $test_data['ldap'][$dn][$attr_name][$i] = $attr_value;
-    $count_set = (int)isset($test_data['ldap'][$dn][$attr_name]['count']);
-    $test_data['ldap'][$dn][$attr_name]['count'] = count($test_data['ldap'][$dn][$attr_name]) - $count_set; // don't count the 'count'
+    $count_set = (int) isset($test_data['ldap'][$dn][$attr_name]['count']);
+    // don't count the 'count'.
+    $test_data['ldap'][$dn][$attr_name]['count'] = count($test_data['ldap'][$dn][$attr_name]) - $count_set;
     variable_set('ldap_test_server__' . $sid, $test_data);
-    $ldap_server = ldap_servers_get_servers($sid, NULL, TRUE, TRUE); // clear server cache;
+    // Clear server cache;.
+    $ldap_server = ldap_servers_get_servers($sid, NULL, TRUE, TRUE);
   }
 
-  function configureLdapAuthentication($ldap_authentication_test_conf_id, $sids) {
+  /**
+   *
+   */
+  public function configureLdapAuthentication($ldap_authentication_test_conf_id, $sids) {
     module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
     $options = $this->data['ldap_authentication'][$ldap_authentication_test_conf_id];
     foreach ($sids as $i => $sid) {
@@ -75,7 +96,10 @@ class LdapTestFunctions  {
     $ldapServerAdmin->save();
   }
 
-  function configureLdapUser($ldap_user_test_conf_id) {
+  /**
+   *
+   */
+  public function configureLdapUser($ldap_user_test_conf_id) {
     module_load_include('php', 'ldap_user', 'LdapUserConfAdmin.class');
     $ldapUserConfAdmin = new LdapUserConfAdmin();
     $options = $this->data['ldap_user'][$ldap_user_test_conf_id];
@@ -87,8 +111,11 @@ class LdapTestFunctions  {
     $ldapUserConfAdmin->save();
   }
 
-  function prepConsumerConf($consumer_confs) {
-    // create consumer authorization configuration.
+  /**
+   *
+   */
+  public function prepConsumerConf($consumer_confs) {
+    // Create consumer authorization configuration.
     foreach ($consumer_confs as $consumer_type => $consumer_conf) {
       $consumer_obj = ldap_authorization_get_consumer_object($consumer_type);
       $consumer_conf_admin = new LdapAuthorizationConsumerConfAdmin($consumer_obj, TRUE);
@@ -97,73 +124,88 @@ class LdapTestFunctions  {
       }
       foreach ($consumer_conf_admin->mappings as $i => $mapping) {
         $mappings = $consumer_obj->normalizeMappings(
-          array(
-            array($mapping['from'], $mapping['user_entered'])
-          )
-          , FALSE);
+          [
+            [$mapping['from'], $mapping['user_entered']],
+          ],
+           FALSE);
         $consumer_conf_admin->mappings[$i] = $mappings[0];
       }
       $consumer_conf_admin->save();
     }
   }
 
-
-  function ldapUserIsAuthmapped($username) {
+  /**
+   *
+   */
+  public function ldapUserIsAuthmapped($username) {
     $authmaps = user_get_authmaps($username);
     return ($authmaps && in_array('ldap_user', array_keys($authmaps)));
   }
 
-  function drupalLdapUpdateUser($edit = array(), $ldap_authenticated = FALSE, $user) {
+  /**
+   *
+   */
+  public function drupalLdapUpdateUser($edit = [], $ldap_authenticated = FALSE, $user) {
     if (count($edit)) {
       $user = user_save($user, $edit);
     }
     if ($ldap_authenticated) {
-      user_set_authmaps($user, array('authname_ldap_user' => $user->name));
+      user_set_authmaps($user, ['authname_ldap_user' => $user->name]);
     }
     return $user;
   }
-// from http://www.midwesternmac.com/blogs/jeff-geerling/programmatically-adding-roles
-public function removeRoleFromUser($user, $role_name) {
 
-  if (is_numeric($user)) {
-    $user = user_load($user);
-  }
-  $key = array_search($role_name, $user->roles);
-  if ($key == TRUE) {
-    // Get the rid from the roles table.
-    $roles = user_roles(TRUE);
-    $rid = array_search($role_name, $roles);
-    if ($rid != FALSE) {
-      // Make a copy of the roles array, without the deleted one.
-      $new_roles = array();
-      foreach($user->roles as $id => $name) {
-        if ($id != $rid) {
-          $new_roles[$id] = $name;
+  /**
+   * From http://www.midwesternmac.com/blogs/jeff-geerling/programmatically-adding-roles.
+   */
+  public function removeRoleFromUser($user, $role_name) {
+
+    if (is_numeric($user)) {
+      $user = user_load($user);
+    }
+    $key = array_search($role_name, $user->roles);
+    if ($key == TRUE) {
+      // Get the rid from the roles table.
+      $roles = user_roles(TRUE);
+      $rid = array_search($role_name, $roles);
+      if ($rid != FALSE) {
+        // Make a copy of the roles array, without the deleted one.
+        $new_roles = [];
+        foreach ($user->roles as $id => $name) {
+          if ($id != $rid) {
+            $new_roles[$id] = $name;
+          }
         }
+        user_save($user, ['roles' => $new_roles]);
       }
-      user_save($user, array('roles' => $new_roles));
     }
   }
-}
 
-    public function userByNameFlushingCache($name) {
-      $user = user_load_by_name($name);
-      $users = user_load_multiple(array($user->uid), array(), TRUE); // clear user cache
-      $user = $users[$user->uid];
-      return $user;
-    }
+  /**
+   *
+   */
+  public function userByNameFlushingCache($name) {
+    $user = user_load_by_name($name);
+    // Clear user cache.
+    $users = user_load_multiple([$user->uid], [], TRUE);
+    $user = $users[$user->uid];
+    return $user;
+  }
 
- /**
-   * set variable with fake test data
+  /**
+   * Set variable with fake test data.
+   *
+   * @param string $test_ldap_id
+   *   eg. 'hogwarts'.
+   * @param string $test_ldap_type
+   *   e.g. openLdap, openLdapTest1, etc.
    *
-   * @param string $test_ldap_id eg. 'hogwarts'
-   * @param string $test_ldap_type e.g. openLdap, openLdapTest1, etc.
    * @parma string $sid where fake data is stored. e.g. 'default',
    */
   public function populateFakeLdapServerData($test_ldap_id, $sid = 'default') {
 
-    // read csvs into key/value array
-    // create fake ldap data array
+    // Read csvs into key/value array
+    // create fake ldap data array.
     $clones = empty($this->data['ldap_servers'][$sid]['clones']) ? FALSE : $this->data['ldap_servers'][$sid]['clones'];
     $server_properties = $this->data['ldap_servers'][$sid]['properties'];
     $this->getCsvLdapData($test_ldap_id);
@@ -178,7 +220,7 @@ public function removeRoleFromUser($user, $role_name) {
         $attributes,
         $server_properties['ldap_type'],
         $server_properties['user_attr']
-      ) ;
+      );
     }
 
     if ($clones) {
@@ -207,20 +249,20 @@ public function removeRoleFromUser($user, $role_name) {
     foreach ($this->csvTables['groups'] as $guid => $group) {
       $dn = 'cn=' . $group['cn'] . ',' . $this->csvTables['conf'][$test_ldap_id]['groupbasedn'];
       $this->csvTables['groups'][$guid]['dn'] = $dn;
-      $attributes = array(
-        'cn' => array(
+      $attributes = [
+        'cn' => [
           0 => $group['cn'],
           'count' => 1,
-        ),
-        'gid' => array(
+        ],
+        'gid' => [
           0 => $group['gid'],
           'count' => 1,
-        ),
-        'guid' => array(
+        ],
+        'guid' => [
           0 => $guid,
           'count' => 1,
-        ),
-      );
+        ],
+      ];
 
       if ($server_properties['groupMembershipsAttr']) {
         $membershipAttr = $server_properties['groupMembershipsAttr'];
@@ -244,7 +286,7 @@ public function removeRoleFromUser($user, $role_name) {
         $attributes[$membershipAttr]['count'] = count($attributes[$membershipAttr]);
 
       }
-      // need to figure out if memberOf type attribute is desired and populate it
+      // Need to figure out if memberOf type attribute is desired and populate it.
       $this->data['ldap_servers_by_guid'][$sid][$group['guid']]['attr'] = $attributes;
       $this->data['ldap_servers_by_guid'][$sid][$group['guid']]['dn'] = $dn;
       $this->data['ldap_servers'][$sid]['groups'][$dn]['attr'] = $attributes;
@@ -261,85 +303,91 @@ public function removeRoleFromUser($user, $role_name) {
           unset($this->ldapData['ldap_servers'][$sid][$user_dn][$member_attr]['count']);
         }
         $this->ldapData['ldap_servers'][$sid][$user_dn][$member_attr]['count'] =
-        count( $this->ldapData['ldap_servers'][$sid][$user_dn][$member_attr]);
+        count($this->ldapData['ldap_servers'][$sid][$user_dn][$member_attr]);
       }
     }
 
     $this->data['ldap_servers'][$sid]['ldap'] = $this->ldapData['ldap_servers'][$sid];
     $this->data['ldap_servers'][$sid]['csv'] = $this->csvTables;
     variable_set('ldap_test_server__' . $sid, $this->data['ldap_servers'][$sid]);
-    $current_sids = variable_get('ldap_test_servers', array());
+    $current_sids = variable_get('ldap_test_servers', []);
     $current_sids[] = $sid;
     variable_set('ldap_test_servers', array_unique($current_sids));
   }
 
+  /**
+   *
+   */
   public function generateUserLDAPAttributes($test_ldap_id, $user) {
-    $attributes = array(
-      'cn' => array(
+    $attributes = [
+      'cn' => [
         0 => $user['cn'],
         'count' => 1,
-      ),
-      'mail' => array(
+      ],
+      'mail' => [
         0 => $user['cn'] . '@' . $this->csvTables['conf'][$test_ldap_id]['mailhostname'],
         'count' => 1,
-      ),
-      'uid' => array(
+      ],
+      'uid' => [
         0 => $user['uid'],
         'count' => 1,
-      ),
-      'guid' => array(
+      ],
+      'guid' => [
         0 => $user['guid'],
         'count' => 1,
-      ),
-      'sn' => array(
+      ],
+      'sn' => [
         0 => $user['lname'],
         'count' => 1,
-      ),
-      'givenname' => array(
+      ],
+      'givenname' => [
         0 => $user['fname'],
         'count' => 1,
-      ),
-      'house' => array(
+      ],
+      'house' => [
         0 => $user['house'],
         'count' => 1,
-      ),
-      'department' => array(
+      ],
+      'department' => [
         0 => $user['department'],
         'count' => 1,
-      ),
-      'faculty' => array(
-        0 => (int)(boolean)$user['faculty'],
+      ],
+      'faculty' => [
+        0 => (int) (boolean) $user['faculty'],
         'count' => 1,
-      ),
-      'staff' => array(
-        0 => (int)(boolean)$user['staff'],
+      ],
+      'staff' => [
+        0 => (int) (boolean) $user['staff'],
         'count' => 1,
-      ),
-      'student' => array(
-        0 => (int)(boolean)$user['student'],
+      ],
+      'student' => [
+        0 => (int) (boolean) $user['student'],
         'count' => 1,
-      ),
-      'gpa' => array(
+      ],
+      'gpa' => [
         0 => $user['gpa'],
         'count' => 1,
-      ),
-      'probation' => array(
-        0 => (int)(boolean)$user['probation'],
+      ],
+      'probation' => [
+        0 => (int) (boolean) $user['probation'],
         'count' => 1,
-      ),
-      'password'  => array(
+      ],
+      'password'  => [
         0 => 'goodpwd',
         'count' => 1,
-      ),
-    );
+      ],
+    ];
     return $attributes;
   }
 
+  /**
+   *
+   */
   public function addLDAPUserToLDAPArraysFromAttributes($user, $sid, $dn, $attributes, $ldap_type, $user_attr) {
 
     if ($ldap_type == 'activedirectory') {
-      $attributes[$user_attr] = array(0 => $user['cn'], 'count' => 1);
-      $attributes['distinguishedname'] = array( 0 => $dn, 'count' => 1);
+      $attributes[$user_attr] = [0 => $user['cn'], 'count' => 1];
+      $attributes['distinguishedname'] = [0 => $dn, 'count' => 1];
     }
     elseif ($ldap_type == 'openldap') {
 
@@ -352,16 +400,22 @@ public function removeRoleFromUser($user, $role_name) {
     $this->ldapData['ldap_servers'][$sid][$dn]['count'] = count($attributes);
   }
 
+  /**
+   *
+   */
   public function getCsvLdapData($test_ldap_id) {
-    foreach (array('groups', 'users', 'memberships', 'conf') as $type) {
+    foreach (['groups', 'users', 'memberships', 'conf'] as $type) {
       $path = drupal_get_path('module', 'ldap_test') . '/test_ldap/' . $test_ldap_id . '/' . $type . '.csv';
       $this->csvTables[$type] = $this->parseCsv($path);
     }
   }
 
+  /**
+   *
+   */
   public function parseCsv($filepath) {
     $row = 1;
-    $table = array();
+    $table = [];
     if (($handle = fopen($filepath, "r")) !== FALSE) {
       while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
         if (count($data) > 1) {
@@ -371,7 +425,7 @@ public function removeRoleFromUser($user, $role_name) {
       fclose($handle);
     }
 
-    $table_associative = array();
+    $table_associative = [];
     $headings = array_shift($table);
     foreach ($table as $i => $row) {
       $row_id = $row[0];
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/ldap_authentication.conf.inc b/drupal7/sites/all/modules/ldap/ldap_test/ldap_authentication.conf.inc
index bc6f383e..efe1fcef 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/ldap_authentication.conf.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_test/ldap_authentication.conf.inc
@@ -2,31 +2,33 @@
 
 /**
  * @file
- *
  */
 
+/**
+ *
+ */
 function ldap_test_ldap_authentication_data() {
 
-  $conf['default'] = array(
-      'sids' => array('activedirectory1' => 'activedirectory1'),
-      'authenticationMode' => LDAP_AUTHENTICATION_MIXED,
-      'emailOption' => LDAP_AUTHENTICATION_EMAIL_FIELD_DISABLE,
-      'emailUpdate' => LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_DISABLE,
-      'loginUIUsernameTxt' => 'Hogwarts Username',
-      'loginUIPasswordTxt' => 'Hogwards LDAP Password',
-      'ldapUserHelpLinkUrl' => 'https://passwords.hogwarts.edu/',
-      'ldapUserHelpLinkText' => 'Hogwarts IT Password Support Page',
-      'allowOnlyIfTextInDn' => NULL,
-      'excludeIfTextInDn' => NULL,
-      'allowTestPhp' => NULL,
-      'excludeIfNoAuthorizations' => LDAP_AUTHENTICATION_EXCL_IF_NO_AUTHZ_DEFAULT,
-      'ssoEnabled' => FALSE,
-    );
+  $conf['default'] = [
+    'sids' => ['activedirectory1' => 'activedirectory1'],
+    'authenticationMode' => LDAP_AUTHENTICATION_MIXED,
+    'emailOption' => LDAP_AUTHENTICATION_EMAIL_FIELD_DISABLE,
+    'emailUpdate' => LDAP_AUTHENTICATION_EMAIL_UPDATE_ON_LDAP_CHANGE_DISABLE,
+    'loginUIUsernameTxt' => 'Hogwarts Username',
+    'loginUIPasswordTxt' => 'Hogwards LDAP Password',
+    'ldapUserHelpLinkUrl' => 'https://passwords.hogwarts.edu/',
+    'ldapUserHelpLinkText' => 'Hogwarts IT Password Support Page',
+    'allowOnlyIfTextInDn' => NULL,
+    'excludeIfTextInDn' => NULL,
+    'allowTestPhp' => NULL,
+    'excludeIfNoAuthorizations' => LDAP_AUTHENTICATION_EXCL_IF_NO_AUTHZ_DEFAULT,
+    'ssoEnabled' => FALSE,
+  ];
 
   $conf['MixedModeUserLogon'] = $conf['default'];
 
   $conf['MixedModeUserLogon3'] = $conf['default'];
-  $conf['MixedModeUserLogon3']['sids'] = array('activedirectory1' => 'activedirectory1');
+  $conf['MixedModeUserLogon3']['sids'] = ['activedirectory1' => 'activedirectory1'];
 
   $conf['ExclusiveModeUserLogon'] = $conf['default'];
   $conf['ExclusiveModeUserLogon']['authenticationMode'] = LDAP_AUTHENTICATION_EXCLUSIVE;
@@ -35,24 +37,23 @@ function ldap_test_ldap_authentication_data() {
   $conf['SSOUserLogon']['authenticationMode'] = LDAP_AUTHENTICATION_EXCLUSIVE;
   $conf['SSOUserLogon']['ssoEnabled'] = TRUE;
   $conf['SSOUserLogon']['ssoRemoteUserStripDomainName'] = FALSE;
-  $conf['SSOUserLogon']['cookieExpire'] = 3600; // -- 0, 3600, 86400, 604800, 2592000, 31536000, 315360000
-  $conf['SSOUserLogon']['ldapImplementation'] = 'mod_auth_sspi'; //  'mod_auth_kerb'
+  // -- 0, 3600, 86400, 604800, 2592000, 31536000, 315360000.
+  $conf['SSOUserLogon']['cookieExpire'] = 3600;
+  // 'mod_auth_kerb'.
+  $conf['SSOUserLogon']['ldapImplementation'] = 'mod_auth_sspi';
 
   $conf['ExclusiveModeUserLogon3'] = $conf['default'];
-  $conf['ExclusiveModeUserLogon3']['sids'] = array('activedirectory1' => 'activedirectory1');
+  $conf['ExclusiveModeUserLogon3']['sids'] = ['activedirectory1' => 'activedirectory1'];
   $conf['ExclusiveModeUserLogon3']['authenticationMode'] = LDAP_AUTHENTICATION_EXCLUSIVE;
 
-
   $conf['WL1'] = $conf['default'];
   $conf['WL1']['authenticationMode'] = LDAP_AUTHENTICATION_EXCLUSIVE;
 
-
   $conf['WL3'] = $conf['default'];
-  $conf['WL3']['sids'] = array('activedirectory1' => 'activedirectory1');
+  $conf['WL3']['sids'] = ['activedirectory1' => 'activedirectory1'];
   $conf['WL3']['authenticationMode'] = LDAP_AUTHENTICATION_EXCLUSIVE;
 
-
-  // single sign on tests
+  // Single sign on tests.
   $conf['MixedModeUserLogonSSO'] = $conf['MixedModeUserLogon'];
   $conf['MixedModeUserLogonSSO']['ssoRemoteUserStripDomainName'] = FALSE;
   $conf['MixedModeUserLogonSSO']['seamlessLogin'] = TRUE;
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/ldap_authorization.conf.inc b/drupal7/sites/all/modules/ldap/ldap_test/ldap_authorization.conf.inc
index 66767e0c..981e19e1 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/ldap_authorization.conf.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_test/ldap_authorization.conf.inc
@@ -1,209 +1,212 @@
 <?php
+
 /**
  * @file
- *
  */
 
-module_load_include('php', 'og', 'module');  // for og constants
+// For og constants.
+module_load_include('php', 'og', 'module');
 
+/**
+ *
+ */
 function ldap_test_ldap_authorization_data() {
 
-$empty_mappings = array(
-  'from' => '',
-  'user_entered' => '',
-  'normalized' => '',
-  'simplified' => '',
-  'valid' => '',
-  'error_message' => '',
-  );
-$OG_AUTHENTICATED_ROLE = 'member'; // cant use constant OG_AUTHENTICATED_ROLE here
-$conf['og_group2']['og_group'] = array(
-
-  'sid' => 'activedirectory1',
-  'consumerType' => 'og_group',
-  'consumerModule' => 'ldap_authorization_og_group',
-
-  'description' => 'Hogwarts AD',
-  'status' => 1,
-  'onlyApplyToLdapAuthenticated' => 1,
-
-  'mappings' => array(
-    array(
+  $empty_mappings = [
+    'from' => '',
+    'user_entered' => '',
+    'normalized' => '',
+    'simplified' => '',
+    'valid' => '',
+    'error_message' => '',
+  ];
+  // Cant use constant OG_AUTHENTICATED_ROLE here.
+  $OG_AUTHENTICATED_ROLE = 'member';
+  $conf['og_group2']['og_group'] = [
+
+    'sid' => 'activedirectory1',
+    'consumerType' => 'og_group',
+    'consumerModule' => 'ldap_authorization_og_group',
+
+    'description' => 'Hogwarts AD',
+    'status' => 1,
+    'onlyApplyToLdapAuthenticated' => 1,
+
+    'mappings' => [
+    [
       'from' => 'cn=students,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'students',
       'normalized' => 'node:students:' . $OG_AUTHENTICATED_ROLE,
       'simplified' => '',
       'valid' => '',
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=faculty,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'faculty',
       'normalized' => 'node:faculty:' . $OG_AUTHENTICATED_ROLE,
       'simplified' => '',
       'valid' => '',
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'gryffindor',
       'normalized' => 'node:gryffindor:' . $OG_AUTHENTICATED_ROLE,
       'simplified' => '',
       'valid' => '',
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=users,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'users',
       'normalized' => 'node:users:' . $OG_AUTHENTICATED_ROLE,
       'simplified' => '',
       'valid' => '',
       'error_message' => '',
-    ),
-  ),
+    ],
+    ],
 
-  'useMappingsAsFilter' => 1,
+    'useMappingsAsFilter' => 1,
 
-  'synchOnLogon' => 1,
+    'synchOnLogon' => 1,
 
-  'revokeLdapProvisioned' => 1,
-  'createConsumers' => 0,
-  'regrantLdapProvisioned' => 1,
+    'revokeLdapProvisioned' => 1,
+    'createConsumers' => 0,
+    'regrantLdapProvisioned' => 1,
 
-);
+  ];
 
-$conf['og_group15']['og_group'] = $conf['og_group2']['og_group'];
-$conf['og_group15']['og_group']['mappings'] = array(
-    array(
+  $conf['og_group15']['og_group'] = $conf['og_group2']['og_group'];
+  $conf['og_group15']['og_group']['mappings'] = [
+    [
       'from' => 'cn=students,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'group-name=students,role-name=member',
       'simplified' => '',
       'valid' => '',
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=faculty,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'group-name=faculty,role-name=member',
       'simplified' => '',
       'valid' => '',
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'group-name=gryffindor,role-name=member',
       'simplified' => '',
       'valid' => '',
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=users,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'group-name=users,role-name=member',
       'simplified' => '',
       'valid' => '',
       'error_message' => '',
-    ),
-  );
-
+    ],
+  ];
 
-$conf['drupal_role_default']['drupal_role'] = array(
+  $conf['drupal_role_default']['drupal_role'] = [
 
-  'sid' => 'activedirectory1',
-  'consumerType' => 'drupal_role',
-  'consumerModule' => 'ldap_authorization_drupal_role',
+    'sid' => 'activedirectory1',
+    'consumerType' => 'drupal_role',
+    'consumerModule' => 'ldap_authorization_drupal_role',
 
-  'description' => 'Hogwarts AD',
-  'status' => 1,
-  'onlyApplyToLdapAuthenticated' => 1,
+    'description' => 'Hogwarts AD',
+    'status' => 1,
+    'onlyApplyToLdapAuthenticated' => 1,
 
-  'mappings' => array(
-    array(
+    'mappings' => [
+    [
       'from' => 'cn=students,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'students',
       'normalized' => 'students',
       'simplified' => 'students',
       'valid' => TRUE,
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=faculty,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'administrator',
       'normalized' => 'administrator',
       'simplified' => 'administrator',
       'valid' => TRUE,
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'gryffindor',
       'user_entered' => 'gryffindor',
       'normalized' => 'gryffindor',
       'simplified' => 'gryffindor',
       'valid' => TRUE,
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=users,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'users',
       'normalized' => 'users',
       'simplified' => 'users',
       'valid' => TRUE,
       'error_message' => '',
-    ),
-  ),
-
+    ],
+    ],
 
-  'useMappingsAsFilter' => 0,
+    'useMappingsAsFilter' => 0,
 
-  'synchOnLogon' => 1,
+    'synchOnLogon' => 1,
 
-  'revokeLdapProvisioned' => 1,
-  'createConsumers' => 1,
-  'regrantLdapProvisioned' => 1,
-  );
+    'revokeLdapProvisioned' => 1,
+    'createConsumers' => 1,
+    'regrantLdapProvisioned' => 1,
+  ];
 
-$conf['drupal_role_authentication_test']['drupal_role'] = array(
-  'sid' => 'activedirectory1',
-  'consumerType' => 'drupal_role',
-  'consumerModule' => 'ldap_authorization_drupal_role',
+  $conf['drupal_role_authentication_test']['drupal_role'] = [
+    'sid' => 'activedirectory1',
+    'consumerType' => 'drupal_role',
+    'consumerModule' => 'ldap_authorization_drupal_role',
 
-  'description' => 'Hogwarts AD',
-  'status' => 1,
-  'onlyApplyToLdapAuthenticated' => 1,
+    'description' => 'Hogwarts AD',
+    'status' => 1,
+    'onlyApplyToLdapAuthenticated' => 1,
 
-  'mappings' => array(
-    array(
+    'mappings' => [
+    [
       'from' => 'cn=students,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'students',
       'normalized' => 'node:students:' . $OG_AUTHENTICATED_ROLE,
       'simplified' => 'students',
       'valid' => TRUE,
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'gryffindor',
       'user_entered' => 'gryffindor',
       'normalized' => 'node:gryffindor:' . $OG_AUTHENTICATED_ROLE,
       'simplified' => 'gryffindor',
       'valid' => TRUE,
       'error_message' => '',
-    ),
-    array(
+    ],
+    [
       'from' => 'cn=users,ou=groups,dc=hogwarts,dc=edu',
       'user_entered' => 'users',
       'normalized' => 'node:users:' . $OG_AUTHENTICATED_ROLE,
       'simplified' => 'users',
       'valid' => TRUE,
       'error_message' => '',
-    ),
-  ),
+    ],
+    ],
 
-  'useMappingsAsFilter' => 1,
+    'useMappingsAsFilter' => 1,
 
-  'synchOnLogon' => 1,
+    'synchOnLogon' => 1,
 
-  'revokeLdapProvisioned' => 1,
-  'createConsumers' => 1,
-  'regrantLdapProvisioned' => 1,
-  );
+    'revokeLdapProvisioned' => 1,
+    'createConsumers' => 1,
+    'regrantLdapProvisioned' => 1,
+  ];
 
-return $conf;
+  return $conf;
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/ldap_servers.conf.inc b/drupal7/sites/all/modules/ldap/ldap_test/ldap_servers.conf.inc
index ce37ef7f..b235e43c 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/ldap_servers.conf.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_test/ldap_servers.conf.inc
@@ -2,13 +2,13 @@
 
 /**
  * @file
- *
  */
 
-/*** activedirectory is default Active Directory server config **/
+/***
+ * Activedirectory is default Active Directory server config .**/
 function ldap_test_ldap_servers_data() {
 
-$servers['ldapauthor1']['properties']  = array(
+  $servers['ldapauthor1']['properties'] = [
     'sid' => 'openldap1',
     'name'  => 'Test LDAP Server LDAP Authorization' ,
     'inDatabase' => TRUE,
@@ -18,9 +18,9 @@ $servers['ldapauthor1']['properties']  = array(
     'port'  => 389,
     'tls'  => FALSE,
     'bind_method' => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT,
-    'basedn'  => array(
-       'dc=hogwarts,dc=edu',
-      ),
+    'basedn'  => [
+      'dc=hogwarts,dc=edu',
+    ],
     'binddn'  => 'cn=service-account,ou=people,dc=hogwarts,dc=edu',
     'bindpw' => 'goodpwd',
     'user_dn_expression' => NULL,
@@ -37,11 +37,9 @@ $servers['ldapauthor1']['properties']  = array(
     'groupMembershipsAttrMatchingUserAttr' => 'dn',
     'search_pagination' => 0,
     'searchPageSize' => NULL,
-  );
+  ];
 
-
-
-$conf['openldap1']['properties']  = array(
+  $conf['openldap1']['properties'] = [
     'sid' => 'openldap1',
     'name'  => 'Test Open LDAP' ,
     'inDatabase' => TRUE,
@@ -51,9 +49,9 @@ $conf['openldap1']['properties']  = array(
     'port'  => 389,
     'tls'  => FALSE,
     'bind_method' => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT,
-    'basedn'  => array(
-       'dc=hogwarts,dc=edu',
-    ),
+    'basedn'  => [
+      'dc=hogwarts,dc=edu',
+    ],
     'binddn'  => 'cn=service-account,ou=people,dc=hogwarts,dc=edu',
     'bindpw' => 'goodpwd',
     'user_dn_expression' => NULL,
@@ -71,79 +69,75 @@ $conf['openldap1']['properties']  = array(
     'groupMembershipsAttrMatchingUserAttr' => 'dn',
     'search_pagination' => 0,
     'searchPageSize' => NULL,
-  );
-
-$conf['openldap1']['methodResponses']['connect'] = LDAP_SUCCESS;
-
-
-$conf['openldap1']['search_results'] = array();
+  ];
 
+  $conf['openldap1']['methodResponses']['connect'] = LDAP_SUCCESS;
 
-$conf['openldap1']['search_results']['(&(objectClass=group)(|(member=cn=gryffindor,ou=groups,dc=hogwarts,dc=edu)(member=cn=students,ou=groups,dc=hogwarts,dc=edu)(member=cn=honors students,ou=groups,dc=hogwarts,dc=edu)))']['dc=hogwarts,dc=edu'] = array(
-  0 => array('count' => 1, 'dn' => 'cn=users,ou=groups,dc=hogwarts,dc=edu'),
-  'count' => 1,
-);
+  $conf['openldap1']['search_results'] = [];
 
-$conf['openldap1']['search_results']['(cn=hpotter)']['dc=hogwarts,dc=edu'] = array(
-  0 => array(
+  $conf['openldap1']['search_results']['(&(objectClass=group)(|(member=cn=gryffindor,ou=groups,dc=hogwarts,dc=edu)(member=cn=students,ou=groups,dc=hogwarts,dc=edu)(member=cn=honors students,ou=groups,dc=hogwarts,dc=edu)))']['dc=hogwarts,dc=edu'] = [
+    0 => ['count' => 1, 'dn' => 'cn=users,ou=groups,dc=hogwarts,dc=edu'],
     'count' => 1,
-    'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
-    'FULLENTRY' => TRUE,
-  ),
-  'count' => 1,
-);
-
-$conf['openldap1']['search_results']['(cn=hpotter)']['dc=hogwarts,dc=edu'] = array(
-  0 => array(
-    'count' => 1,
-    'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
-    'FULLENTRY' => TRUE,
-  ),
-  'count' => 1,
-);
-
-$conf['openldap1']['search_results']['(cn=hpotter-granger)']['dc=hogwarts,dc=edu'] = array(
-  0 => array(
+  ];
+
+  $conf['openldap1']['search_results']['(cn=hpotter)']['dc=hogwarts,dc=edu'] = [
+    0 => [
+      'count' => 1,
+      'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
+      'FULLENTRY' => TRUE,
+    ],
     'count' => 1,
-    'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
-    'FULLENTRY' => TRUE,
-  ),
-  'count' => 1,
-);
-
-$conf['openldap1']['search_results']['(cn=ssnape)']['dc=hogwarts,dc=edu'] = array(
-  0 => array(
+  ];
+
+  $conf['openldap1']['search_results']['(cn=hpotter)']['dc=hogwarts,dc=edu'] = [
+    0 => [
+      'count' => 1,
+      'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
+      'FULLENTRY' => TRUE,
+    ],
     'count' => 1,
-    'dn' => 'cn=ssnape,ou=people,dc=hogwarts,dc=edu',
-    'FULLENTRY' => TRUE,
-  ),
-  'count' => 1,
-);
-
-$conf['openldap1']['search_results']['(cn=adumbledore)']['dc=hogwarts,dc=edu'] = array(
-  0 => array(
+  ];
+
+  $conf['openldap1']['search_results']['(cn=hpotter-granger)']['dc=hogwarts,dc=edu'] = [
+    0 => [
+      'count' => 1,
+      'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
+      'FULLENTRY' => TRUE,
+    ],
     'count' => 1,
-    'dn' => 'cn=adumbledore,ou=people,dc=hogwarts,dc=edu',
-    'FULLENTRY' => TRUE,
-  ),
-  'count' => 1,
-);
+  ];
 
-$conf['openldap1']['search_results']['(&(objectClass=groupofnames)(member=cn=hpotter,ou=people,dc=hogwarts,dc=edu))']['dc=hogwarts,dc=edu'] = array(
-  0 => array('count' => 1, 'dn' => 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu'),
-  1 => array('count' => 1, 'dn' => 'cn=students,ou=groups,dc=hogwarts,dc=edu'),
-  2 => array('count' => 1, 'dn' => 'cn=honors students,ou=groups,dc=hogwarts,dc=edu'),
-  'count' => 3,
-);
+  $conf['openldap1']['search_results']['(cn=ssnape)']['dc=hogwarts,dc=edu'] = [
+    0 => [
+      'count' => 1,
+      'dn' => 'cn=ssnape,ou=people,dc=hogwarts,dc=edu',
+      'FULLENTRY' => TRUE,
+    ],
+    'count' => 1,
+  ];
 
-$conf['openldap1']['search_results']['(&(objectClass=groupofnames)(|(member=cn=gryffindor,ou=groups,dc=hogwarts,dc=edu)(member=cn=students,ou=groups,dc=hogwarts,dc=edu)(member=cn=honors students,ou=groups,dc=hogwarts,dc=edu)))']['dc=hogwarts,dc=edu'] = array(
-  0 => array('count' => 1, 'dn' => 'cn=users,ou=groups,dc=hogwarts,dc=edu'),
-  'count' => 1,
-);
+  $conf['openldap1']['search_results']['(cn=adumbledore)']['dc=hogwarts,dc=edu'] = [
+    0 => [
+      'count' => 1,
+      'dn' => 'cn=adumbledore,ou=people,dc=hogwarts,dc=edu',
+      'FULLENTRY' => TRUE,
+    ],
+    'count' => 1,
+  ];
 
+  $conf['openldap1']['search_results']['(&(objectClass=groupofnames)(member=cn=hpotter,ou=people,dc=hogwarts,dc=edu))']['dc=hogwarts,dc=edu'] = [
+    0 => ['count' => 1, 'dn' => 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu'],
+    1 => ['count' => 1, 'dn' => 'cn=students,ou=groups,dc=hogwarts,dc=edu'],
+    2 => ['count' => 1, 'dn' => 'cn=honors students,ou=groups,dc=hogwarts,dc=edu'],
+    'count' => 3,
+  ];
 
+  $conf['openldap1']['search_results']['(&(objectClass=groupofnames)(|(member=cn=gryffindor,ou=groups,dc=hogwarts,dc=edu)(member=cn=students,ou=groups,dc=hogwarts,dc=edu)(member=cn=honors students,ou=groups,dc=hogwarts,dc=edu)))']['dc=hogwarts,dc=edu'] = [
+    0 => ['count' => 1, 'dn' => 'cn=users,ou=groups,dc=hogwarts,dc=edu'],
+    'count' => 1,
+  ];
 
-$conf['activedirectory1']['properties']  = array(
+  $conf['activedirectory1']['properties'] = [
     'sid' => 'activedirectory1',
     'name'  => 'Test Active Directory LDAP' ,
     'inDatabase' => TRUE,
@@ -153,9 +147,9 @@ $conf['activedirectory1']['properties']  = array(
     'port'  => 389,
     'tls'  => FALSE,
     'bind_method' => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT,
-    'basedn'  => array(
-       'dc=hogwarts,dc=edu',
-    ),
+    'basedn'  => [
+      'dc=hogwarts,dc=edu',
+    ],
     'binddn'  => 'cn=service-account,ou=people,dc=hogwarts,dc=edu',
     'bindpw' => 'goodpwd',
     'user_dn_expression' => NULL,
@@ -174,58 +168,55 @@ $conf['activedirectory1']['properties']  = array(
     'groupMembershipsAttrMatchingUserAttr' => 'dn',
     'search_pagination' => 0,
     'searchPageSize' => NULL,
-  );
+  ];
 
-$conf['activedirectory1']['methodResponses']['connect'] = LDAP_SUCCESS;
-$conf['activedirectory1']['clones'] = LDAP_TEST_USER_ORPHAN_CLONE_COUNT;
+  $conf['activedirectory1']['methodResponses']['connect'] = LDAP_SUCCESS;
+  $conf['activedirectory1']['clones'] = LDAP_TEST_USER_ORPHAN_CLONE_COUNT;
 
-$conf['activedirectory1']['search_results'] = array();
+  $conf['activedirectory1']['search_results'] = [];
 
-$conf['activedirectory1']['search_results']['(&(objectClass=group)(member=cn=hpotter,ou=people,dc=hogwarts,dc=edu))']['dc=hogwarts,dc=edu'] = array(
-  0 => array('count' => 1, 'dn' => 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu'),
-  1 => array('count' => 1, 'dn' => 'cn=students,ou=groups,dc=hogwarts,dc=edu'),
-  2 => array('count' => 1, 'dn' => 'cn=honors students,ou=groups,dc=hogwarts,dc=edu'),
-  'count' => 3,
-);
+  $conf['activedirectory1']['search_results']['(&(objectClass=group)(member=cn=hpotter,ou=people,dc=hogwarts,dc=edu))']['dc=hogwarts,dc=edu'] = [
+    0 => ['count' => 1, 'dn' => 'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu'],
+    1 => ['count' => 1, 'dn' => 'cn=students,ou=groups,dc=hogwarts,dc=edu'],
+    2 => ['count' => 1, 'dn' => 'cn=honors students,ou=groups,dc=hogwarts,dc=edu'],
+    'count' => 3,
+  ];
 
-$conf['activedirectory1']['search_results']['(&(objectClass=group)(|(member=cn=gryffindor,ou=groups,dc=hogwarts,dc=edu)(member=cn=students,ou=groups,dc=hogwarts,dc=edu)(member=cn=honors students,ou=groups,dc=hogwarts,dc=edu)))']['dc=hogwarts,dc=edu'] = array(
-  0 => array('count' => 1, 'dn' => 'cn=users,ou=groups,dc=hogwarts,dc=edu'),
-  'count' => 1,
-);
+  $conf['activedirectory1']['search_results']['(&(objectClass=group)(|(member=cn=gryffindor,ou=groups,dc=hogwarts,dc=edu)(member=cn=students,ou=groups,dc=hogwarts,dc=edu)(member=cn=honors students,ou=groups,dc=hogwarts,dc=edu)))']['dc=hogwarts,dc=edu'] = [
+    0 => ['count' => 1, 'dn' => 'cn=users,ou=groups,dc=hogwarts,dc=edu'],
+    'count' => 1,
+  ];
 
-foreach (array('hpotter', 'hgrainger', 'ssnape', 'adumbledore') as $cn) {
+  foreach (['hpotter', 'hgrainger', 'ssnape', 'adumbledore'] as $cn) {
 
-  $conf['activedirectory1']['search_results']["(cn=$cn)"]['dc=hogwarts,dc=edu'] = array(
-    0 => array(
+    $conf['activedirectory1']['search_results']["(cn=$cn)"]['dc=hogwarts,dc=edu'] = [
+      0 => [
+        'count' => 1,
+        'dn' => "cn=$cn,ou=people,dc=hogwarts,dc=edu",
+        'FULLENTRY' => TRUE,
+      ],
       'count' => 1,
-      'dn' => "cn=$cn,ou=people,dc=hogwarts,dc=edu",
-      'FULLENTRY' => TRUE,
-    ),
-    'count' => 1,
-  );
-
-  $conf['activedirectory1']['search_results']["(samaccountname=$cn)"]['dc=hogwarts,dc=edu'] = array(
-    0 => array(
+    ];
+
+    $conf['activedirectory1']['search_results']["(samaccountname=$cn)"]['dc=hogwarts,dc=edu'] = [
+      0 => [
+        'count' => 1,
+        'dn' => "cn=$cn,ou=people,dc=hogwarts,dc=edu",
+        'FULLENTRY' => TRUE,
+      ],
       'count' => 1,
-      'dn' => "cn=$cn,ou=people,dc=hogwarts,dc=edu",
-      'FULLENTRY' => TRUE,
-    ),
-    'count' => 1,
-  );
-
-}
+    ];
 
+  }
 
-$conf['activedirectory1']['search_results']['(samaccountname=hpotter-granger)']['dc=hogwarts,dc=edu'] = array(
-  0 => array(
+  $conf['activedirectory1']['search_results']['(samaccountname=hpotter-granger)']['dc=hogwarts,dc=edu'] = [
+    0 => [
+      'count' => 1,
+      'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
+      'FULLENTRY' => TRUE,
+    ],
     'count' => 1,
-    'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
-    'FULLENTRY' => TRUE,
-  ),
-  'count' => 1,
-);
-
-
+  ];
 
-return $conf;
+  return $conf;
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info b/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info
index 31a747e3..d7adb75c 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info
+++ b/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info
@@ -6,6 +6,7 @@ dependencies[] = ldap_servers
 dependencies[] = entity
 
 core = 7.x
+php = 5.4
 
 files[] = ldap_servers.conf.inc
 files[] = ldap_user.conf.inc
@@ -18,8 +19,8 @@ files[] = LdapServerTest.class.php
 files[] = LdapTestFunctions.class.php
 files[] = LdapUserTestCase.class.php
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.module b/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.module
index 4565ab11..1fee9aec 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.module
+++ b/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.module
@@ -2,10 +2,11 @@
 
 /**
  * @file
- * Module for the LDAP module testing
- *
+ * Module for the LDAP module testing.
  */
 
-define('LDAP_TEST_USER_ORPHAN_CLONE_COUNT', 7);  // number of cloned drupal users (clone0, clone1, etc) to make for tests
-define('LDAP_TEST_USER_ORPHAN_CLONE_REMOVE_COUNT', 2); // number of cloned drupal users to delete in orphan check
+// Number of cloned drupal users (clone0, clone1, etc) to make for tests.
+define('LDAP_TEST_USER_ORPHAN_CLONE_COUNT', 7);
+// Number of cloned drupal users to delete in orphan check.
+define('LDAP_TEST_USER_ORPHAN_CLONE_REMOVE_COUNT', 2);
 define('LDAP_TEST_LDAP_NAME', 'hogwarts');
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/ldap_user.conf.inc b/drupal7/sites/all/modules/ldap/ldap_test/ldap_user.conf.inc
index c2f09885..35bed440 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/ldap_user.conf.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_test/ldap_user.conf.inc
@@ -2,376 +2,371 @@
 
 /**
  * @file
- * simpletest ldap user config
+ * Simpletest ldap user config.
  *
- * should only contain saveable properties of ldapUserConf class.
+ * Should only contain saveable properties of ldapUserConf class.
  */
 
+/**
+ *
+ */
 function ldap_test_ldap_user_data() {
 
-$conf['default']  = array(
+  $conf['default'] = [
     'drupalAcctProvisionServer' => 'activedirectory1',
     'ldapEntryProvisionServer' => LDAP_USER_NO_SERVER_SID,
-    'drupalAcctProvisionTriggers' => array(
+    'drupalAcctProvisionTriggers' => [
       LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE,
       LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE,
-      ),
-    'ldapEntryProvisionTriggers' => array(
-      ),
+    ],
+    'ldapEntryProvisionTriggers' => [],
     'userConflictResolve' => LDAP_USER_CONFLICT_LOG,
     'acctCreation'  => LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR,
-    'ldapUserSynchMappings' => array(
-      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => array(),
-      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(),
-    ),
-   'orphanedCheckQty' => 50,
-   'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
-  );
-  /**
-   *    'wsEnabled'  => 0,
-      'wsUserIps' => array('1.2.3.4'),
-      'wsKey'  => 'sdafjlksjadsdafjkksdafjsdfsdjfsdf',
-  */
-$conf['ad_authentication'] = array(
+    'ldapUserSynchMappings' => [
+      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => [],
+      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => [],
+    ],
+    'orphanedCheckQty' => 50,
+    'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
+  ];
+
+  $conf['ad_authentication'] = [
     'drupalAcctProvisionServer' => 'activedirectory1',
     'ldapEntryProvisionServer' => LDAP_USER_NO_SERVER_SID,
-    'drupalAcctProvisionTriggers' => array(
+    'drupalAcctProvisionTriggers' => [
       LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE,
       LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE,
-      ),
-    'ldapEntryProvisionTriggers' => array(
-      ),
+    ],
+    'ldapEntryProvisionTriggers' => [],
     'userConflictResolve' => LDAP_USER_CONFLICT_LOG,
     'acctCreation'  => LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR,
-    'ldapUserSynchMappings' => array(
-      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => array(),
-      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(),
-    ),
-   'orphanedCheckQty' => 50,
-   'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
-  );
+    'ldapUserSynchMappings' => [
+      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => [],
+      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => [],
+    ],
+    'orphanedCheckQty' => 50,
+    'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
+  ];
 
-  $conf['ad_authorization'] = array(
+  $conf['ad_authorization'] = [
     'drupalAcctProvisionServer' => 'ldapauthor1',
     'ldapEntryProvisionServer' => LDAP_USER_NO_SERVER_SID,
-    'drupalAcctProvisionTriggers' => array(
+    'drupalAcctProvisionTriggers' => [
       LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE,
       LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE,
-      ),
-    'ldapEntryProvisionTriggers' => array(
-      ),
+    ],
+    'ldapEntryProvisionTriggers' => [],
     'userConflictResolve' => LDAP_USER_CONFLICT_LOG,
     'acctCreation'  => LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR,
 
-    'ldapUserSynchMappings' => array(
-      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => array(),
-      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(),
-    ),
+    'ldapUserSynchMappings' => [
+      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => [],
+      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => [],
+    ],
     'orphanedCheckQty' => 50,
     'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
-  );
+  ];
 
-  $conf['provisionToDrupal']  = array(
+  $conf['provisionToDrupal'] = [
     'drupalAcctProvisionServer' => 'activedirectory1',
     'ldapEntryProvisionServer' => LDAP_USER_NO_SERVER_SID,
-    'drupalAcctProvisionTriggers' => array(
+    'drupalAcctProvisionTriggers' => [
       LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE,
       LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE,
-      ),
-    'ldapEntryProvisionTriggers' => array(),
+    ],
+    'ldapEntryProvisionTriggers' => [],
     'userConflictResolve' => LDAP_USER_CONFLICT_LOG,
     'acctCreation'  => LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR,
-    'ldapUserSynchMappings' => array(
-      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => array(),
-      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(),
-    ),
-   'orphanedCheckQty' => 50,
-   'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
-  );
-
+    'ldapUserSynchMappings' => [
+      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => [],
+      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => [],
+    ],
+    'orphanedCheckQty' => 50,
+    'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
+  ];
 
-  $conf['provisionToDrupalWithMappings']  = array(
+  $conf['provisionToDrupalWithMappings'] = [
     'drupalAcctProvisionServer' => 'activedirectory1',
     'ldapEntryProvisionServer' => LDAP_USER_NO_SERVER_SID,
-    'drupalAcctProvisionTriggers' => array(
+    'drupalAcctProvisionTriggers' => [
       LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE,
       LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE,
-      ),
-    'ldapEntryProvisionTriggers' => array(
+    ],
+    'ldapEntryProvisionTriggers' => [
       LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE,
-    ),
+    ],
     'userConflictResolve' => LDAP_USER_CONFLICT_LOG,
     'acctCreation'  => LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR,
-    'ldapUserSynchMappings' => array(
-      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => array(
-        '[field.field_display_name]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[givenname] [sn]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '[field.field_display_name]',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
-        ),
-       '[field.field_lname]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[sn:0]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '[field.field_lname]',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
-        ),
-       '[field.field_fname]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[givenName]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '[field.field_fname]',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
-        ),
-        '[field.field_department]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => 'Physics',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '[field.field_department]',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
-        ),
-      ),
-      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(),
-    ),
-   'orphanedCheckQty' => 50,
-   'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
-  );
+    'ldapUserSynchMappings' => [
+      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => [
+        '[field.field_display_name]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[givenname] [sn]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '[field.field_display_name]',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
+        ],
+        '[field.field_lname]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[sn:0]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '[field.field_lname]',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
+        ],
+        '[field.field_fname]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[givenName]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '[field.field_fname]',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
+        ],
+        '[field.field_department]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => 'Physics',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '[field.field_department]',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
+        ],
+      ],
+      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => [],
+    ],
+    'orphanedCheckQty' => 50,
+    'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
+  ];
 
-  $conf['provisionToLdap_activedirectory1']  = array(
+  $conf['provisionToLdap_activedirectory1'] = [
     'drupalAcctProvisionServer' => LDAP_USER_NO_SERVER_SID,
     'ldapEntryProvisionServer' => 'activedirectory1',
-    'drupalAcctProvisionTriggers' => array(),
-    'ldapEntryProvisionTriggers' => array(
+    'drupalAcctProvisionTriggers' => [],
+    'ldapEntryProvisionTriggers' => [
       LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE,
       LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE,
-      ),
+    ],
     'userConflictResolve' => LDAP_USER_CONFLICT_LOG,
     'acctCreation'  => LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR,
     'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
-    'ldapUserSynchMappings' => array(
-      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => array(),
-      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(
-          '[dn]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[dn]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => 'cn=[property.name],ou=people,dc=hogwarts,dc=edu',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[cn]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[cn]',
-            'user_attr' => '[property.name]',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[displayname]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[displayname]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '[field.field_fname] [field.field_lname]',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[samaccountname]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[samaccountname]',
-            'user_attr' => '[property.name]',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY),
-          ),
-          '[sn]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[sn]',
-            'user_attr' => '[field.field_lname]',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[givenname]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[givenname]',
-            'user_attr' => '[field.field_fname]',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[guid]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[guid]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '151',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY),
-          ),
-          '[provisionsource]' => array(
-            'sid' => 'activedirectory1',
-            'ldap_attr' => '[provisionsource]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => 'drupal.hogwarts.edu',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY),
-          ),
-        ),
-      )
-    );
+    'ldapUserSynchMappings' => [
+      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => [],
+      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => [
+        '[dn]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[dn]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => 'cn=[property.name],ou=people,dc=hogwarts,dc=edu',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[cn]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[cn]',
+          'user_attr' => '[property.name]',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[displayname]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[displayname]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '[field.field_fname] [field.field_lname]',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[samaccountname]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[samaccountname]',
+          'user_attr' => '[property.name]',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY],
+        ],
+        '[sn]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[sn]',
+          'user_attr' => '[field.field_lname]',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[givenname]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[givenname]',
+          'user_attr' => '[field.field_fname]',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[guid]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[guid]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '151',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY],
+        ],
+        '[provisionsource]' => [
+          'sid' => 'activedirectory1',
+          'ldap_attr' => '[provisionsource]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => 'drupal.hogwarts.edu',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY],
+        ],
+      ],
+    ],
+  ];
 
-  $conf['provisionToLdap_openldap1']  = array(
+  $conf['provisionToLdap_openldap1'] = [
     'drupalAcctProvisionServer' => LDAP_USER_NO_SERVER_SID,
     'ldapEntryProvisionServer' => 'openldap1',
-    'drupalAcctProvisionTriggers' => array(),
-    'ldapEntryProvisionTriggers' => array(
+    'drupalAcctProvisionTriggers' => [],
+    'ldapEntryProvisionTriggers' => [
       LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE,
       LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE,
-      ),
+    ],
     'userConflictResolve' => LDAP_USER_CONFLICT_LOG,
     'acctCreation'  => LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR,
     'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM,
-    'ldapUserSynchMappings' => array(
-      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => array(),
-      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(
-          '[dn]' => array(
-            'sid' => 'openldap1',
-            'ldap_attr' => '[dn]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => 'cn=[property.name],ou=people,dc=hogwarts,dc=edu',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[displayname]' => array(
-            'sid' => 'openldap1',
-            'ldap_attr' => '[displayname]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '[field.field_fname] [field.field_lname]',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[cn]' => array(
-            'sid' => 'openldap1',
-            'ldap_attr' => '[cn]',
-            'user_attr' => '[property.name]',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY),
-          ),
-          '[sn]' => array(
-            'sid' => 'openldap1',
-            'ldap_attr' => '[sn]',
-            'user_attr' => '[field.field_lname]',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[givenname]' => array(
-            'sid' => 'openldap1',
-            'ldap_attr' => '[givenname]',
-            'user_attr' => '[field.field_fname]',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-          ),
-          '[guid]' => array(
-            'sid' => 'openldap1',
-            'ldap_attr' => '[guid]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => '151',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY),
-          ),
-          '[provisionsource]' => array(
-            'sid' => 'openldap1',
-            'ldap_attr' => '[provisionsource]',
-            'user_attr' => 'user_tokens',
-            'convert' => 0,
-            'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-            'user_tokens' => 'drupal.hogwarts.edu',
-            'config_module' => 'ldap_user',
-            'synch_module' => 'ldap_user',
-            'enabled' => 1,
-            'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY),
-          ),
-        ),
-      )
-    );
+    'ldapUserSynchMappings' => [
+      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => [],
+      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => [
+        '[dn]' => [
+          'sid' => 'openldap1',
+          'ldap_attr' => '[dn]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => 'cn=[property.name],ou=people,dc=hogwarts,dc=edu',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[displayname]' => [
+          'sid' => 'openldap1',
+          'ldap_attr' => '[displayname]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '[field.field_fname] [field.field_lname]',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[cn]' => [
+          'sid' => 'openldap1',
+          'ldap_attr' => '[cn]',
+          'user_attr' => '[property.name]',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY],
+        ],
+        '[sn]' => [
+          'sid' => 'openldap1',
+          'ldap_attr' => '[sn]',
+          'user_attr' => '[field.field_lname]',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[givenname]' => [
+          'sid' => 'openldap1',
+          'ldap_attr' => '[givenname]',
+          'user_attr' => '[field.field_fname]',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+        ],
+        '[guid]' => [
+          'sid' => 'openldap1',
+          'ldap_attr' => '[guid]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => '151',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY],
+        ],
+        '[provisionsource]' => [
+          'sid' => 'openldap1',
+          'ldap_attr' => '[provisionsource]',
+          'user_attr' => 'user_tokens',
+          'convert' => 0,
+          'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+          'user_tokens' => 'drupal.hogwarts.edu',
+          'config_module' => 'ldap_user',
+          'synch_module' => 'ldap_user',
+          'enabled' => 1,
+          'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY],
+        ],
+      ],
+    ],
+  ];
 
   return $conf;
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/test_ldap/hogwarts/hogwarts_x_openldap1.entries.php b/drupal7/sites/all/modules/ldap/ldap_test/test_ldap/hogwarts/hogwarts_x_openldap1.entries.php
index 8ca40aeb..45eed0ad 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/test_ldap/hogwarts/hogwarts_x_openldap1.entries.php
+++ b/drupal7/sites/all/modules/ldap/ldap_test/test_ldap/hogwarts/hogwarts_x_openldap1.entries.php
@@ -3,992 +3,991 @@
 /**
  * @file
  * Depracated File.  Not for use, but for reference
- * Array below generated by code and likely out of date
- *
+ * Array below generated by code and likely out of date.
  */
 
-$entries = array(
-    'cn=hpotter,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+$entries = [
+  'cn=hpotter,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'hpotter',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'hpotter@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '1',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '101',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Potter',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Harry',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Gryffindor',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '3.8',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=hgrainger,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=hgrainger,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'hgrainger',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'hgrainger@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '2',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '102',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Granger',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Hermione',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Gryffindor',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '4',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=rweasley,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=rweasley,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'rweasley',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'rweasley@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '3',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '103',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Weasley',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Ron',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Gryffindor',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '3.6',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=fweasley,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=fweasley,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'fweasley',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'fweasley@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '4',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '104',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Weasley',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Fred',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Gryffindor',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '3',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=gweasley,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=gweasley,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'gweasley',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'gweasley@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '5',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '105',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Weasley',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'George',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Gryffindor',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '2.7',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=dmalfoy,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=dmalfoy,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'dmalfoy',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'dmalfoy@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '6',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '106',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Malfoy',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Draco',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Slytherin',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '3.7',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=triddle,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=triddle,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'triddle',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'triddle@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '7',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '107',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Riddle',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Tom',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Slytherin',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '3.6',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=ggoyle,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=ggoyle,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'ggoyle',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'ggoyle@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '8',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '108',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Goyle',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Gregory',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Slytherin',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '3.3',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=ssnape,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=ssnape,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'ssnape',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'ssnape@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '9',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '109',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Snape',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Severus ',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Slytherin',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => 'Defence Against the Dark Arts professor ',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 0,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=adumbledore,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=adumbledore,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'adumbledore',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'adumbledore@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '10',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '110',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Dumbledore',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Albus',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => 'Head Master Of Hogwarts',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 0,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=mmcgonagall,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=mmcgonagall,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'mmcgonagall',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'mmcgonagall@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '11',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '111',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'McGonagall',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Minerva',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Gryffindor',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => 'Tranfiguration/ Deputy Head Mistress',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 0,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=spomana,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=spomana,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'spomana',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'spomana@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '12',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '112',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Pomona',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Sprout',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Hufflepuff',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => 'Herbology',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 0,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=rhagrid,ou=people,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=rhagrid,ou=people,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'rhagrid',
         'count' => 1,
-      ),
+      ],
       'mail' =>
-      array(
+      [
         0 => 'rhagrid@hogwarts.edu',
         'count' => 1,
-      ),
+      ],
       'uid' =>
-      array(
+      [
         0 => '13',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => '113',
         'count' => 1,
-      ),
+      ],
       'sn' =>
-      array(
+      [
         0 => 'Hagrid',
         'count' => 1,
-      ),
+      ],
       'givenname' =>
-      array(
+      [
         0 => 'Rubeus',
         'count' => 1,
-      ),
+      ],
       'house' =>
-      array(
+      [
         0 => 'Gryffindor',
         'count' => 1,
-      ),
+      ],
       'department' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'faculty' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'staff' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'student' =>
-      array(
+      [
         0 => 1,
         'count' => 1,
-      ),
+      ],
       'gpa' =>
-      array(
+      [
         0 => '',
         'count' => 1,
-      ),
+      ],
       'probation' =>
-      array(
+      [
         0 => 0,
         'count' => 1,
-      ),
+      ],
       'password' =>
-      array(
+      [
         0 => 'goodpwd',
         'count' => 1,
-      ),
+      ],
       'count' => 14,
-    ),
-    'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+    ],
+  'cn=gryffindor,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'gryffindor',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '1',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 201,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
         1 => 'cn=hgrainger,ou=people,dc=hogwarts,dc=edu',
         2 => 'cn=rweasley,ou=people,dc=hogwarts,dc=edu',
@@ -997,77 +996,77 @@ $entries = array(
         5 => 'cn=mmcgonagall,ou=people,dc=hogwarts,dc=edu',
         6 => 'cn=rhagrid,ou=people,dc=hogwarts,dc=edu',
         'count' => 7,
-      ),
-    ),
-    'cn=slytherin,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+      ],
+    ],
+  'cn=slytherin,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'slytherin',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '2',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 202,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=dmalfoy,ou=people,dc=hogwarts,dc=edu',
         1 => 'cn=triddle,ou=people,dc=hogwarts,dc=edu',
         2 => 'cn=ggoyle,ou=people,dc=hogwarts,dc=edu',
         3 => 'cn=ssnape,ou=people,dc=hogwarts,dc=edu',
         4 => 'cn=dmalfoy,ou=people,dc=hogwarts,dc=edu',
         'count' => 5,
-      ),
-    ),
-    'cn=hufflepuff,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+      ],
+    ],
+  'cn=hufflepuff,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'hufflepuff',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '3',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 203,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=spomana,ou=people,dc=hogwarts,dc=edu',
         'count' => 1,
-      ),
-    ),
-    'cn=students,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+      ],
+    ],
+  'cn=students,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'students',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '4',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 204,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
         1 => 'cn=hgrainger,ou=people,dc=hogwarts,dc=edu',
         2 => 'cn=rweasley,ou=people,dc=hogwarts,dc=edu',
@@ -1076,128 +1075,128 @@ $entries = array(
         5 => 'cn=dmalfoy,ou=people,dc=hogwarts,dc=edu',
         6 => 'cn=ggoyle,ou=people,dc=hogwarts,dc=edu',
         'count' => 7,
-      ),
-    ),
-    'cn=honors students,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+      ],
+    ],
+  'cn=honors students,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'honors students',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '5',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 205,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
         1 => 'cn=hgrainger,ou=people,dc=hogwarts,dc=edu',
         'count' => 2,
-      ),
-    ),
-    'cn=probation students,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+      ],
+    ],
+  'cn=probation students,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'probation students',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '6',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 206,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=dmalfoy,ou=people,dc=hogwarts,dc=edu',
         1 => 'cn=ggoyle,ou=people,dc=hogwarts,dc=edu',
         'count' => 2,
-      ),
-    ),
-    'cn=faculty,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+      ],
+    ],
+  'cn=faculty,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'faculty',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '7',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 207,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=ssnape,ou=people,dc=hogwarts,dc=edu',
         1 => 'cn=adumbledore,ou=people,dc=hogwarts,dc=edu',
         2 => 'cn=mmcgonagall,ou=people,dc=hogwarts,dc=edu',
         3 => 'cn=spomana,ou=people,dc=hogwarts,dc=edu',
         'count' => 4,
-      ),
-    ),
-    'cn=staff,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+      ],
+    ],
+  'cn=staff,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'staff',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '8',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 208,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=rhagrid,ou=people,dc=hogwarts,dc=edu',
         'count' => 1,
-      ),
-    ),
-    'cn=users,ou=groups,dc=hogwarts,dc=edu' =>
-    array(
+      ],
+    ],
+  'cn=users,ou=groups,dc=hogwarts,dc=edu' =>
+    [
       'cn' =>
-      array(
+      [
         0 => 'users',
         'count' => 1,
-      ),
+      ],
       'gid' =>
-      array(
+      [
         0 => '9',
         'count' => 1,
-      ),
+      ],
       'guid' =>
-      array(
+      [
         0 => 209,
         'count' => 1,
-      ),
+      ],
       'member' =>
-      array(
+      [
         0 => 'cn=students,ou=groups,dc=hogwarts,dc=edu',
         1 => 'cn=faculty,ou=groups,dc=hogwarts,dc=edu',
         2 => 'cn=staff,ou=groups,dc=hogwarts,dc=edu',
         'count' => 3,
-      ),
-    ),
-  );
+      ],
+    ],
+];
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php b/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php
index 5d21a946..4ae0791f 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php
@@ -3,15 +3,17 @@
 /**
  * @file
  * This class represents a ldap_user module's configuration
- * It is extended by LdapUserConfAdmin for configuration and other admin functions
+ * It is extended by LdapUserConfAdmin for configuration and other admin functions.
  */
 
-require_once('ldap_user.module');
-
+require_once 'ldap_user.module';
+/**
+ *
+ */
 class LdapUserConf {
 
   /**
-   * server providing Drupal account provisioning
+   * Server providing Drupal account provisioning.
    *
    * @var string
    *
@@ -20,7 +22,7 @@ class LdapUserConf {
   public $drupalAcctProvisionServer = LDAP_USER_NO_SERVER_SID;
 
   /**
-   * server providing LDAP entry provisioning
+   * Server providing LDAP entry provisioning.
    *
    * @var string
    *
@@ -33,35 +35,35 @@ class LdapUserConf {
    *
    * @var array
    */
-  public $provisionSidFromDirection = array(
+  public $provisionSidFromDirection = [
     LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => LDAP_USER_NO_SERVER_SID,
     LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => LDAP_USER_NO_SERVER_SID,
-  );
+  ];
 
   /**
    * Array of events that trigger provisioning of Drupal Accounts
    * Valid constants are:
    *   LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE
    *   LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE
-   *   LDAP_USER_DRUPAL_USER_PROV_ON_ALLOW_MANUAL_CREATE
+   *   LDAP_USER_DRUPAL_USER_PROV_ON_ALLOW_MANUAL_CREATE.
    *
    * @var array
    */
-  public $drupalAcctProvisionTriggers = array(LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE, LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE, LDAP_USER_DRUPAL_USER_PROV_ON_ALLOW_MANUAL_CREATE);
+  public $drupalAcctProvisionTriggers = [LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE, LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE, LDAP_USER_DRUPAL_USER_PROV_ON_ALLOW_MANUAL_CREATE];
 
   /**
    * Array of events that trigger provisioning of LDAP Entries
    * Valid constants are:
    *   LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE
    *   LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE
-   *   LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE
+   *   LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE.
    *
    * @var array
    */
-  public $ldapEntryProvisionTriggers = array();
+  public $ldapEntryProvisionTriggers = [];
 
   /**
-   * server providing LDAP entry provisioning
+   * Server providing LDAP entry provisioning.
    *
    * @var string
    *
@@ -81,7 +83,7 @@ class LdapUserConf {
   public $accountsWithSameEmail = LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED;
 
   /**
-   * drupal account creation model
+   * Drupal account creation model.
    *
    * @var int
    *   LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR   /admin/config/people/accounts/settings do not affect "LDAP Associated" Drupal accounts.
@@ -90,30 +92,31 @@ class LdapUserConf {
   public $acctCreation = LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR_DEFAULT;
 
   /**
-   * has current object been saved to the database?
-   *
-   * @var boolean
+   * Has current object been saved to the database?
    *
+   * @var bool
    */
   public $inDatabase = FALSE;
 
   /**
-   * what to do when an ldap provisioned username conflicts with existing drupal user?
+   * What to do when an ldap provisioned username conflicts with existing drupal user?
    *
    * @var int
    *   LDAP_USER_CONFLICT_LOG - log the conflict
    *   LDAP_USER_CONFLICT_RESOLVE - LDAP associate the existing drupal user
-   *
    */
   public $manualAccountConflict = LDAP_USER_MANUAL_ACCT_CONFLICT_REJECT;
 
-  public $setsLdapPassword = TRUE; // @todo default to FALSE and check for mapping to set to true
+  /**
+   * @todo default to FALSE and check for mapping to set to true
+   */
+  public $setsLdapPassword = TRUE;
 
   public $loginConflictResolve = FALSE;
 
   public $disableAdminPasswordField = FALSE;
   /**
-   * array of field synch mappings provided by all modules (via hook_ldap_user_attrs_list_alter())
+   * Array of field synch mappings provided by all modules (via hook_ldap_user_attrs_list_alter())
    * array of the form: array(
    * LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER | LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(
    *   <server_id> => array(
@@ -133,58 +136,61 @@ class LdapUserConf {
    *    )
    *  )
    */
-  public $synchMapping = NULL; // array of field synching directions for each operation.  should include ldapUserSynchMappings
-  // keyed on direction => property, ldap, or field token such as '[field.field_lname] with brackets in them.
-
   /**
-  * synch mappings configured in ldap user module (not in other modules)
-  *   array of the form: array(
-    LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER | LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(
-      'sid' => <server_id> (redundant)
-      'ldap_attr' => e.g. [sn]
-      'user_attr'  => e.g. [field.field_user_lname] (when this value is set to 'user_tokens', 'user_tokens' value is used.)
-      'user_tokens' => e.g. [field.field_user_lname], [field.field_user_fname]
-      'convert' => 1|0 boolean indicating need to covert from binary
-      'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER | LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY (redundant)
-      'config_module' => 'ldap_user'
-      'prov_module' => 'ldap_user'
-      'enabled' => 1|0 boolean
-       prov_events' => array( of LDAP_USER_EVENT_* constants indicating during which synch actions field should be synched)
-          - four permutations available
-             to ldap:   LDAP_USER_EVENT_CREATE_LDAP_ENTRY,  LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY,
-             to drupal: LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER
-      )
-    )
-  )
-  */
-  public $ldapUserSynchMappings = NULL;  //
-  // keyed on property, ldap, or field token such as '[field.field_lname] with brackets in them.
+   * Array of field synching directions for each operation.  should include ldapUserSynchMappings.
+   */
+  public $synchMapping = NULL;
+  // Keyed on direction => property, ldap, or field token such as '[field.field_lname] with brackets in them.
+  /**
+   * Synch mappings configured in ldap user module (not in other modules)
+   *   array of the form: array(
+   * LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER | LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(
+   * 'sid' => <server_id> (redundant)
+   * 'ldap_attr' => e.g. [sn]
+   * 'user_attr'  => e.g. [field.field_user_lname] (when this value is set to 'user_tokens', 'user_tokens' value is used.)
+   * 'user_tokens' => e.g. [field.field_user_lname], [field.field_user_fname]
+   * 'convert' => 1|0 boolean indicating need to covert from binary
+   * 'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER | LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY (redundant)
+   * 'config_module' => 'ldap_user'
+   * 'prov_module' => 'ldap_user'
+   * 'enabled' => 1|0 boolean
+   * prov_events' => array( of LDAP_USER_EVENT_* constants indicating during which synch actions field should be synched)
+   * - four permutations available
+   * to ldap:   LDAP_USER_EVENT_CREATE_LDAP_ENTRY,  LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY,
+   * to drupal: LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER
+   * )
+   * )
+   * )
+   */
+  public $ldapUserSynchMappings = NULL;
+  /**
+   * Keyed on property, ldap, or field token such as '[field.field_lname] with brackets in them.
+   */
   public $detailedWatchdog = FALSE;
   public $provisionsDrupalAccountsFromLdap = FALSE;
   public $provisionsLdapEntriesFromDrupalUsers = FALSE;
 
-  // what should be done with ldap provisioned accounts that no longer have associated drupal accounts.
+  /**
+   * What should be done with ldap provisioned accounts that no longer have associated drupal accounts.
+   */
   public $orphanedDrupalAcctBehavior = 'ldap_user_orphan_email';
-   /** options are partially derived from user module account cancel options:
-    *
-    'ldap_user_orphan_do_not_check' => Do not check for orphaned Drupal accounts.)
-    'ldap_user_orphan_email' => Perform no action, but email list of orphaned accounts. (All the other options will send email summaries also.)
-    'user_cancel_block' => Disable the account and keep its content.
-    'user_cancel_block_unpublish' => Disable the account and unpublish its content.
-    'user_cancel_reassign' => Delete the account and make its content belong to the Anonymous user.
-    'user_cancel_delete' => Delete the account and its content.
-    */
+  /**
+   * Options are partially derived from user module account cancel options:.
+   *
+   * 'ldap_user_orphan_do_not_check' => Do not check for orphaned Drupal accounts.)
+   * 'ldap_user_orphan_email' => Perform no action, but email list of orphaned accounts. (All the other options will send email summaries also.)
+   * 'user_cancel_block' => Disable the account and keep its content.
+   * 'user_cancel_block_unpublish' => Disable the account and unpublish its content.
+   * 'user_cancel_reassign' => Delete the account and make its content belong to the Anonymous user.
+   * 'user_cancel_delete' => Delete the account and its content.
+   */
 
   public $orphanedCheckQty = 100;
 
-// public $wsKey = NULL;
-//  public $wsEnabled = 0;
-//  public $wsUserIps = array();
-
-  public $provisionsLdapEvents = array();
-  public $provisionsDrupalEvents = array();
+  public $provisionsLdapEvents = [];
+  public $provisionsDrupalEvents = [];
 
-  public $saveable = array(
+  public $saveable = [
     'drupalAcctProvisionServer',
     'ldapEntryProvisionServer',
     'drupalAcctProvisionTriggers',
@@ -197,23 +203,26 @@ class LdapUserConf {
     'acctCreation',
     'ldapUserSynchMappings',
     'disableAdminPasswordField',
-  );
-// 'wsKey','wsEnabled','wsUserIps',
-  function __construct() {
+  ];
+
+  /**
+   *
+   */
+  public function __construct() {
     $this->load();
 
     $this->provisionSidFromDirection[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER] = $this->drupalAcctProvisionServer;
     $this->provisionSidFromDirection[LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY] = $this->ldapEntryProvisionServer;
 
-    $this->provisionsLdapEvents = array(
+    $this->provisionsLdapEvents = [
       LDAP_USER_EVENT_CREATE_LDAP_ENTRY => t('On LDAP Entry Creation'),
       LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY => t('On Synch to LDAP Entry'),
-      );
+    ];
 
-    $this->provisionsDrupalEvents = array(
+    $this->provisionsDrupalEvents = [
       LDAP_USER_EVENT_CREATE_DRUPAL_USER => t('On Drupal User Creation'),
       LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER => t('On Synch to Drupal User'),
-      );
+    ];
 
     $this->provisionsDrupalAccountsFromLdap = (
       $this->drupalAcctProvisionServer &&
@@ -231,7 +240,10 @@ class LdapUserConf {
     $this->detailedWatchdog = variable_get('ldap_help_watchdog_detail', 0);
   }
 
-  function load() {
+  /**
+   *
+   */
+  public function load() {
 
     if ($saved = variable_get("ldap_user_conf", FALSE)) {
       $this->inDatabase = TRUE;
@@ -245,9 +257,9 @@ class LdapUserConf {
       $this->inDatabase = FALSE;
       // By default this variable should be 0 if the "sharedemail" module
       // is not enabled, or 1 if the module is.
-      $this->accountsWithSameEmail = (int)module_exists('sharedemail');
+      $this->accountsWithSameEmail = (int) module_exists('sharedemail');
     }
-    // determine account creation configuration
+    // Determine account creation configuration.
     $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
     if ($this->acctCreation == LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR_DEFAULT || $user_register == USER_REGISTER_VISITORS) {
       $this->createLDAPAccounts = TRUE;
@@ -264,33 +276,33 @@ class LdapUserConf {
   }
 
   /**
-   * Destructor Method
+   * Destructor Method.
    */
-  function __destruct() { }
-
+  public function __destruct() {}
 
   /**
-   * Util to fetch mappings for a given direction
+   * Util to fetch mappings for a given direction.
    *
    * @param string $sid
-   *   The server id
-   * @param string $direction LDAP_USER_PROV_DIRECTION_* constant
+   *   The server id.
+   * @param string $direction
+   *   LDAP_USER_PROV_DIRECTION_* constant.
    * @param array $prov_events
    *
-   * @return array/bool
+   * @return arraybool
    *   Array of mappings (may be empty array)
-  */
+   */
   public function getSynchMappings($direction = LDAP_USER_PROV_DIRECTION_ALL, $prov_events = NULL) {
     if (!$prov_events) {
       $prov_events = ldap_user_all_events();
     }
 
-    $mappings = array();
+    $mappings = [];
     if ($direction == LDAP_USER_PROV_DIRECTION_ALL) {
-      $directions = array(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY);
+      $directions = [LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY];
     }
     else {
-      $directions = array($direction);
+      $directions = [$direction];
     }
     foreach ($directions as $direction) {
       if (!empty($this->ldapUserSynchMappings[$direction])) {
@@ -307,6 +319,9 @@ class LdapUserConf {
     return $mappings;
   }
 
+  /**
+   *
+   */
   public function isDrupalAcctProvisionServer($sid) {
     if (!$sid || !$this->drupalAcctProvisionServer) {
       return FALSE;
@@ -319,6 +334,9 @@ class LdapUserConf {
     }
   }
 
+  /**
+   *
+   */
   public function isLdapEntryProvisionServer($sid) {
     if (!$sid || !$this->ldapEntryProvisionServer) {
       return FALSE;
@@ -334,18 +352,18 @@ class LdapUserConf {
   /**
    * Util to fetch attributes required for this user conf, not other modules.
    *
-   * @param enum $direction LDAP_USER_PROV_DIRECTION_* constants
+   * @param enum $direction
+   *   LDAP_USER_PROV_DIRECTION_* constants.
    * @param string $ldap_context
-   *
-  */
+   */
   public function getLdapUserRequiredAttributes($direction = LDAP_USER_PROV_DIRECTION_ALL, $ldap_context = NULL) {
 
-    $attributes_map = array();
-    $required_attributes = array();
+    $attributes_map = [];
+    $required_attributes = [];
     if ($this->drupalAcctProvisionServer) {
       $prov_events = $this->ldapContextToProvEvents($ldap_context);
       $attributes_map = $this->getSynchMappings($direction, $prov_events);
-      $required_attributes = array();
+      $required_attributes = [];
       foreach ($attributes_map as $detail) {
         if (count(array_intersect($prov_events, $detail['prov_events']))) {
           // Add the attribute to our array.
@@ -358,20 +376,19 @@ class LdapUserConf {
     return $required_attributes;
   }
 
-/**
- * converts the more general ldap_context string to its associated ldap user event
- */
-
+  /**
+   * Converts the more general ldap_context string to its associated ldap user event.
+   */
   public function ldapContextToProvEvents($ldap_context = NULL) {
 
     switch ($ldap_context) {
 
       case 'ldap_user_prov_to_drupal':
-        $result = array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_LDAP_ASSOCIATE_DRUPAL_ACCT);
+        $result = [LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_LDAP_ASSOCIATE_DRUPAL_ACCT];
         break;
 
       case 'ldap_user_prov_to_ldap':
-        $result = array(LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY, LDAP_USER_EVENT_CREATE_LDAP_ENTRY);
+        $result = [LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY, LDAP_USER_EVENT_CREATE_LDAP_ENTRY];
         break;
 
       default:
@@ -383,11 +400,9 @@ class LdapUserConf {
 
   }
 
-
-/**
- * converts the more general ldap_context string to its associated ldap user prov direction
- */
-
+  /**
+   * Converts the more general ldap_context string to its associated ldap user prov direction.
+   */
   public function ldapContextToProvDirection($ldap_context = NULL) {
 
     switch ($ldap_context) {
@@ -401,7 +416,7 @@ class LdapUserConf {
         $result = LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY;
         break;
 
-      // provisioning is can hapen in both directions in most contexts
+      // Provisioning is can hapen in both directions in most contexts.
       case 'ldap_user_insert_drupal_user':
       case 'ldap_user_update_drupal_user':
       case 'ldap_authentication_authenticate':
@@ -419,32 +434,35 @@ class LdapUserConf {
   }
 
   /**
-    derive mapping array from ldap user configuration and other configurations.
-    if this becomes a resource hungry function should be moved to ldap_user functions
-    and stored with static variable. should be cached also.
-
-    this should be cached and modules implementing ldap_user_synch_mapping_alter
-    should know when to invalidate cache.
+   * Derive mapping array from ldap user configuration and other configurations.
+   * if this becomes a resource hungry function should be moved to ldap_user functions
+   * and stored with static variable. should be cached also.
+   *
+   * This should be cached and modules implementing ldap_user_synch_mapping_alter
+   * should know when to invalidate cache.
+   */
 
+  /**
+   * @todo change default to false after development
    */
+  public function setSynchMapping($reset = TRUE) {
 
-  function setSynchMapping($reset = TRUE) {  // @todo change default to false after development
     $synch_mapping_cache = cache_get('ldap_user_synch_mapping');
     if (!$reset && $synch_mapping_cache) {
       $this->synchMapping = $synch_mapping_cache->data;
     }
     else {
-      $available_user_attrs = array();
-      foreach (array(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) as $direction) {
+      $available_user_attrs = [];
+      foreach ([LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY] as $direction) {
         $sid = $this->provisionSidFromDirection[$direction];
-        $available_user_attrs[$direction] = array();
+        $available_user_attrs[$direction] = [];
         $ldap_server = ($sid) ? ldap_servers_get_servers($sid, NULL, TRUE) : FALSE;
 
-        $params = array(
+        $params = [
           'ldap_server' => $ldap_server,
           'ldap_user_conf' => $this,
           'direction' => $direction,
-        );
+        ];
 
         drupal_alter('ldap_user_attrs_list', $available_user_attrs[$direction], $params);
       }
@@ -455,21 +473,23 @@ class LdapUserConf {
   }
 
   /**
-   * given a $prov_event determine if ldap user configuration supports it.
-   *   this is overall, not per field synching configuration
+   * Given a $prov_event determine if ldap user configuration supports it.
+   *   this is overall, not per field synching configuration.
    *
-   * @param enum $direction LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY
+   * @param enum $direction
+   *   LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY.
    *
    * @param enum $prov_event
    *   LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, LDAP_USER_EVENT_CREATE_DRUPAL_USER
    *   LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY LDAP_USER_EVENT_CREATE_LDAP_ENTRY
    *   LDAP_USER_EVENT_LDAP_ASSOCIATE_DRUPAL_ACCT
-   *   LDAP_USER_EVENT_ALL
+   *   LDAP_USER_EVENT_ALL.
+   *
+   * @param enum $action
+   *   'synch', 'provision', 'delete_ldap_entry', 'delete_drupal_entry', 'cancel_drupal_entry'.
    *
-   * @param enum $action 'synch', 'provision', 'delete_ldap_entry', 'delete_drupal_entry', 'cancel_drupal_entry'
-   * @return boolean
+   * @return bool
    */
-
   public function provisionEnabled($direction, $provision_trigger) {
     $result = FALSE;
 
@@ -495,30 +515,30 @@ class LdapUserConf {
     return $result;
   }
 
- /**
-   * given a drupal account, provision an ldap entry if none exists.  if one exists do nothing
+  /**
+   * Given a drupal account, provision an ldap entry if none exists.  if one exists do nothing.
    *
-   * @param object $account drupal account object with minimum of name property
-   * @param array $ldap_user as prepopulated ldap entry.  usually not provided
+   * @param object $account
+   *   drupal account object with minimum of name property.
+   * @param array $ldap_user
+   *   as prepopulated ldap entry.  usually not provided.
    *
    * @return array of form:
-   *     array('status' => 'success', 'fail', or 'conflict'),
+   *   array('status' => 'success', 'fail', or 'conflict'),
    *     array('ldap_server' => ldap server object),
    *     array('proposed' => proposed ldap entry),
    *     array('existing' => existing ldap entry),
    *     array('description' = > blah blah)
-   *
    */
-
   public function provisionLdapEntry($account, $ldap_user = NULL, $test_query = FALSE) {
-    $watchdog_tokens = array();
-    $result = array(
+    $watchdog_tokens = [];
+    $result = [
       'status' => NULL,
       'ldap_server' => NULL,
       'proposed' => NULL,
       'existing' => NULL,
       'description' => NULL,
-    );
+    ];
 
     if (is_scalar($account)) {
       $username = $account;
@@ -531,7 +551,8 @@ class LdapUserConf {
     if (is_object($account) && property_exists($account, 'uid') && $account->uid == 1) {
       $result['status'] = 'fail';
       $result['error_description'] = 'can not provision drupal user 1';
-      return $result; // do not provision or synch user 1
+      // Do not provision or synch user 1.
+      return $result;
     }
 
     if ($account == FALSE || $account->uid == 0) {
@@ -547,13 +568,13 @@ class LdapUserConf {
     }
 
     $ldap_server = ldap_servers_get_servers($this->ldapEntryProvisionServer, NULL, TRUE);
-    $params = array(
+    $params = [
       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-      'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY),
+      'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY],
       'module' => 'ldap_user',
       'function' => 'provisionLdapEntry',
       'include_count' => FALSE,
-    );
+    ];
 
     list($proposed_ldap_entry, $error) = $this->drupalUserToLdapEntry($account, $ldap_server, $params, $ldap_user);
     $proposed_dn = (is_array($proposed_ldap_entry) && isset($proposed_ldap_entry['dn']) && $proposed_ldap_entry['dn']) ? $proposed_ldap_entry['dn'] : NULL;
@@ -586,15 +607,15 @@ class LdapUserConf {
       $result['ldap_server'] = $ldap_server;
     }
     else {
-      // stick $proposed_ldap_entry in $ldap_entries array for drupal_alter call
-      $ldap_entries = array($proposed_dn_lcase => $proposed_ldap_entry);
-      $context = array(
+      // Stick $proposed_ldap_entry in $ldap_entries array for drupal_alter call.
+      $ldap_entries = [$proposed_dn_lcase => $proposed_ldap_entry];
+      $context = [
         'action' => 'add',
-        'corresponding_drupal_data' => array($proposed_dn_lcase => $account),
+        'corresponding_drupal_data' => [$proposed_dn_lcase => $account],
         'corresponding_drupal_data_type' => 'user',
-      );
+      ];
       drupal_alter('ldap_entry_pre_provision', $ldap_entries, $ldap_server, $context);
-      // remove altered $proposed_ldap_entry from $ldap_entries array
+      // Remove altered $proposed_ldap_entry from $ldap_entries array.
       $proposed_ldap_entry = $ldap_entries[$proposed_dn_lcase];
 
       $ldap_entry_created = $ldap_server->createLdapEntry($proposed_ldap_entry, $proposed_dn);
@@ -606,10 +627,10 @@ class LdapUserConf {
         $result['created'] = $ldap_entry_created;
         $result['ldap_server'] = $ldap_server;
 
-        // need to store <sid>|<dn> in ldap_user_prov_entries field, which may contain more than one
+        // Need to store <sid>|<dn> in ldap_user_prov_entries field, which may contain more than one.
         $ldap_user_prov_entry = $ldap_server->sid . '|' . $proposed_ldap_entry['dn'];
         if (!isset($user_entity->ldap_user_prov_entries[LANGUAGE_NONE])) {
-          $user_entity->ldap_user_prov_entries = array(LANGUAGE_NONE => array());
+          $user_entity->ldap_user_prov_entries = [LANGUAGE_NONE => []];
         }
         $ldap_user_prov_entry_exists = FALSE;
         foreach ($user_entity->ldap_user_prov_entries[LANGUAGE_NONE] as $i => $field_value_instance) {
@@ -618,9 +639,9 @@ class LdapUserConf {
           }
         }
         if (!$ldap_user_prov_entry_exists) {
-          $user_entity->ldap_user_prov_entries[LANGUAGE_NONE][] = array(
+          $user_entity->ldap_user_prov_entries[LANGUAGE_NONE][] = [
             'value' => $ldap_user_prov_entry,
-          );
+          ];
 
           // Save the field without calling user_save()
           field_attach_presave('user', $user_entity);
@@ -637,13 +658,13 @@ class LdapUserConf {
       }
     }
 
-    $tokens = array(
+    $tokens = [
       '%dn' => isset($result['proposed']['dn']) ? $result['proposed']['dn'] : NULL,
       '%sid' => (isset($result['ldap_server']) && $result['ldap_server']) ? $result['ldap_server']->sid : 0,
       '%username' => @$account->name,
       '%uid' => @$account->uid,
       '%description' => @$result['description'],
-    );
+    ];
     if (!$test_query && isset($result['status'])) {
       if ($result['status'] == 'success') {
         if ($this->detailedWatchdog) {
@@ -662,37 +683,39 @@ class LdapUserConf {
     return $result;
   }
 
-
   /**
-   * given a drupal account, synch to related ldap entry
+   * Given a drupal account, synch to related ldap entry.
    *
-   * @param drupal user object $account.  Drupal user object
-   * @param array $user_edit.  Edit array for user_save.  generally null unless user account is being created or modified in same synching
-   * @param array $ldap_user.  current ldap data of user. @see README.developers.txt for structure
+   * @param drupal user object $account
+   *   Drupal user object.
+   * @param array $user_edit
+   *   Edit array for user_save.  generally null unless user account is being created or modified in same synching.
+   * @param array $ldap_user
+   *   current ldap data of user. @see README.developers.txt for structure.
    *
    * @return TRUE on success or FALSE on fail.
    */
-
-  public function synchToLdapEntry($account, $user_edit = NULL, $ldap_user =  array(), $test_query = FALSE) {
+  public function synchToLdapEntry($account, $user_edit = NULL, $ldap_user = [], $test_query = FALSE) {
 
     if (is_object($account) && property_exists($account, 'uid') && $account->uid == 1) {
-      return FALSE; // do not provision or synch user 1
+      // Do not provision or synch user 1.
+      return FALSE;
     }
 
-    $watchdog_tokens = array();
+    $watchdog_tokens = [];
     $result = FALSE;
     $proposed_ldap_entry = FALSE;
 
     if ($this->ldapEntryProvisionServer) {
       $ldap_server = ldap_servers_get_servers($this->ldapEntryProvisionServer, NULL, TRUE);
 
-      $params = array(
+      $params = [
         'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-        'prov_events' => array(LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
+        'prov_events' => [LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
         'module' => 'ldap_user',
         'function' => 'synchToLdapEntry',
         'include_count' => FALSE,
-      );
+      ];
 
       list($proposed_ldap_entry, $error) = $this->drupalUserToLdapEntry($account, $ldap_server, $params, $ldap_user);
       if ($error != LDAP_USER_PROV_RESULT_NO_ERROR) {
@@ -700,7 +723,8 @@ class LdapUserConf {
       }
       elseif (is_array($proposed_ldap_entry) && isset($proposed_ldap_entry['dn'])) {
         $existing_ldap_entry = $ldap_server->dnExists($proposed_ldap_entry['dn'], 'ldap_entry');
-        $attributes = array(); // this array represents attributes to be modified; not comprehensive list of attributes
+        // This array represents attributes to be modified; not comprehensive list of attributes.
+        $attributes = [];
         foreach ($proposed_ldap_entry as $attr_name => $attr_values) {
           if ($attr_name != 'dn') {
             if (isset($attr_values['count'])) {
@@ -717,40 +741,42 @@ class LdapUserConf {
 
         if ($test_query) {
           $proposed_ldap_entry = $attributes;
-          $result = array(
+          $result = [
             'proposed' => $proposed_ldap_entry,
             'server' => $ldap_server,
-          );
+          ];
         }
         else {
-          // stick $proposed_ldap_entry in $ldap_entries array for drupal_alter call
+          // Stick $proposed_ldap_entry in $ldap_entries array for drupal_alter call.
           $proposed_dn_lcase = drupal_strtolower($proposed_ldap_entry['dn']);
-          $ldap_entries = array($proposed_dn_lcase => $attributes);
-          $context = array(
+          $ldap_entries = [$proposed_dn_lcase => $attributes];
+          $context = [
             'action' => 'update',
-            'corresponding_drupal_data' => array($proposed_dn_lcase => $attributes),
+            'corresponding_drupal_data' => [$proposed_dn_lcase => $attributes],
             'corresponding_drupal_data_type' => 'user',
-          );
+          ];
           drupal_alter('ldap_entry_pre_provision', $ldap_entries, $ldap_server, $context);
-          // remove altered $proposed_ldap_entry from $ldap_entries array
+          // Remove altered $proposed_ldap_entry from $ldap_entries array.
           $attributes = $ldap_entries[$proposed_dn_lcase];
           $result = $ldap_server->modifyLdapEntry($proposed_ldap_entry['dn'], $attributes);
-          if ($result) { // success
+          // Success.
+          if ($result) {
             module_invoke_all('ldap_entry_post_provision', $ldap_entries, $ldap_server, $context);
           }
         }
       }
-      else { // failed to get acceptable proposed ldap entry
+      // Failed to get acceptable proposed ldap entry.
+      else {
         $result = FALSE;
       }
     }
 
-    $tokens = array(
+    $tokens = [
       '%dn' => isset($proposed_ldap_entry['dn']) ? $proposed_ldap_entry['dn'] : NULL,
       '%sid' => $this->ldapEntryProvisionServer,
       '%username' => $account->name,
       '%uid' => ($test_query || !property_exists($account, 'uid')) ? '' : $account->uid,
-    );
+    ];
 
     if ($result) {
       watchdog('ldap_user', 'LDAP entry on server %sid synched dn=%dn. username=%username, uid=%uid', $tokens, WATCHDOG_INFO);
@@ -764,32 +790,36 @@ class LdapUserConf {
   }
 
   /**
-   * given a drupal account, query ldap and get all user fields and create user account
+   * Given a drupal account, query ldap and get all user fields and create user account.
    *
-   * @param array $account drupal account array with minimum of name
-   * @param array $user_edit drupal edit array in form user_save($account, $user_edit) would take,
-   *   generally empty unless overriding synchToDrupalAccount derived values
-   * @param array $ldap_user as user's ldap entry.  passed to avoid requerying ldap in cases where already present
-   * @param boolean $save indicating if drupal user should be saved.  generally depends on where function is called from.
+   * @param array $account
+   *   drupal account array with minimum of name.
+   * @param array $user_edit
+   *   drupal edit array in form user_save($account, $user_edit) would take,
+   *   generally empty unless overriding synchToDrupalAccount derived values.
+   * @param array $ldap_user
+   *   as user's ldap entry.  passed to avoid requerying ldap in cases where already present.
+   * @param bool $save
+   *   indicating if drupal user should be saved.  generally depends on where function is called from.
    *
-   * @return result of user_save() function is $save is true, otherwise return TRUE
+   * @return bool|object
+   *   Result of user_save() function is $save is true, otherwise return TRUE
    *   $user_edit data returned by reference
-   *
    */
   public function synchToDrupalAccount($drupal_user, &$user_edit, $prov_event = LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, $ldap_user = NULL, $save = FALSE) {
 
-    $debug = array(
+    $debug = [
       'account' => $drupal_user,
       'user_edit' => $user_edit,
       'ldap_user' => $ldap_user,
-    );
+    ];
 
     if (
         (!$ldap_user  && !isset($drupal_user->name)) ||
         (!$drupal_user && $save) ||
         ($ldap_user && !isset($ldap_user['sid']))
     ) {
-       // should throw watchdog error also
+      // Should throw watchdog error also.
       return FALSE;
     }
 
@@ -803,7 +833,7 @@ class LdapUserConf {
 
     if ($this->drupalAcctProvisionServer) {
       $ldap_server = ldap_servers_get_servers($this->drupalAcctProvisionServer, NULL, TRUE);
-      $this->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, array($prov_event));
+      $this->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, [$prov_event]);
     }
 
     if ($save) {
@@ -816,11 +846,12 @@ class LdapUserConf {
     }
   }
 
-
   /**
-   * given a drupal account, delete user account
+   * Given a drupal account, delete user account.
+   *
+   * @param string $username
+   *   drupal account name.
    *
-   * @param string $username drupal account name
    * @return TRUE or FALSE.  FALSE indicates failed or action not enabled in ldap user configuration
    */
   public function deleteDrupalAccount($username) {
@@ -835,7 +866,7 @@ class LdapUserConf {
   }
 
   /**
-   * given a drupal account, find the related ldap entry.
+   * Given a drupal account, find the related ldap entry.
    *
    * @param drupal user object $account
    *
@@ -845,39 +876,40 @@ class LdapUserConf {
     if (!$prov_events) {
       $prov_events = ldap_user_all_events();
     }
-    $sid = $this->ldapEntryProvisionServer; //
+    $sid = $this->ldapEntryProvisionServer;
     if (!$sid) {
       return FALSE;
     }
-    // $user_entity->ldap_user_prov_entries,
+    // $user_entity->ldap_user_prov_entries,.
     $ldap_server = ldap_servers_get_servers($sid, NULL, TRUE);
-    $params = array(
+    $params = [
       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
       'prov_events' => $prov_events,
       'module' => 'ldap_user',
       'function' => 'getProvisionRelatedLdapEntry',
       'include_count' => FALSE,
-      );
+    ];
     list($proposed_ldap_entry, $error) = $this->drupalUserToLdapEntry($account, $ldap_server, $params);
     if (!(is_array($proposed_ldap_entry) && isset($proposed_ldap_entry['dn']) && $proposed_ldap_entry['dn'])) {
       return FALSE;
     }
-    $ldap_entry = $ldap_server->dnExists($proposed_ldap_entry['dn'], 'ldap_entry', array());
+    $ldap_entry = $ldap_server->dnExists($proposed_ldap_entry['dn'], 'ldap_entry', []);
     return $ldap_entry;
 
   }
 
   /**
-   * given a drupal account, delete ldap entry that was provisioned based on it
+   * Given a drupal account, delete ldap entry that was provisioned based on it
    *   normally this will be 0 or 1 entry, but the ldap_user_provisioned_ldap_entries
-   *   field attached to the user entity track each ldap entry provisioned
+   *   field attached to the user entity track each ldap entry provisioned.
+   *
+   * @param object $account
+   *   drupal account.
    *
-   * @param object $account drupal account
    * @return TRUE or FALSE.  FALSE indicates failed or action not enabled in ldap user configuration
    */
   public function deleteProvisionedLdapEntries($account) {
-    // determine server that is associated with user
-
+    // Determine server that is associated with user.
     $boolean_result = FALSE;
     if (isset($account->ldap_user_prov_entries[LANGUAGE_NONE][0])) {
       foreach ($account->ldap_user_prov_entries[LANGUAGE_NONE] as $i => $field_instance) {
@@ -888,7 +920,7 @@ class LdapUserConf {
           $ldap_server = ldap_servers_get_servers($sid, NULL, TRUE);
           if (is_object($ldap_server) && $dn) {
             $boolean_result = $ldap_server->delete($dn);
-            $tokens = array('%sid' => $sid, '%dn' => $dn, '%username' => $account->name, '%uid' => $account->uid);
+            $tokens = ['%sid' => $sid, '%dn' => $dn, '%username' => $account->name, '%uid' => $account->uid];
             if ($boolean_result) {
               watchdog('ldap_user', 'LDAP entry on server %sid deleted dn=%dn. username=%username, uid=%uid', $tokens, WATCHDOG_INFO);
             }
@@ -906,35 +938,37 @@ class LdapUserConf {
 
   }
 
-/**
-  *  populate ldap entry array for provisioning
-  *
-  * @param array $account drupal account
-  * @param object $ldap_server
-  * @param array $ldap_user ldap entry of user, returned by reference
-  * @param array $params with the following key values:
-  *    'ldap_context' =>
-       'module' => module calling function, e.g. 'ldap_user'
-       'function' => function calling function, e.g. 'provisionLdapEntry'
-       'include_count' => should 'count' array key be included
-       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY || LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER
-  *
-  * @return array(ldap entry, $result) in ldap extension array format.!THIS IS NOT THE ACTUAL LDAP ENTRY
-  */
-
-  function drupalUserToLdapEntry($account, $ldap_server, $params, $ldap_user_entry = NULL) {
+  /**
+   * Populate ldap entry array for provisioning.
+   *
+   * @param array $account
+   *   drupal account.
+   * @param \LdapServer $ldap_server
+   * @param array $ldap_user
+   *   ldap entry of user, returned by reference.
+   * @param array $params
+   *   with the following key values:
+   *   'ldap_context' =>
+   *   'module' => module calling function, e.g. 'ldap_user'
+   *   'function' => function calling function, e.g. 'provisionLdapEntry'
+   *   'include_count' => should 'count' array key be included
+   *   'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY || LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER.
+   *
+   * @return array(ldap entry, $result) in ldap extension array format.!THIS IS NOT THE ACTUAL LDAP ENTRY
+   */
+  public function drupalUserToLdapEntry($account, $ldap_server, $params, $ldap_user_entry = NULL) {
     $provision = (isset($params['function']) && $params['function'] == 'provisionLdapEntry');
     $result = LDAP_USER_PROV_RESULT_NO_ERROR;
     if (!$ldap_user_entry) {
-      $ldap_user_entry = array();
+      $ldap_user_entry = [];
     }
 
     if (!is_object($account) || !is_object($ldap_server)) {
-      return array(NULL, LDAP_USER_PROV_RESULT_BAD_PARAMS);
+      return [NULL, LDAP_USER_PROV_RESULT_BAD_PARAMS];
     }
-    $watchdog_tokens = array(
+    $watchdog_tokens = [
       '%drupal_username' => $account->name,
-    );
+    ];
     $include_count = (isset($params['include_count']) && $params['include_count']);
 
     $direction = isset($params['direction']) ? $params['direction'] : LDAP_USER_PROV_DIRECTION_ALL;
@@ -942,10 +976,11 @@ class LdapUserConf {
 
     $mappings = $this->getSynchMappings($direction, $prov_events);
     foreach ($mappings as $field_key => $field_detail) {
-      list($ldap_attr_name, $ordinal, $conversion) = ldap_servers_token_extract_parts($field_key, TRUE);  //trim($field_key, '[]');
+      list($ldap_attr_name, $ordinal, $conversion) = ldap_servers_token_extract_parts($field_key, TRUE);
       $ordinal = (!$ordinal) ? 0 : $ordinal;
-      if ($ldap_user_entry && isset($ldap_user_entry[$ldap_attr_name]) && is_array($ldap_user_entry[$ldap_attr_name]) && isset($ldap_user_entry[$ldap_attr_name][$ordinal]) ) {
-        continue; // don't override values passed in;
+      if ($ldap_user_entry && isset($ldap_user_entry[$ldap_attr_name]) && is_array($ldap_user_entry[$ldap_attr_name]) && isset($ldap_user_entry[$ldap_attr_name][$ordinal])) {
+        // don't override values passed in.
+        continue;
       }
 
       $synched = $this->isSynched($field_key, $params['prov_events'], LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY);
@@ -953,9 +988,11 @@ class LdapUserConf {
         $token = ($field_detail['user_attr'] == 'user_tokens') ? $field_detail['user_tokens'] : $field_detail['user_attr'];
         $value = ldap_servers_token_replace($account, $token, 'user_account');
 
-        if (substr($token, 0, 10) == '[password.' && (!$value || $value == $token)) { // deal with empty/unresolved password
+        // Deal with empty/unresolved password.
+        if (substr($token, 0, 10) == '[password.' && (!$value || $value == $token)) {
           if (!$provision) {
-            continue; //don't overwrite password on synch if no value provided
+            // don't overwrite password on synch if no value provided.
+            continue;
           }
         }
 
@@ -964,7 +1001,7 @@ class LdapUserConf {
         }
         elseif ($value) {
           if (!isset($ldap_user_entry[$ldap_attr_name]) || !is_array($ldap_user_entry[$ldap_attr_name])) {
-            $ldap_user_entry[$ldap_attr_name] = array();
+            $ldap_user_entry[$ldap_attr_name] = [];
           }
           $ldap_user_entry[$ldap_attr_name][$ordinal] = $value;
           if ($include_count) {
@@ -983,29 +1020,32 @@ class LdapUserConf {
     $params['account'] = $account;
     drupal_alter('ldap_entry', $ldap_user_entry, $params);
 
-    return array($ldap_user_entry, $result);
+    return [$ldap_user_entry, $result];
 
   }
 
-
-
-   /**
-   * given a drupal account, query ldap and get all user fields and save user account
+  /**
+   * Given a drupal account, query ldap and get all user fields and save user account
    * (note: parameters are in odd order to match synchDrupalAccount handle)
    *
-   * @param array $account drupal account object or null
-   * @param array $user_edit drupal edit array in form user_save($account, $user_edit) would take.
-   * @param array $ldap_user as user's ldap entry.  passed to avoid requerying ldap in cases where already present
-   * @param boolean $save indicating if drupal user should be saved.  generally depends on where function is called from and if the
+   * @param array $account
+   *   drupal account object or null.
+   * @param array $user_edit
+   *   drupal edit array in form user_save($account, $user_edit) would take.
+   * @param array $ldap_user
+   *   as user's ldap entry.  passed to avoid requerying ldap in cases where already present.
+   * @param bool $save
+   *   indicating if drupal user should be saved.  generally depends on where function is called from and if the.
    *
-   * @return result of user_save() function is $save is true, otherwise return TRUE on success or FALSE on any problem
-   *   $user_edit data returned by reference
+   * @return bool
+   *   Resultof user_save() function is $save is true, otherwise return TRUE on
+   *   success or FALSE on any problem
    *
+   *   $user_edit data returned by reference
    */
-
   public function provisionDrupalAccount($account = FALSE, &$user_edit, $ldap_user = NULL, $save = TRUE) {
 
-    $watchdog_tokens = array();
+    $watchdog_tokens = [];
     /**
      * @todo
      * -- add error catching for conflicts, conflicts should be checked before calling this function.
@@ -1038,43 +1078,47 @@ class LdapUserConf {
       $user_edit['name'] = $account->name;
       $watchdog_tokens['%username'] = $user_edit['name'];
     }
-    //When using the multi-domain last authentication option
-    //$ldap_server breaks beacause $this->drupalAcctProvisionServer is set on LDAP_USER_AUTH_SERVER_SID
-    //So we need to check it's not the case before using ldap_servers_get_servers
+    // When using the multi-domain last authentication option
+    // $ldap_server breaks beacause $this->drupalAcctProvisionServer is set on LDAP_USER_AUTH_SERVER_SID
+    // So we need to check it's not the case before using ldap_servers_get_servers.
     if ($this->drupalAcctProvisionServer && $this->drupalAcctProvisionServer != LDAP_USER_AUTH_SERVER_SID) {
 
-      $ldap_server = ldap_servers_get_servers($this->drupalAcctProvisionServer, 'enabled', TRUE);  // $ldap_user['sid']
+      /** @var \LdapServer $ldap_server */
+      // $ldap_user['sid'].
+      $ldap_server = ldap_servers_get_servers($this->drupalAcctProvisionServer, 'enabled', TRUE);
 
-      $params = array(
+      $params = [
         'account' => $account,
         'user_edit' => $user_edit,
         'prov_event' => LDAP_USER_EVENT_CREATE_DRUPAL_USER,
         'module' => 'ldap_user',
         'function' => 'provisionDrupalAccount',
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-      );
+      ];
 
       drupal_alter('ldap_entry', $ldap_user, $params);
 
-      // look for existing drupal account with same puid.  if so update username and attempt to synch in current context
+      // Look for existing drupal account with same puid.  if so update username and attempt to synch in current context.
       $puid = $ldap_server->userPuidFromLdapEntry($ldap_user['attr']);
-      $account2 = ($puid) ? $ldap_server->userUserEntityFromPuid($puid) : FALSE;
-
-      if ($account2) { // synch drupal account, since drupal account exists
-        // 1. correct username and authmap
-        $this->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER));
-        $account = user_save($account2, $user_edit, 'ldap_user');
-        user_set_authmaps($account, array("authname_ldap_user" => $user_edit['name']));
-        // 2. attempt synch if appropriate for current context
+      $existing_account_from_puid = ($puid) ? $ldap_server->userUserEntityFromPuid($puid) : FALSE;
+
+      // Synch drupal account, since drupal account exists.
+      if ($existing_account_from_puid) {
+        // 1. correct username and authmap.
+        $this->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, [LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER]);
+        $account = user_save($existing_account_from_puid, $user_edit, 'ldap_user');
+        user_set_authmaps($account, ["authname_ldap_user" => $user_edit['name']]);
+        // 2. attempt synch if appropriate for current context.
         if ($account) {
           $account = $this->synchToDrupalAccount($account, $user_edit, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, $ldap_user, TRUE);
         }
         return $account;
       }
-      else { // create drupal account
-        $this->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, array(LDAP_USER_EVENT_CREATE_DRUPAL_USER));
+      // Create drupal account.
+      else {
+        $this->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, [LDAP_USER_EVENT_CREATE_DRUPAL_USER]);
         if ($save) {
-          $watchdog_tokens = array('%drupal_username' => $user_edit['name']);
+          $watchdog_tokens = ['%drupal_username' => $user_edit['name']];
           if (empty($user_edit['name'])) {
             drupal_set_message(t('User account creation failed because of invalid, empty derived Drupal username.'), 'error');
             watchdog('ldap_user',
@@ -1093,7 +1137,7 @@ class LdapUserConf {
             );
             return FALSE;
           }
-          if(($this->accountsWithSameEmail == LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED) && ($account_with_same_email = user_load_by_mail($user_edit['mail']))) {
+          if (($this->accountsWithSameEmail == LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED) && ($account_with_same_email = user_load_by_mail($user_edit['mail']))) {
             $watchdog_tokens['%email'] = $user_edit['mail'];
             $watchdog_tokens['%duplicate_name'] = $account_with_same_email->name;
             watchdog('ldap_user', 'LDAP user %drupal_username has email address
@@ -1106,7 +1150,7 @@ class LdapUserConf {
             drupal_set_message(t('User account creation failed because of system problems.'), 'error');
           }
           else {
-            user_set_authmaps($account, array('authname_ldap_user' => $account->name));
+            user_set_authmaps($account, ['authname_ldap_user' => $account->name]);
             ldap_user_ldap_provision_semaphore('drupal_created', 'set', $account->name);
           }
           return $account;
@@ -1117,25 +1161,26 @@ class LdapUserConf {
   }
 
   /**
-   * set ldap associations of a drupal account by altering user fields
+   * Set ldap associations of a drupal account by altering user fields.
    *
    * @param string $drupal_username
    *
-   * @return boolean TRUE on success, FALSE on error or failure because of invalid user or ldap accounts
-   *
+   * @return bool
+   *   TRUE on success, FALSE on error or failure because of invalid user or ldap accounts
    */
-  function ldapAssociateDrupalAccount($drupal_username) {
+  public function ldapAssociateDrupalAccount($drupal_username) {
 
     if ($this->drupalAcctProvisionServer) {
-      $prov_events = array(LDAP_USER_EVENT_LDAP_ASSOCIATE_DRUPAL_ACCT);
-      $ldap_server = ldap_servers_get_servers($this->drupalAcctProvisionServer, 'enabled', TRUE);  // $ldap_user['sid']
+      $prov_events = [LDAP_USER_EVENT_LDAP_ASSOCIATE_DRUPAL_ACCT];
+      // $ldap_user['sid'].
+      $ldap_server = ldap_servers_get_servers($this->drupalAcctProvisionServer, 'enabled', TRUE);
       $account = user_load_by_name($drupal_username);
       $ldap_user = ldap_servers_get_user_ldap_data($drupal_username, $this->drupalAcctProvisionServer, 'ldap_user_prov_to_drupal');
       if (!$account) {
         watchdog(
           'ldap_user',
           'Failed to LDAP associate drupal account %drupal_username because account not found',
-          array('%drupal_username' => $drupal_username),
+          ['%drupal_username' => $drupal_username],
           WATCHDOG_ERROR
         );
         return FALSE;
@@ -1144,27 +1189,27 @@ class LdapUserConf {
         watchdog(
           'ldap_user',
           'Failed to LDAP associate drupal account %drupal_username because corresponding LDAP entry not found',
-          array('%drupal_username' => $drupal_username),
+          ['%drupal_username' => $drupal_username],
           WATCHDOG_ERROR
         );
         return FALSE;
       }
       else {
-        $user_edit = array();
-        $user_edit['data']['ldap_user']['init'] = array(
+        $user_edit = [];
+        $user_edit['data']['ldap_user']['init'] = [
           'sid'  => $ldap_user['sid'],
           'dn'   => $ldap_user['dn'],
           'mail'   => $account->mail,
-        );
+        ];
         $ldap_user_puid = $ldap_server->userPuidFromLdapEntry($ldap_user['attr']);
         if ($ldap_user_puid) {
-          $user_edit['ldap_user_puid'][LANGUAGE_NONE][0]['value'] = $ldap_user_puid; //
+          $user_edit['ldap_user_puid'][LANGUAGE_NONE][0]['value'] = $ldap_user_puid;
         }
         $user_edit['ldap_user_puid_property'][LANGUAGE_NONE][0]['value'] = $ldap_server->unique_persistent_attr;
         $user_edit['ldap_user_puid_sid'][LANGUAGE_NONE][0]['value'] = $ldap_server->sid;
         $user_edit['ldap_user_current_dn'][LANGUAGE_NONE][0]['value'] = $ldap_user['dn'];
         $account = user_save($account, $user_edit, 'ldap_user');
-        return (boolean)$account;
+        return (boolean) $account;
       }
     }
     else {
@@ -1172,20 +1217,20 @@ class LdapUserConf {
     }
   }
 
-  /** populate $user edit array (used in hook_user_save, hook_user_update, etc)
-   * ... should not assume all attribues are present in ldap entry
+  /**
+   * Populate $user edit array (used in hook_user_save, hook_user_update, etc)
+   * ... should not assume all attribues are present in ldap entry.
    *
-   * @param array ldap entry $ldap_user
-   * @param array $edit see hook_user_save, hook_user_update, etc
-   * @param object $ldap_server
-   * @param enum $direction
+   * @param $ldap_user
+   * @param array $edit
+   *   see hook_user_save, hook_user_update, etc.
+   * @param \LdapServer $ldap_server
+   * @param int $direction
    * @param array $prov_events
-   *
    */
+  public function entryToUserEdit($ldap_user, &$edit, $ldap_server, $direction = LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, $prov_events = NULL) {
 
-  function entryToUserEdit($ldap_user, &$edit, $ldap_server, $direction = LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, $prov_events = NULL) {
-
-    // need array of user fields and which direction and when they should be synched.
+    // Need array of user fields and which direction and when they should be synched.
     if (!$prov_events) {
       $prov_events = ldap_user_all_events();
     }
@@ -1207,17 +1252,17 @@ class LdapUserConf {
       $edit['mail'] = isset($edit['mail']) ? $edit['mail'] : $ldap_user['mail'];
       if (!isset($edit['pass'])) {
         $edit['pass'] = user_password(20);
-        watchdog('ldap_user', '20 character random password generated for the %username account that has been created.', array('%username' => $drupal_username), WATCHDOG_INFO);
+        watchdog('ldap_user', '20 character random password generated for the %username account that has been created.', ['%username' => $drupal_username], WATCHDOG_INFO);
       }
       $edit['init'] = isset($edit['init']) ? $edit['init'] : $edit['mail'];
       $edit['status'] = isset($edit['status']) ? $edit['status'] : 1;
       $edit['signature'] = isset($edit['signature']) ? $edit['signature'] : '';
 
-      $edit['data']['ldap_user']['init'] = array(
+      $edit['data']['ldap_user']['init'] = [
         'sid'  => $ldap_user['sid'],
         'dn'   => $ldap_user['dn'],
         'mail' => $edit['mail'],
-      );
+      ];
     }
 
     /*
@@ -1225,11 +1270,11 @@ class LdapUserConf {
      * when syncing the profile.
      */
     if ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER && in_array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, $prov_events)) {
-       $edit['data']['ldap_user']['init'] = array(
+      $edit['data']['ldap_user']['init'] = [
         'sid'  => $ldap_user['sid'],
         'dn'   => $ldap_user['dn'],
         'mail' => isset($edit['mail']) && !empty($edit['mail']) ? $edit['mail'] : $ldap_user['mail'],
-      );
+      ];
     }
 
     if ($this->isSynched('[property.picture]', $prov_events, $direction)) {
@@ -1237,7 +1282,8 @@ class LdapUserConf {
       if ($picture) {
         if (in_array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, $prov_events)) {
           $edit['picture'] = $picture->fid;
-        } else {
+        }
+        else {
           $edit['picture'] = $picture;
         }
         $edit['data']['ldap_user']['init']['thumb5md'] = $picture->md5Sum;
@@ -1250,7 +1296,7 @@ class LdapUserConf {
     if ($this->isSynched('[field.ldap_user_puid]', $prov_events, $direction)) {
       $ldap_user_puid = $ldap_server->userPuidFromLdapEntry($ldap_user['attr']);
       if ($ldap_user_puid) {
-        $edit['ldap_user_puid'][LANGUAGE_NONE][0]['value'] = $ldap_user_puid; //
+        $edit['ldap_user_puid'][LANGUAGE_NONE][0]['value'] = $ldap_user_puid;
       }
     }
     if ($this->isSynched('[field.ldap_user_puid_property]', $prov_events, $direction)) {
@@ -1266,14 +1312,14 @@ class LdapUserConf {
     // Get any additional mappings.
     $mappings = $this->getSynchMappings($direction, $prov_events);
 
-     // Loop over the mappings.
+    // Loop over the mappings.
     foreach ($mappings as $user_attr_key => $field_detail) {
 
-       // Make sure this mapping is relevant to the sync context.
+      // Make sure this mapping is relevant to the sync context.
       if (!$this->isSynched($user_attr_key, $prov_events, $direction)) {
         continue;
       }
-       /**
+      /**
         * if "convert from binary is selected" and no particular method is in token,
         * default to ldap_servers_binary() function
         */
@@ -1283,8 +1329,7 @@ class LdapUserConf {
       $value = ldap_servers_token_replace($ldap_user['attr'], $field_detail['ldap_attr'], 'ldap_entry');
       list($value_type, $value_name, $value_instance) = ldap_servers_parse_user_attr_name($user_attr_key);
 
-      // $value_instance not used, may have future use case
-
+      // $value_instance not used, may have future use case.
       // Are we dealing with a field?
       if ($value_type == 'field') {
         // Field api field - first we get the field.
@@ -1292,9 +1337,9 @@ class LdapUserConf {
         // Then the columns for the field in the schema.
         $columns = array_keys($field['columns']);
         // Then we convert the value into an array if it's scalar.
-        $values = $field['cardinality'] == 1 ? array($value) : (array) $value;
+        $values = $field['cardinality'] == 1 ? [$value] : (array) $value;
 
-        $items = array();
+        $items = [];
         // Loop over the values and set them in our $items array.
         foreach ($values as $delta => $value) {
           if (isset($value)) {
@@ -1313,24 +1358,30 @@ class LdapUserConf {
     }
 
     // Allow other modules to have a say.
-
     drupal_alter('ldap_user_edit_user', $edit, $ldap_user, $ldap_server, $prov_events);
-    if (isset($edit['name']) && $edit['name'] == '') {  // don't let empty 'name' value pass for user
+    // don't let empty 'name' value pass for user.
+    if (isset($edit['name']) && $edit['name'] == '') {
       unset($edit['name']);
     }
 
   }
+
   /**
-   * given configuration of synching, determine is a given synch should occur
+   * Given configuration of synching, determine is a given synch should occur.
    *
-   * @param string $attr_token e.g. [property.mail], [field.ldap_user_puid_property]
-   * @param object $ldap_server
-   * @param array $prov_events e.g. array(LDAP_USER_EVENT_CREATE_DRUPAL_USER).  typically array with 1 element
-   * @param scalar $direction LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY
+   * @param string $attr_token
+   *   e.g. [property.mail], [field.ldap_user_puid_property].
+   * @param array $prov_events
+   *   e.g. array(LDAP_USER_EVENT_CREATE_DRUPAL_USER).  typically array with 1
+   *   element.
+   * @param scalar $direction
+   *   LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or
+   *   LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY.
+   *
+   * @return bool
    */
-
   public function isSynched($attr_token, $prov_events, $direction) {
-    $result = (boolean)(
+    $result = (boolean) (
       isset($this->synchMapping[$direction][$attr_token]['prov_events']) &&
       count(array_intersect($prov_events, $this->synchMapping[$direction][$attr_token]['prov_events']))
     );
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php b/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php
index 70abb0ad..d17ff03d 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php
@@ -2,33 +2,36 @@
 
 /**
  * @file
- * This classextends by LdapUserConf for configuration and other admin functions
+ * This classextends by LdapUserConf for configuration and other admin functions.
  */
 
 module_load_include('php', 'ldap_user', 'LdapUserConf.class');
 module_load_include('inc', 'user', 'user.pages');
-
+/**
+ *
+ */
 class LdapUserConfAdmin extends LdapUserConf {
 
   /**
-   * basic settings
+   * Basic settings.
    */
 
   protected $drupalAcctProvisionServerDescription;
-  protected $drupalAcctProvisionServerOptions = array();
-  protected $ldapEntryProvisionServerOptions = array();
+  protected $drupalAcctProvisionServerOptions = [];
+  protected $ldapEntryProvisionServerOptions = [];
 
   protected $drupalAccountProvisionEventsDescription;
-  protected $drupalAccountProvisionEventsOptions = array();
+  protected $drupalAccountProvisionEventsOptions = [];
 
   protected $ldapEntryProvisionTriggersDescription;
-  protected $ldapEntryProvisionTriggersOptions = array();
+  protected $ldapEntryProvisionTriggersOptions = [];
 
   protected $synchFormRow = 0;
 
-  /*
-   * 3. Drupal Account Provisioning and Syncing
+  /**
+   * 3. Drupal Account Provisioning and Syncing.
    */
+
   public $userConflictResolveDescription;
   public $userConflictResolveDefault = LDAP_USER_CONFLICT_RESOLVE_DEFAULT;
   public $userConflictOptions;
@@ -45,12 +48,18 @@ class LdapUserConfAdmin extends LdapUserConf {
   public $hasError = FALSE;
   public $errorName = NULL;
 
+  /**
+   *
+   */
   public function clearError() {
     $this->hasError = FALSE;
     $this->errorMsg = NULL;
     $this->errorName = NULL;
   }
 
+  /**
+   *
+   */
   public function save() {
     foreach ($this->saveable as $property) {
       $save[$property] = $this->{$property};
@@ -59,10 +68,16 @@ class LdapUserConfAdmin extends LdapUserConf {
     ldap_user_conf_cache_clear();
   }
 
-  static public function uninstall() {
+  /**
+   *
+   */
+  public static function uninstall() {
     variable_del('ldap_user_conf');
   }
 
+  /**
+   *
+   */
   public function __construct() {
     parent::__construct();
     $this->setTranslatableProperties();
@@ -80,123 +95,121 @@ class LdapUserConfAdmin extends LdapUserConf {
 
   }
 
-
-/**
- * generate admin form for ldapUserConf object
- *
- * @return array $form as drupal form api form array
- */
+  /**
+   * Generate admin form for ldapUserConf object.
+   *
+   * @return array $form as drupal form api form array
+   */
   public function drupalForm() {
     if (count($this->drupalAcctProvisionServerOptions) == 0) {
       $message = ldap_servers_no_enabled_servers_msg('configure LDAP User');
-      $form['intro'] = array(
+      $form['intro'] = [
         '#type' => 'item',
         '#markup' => t('<h1>LDAP User Settings</h1>') . $message,
-      );
+      ];
       return $form;
     }
-    $form['#storage'] = array();
+    $form['#storage'] = [];
     $form['#theme'] = 'ldap_user_conf_form';
 
-    $form['intro'] = array(
+    $form['intro'] = [
       '#type' => 'item',
       '#markup' => t('<h1>LDAP User Settings</h1>'),
-    );
+    ];
 
-    $form['manual_drupal_account_editing'] = array(
+    $form['manual_drupal_account_editing'] = [
       '#type' => 'fieldset',
       '#title' => t('Manual Drupal Account Creation and Updates'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
-    $form['manual_drupal_account_editing']['manualAccountConflict'] = array(
+    $form['manual_drupal_account_editing']['manualAccountConflict'] = [
       '#type' => 'radios',
       '#options' => $this->manualAccountConflictOptions,
       '#title' => t('How to resolve LDAP conflicts with manually  created Drupal accounts.'),
       '#description' => t('This applies only to accounts created manually through admin/people/create
         for which an LDAP entry can be found on the LDAP server selected in "LDAP Servers Providing Provisioning Data"'),
       '#default_value' => $this->manualAccountConflict,
-    );
+    ];
 
-    $form['basic_to_drupal'] = array(
+    $form['basic_to_drupal'] = [
       '#type' => 'fieldset',
       '#title' => t('Basic Provisioning to Drupal Account Settings'),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
-    );
+    ];
 
     $default_value = ($this->drupalAcctProvisionServer) ? $this->drupalAcctProvisionServer : 'none';
-    $form['basic_to_drupal']['drupalAcctProvisionServer'] = array(
+    $form['basic_to_drupal']['drupalAcctProvisionServer'] = [
       '#type' => 'radios',
       '#title' => t('LDAP Servers Providing Provisioning Data'),
       '#required' => 1,
       '#default_value' => $default_value,
       '#options' => $this->drupalAcctProvisionServerOptions,
       '#description' => $this->drupalAcctProvisionServerDescription,
-      '#states' => array(
-        'enabled' => array(   // action to take.
-          ':input[name=drupalAcctProvisionTriggers]' => array('value' => LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE),
-        ),
-      ),
-    );
-
-
-    $form['basic_to_drupal']['drupalAcctProvisionTriggers'] = array(
+      '#states' => [
+        'enabled' => [
+          ':input[name=drupalAcctProvisionTriggers]' => ['value' => LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE],
+        ],
+      ],
+    ];
+
+    $form['basic_to_drupal']['drupalAcctProvisionTriggers'] = [
       '#type' => 'checkboxes',
       '#title' => t('Drupal Account Provisioning Events'),
       '#required' => FALSE,
       '#default_value' => $this->drupalAcctProvisionTriggers,
       '#options' => $this->drupalAccountProvisionEventsOptions,
       '#description' => $this->drupalAccountProvisionEventsDescription,
-    );
+    ];
 
-    $form['basic_to_drupal']['disableAdminPasswordField'] = array(
+    $form['basic_to_drupal']['disableAdminPasswordField'] = [
       '#type' => 'checkbox',
       '#title' => t('Disable the password fields at /admin/create/people since the password is going to be randomly generated anyway. This is useful if you are synching data to Drupal from LDAP, and not bringing the user password from LDAP.'),
       '#default_value' => $this->disableAdminPasswordField,
-    );
+    ];
 
-    $form['basic_to_drupal']['userConflictResolve'] = array(
+    $form['basic_to_drupal']['userConflictResolve'] = [
       '#type' => 'radios',
       '#title' => t('Existing Drupal User Account Conflict'),
       '#required' => 1,
       '#default_value' => $this->userConflictResolve,
       '#options' => $this->userConflictOptions,
-      '#description' => t( $this->userConflictResolveDescription),
-    );
+      '#description' => t($this->userConflictResolveDescription),
+    ];
 
-    $form['basic_to_drupal']['accountsWithSameEmail'] = array(
+    $form['basic_to_drupal']['accountsWithSameEmail'] = [
       '#type' => 'radios',
       '#title' => t('Existing Account with Same Email Address'),
       '#default_value' => $this->accountsWithSameEmail,
       '#options' => $this->accountsWithSameEmailOptions,
       '#description' => t($this->accountsWithSameEmailDescription),
       '#disabled' => (module_exists('sharedemail') === FALSE),
-    );
+    ];
 
-    $form['basic_to_drupal']['acctCreation'] = array(
+    $form['basic_to_drupal']['acctCreation'] = [
       '#type' => 'radios',
       '#title' => t('Application of Drupal Account settings to LDAP Authenticated Users'),
       '#required' => 1,
       '#default_value' => $this->acctCreation,
       '#options' => $this->acctCreationOptions,
       '#description' => t($this->acctCreationDescription),
-    );
+    ];
 
-    $account_options = array();
+    $account_options = [];
     $account_options['ldap_user_orphan_do_not_check'] = t('Do not check for orphaned Drupal accounts.');
     $account_options['ldap_user_orphan_email'] = t('Perform no action, but email list of orphaned accounts. (All the other options will send email summaries also.)');
     foreach (user_cancel_methods() as $option_name => $option) {
       $account_options[$option_name] = $option['#title'];
     }
 
-    //@todo these 2 options are removed until this feature is better tested in
+    // @todo these 2 options are removed until this feature is better tested in
     // actual production environments; it has potentially disastrous effects
     unset($account_options['user_cancel_reassign']);
     unset($account_options['user_cancel_delete']);
 
-    $form['basic_to_drupal']['orphanedDrupalAcctBehavior'] = array(
+    $form['basic_to_drupal']['orphanedDrupalAcctBehavior'] = [
       '#type' => 'radios',
       '#title' => t('Action to perform on Drupal account that no longer have a
         corresponding LDAP entry'),
@@ -204,103 +217,44 @@ class LdapUserConfAdmin extends LdapUserConf {
       '#default_value' => $this->orphanedDrupalAcctBehavior,
       '#options' => $account_options,
       '#description' => t($this->orphanedDrupalAcctBehaviorDescription),
-    );
+    ];
 
-
-    $form['basic_to_drupal']['orphanedCheckQty'] = array(
+    $form['basic_to_drupal']['orphanedCheckQty'] = [
       '#type' => 'textfield',
       '#size' => 10,
       '#title' => t('Number of users to check each cron run.'),
       '#description' => t(''),
       '#default_value' => $this->orphanedCheckQty,
       '#required' => FALSE,
-    );
+    ];
 
-
-    $form['basic_to_ldap'] = array(
+    $form['basic_to_ldap'] = [
       '#type' => 'fieldset',
       '#title' => t('Basic Provisioning to LDAP Settings'),
       '#collapsible' => TRUE,
       '#collapsed' => !($this->ldapEntryProvisionServer),
-    );
+    ];
 
     $default_value = ($this->ldapEntryProvisionServer) ? $this->ldapEntryProvisionServer : 'none';
-    $form['basic_to_ldap']['ldapEntryProvisionServer'] = array(
+    $form['basic_to_ldap']['ldapEntryProvisionServer'] = [
       '#type' => 'radios',
       '#title' => t('LDAP Servers to Provision LDAP Entries on'),
       '#required' => 1,
       '#default_value' => $default_value,
       '#options' => $this->ldapEntryProvisionServerOptions,
       '#description' => $this->ldapEntryProvisionServerDescription,
-    );
+    ];
 
-    $form['basic_to_ldap']['ldapEntryProvisionTriggers'] = array(
+    $form['basic_to_ldap']['ldapEntryProvisionTriggers'] = [
       '#type' => 'checkboxes',
       '#title' => t('LDAP Entry Provisioning Events'),
       '#required' => FALSE,
       '#default_value' => $this->ldapEntryProvisionTriggers,
       '#options' => $this->ldapEntryProvisionTriggersOptions,
-      '#description' => $this->ldapEntryProvisionTriggersDescription
-    );
+      '#description' => $this->ldapEntryProvisionTriggersDescription,
+    ];
 
-/**
-    $form['ws'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('[Untested and Unfinished Code] REST Webservice for Provisioning and Synching.'),
-      '#collapsible' => TRUE,
-      '#collapsed' => !$this->wsEnabled,
-      '#description' => t('Once configured, this webservice can be used to trigger creation, synching, deletion, etc of an LDAP associated Drupal account.'),
-    );
-
-    $form['ws']['wsEnabled'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Enable REST Webservice'),
-      '#required' => FALSE,
-      '#default_value' => $this->wsEnabled,
-    );
-
-    $form['ws']['wsUserIps'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Allowed IP Addresses to request webservice.'),
-      '#required' => FALSE,
-      '#default_value' => join("\n", $this->wsUserIps),
-      '#description' => t('One Per Line. The current server address is LOCAL_ADDR and the client ip requesting this page is REMOTE_ADDR .', $_SERVER),
-      '#cols' => 20,
-      '#rows' => 2,
-      '#states' => array(
-        'visible' => array(   // action to take.
-          ':input[name="wsEnabled"]' => array('checked' => TRUE),
-        ),
-      ),
-    );
-
-    if (!$this->wsKey) {
-      $urls = t('URLs are not available until a key is create a key and urls will be generated');
-    }
-    else {
-      $urls = theme('item_list',
-        array(
-          'items' => ldap_user_ws_urls_item_list(),
-          'title' => 'REST urls',
-          'type' => 'ul',
-        ));
-    }
-
-    $form['ws']['wsKey'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Key for webservice'),
-      '#required' => FALSE,
-      '#default_value' => $this->wsKey,
-      '#description' => t('Any random string of characters.') . $urls,
-      '#states' => array(
-        'visible' => array(   // action to take.
-          ':input[name="wsEnabled"]' => array('checked' => TRUE),
-        ),
-      ),
-    );
-*/
-
-    $form['basic_to_drupal']['server_mapping_preamble'] = array(
+    $form['basic_to_drupal']['server_mapping_preamble'] = [
       '#type' => 'markup',
       '#markup' => t('
 The relationship between a Drupal user and an LDAP entry is defined within the LDAP server configurations.
@@ -312,12 +266,12 @@ When more than one ldap server is enabled for provisioning data (or simply more
 mappings need to be setup for each server.  If no tables are listed below, you have not enabled any provisioning servers at
 the top of this form.
 '),
-    );
+    ];
 
-    foreach (array(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) as $direction) {
+    foreach ([LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY] as $direction) {
       $sid = $this->provisionSidFromDirection[$direction];
       $ldap_server = ($sid) ? ldap_servers_get_servers($sid, NULL, TRUE) : FALSE;
-      $ldap_server_selected = (boolean)$ldap_server;
+      $ldap_server_selected = (boolean) $ldap_server;
 
       if ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
         $parent_fieldset = 'basic_to_drupal';
@@ -328,31 +282,29 @@ the top of this form.
         $description = t('Provisioning from Drupal to LDAP Mappings:');
       }
 
-      $form[$parent_fieldset]['mappings__' . $direction] = array(
+      $form[$parent_fieldset]['mappings__' . $direction] = [
         '#type' => 'fieldset',
         '#title' => $description,
         '#collapsible' => TRUE,
         '#collapsed' => FALSE,
         '#description' => '',
-        'table__' . $direction => array(
+        'table__' . $direction => [
           '#type' => 'markup',
           '#markup' => '[replace_with_table__' . $direction . ']',
-        ),
-      );
+        ],
+      ];
 
-
-$password_notes = '<h3>' . t('Password Tokens') . '</h3><ul>' .
-'<li>' . t('Pwd: Random -- Uses a random Drupal generated password') . '</li>' .
-'<li>' . t('Pwd: User or Random -- Uses password supplied on user forms.
+      $password_notes = '<h3>' . t('Password Tokens') . '</h3><ul>' .
+      '<li>' . t('Pwd: Random -- Uses a random Drupal generated password') . '</li>' .
+      '<li>' . t('Pwd: User or Random -- Uses password supplied on user forms.
   If none available uses random password.') . '</li></ul>' .
-'<h3>' . t('Password Concerns') . '</h3>' .
-'<ul>' .
-'<li>' . t('Provisioning passwords to LDAP means passwords must meet the LDAP\'s
+      '<h3>' . t('Password Concerns') . '</h3>' .
+      '<ul>' .
+      '<li>' . t('Provisioning passwords to LDAP means passwords must meet the LDAP\'s
 password requirements.  Password Policy module can be used to add requirements.') . '</li>' .
-'<li>' . t('Some LDAPs require a user to reset their password if it has been changed
+      '<li>' . t('Some LDAPs require a user to reset their password if it has been changed
 by someone other that user.  Consider this when provisioning LDAP passwords.') . '</li>' .
-'</ul></p>';
-
+      '</ul></p>';
 
       $source_drupal_token_notes = <<<EOT
 <p>Examples in form: Source Drupal User token => Target LDAP Token (notes)</p>
@@ -369,52 +321,53 @@ by someone other that user.  Consider this when provisioning LDAP passwords.') .
 </ul>
 EOT;
 
-      if ($direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) { // add some password notes
-        $form[$parent_fieldset]['password_notes'] = array(
+      // Add some password notes.
+      if ($direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
+        $form[$parent_fieldset]['password_notes'] = [
           '#type' => 'fieldset',
           '#title' => t('Password Notes'),
           '#collapsible' => TRUE,
           '#collapsed' => TRUE,
-          'directions' => array(
+          'directions' => [
             '#type' => 'markup',
             '#markup' => $password_notes,
-          ),
-        );
-        $form[$parent_fieldset]['source_drupal_token_notes'] = array(
+          ],
+        ];
+        $form[$parent_fieldset]['source_drupal_token_notes'] = [
           '#type' => 'fieldset',
           '#title' => t('Source Drupal User Tokens and Corresponding Target LDAP Tokens'),
           '#collapsible' => TRUE,
           '#collapsed' => TRUE,
-          'directions' => array(
+          'directions' => [
             '#type' => 'markup',
             '#markup' => $source_drupal_token_notes,
-          ),
-        );
+          ],
+        ];
       }
       $this->addServerMappingFields($form, $direction);
     }
 
-    foreach (array('orphanedCheckQty', 'orphanedDrupalAcctBehavior', 'acctCreation', 'userConflictResolve', 'accountsWithSameEmail', 'drupalAcctProvisionTriggers', 'mappings__' . LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) as $input_name) {
+    foreach (['orphanedCheckQty', 'orphanedDrupalAcctBehavior', 'acctCreation', 'userConflictResolve', 'accountsWithSameEmail', 'drupalAcctProvisionTriggers', 'mappings__' . LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER] as $input_name) {
       $form['basic_to_drupal'][$input_name]['#states']['invisible'] =
-        array(
-          ':input[name=drupalAcctProvisionServer]' => array('value' => 'none'),
-        );
+        [
+          ':input[name=drupalAcctProvisionServer]' => ['value' => 'none'],
+        ];
     }
 
-    foreach (array('ldapEntryProvisionTriggers', 'password_notes', 'source_drupal_token_notes', 'mappings__' . LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) as $input_name) {
+    foreach (['ldapEntryProvisionTriggers', 'password_notes', 'source_drupal_token_notes', 'mappings__' . LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY] as $input_name) {
       $form['basic_to_ldap'][$input_name]['#states']['invisible'] =
-        array(
-          ':input[name=ldapEntryProvisionServer]' => array('value' => 'none'),
-        );
+        [
+          ':input[name=ldapEntryProvisionServer]' => ['value' => 'none'],
+        ];
     }
 
-    $form['submit'] = array(
+    $form['submit'] = [
       '#type' => 'submit',
       '#value' => 'Save',
-    );
+    ];
 
-  return $form;
-}
+    return $form;
+  }
 
   /**
    * @param $sid
@@ -428,33 +381,35 @@ EOT;
     }
   }
 
-/**
- * validate submitted form
- *
- * @param array $values as $form_state['values'] from drupal form api
- * @param array $storage as $form_state['storage'] from drupal form api
- *
- * @return array in form array($errors, $warnings)to be thrown by form api
- */
-  public function drupalFormValidate($values, $storage)  {
+  /**
+   * Validate submitted form.
+   *
+   * @param array $values
+   *   as $form_state['values'] from drupal form api.
+   * @param array $storage
+   *   as $form_state['storage'] from drupal form api.
+   *
+   * @return array in form array($errors, $warnings)to be thrown by form api
+   */
+  public function drupalFormValidate($values, $storage) {
     $this->populateFromDrupalForm($values, $storage);
     list($errors, $warnings) = $this->validate($values);
 
     $this->checkPuidOrphans($values['drupalAcctProvisionServer'], $values['orphanedDrupalAcctBehavior']);
 
-    // since failed mapping rows in form, don't populate ->ldapUserSynchMappings, need to validate these from values
+    // Since failed mapping rows in form, don't populate ->ldapUserSynchMappings, need to validate these from values.
     foreach ($values as $field => $value) {
       $parts = explode('__', $field);
-      // since synch mapping fields are in n-tuples, process entire n-tuple at once (on field == configurable_to_drupal)
+      // Since synch mapping fields are in n-tuples, process entire n-tuple at once (on field == configurable_to_drupal)
       if (count($parts) != 4 || $parts[1] !== 'sm' || $parts[2] != 'configurable_to_drupal') {
         continue;
       }
       list($direction, $discard, $column_name, $i) = $parts;
       $action = $storage['synch_mapping_fields'][$direction][$i]['action'];
-      $tokens = array();
-      $row_mappings = array();
-      foreach (array('remove', 'configurable_to_drupal', 'configurable_to_ldap', 'convert', 'direction', 'ldap_attr', 'user_attr', 'user_tokens') as $column_name) {
-        $input_name = join('__', array('sm', $column_name, $i));
+      $tokens = [];
+      $row_mappings = [];
+      foreach (['remove', 'configurable_to_drupal', 'configurable_to_ldap', 'convert', 'direction', 'ldap_attr', 'user_attr', 'user_tokens'] as $column_name) {
+        $input_name = join('__', ['sm', $column_name, $i]);
         $row_mappings[$column_name] = isset($values[$input_name]) ? $values[$input_name] : NULL;
       }
 
@@ -464,42 +419,44 @@ EOT;
         $row_descriptor = t("server %sid row mapping to ldap attribute %ldap_attr", $tokens);
         $tokens['!row_descriptor'] = $row_descriptor;
         if (!$row_mappings['direction']) {
-          $input_name = join('__', array('sm', 'direction', $i));
+          $input_name = join('__', ['sm', 'direction', $i]);
           $errors[$input_name] = t('No mapping direction given in !row_descriptor', $tokens);
         }
         if ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER && $row_mappings['user_attr'] == 'user_tokens') {
-          $input_name = join('__', array('sm', 'user_attr', $i));
+          $input_name = join('__', ['sm', 'user_attr', $i]);
           $errors[$input_name] = t('User tokens not allowed when mapping to Drupal user.  Location: !row_descriptor', $tokens);
         }
         if (!$row_mappings['ldap_attr']) {
-          $input_name = join('__', array('sm', 'ldap_attr', $i));
+          $input_name = join('__', ['sm', 'ldap_attr', $i]);
           $errors[$input_name] = t('No ldap attribute given in !row_descriptor', $tokens);
         }
         if (!$row_mappings['user_attr']) {
-          $input_name = join('__', array('sm', 'user_attr', $i));
+          $input_name = join('__', ['sm', 'user_attr', $i]);
           $errors[$input_name] = t('No user attribute given in !row_descriptor', $tokens);
         }
       }
 
     }
-    return array($errors, $warnings);
+    return [$errors, $warnings];
   }
 
-/**
- * validate object, not form
- * @param array $values as $form_state['values'] from drupal form api
- * @return array in form array($errors, $warnings)to be thrown by form api
- *
- * @todo validate that a user field exists, such as field.field_user_lname
- *
- */
+  /**
+   * Validate object, not form.
+   *
+   * @param array $values
+   *   as $form_state['values'] from drupal form api.
+   *
+   * @return array in form array($errors, $warnings)to be thrown by form api
+   *
+   * @todo validate that a user field exists, such as field.field_user_lname
+   */
   public function validate($values) {
-    $errors = array();
-    $warnings = array();
-    $tokens = array();
+    $errors = [];
+    $warnings = [];
+    $tokens = [];
 
-    $has_drupal_acct_prov_servers  = (boolean)($this->drupalAcctProvisionServer);
-    $has_drupal_acct_prov_settings_options  = (count(array_filter($this->drupalAcctProvisionTriggers)) > 0);
+    $has_drupal_acct_prov_servers = (boolean) ($this->drupalAcctProvisionServer);
+    $has_drupal_acct_prov_settings_options = (count(array_filter($this->drupalAcctProvisionTriggers)) > 0);
 
     if (!$has_drupal_acct_prov_servers && $has_drupal_acct_prov_settings_options) {
       $warnings['drupalAcctProvisionServer'] = t('No Servers are enabled to provide provisioning to Drupal, but Drupal Account Provisioning Options are selected.', $tokens);
@@ -508,7 +465,7 @@ EOT;
       $warnings['drupalAcctProvisionTriggers'] = t('Servers are enabled to provide provisioning to Drupal, but no Drupal Account Provisioning Options are selected.  This will result in no synching happening.', $tokens);
     }
 
-    $has_ldap_prov_servers = (boolean)($this->ldapEntryProvisionServer);
+    $has_ldap_prov_servers = (boolean) ($this->ldapEntryProvisionServer);
     $has_ldap_prov_settings_options = (count(array_filter($this->ldapEntryProvisionTriggers)) > 0);
     if (!$has_ldap_prov_servers && $has_ldap_prov_settings_options) {
       $warnings['ldapEntryProvisionServer'] = t('No Servers are enabled to provide provisioning to ldap, but LDAP Entry Options are selected.', $tokens);
@@ -520,8 +477,9 @@ EOT;
     if (isset($this->ldapUserSynchMappings)) {
       $to_ldap_entries_mappings_exist = FALSE;
       foreach ($this->ldapUserSynchMappings as $synch_direction => $mappings) {
-        $map_index = array();
-        $tokens = array(); // array('%sid' => $sid);
+        $map_index = [];
+        // Format ['%sid' => $sid].
+        $tokens = [];
         $to_drupal_user_mappings_exist = FALSE;
         $to_ldap_entries_mappings_exist = FALSE;
 
@@ -550,37 +508,28 @@ EOT;
           }
           $row_descriptor = t("server %sid row mapping to ldap attribute %ldap_attr", $tokens);
           $tokens['!row_descriptor'] = $row_descriptor;
-          $ldap_attribute_maps_in_token = array();
+          $ldap_attribute_maps_in_token = [];
           ldap_servers_token_extract_attributes($ldap_attribute_maps_in_token, $mapping['ldap_attr']);
 
           if ($mapping['direction'] == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
             $row_id = $map_index[$mapping['user_attr']];
             $to_drupal_user_mappings_exist = TRUE;
-          //  if (!$is_drupal_user_prov_server) {
-           //   $errors['mappings__'. $sid] =  t('Mapping rows exist for provisioning to drupal user, but server %sid is not enabled for provisioning
-            //    to drupal users.', $tokens);
-          //  }
           }
           if ($mapping['direction'] == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
             $row_id = $map_index[$mapping['ldap_attr']];
             $to_ldap_entries_mappings_exist = TRUE;
-           // if (!$is_ldap_entry_prov_server) {
-            //  $errors['mappings__'. $sid] =  t('Mapping rows exist for provisioning to ldap entries,
-            //    but server %sid is not enabled for provisioning
-             //   to ldap entries.', $tokens);
-           // }
 
             if (count(array_keys($ldap_attribute_maps_in_token)) != 1) {
-              $token_field_id = join('__', array('sm', 'user_tokens', $row_id));
+              $token_field_id = join('__', ['sm', 'user_tokens', $row_id]);
               $errors[$token_field_id] = t('When provisioning to ldap, ldap attribute column must be singular token such as [cn]. %ldap_attr is not.
                 Do not use compound tokens such as "[displayName] [sn]" or literals such as "physics". Location: !row_descriptor', $tokens);
             }
 
           }
-          $ldap_attr_field_id = join('__', array('sm', 'ldap_attr', $row_id));
-          $user_attr_field_id = join('__', array('sm', 'user_attr', $row_id));
-          $first_context_field_id = join('__', array('sm', 1, $row_id));
-          $user_tokens_field_id = join('__', array('sm', 'user_tokens', $row_id));
+          $ldap_attr_field_id = join('__', ['sm', 'ldap_attr', $row_id]);
+          $user_attr_field_id = join('__', ['sm', 'user_attr', $row_id]);
+          $first_context_field_id = join('__', ['sm', 1, $row_id]);
+          $user_tokens_field_id = join('__', ['sm', 'user_tokens', $row_id]);
 
           if (!$mapping['ldap_attr']) {
             $errors[$ldap_attr_field_id] = t('No LDAP Attribute given in !row_descriptor', $tokens);
@@ -600,14 +549,16 @@ EOT;
           One row must map to [dn].  This row will have a user token like cn=[property.name],ou=users,dc=ldap,dc=mycompany,dc=com');
       }
     }
-    return array($errors, $warnings);
+    return [$errors, $warnings];
   }
 
   /**
-   * populate object with data from form values
+   * Populate object with data from form values.
    *
-   * @param array $values as $form_state['values'] from drupal form api
-   * @param array $storage as $form_state['storage'] from drupal form api
+   * @param array $values
+   *   as $form_state['values'] from drupal form api.
+   * @param array $storage
+   *   as $form_state['storage'] from drupal form api.
    */
   protected function populateFromDrupalForm($values, $storage) {
     $this->drupalAcctProvisionServer = ($values['drupalAcctProvisionServer'] == 'none') ? 0 : $values['drupalAcctProvisionServer'];
@@ -619,59 +570,52 @@ EOT;
     $this->orphanedCheckQty = $values['orphanedCheckQty'];
 
     $this->manualAccountConflict = $values['manualAccountConflict'];
-    $this->userConflictResolve  = ($values['userConflictResolve']) ? (int)$values['userConflictResolve'] : NULL;
-    $this->accountsWithSameEmail = ($values['accountsWithSameEmail']) ? (int)$values['accountsWithSameEmail'] : NULL;
-    $this->acctCreation  = ($values['acctCreation']) ? (int)$values['acctCreation'] : NULL;
+    $this->userConflictResolve = ($values['userConflictResolve']) ? (int) $values['userConflictResolve'] : NULL;
+    $this->accountsWithSameEmail = ($values['accountsWithSameEmail']) ? (int) $values['accountsWithSameEmail'] : NULL;
+    $this->acctCreation = ($values['acctCreation']) ? (int) $values['acctCreation'] : NULL;
     $this->disableAdminPasswordField = $values['disableAdminPasswordField'];
-   // $this->wsKey  = ($values['wsKey']) ? $values['wsKey'] : NULL;
-
-   // $this->wsUserIps  = ($values['wsUserIps']) ? explode("\n", $values['wsUserIps']) : array();
-  //  foreach ($this->wsUserIps as $i => $ip) {
-  //    $this->wsUserIps[$i] = trim($ip);
-  //  }
-   // $this->wsEnabled  = ($values['wsEnabled']) ? (int)$values['wsEnabled'] : 0;
 
     $this->ldapUserSynchMappings = $this->synchMappingsFromForm($values, $storage);
 
   }
 
-
-
-/**
- *  Extract synch mappings array from mapping table in admin form.
- *
- * @param array $values as $form_state['values'] from drupal form api
- * @param array $storage as $form_state['storage'] from drupal form api
- *
- * $values input names in form:
- *   1__sm__configurable__5,
- *   1__sm__remove__5,
- *   1__sm__ldap_attr__5,
- *   1__sm__convert__5,
- *   1__sm__direction__5,
- *   1__sm__user_attr__5,
- *   1__sm__user_tokens__5
- *   1__sm__1__5,
- *   1__sm__2__5,
-    ...where
-      -- first arg is direction, eg 1 or 2 LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY
-      -- second arg is discarded ('sm')
-      -- third part is field, e.g. user_attr
-      -- fourth is the row in the configuration form, e.g. 5
-
-   where additiond data is in $form['#storage'][<direction>]['synch_mapping_fields'][N]
-    $form['#storage']['synch_mapping_fields'][<direction>][N] = array(
-      'sid' => $sid,
-      'action' => 'add',
-    );
- */
+  /**
+   * Extract synch mappings array from mapping table in admin form.
+   *
+   * @param array $values
+   *   as $form_state['values'] from drupal form api.
+   * @param array $storage
+   *   as $form_state['storage'] from drupal form api
+   *
+   *   $values input names in form:
+   *   1__sm__configurable__5,
+   *   1__sm__remove__5,
+   *   1__sm__ldap_attr__5,
+   *   1__sm__convert__5,
+   *   1__sm__direction__5,
+   *   1__sm__user_attr__5,
+   *   1__sm__user_tokens__5
+   *   1__sm__1__5,
+   *   1__sm__2__5,
+   *   ...where
+   *   -- first arg is direction, eg 1 or 2 LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY
+   *   -- second arg is discarded ('sm')
+   *   -- third part is field, e.g. user_attr
+   *   -- fourth is the row in the configuration form, e.g. 5
+   *
+   *   where additiond data is in $form['#storage'][<direction>]['synch_mapping_fields'][N]
+   *   $form['#storage']['synch_mapping_fields'][<direction>][N] = array(
+   *   'sid' => $sid,
+   *   'action' => 'add',
+   *   );.
+   */
   private function synchMappingsFromForm($values, $storage) {
 
-    $mappings = array();
+    $mappings = [];
     foreach ($values as $field => $value) {
 
       $parts = explode('__', $field);
-      // since synch mapping fields are in n-tuples, process entire n-tuple at once
+      // Since synch mapping fields are in n-tuples, process entire n-tuple at once.
       if (count($parts) != 4 || $parts[1] !== 'sm') {
         continue;
       }
@@ -679,9 +623,9 @@ EOT;
       list($direction, $discard, $column_name, $i) = $parts;
       $action = $storage['synch_mapping_fields'][$direction][$i]['action'];
 
-      $row_mappings = array();
-      foreach (array('remove', 'configurable_to_drupal', 'configurable_to_ldap', 'convert', 'ldap_attr', 'user_attr', 'user_tokens') as $column_name) {
-        $input_name = join('__', array($direction, 'sm', $column_name, $i));
+      $row_mappings = [];
+      foreach (['remove', 'configurable_to_drupal', 'configurable_to_ldap', 'convert', 'ldap_attr', 'user_attr', 'user_tokens'] as $column_name) {
+        $input_name = join('__', [$direction, 'sm', $column_name, $i]);
         $row_mappings[$column_name] = isset($values[$input_name]) ? $values[$input_name] : NULL;
       }
 
@@ -691,7 +635,7 @@ EOT;
 
       $key = ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) ? $row_mappings['user_attr'] : $row_mappings['ldap_attr'];
       if ($row_mappings['configurable_to_drupal'] && $row_mappings['ldap_attr'] && $row_mappings['user_attr']) {
-        $mappings[$direction][$key] = array(
+        $mappings[$direction][$key] = [
           'ldap_attr' => $row_mappings['ldap_attr'],
           'user_attr' => $row_mappings['user_attr'],
           'convert' => $row_mappings['convert'],
@@ -700,11 +644,11 @@ EOT;
           'config_module' => 'ldap_user',
           'prov_module' => 'ldap_user',
           'enabled' => 1,
-          );
+        ];
 
         $synchEvents = ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) ? $this->provisionsDrupalEvents : $this->provisionsLdapEvents;
         foreach ($synchEvents as $prov_event => $discard) {
-          $input_name = join('__', array($direction, 'sm', $prov_event, $i));
+          $input_name = join('__', [$direction, 'sm', $prov_event, $i]);
           if (isset($values[$input_name]) && $values[$input_name]) {
             $mappings[$direction][$key]['prov_events'][] = $prov_event;
           }
@@ -716,10 +660,12 @@ EOT;
   }
 
   /**
-   * method to respond to successfully validated form submit.
+   * Method to respond to successfully validated form submit.
    *
-   * @param array $values as $form_state['values'] from drupal form api
-   * @param array $storage as $form_state['storage'] from drupal form api
+   * @param array $values
+   *   as $form_state['values'] from drupal form api.
+   * @param array $storage
+   *   as $form_state['storage'] from drupal form api.
    *
    * @return by reference to $form array
    */
@@ -739,14 +685,14 @@ EOT;
   }
 
   /**
-   * add existing mappings to ldap user provisioning mapping admin form table
+   * Add existing mappings to ldap user provisioning mapping admin form table.
    *
    * @param drupal form array $form
-   * @param enum $direction LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY
+   * @param enum $direction
+   *   LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY.
    *
    * @return by reference to $form array
    */
-
   private function addServerMappingFields(&$form, $direction) {
 
     if ($direction == LDAP_USER_PROV_DIRECTION_NONE) {
@@ -754,7 +700,7 @@ EOT;
     }
 
     $text = ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) ? 'target' : 'source';
-    $user_attr_options = array('0' => t('Select') . ' ' . $text);
+    $user_attr_options = ['0' => t('Select') . ' ' . $text];
 
     if (!empty($this->synchMapping[$direction])) {
       foreach ($this->synchMapping[$direction] as $target_id => $mapping) {
@@ -777,20 +723,22 @@ EOT;
 
     $row = 0;
 
-    // 1. non configurable mapping rows
+    // 1. non configurable mapping rows.
     foreach ($this->synchMapping[$direction] as $target_id => $mapping) {
       if (isset($mapping['exclude_from_mapping_ui']) && $mapping['exclude_from_mapping_ui']) {
         continue;
       }
-      if ( !$this->isMappingConfigurable($mapping, 'ldap_user') && ($mapping['direction'] == $direction || $mapping['direction'] == LDAP_USER_PROV_DIRECTION_ALL)) { // is configurable by ldap_user module (not direction to ldap_user)
+      // Is configurable by ldap_user module (not direction to ldap_user)
+      if (!$this->isMappingConfigurable($mapping, 'ldap_user') && ($mapping['direction'] == $direction || $mapping['direction'] == LDAP_USER_PROV_DIRECTION_ALL)) {
         $this->addSynchFormRow($form, 'nonconfigurable', $direction, $mapping, $user_attr_options, $row);
         $row++;
       }
     }
 
-    // 2. existing configurable mappings rows
+    // 2. existing configurable mappings rows.
     if (!empty($this->ldapUserSynchMappings[$direction])) {
-      foreach ($this->ldapUserSynchMappings[$direction] as $target_attr_token => $mapping) {  // key could be ldap attribute name or user attribute name
+      // Key could be ldap attribute name or user attribute name.
+      foreach ($this->ldapUserSynchMappings[$direction] as $target_attr_token => $mapping) {
         if (isset($mapping['enabled']) && $mapping['enabled'] && $this->isMappingConfigurable($this->synchMapping[$direction][$target_attr_token], 'ldap_user')) {
           $this->addSynchFormRow($form, 'update', $direction, $mapping, $user_attr_options, $row);
           $row++;
@@ -798,7 +746,7 @@ EOT;
       }
     }
 
-    // 3. leave 4 rows for adding more mappings
+    // 3. leave 4 rows for adding more mappings.
     for ($i = 0; $i < 4; $i++) {
       $this->addSynchFormRow($form, 'add', $direction, NULL, $user_attr_options, $row);
       $row++;
@@ -807,15 +755,19 @@ EOT;
   }
 
   /**
-   * add mapping form row to ldap user provisioning mapping admin form table
+   * Add mapping form row to ldap user provisioning mapping admin form table.
    *
    * @param drupal form array $form
-   * @param string $action is 'add', 'update', or 'nonconfigurable'
-   * @param enum $direction LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY
-   * @param array $mapping is current setting for updates or nonconfigurable items
-   * @param array $user_attr_options of drupal user target options
-   * @param int $row is current row in table
-
+   * @param string $action
+   *   is 'add', 'update', or 'nonconfigurable'.
+   * @param enum $direction
+   *   LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER or LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY.
+   * @param array $mapping
+   *   is current setting for updates or nonconfigurable items.
+   * @param array $user_attr_options
+   *   of drupal user target options.
+   * @param int $row
+   *   is current row in table.
    *
    * @return by reference to $form
    */
@@ -824,40 +776,40 @@ EOT;
     $id_prefix = $direction . '__';
 
     $id = $id_prefix . 'sm__remove__' . $row;
-    $form[$id] = array(
+    $form[$id] = [
       '#id' => $id,
       '#row' => $row,
       '#col' => 0,
       '#type' => 'checkbox',
       '#default_value' => NULL,
       '#disabled' => ($action == 'add' || $action == 'nonconfigurable'),
-    );
+    ];
 
     $id = $id_prefix . 'sm__convert__' . $row;
-    $form[$id] = array(
+    $form[$id] = [
       '#id' => $id,
       '#row' => $row,
       '#col' => ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) ? 2 : 3,
       '#type' => 'checkbox',
       '#default_value' => isset($mapping['convert']) ? $mapping['convert'] : '',
       '#disabled' => ($action == 'nonconfigurable'),
-      '#attributes' => array('class' => array('convert')),
-    );
+      '#attributes' => ['class' => ['convert']],
+    ];
 
     $id = $id_prefix . 'sm__ldap_attr__' . $row;
     $col = ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) ? 1 : 4;
     if ($action == 'nonconfigurable') {
-      $form[$id] = array(
+      $form[$id] = [
         '#id' => $id,
         '#row' => $row,
         '#col' => $col,
         '#type' => 'item',
         '#markup' => isset($mapping['source']) ? $mapping['source'] : '?',
-        '#attributes' => array('class' => array('source')),
-      );
+        '#attributes' => ['class' => ['source']],
+      ];
     }
     else {
-      $form[$id] = array(
+      $form[$id] = [
         '#id' => $id,
         '#row' => $row,
         '#col' => $col,
@@ -865,35 +817,35 @@ EOT;
         '#default_value' => isset($mapping['ldap_attr']) ? $mapping['ldap_attr'] : '',
         '#size' => 20,
         '#maxlength' => 255,
-        '#attributes' => array('class' => array('ldap-attr')),
-      );
+        '#attributes' => ['class' => ['ldap-attr']],
+      ];
     }
 
     $user_attr_input_id = $id_prefix . 'sm__user_attr__' . $row;
     $col = ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) ? 3 : 1;
     if ($action == 'nonconfigurable') {
-      $form[$user_attr_input_id] = array(
+      $form[$user_attr_input_id] = [
         '#id' => $user_attr_input_id,
         '#row' => $row,
         '#col' => $col,
         '#type' => 'item',
         '#markup' => isset($mapping['name']) ? $mapping['name'] : '?',
-      );
+      ];
     }
     else {
-      $form[$user_attr_input_id] = array(
+      $form[$user_attr_input_id] = [
         '#id' => $user_attr_input_id,
         '#row' => $row,
         '#col' => $col,
         '#type' => 'select',
         '#default_value' => isset($mapping['user_attr']) ? $mapping['user_attr'] : '',
         '#options' => $user_attr_options,
-      );
+      ];
     }
 
     if ($direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
       $id = $id_prefix . 'sm__user_tokens__' . $row;
-      $form[$id] = array(
+      $form[$id] = [
         '#id' => $id,
         '#row' => $row,
         '#col' => 2,
@@ -902,53 +854,54 @@ EOT;
         '#size' => 40,
         '#maxlength' => 255,
         '#disabled' => ($action == 'nonconfigurable'),
-        '#states' => array(
-          'visible' => array(   // action to take.
-            ':input[name="' . $user_attr_input_id . '"]' => array('value' => 'user_tokens'),
-          )
-        ),
-        '#attributes' => array('class' => array('tokens')),
-      );
+        '#states' => [
+          'visible' => [
+            ':input[name="' . $user_attr_input_id . '"]' => ['value' => 'user_tokens'],
+          ],
+        ],
+        '#attributes' => ['class' => ['tokens']],
+      ];
     }
 
-    $form['#storage']['synch_mapping_fields'][$direction][$row] = array(
+    $form['#storage']['synch_mapping_fields'][$direction][$row] = [
       'action' => $action,
       'direction' => $direction,
-    );
+    ];
 
     $id = $id_prefix . 'sm__configurable_to_drupal__' . $row;
-    $form[$id] = array(
+    $form[$id] = [
       '#id' => $id,
       '#type' => 'hidden',
       '#default_value' => ($action != 'nonconfigurable'),
-    );
-
+    ];
 
     $col = ($direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) ? 5 : 4;
     $synchEvents = ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) ? $this->provisionsDrupalEvents : $this->provisionsLdapEvents;
 
     foreach ($synchEvents as $prov_event => $prov_event_name) {
       $col++;
-      $id = $id_prefix . join('__', array('sm', $prov_event, $row));
-      $form[$id] = array(
+      $id = $id_prefix . join('__', ['sm', $prov_event, $row]);
+      $form[$id] = [
         '#id' => $id ,
         '#type' => 'checkbox',
-        '#default_value' => isset($mapping['prov_events']) ? (int)(in_array($prov_event, $mapping['prov_events'])) : '',
+        '#default_value' => isset($mapping['prov_events']) ? (int) (in_array($prov_event, $mapping['prov_events'])) : '',
         '#row' => $row,
         '#col' => $col,
         '#disabled' => (!$this->provisionEventConfigurable($prov_event, $mapping) || ($action == 'nonconfigurable')),
-        '#attributes' => array('class' => array('synch-method')),
-      );
+        '#attributes' => ['class' => ['synch-method']],
+      ];
     }
   }
 
   /**
    * Is a mapping configurable by a given module?
    *
-   * @param array $mapping as mapping configuration for field, attribute, property, etc.
-   * @param string $module machine name such as ldap_user
+   * @param array $mapping
+   *   as mapping configuration for field, attribute, property, etc.
+   * @param string $module
+   *   machine name such as ldap_user.
    *
-   * @return boolean
+   * @return bool
    */
   private function isMappingConfigurable($mapping = NULL, $module = 'ldap_user') {
     $configurable = (
@@ -966,25 +919,24 @@ EOT;
     return $configurable;
   }
 
-
   /**
    * Is a particular synch method viable for a given mapping?
    * That is, Can it be enabled in the UI by admins?
    *
    * @param int $prov_event
-   * @param array $mapping is array of mapping configuration.
+   * @param array $mapping
+   *   is array of mapping configuration.
    *
-   * @return boolean
+   * @return bool
    */
-
   private function provisionEventConfigurable($prov_event, $mapping = NULL) {
 
     if ($mapping) {
       if ($prov_event == LDAP_USER_EVENT_CREATE_LDAP_ENTRY || $prov_event == LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY) {
-        $configurable = (boolean)(!isset($mapping['configurable_to_ldap']) || $mapping['configurable_to_ldap']);
+        $configurable = (boolean) (!isset($mapping['configurable_to_ldap']) || $mapping['configurable_to_ldap']);
       }
       elseif ($prov_event == LDAP_USER_EVENT_CREATE_DRUPAL_USER || $prov_event == LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER) {
-        $configurable = (boolean)(!isset($mapping['configurable_to_drupal']) || $mapping['configurable_to_drupal']);
+        $configurable = (boolean) (!isset($mapping['configurable_to_drupal']) || $mapping['configurable_to_drupal']);
       }
     }
     else {
@@ -994,6 +946,9 @@ EOT;
     return $configurable;
   }
 
+  /**
+   *
+   */
   protected function setTranslatableProperties() {
 
     $values['drupalAcctProvisionServerDescription'] = t('Check ONE LDAP server configuration to use
@@ -1006,53 +961,52 @@ EOT;
       the user\'s Drupal account since Drupal requires a password for the "users" table. Check the watchdog at /admin/reports/dblog to
       confirm that a random password was generated when the user account was created.');
 
-    $values['drupalAccountProvisionEventsOptions'] = array(
+    $values['drupalAccountProvisionEventsOptions'] = [
       LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE => t('Create or Synch to Drupal user on successful authentication with LDAP
         credentials. (Requires LDAP Authentication module).'),
       LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE => t('Create or Synch to Drupal user anytime a Drupal user account
         is created or updated. Requires a server with binding method of "Service Account Bind" or "Anonymous Bind".'),
-      );
+    ];
 
     $values['ldapEntryProvisionTriggersDescription'] = t('Which LDAP attributes are synched on create or synch is determined in the
       "Provisioning from Drupal to LDAP mappings" table below in the right two columns.');
 
-    $values['ldapEntryProvisionTriggersOptions'] = array(
+    $values['ldapEntryProvisionTriggersOptions'] = [
       LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE => t('Create or Synch to LDAP entry when a Drupal account is created or updated.
         Only applied to accounts with a status of approved.'),
       LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE => t('Create or Synch to LDAP entry when a user authenticates.'),
       LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE => t('Delete LDAP entry when the corresponding Drupal Account is deleted.  This only applies when the LDAP entry was provisioned by Drupal by the LDAP User module.'),
       LDAP_USER_DRUPAL_USER_PROV_ON_ALLOW_MANUAL_CREATE => t('Provide option on admin/people/create to create corresponding LDAP Entry.'),
 
-    );
+    ];
 
     $values['orphanedDrupalAcctBehaviorDescription'] = t('It is highly recommended to use the "Perform no action, but email list of orphaned accounts" for some time before considering switching to "Disable the account" options.');
 
-
-    $values['manualAccountConflictOptions'] = array(
+    $values['manualAccountConflictOptions'] = [
       LDAP_USER_MANUAL_ACCT_CONFLICT_REJECT => t('Reject manual creation of Drupal accounts that conflict with LDAP Accounts. This only applies to accounts created on user logon;  Account conflicts can still be generated by manually creating users that conflict with ldap users and these users will have their data synched with LDAP data.'),
       LDAP_USER_MANUAL_ACCT_CONFLICT_LDAP_ASSOCIATE => t('Associate manually created Drupal accounts with related LDAP Account if one exists.'),
       LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM => t('Show option on user create form to determine how account conflict is resolved.'),
-    );
+    ];
 
     /**
     *  Drupal Account Provisioning and Synching
     */
     $values['userConflictResolveDescription'] = t('What should be done if a local Drupal or other external
       user account already exists with the same login name.');
-    $values['userConflictOptions'] = array(
+    $values['userConflictOptions'] = [
       LDAP_USER_CONFLICT_LOG => t('Don\'t associate Drupal account with LDAP.  Require user to use Drupal password. Log the conflict'),
       LDAP_USER_CONFLICT_RESOLVE => t('Associate Drupal account with the LDAP entry.  This option
       is useful for creating accounts and assigning roles before an LDAP user authenticates.'),
-      );
+    ];
     $values['accountsWithSameEmailDescription'] = t('Allows provisioning a Drupal user account from LDAP regardless of whether another Drupal user account has the same email address. This setting depends on the "sharedemail" contrib module being enabled. ');
     if (!module_exists('sharedemail')) {
       $values['accountsWithSameEmailDescription'] .= t('The module is not currently enabled; you must install/enable it if you want to use this setting.');
     }
-    $values['accountsWithSameEmailOptions'] = array(
+    $values['accountsWithSameEmailOptions'] = [
       LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED => t('Prevent provisioning a user account if an existing account has the same email address.'),
       LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_ENABLED => t('Allow provisioning a user account that has the same email address as another user account.'),
-      );
-    $values['acctCreationOptions'] = array(
+    ];
+    $values['acctCreationOptions'] = [
       LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR => t('Account creation settings at
         /admin/config/people/accounts/settings do not affect "LDAP Associated" Drupal accounts.'),
       LDAP_USER_ACCT_CREATION_USER_SETTINGS_FOR_LDAP => t('Account creation policy
@@ -1060,11 +1014,11 @@ EOT;
          "Visitors" option automatically creates and account when they successfully LDAP authenticate.
          "Admin" and "Admin with approval" do not allow user to authenticate until the account is approved.'),
 
-      );
+    ];
 
-      foreach ($values as $property => $default_value) {
-        $this->$property = $default_value;
-      }
+    foreach ($values as $property => $default_value) {
+      $this->$property = $default_value;
     }
+  }
 
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.admin.inc b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.admin.inc
index 409a1e1a..31354071 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.admin.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.admin.inc
@@ -3,11 +3,10 @@
 /**
  * @file
  * LDAP User editing UI.
- *
  */
 
 /**
- * form for adding, updating, and deleting a single ldap authorization mapping
+ * Form for adding, updating, and deleting a single ldap authorization mapping.
  */
 function ldap_user_admin_form($form, &$form_state) {
   $ldap_user_conf = ldap_user_conf('admin');
@@ -15,9 +14,8 @@ function ldap_user_admin_form($form, &$form_state) {
   return $form;
 }
 
-
 /**
- * validate handler for the ldap_user_admin_form
+ * Validate handler for the ldap_user_admin_form.
  */
 function ldap_user_admin_form_validate($form, &$form_state) {
 
@@ -29,23 +27,24 @@ function ldap_user_admin_form_validate($form, &$form_state) {
   foreach ($warnings as $warning_name => $warning_text) {
     drupal_set_message($warning_text, 'warning');
   }
-  $form_state['ldap_warnings'] = (boolean)(count($warnings) > 0);
+  $form_state['ldap_warnings'] = (boolean) (count($warnings) > 0);
 }
 
 /**
- * submit handler function for ldap_user_admin_form
+ * Submit handler function for ldap_user_admin_form.
  */
 function ldap_user_admin_form_submit($form, &$form_state) {
 
   $ldap_user_conf = ldap_user_conf('admin');
-  $ldap_user_conf->drupalFormSubmit($form_state['values'], $form['#storage']);  // add form data to object and save or create
+  // Add form data to object and save or create.
+  $ldap_user_conf->drupalFormSubmit($form_state['values'], $form['#storage']);
 
   if ($ldap_user_conf->hasError == FALSE) {
     drupal_set_message(t('LDAP user configuration saved'), 'status');
     drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/user');
   }
   else {
-    form_set_error($conf->errorName, $conf->errorMsg);
+    form_set_error($ldap_user_conf->errorName, $ldap_user_conf->errorMsg);
     $ldap_user_conf->clearError();
   }
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.api.php b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.api.php
index 785b803d..e1960c4d 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.api.php
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.api.php
@@ -2,14 +2,13 @@
 
 /**
  * @file
- * Hooks and functions relevant to developers
- *
+ * Hooks and functions relevant to developers.
  */
 
 /**
- * hook_ldap_user_attrs_alter().
+ * Hook_ldap_user_attrs_alter().
  *
- * alter list of available drupal user targets (fields, properties, etc.)
+ * Alter list of available drupal user targets (fields, properties, etc.)
  *   for ldap_user provisioning mapping form (admin/config/people/ldap/user)
  *
  * return array with elements of the form:
@@ -38,10 +37,9 @@
  *   'data' ($user->data array.  field_name will be used as key such as $user->data[<field_name>] = mapped value
  * 'field_name' machine name of property, field, profile2 field, or data associative array key
  */
-
 function hook_ldap_user_attrs_list_alter(&$available_user_attrs, &$params) {
 
- /** search for _ldap_user_attrs_list_alter for good examples
+  /** search for _ldap_user_attrs_list_alter for good examples
   * the general trick to implementing this hook is:
   *   make sure to specify config and synch module
   *   if its configurable by ldap_user module, don't specify convert, user_tokens, direction.  these will be set by UI and stored values
@@ -50,22 +48,19 @@ function hook_ldap_user_attrs_list_alter(&$available_user_attrs, &$params) {
 
 }
 
-
-
 /**
  * Allow modules to alter the user object in the context of an ldap entry
- * during synchronization
+ * during synchronization.
  *
  * @param array $edit
  *   The edit array (see hook_user_insert). Make changes to this object as
  *   required.
- * @param array $ldap_user, for structure @see LdapServer::userUserNameToExistingLdapEntry()
- *   Array, the ldap user object relating to the drupal user
+ * @param array $ldap_user,
+ *   for structure @see LdapServer::userUserNameToExistingLdapEntry()
+ *   Array, the ldap user object relating to the drupal user.
  * @param object $ldap_server
- *   The LdapServer object from which the ldap entry was fetched
+ *   The LdapServer object from which the ldap entry was fetched.
  * @param int $prov_event
- *
- *
  */
 function hook_ldap_user_edit_user_alter(&$edit, &$ldap_user, $ldap_server, $prov_event) {
   $edit['myfield'] = $ldap_server->getAttributeValue($ldap_user, 'myfield');
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.cron.inc b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.cron.inc
index 88e1f4f7..bf351668 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.cron.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.cron.inc
@@ -2,22 +2,18 @@
 
 /**
  * @file
- * cron relate functions
- *
+ * Cron relate functions.
  */
 
 /**
- * function to respond to ldap associated drupal accounts which no
- * longer have a related LDAP entry
+ * Function to respond to ldap associated drupal accounts which no
+ * longer have a related LDAP entry.
  *
  * @param LdapUserConf $ldap_user_conf
  *
  * @return boolean FALSE on error or incompletion or TRUE otherwise
  */
 function _ldap_user_orphans($ldap_user_conf) {
-
-  // return TRUE; // this is untested code
-
   if (!$ldap_user_conf->orphanedDrupalAcctBehavior ||
     $ldap_user_conf->orphanedDrupalAcctBehavior == 'ldap_user_orphan_do_not_check') {
     return TRUE;
@@ -40,18 +36,20 @@ function _ldap_user_orphans($ldap_user_conf) {
     ->fieldCondition('ldap_user_puid', 'value', 'NULL', '!=')
     ->fieldCondition('ldap_user_current_dn', 'value', 'NULL', '!=')
     ->propertyCondition('uid', $last_uid_checked, '>')
+    ->propertyCondition('status', 1)
     ->propertyOrderBy('uid', 'ASC')
     ->range(0, $ldap_user_conf->orphanedCheckQty)
-    ->addMetaData('account', user_load(1)); // run the query as user 1
+  // Run the query as user 1.
+    ->addMetaData('account', user_load(1));
   $result = $query->execute();
 
-  $email_list = array();
+  $email_list = [];
   $ldap_servers = ldap_servers_get_servers(NULL, 'enabled');
-  $watchdogs_sids_missing_watchdogged = array();
+  $watchdogs_sids_missing_watchdogged = [];
   /**
-   * first produce array of form:
-   *  $drupal_users[$sid][$puid_attr][$puid]['exists'] = FALSE | TRUE;
-   *  signifying if corresponding LDAP Entry exists
+   * First produce array of form:
+   *  $drupal_users[$sid][$puid_attr][$puid]['exists'] = bool
+   *  signifying if corresponding LDAP Entry exists.
    */
   if (!(isset($result['user']) && count($result['user']) > 0)) {
     return TRUE;
@@ -60,7 +58,7 @@ function _ldap_user_orphans($ldap_user_conf) {
   $uids = array_keys($result['user']);
   $user_count = count($uids);
 
-  // if maxed out reset uid check counter
+  // If maxed out reset uid check counter.
   if ($user_count < $ldap_user_conf->orphanedCheckQty) {
     variable_set('ldap_user_cron_last_uid_checked', 1);
   }
@@ -69,14 +67,14 @@ function _ldap_user_orphans($ldap_user_conf) {
   }
 
   $batches = floor($user_count / LDAP_SERVERS_MAXFILTER_ORS) + 1;
-  // e.g. 175 users and  50 max ldap query ors will yield 4 batches
+  // e.g. 175 users and  50 max ldap query ors will yield 4 batches.
   for ($batch = 1; $batch <= $batches; $batch++) {
     $email_list = _ldap_user_orphan_process_batch($ldap_user_conf, $batch, $user_count, $uids, $ldap_servers, $watchdogs_sids_missing_watchdogged, $query, $email_list);
   }
 
   if (count($email_list) > 0) {
     $site_email = variable_get('site_mail', FALSE);
-    $params = array('accounts' => $email_list);
+    $params = ['accounts' => $email_list];
     if ($site_email) {
       drupal_mail(
         'ldap_user',
@@ -106,7 +104,7 @@ function _ldap_user_orphans($ldap_user_conf) {
  */
 function _ldap_user_orphan_process_batch($ldap_user_conf, $batch, $user_count, $uids, $ldap_servers, $watchdogs_sids_missing_watchdogged, $query, $email_list) {
   $filters = [];
-  $drupal_users = array();
+  $drupal_users = [];
   /**
    * 1. populate $drupal_users[$sid][$puid_attr][$puid]['exists']  = TRUE
    *
@@ -114,9 +112,12 @@ function _ldap_user_orphan_process_batch($ldap_user_conf, $batch, $user_count, $
    *       2nd batch   $i=50; $i<100; $i++
    *       4th batch   $i=150; $i<175; $i++
    */
-  $start = ($batch - 1) * LDAP_SERVERS_MAXFILTER_ORS; // e.g 0, 50, 100
-  $end_plus_1 = min(($batch) * LDAP_SERVERS_MAXFILTER_ORS, $user_count); // e.g. 50, 100, 150
-  $batch_uids = array_slice($uids, $start, ($end_plus_1 - $start)); // e.g. 50, 50; 100, 50
+  // e.g 0, 50, 100.
+  $start = ($batch - 1) * LDAP_SERVERS_MAXFILTER_ORS;
+  // e.g. 50, 100, 150.
+  $end_plus_1 = min(($batch) * LDAP_SERVERS_MAXFILTER_ORS, $user_count);
+  // e.g. 50, 50; 100, 50.
+  $batch_uids = array_slice($uids, $start, ($end_plus_1 - $start));
   $accounts = entity_load('user', $batch_uids);
 
   foreach ($accounts as $uid => $user) {
@@ -134,13 +135,13 @@ function _ldap_user_orphan_process_batch($ldap_user_conf, $batch, $user_count, $
       $drupal_users[$sid][$puid_attr][$puid]['exists'] = FALSE;
     }
     else {
-      // user with missing ldap data fields
+      // User with missing ldap data fields
       // perhaps should be watchdogged?
     }
   }
 
-  //2. set $drupal_users[$sid][$puid_attr][$puid]['exists'] to FALSE
-  // if entry doesn't exist
+  // 2. set $drupal_users[$sid][$puid_attr][$puid]['exists'] to FALSE
+  // if entry doesn't exist.
   foreach ($filters as $sid => $puid_attrs) {
     if (!isset($ldap_servers[$sid])) {
       if (!isset($watchdogs_sids_missing_watchdogged[$sid])) {
@@ -155,11 +156,12 @@ function _ldap_user_orphan_process_batch($ldap_user_conf, $batch, $user_count, $
       continue;
     }
     foreach ($puid_attrs as $puid_attr => $ors) {
-      // query should look like (|(guid=3243243)(guid=3243243)(guid=3243243))
+      // Query should look like (|(guid=3243243)(guid=3243243)(guid=3243243))
       $ldap_filter = '(|' . join("", $ors) . ')';
       $ldap_entries = $ldap_servers[$sid]->searchAllBaseDns($ldap_filter, [$puid_attr]);
       if ($ldap_entries === FALSE) {
-        unset($drupal_users[$sid]); // if query has error, don't remove ldap entries!
+        // If query has error, don't remove ldap entries!
+        unset($drupal_users[$sid]);
         watchdog(
           'ldap_user',
           'ldap server %sid had error while querying to
@@ -178,10 +180,8 @@ function _ldap_user_orphan_process_batch($ldap_user_conf, $batch, $user_count, $
       }
     }
   }
-  //3. we now have $drupal_users[$sid][$puid_attr][$puid]['exists'] = FALSE | TRUE;
-  if ($ldap_user_conf->orphanedDrupalAcctBehavior == 'ldap_user_orphan_email') {
-    global $base_url;
-  }
+  // 3. we now have $drupal_users[$sid][$puid_attr][$puid]['exists'] = bool.
+  global $base_url;
   foreach ($drupal_users as $sid => $puid_x_puid_attrs) {
     foreach ($puid_x_puid_attrs as $puid_attr => $puids) {
       foreach ($puids as $puid => $user_data) {
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info
index a3d6ae1a..58b9d078 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info
@@ -6,6 +6,7 @@ dependencies[] = entity
 dependencies[] = number
 
 core = 7.x
+php = 5.4
 
 files[] = ldap_user.api.php
 files[] = ldap_user.inc
@@ -24,8 +25,8 @@ configure = admin/config/people/ldap/user
 
 test_dependencies[] = ldap_sso:ldap_sso
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install
index fe2cb66d..b13ccecf 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install
@@ -10,11 +10,11 @@
  */
 function ldap_user_requirements($phase) {
 
-  $requirements = array();
+  $requirements = [];
 
   if ($phase == 'runtime') {
 
-    // check for all $user->* fields created
+    // Check for all $user->* fields created.
     $missing_fields = ldap_user_update_check_user_fields(TRUE);
     if (count($missing_fields)) {
       $requirements['ldap_user']['title'] = t('User Fields for LDAP User Module Missing');
@@ -24,17 +24,16 @@ function ldap_user_requirements($phase) {
       $requirements['ldap_user']['description'] = t('Fields are added to the
         Drupal User entity for LDAP User module functionality.  These fields should
         have been created in LDAP User update 7203. The following userfields are missing:') .
-        theme('item_list', array(
+        theme('item_list', [
           'items' => $missing_fields,
           'type' => 'ul',
           'title' => NULL,
-        )) .
+        ]) .
         t('Rerun update 7203 to correct this; it will not write over destroy existing fields.');
     }
   }
 
-
-  // check that ldapauth not installed.
+  // Check that ldapauth not installed.
   return $requirements;
 
 }
@@ -52,26 +51,26 @@ function ldap_user_install() {
     }
   }
 
-  // make ldap user weight slightly less than other ldap modules so it can load
+  // Make ldap user weight slightly less than other ldap modules so it can load
   // user's associated ldap data first and save on ldap queries.
-
   db_query("UPDATE {system} SET weight = -1 WHERE name = 'ldap_user'");
 
   _ldap_user_install_update_authmap();
 
-
-
 }
 
+/**
+ *
+ */
 function _ldap_user_install_update_authmap() {
   db_update('authmap')
-  ->fields(
-    array(
+    ->fields(
+    [
       'module' => 'ldap_user',
-    )
+    ]
   )
-  ->condition('module', 'ldap_authentication')
-  ->execute();
+    ->condition('module', 'ldap_authentication')
+    ->execute();
 
 }
 
@@ -104,366 +103,362 @@ function ldap_user_uninstall() {
  */
 function ldap_user_schema() {
 
-
 }
 
-
-// see http://api.drupal.org/api/drupal/modules%21field%21field.module/group/field/7
-
-
+/**
+ * See http://api.drupal.org/api/drupal/modules%21field%21field.module/group/field/7.
+ */
 function ldap_user_user_entity_fields() {
 
-  $fields = array();
+  $fields = [];
 
   $field_name = 'ldap_user_puid_sid';
-  $fields[$field_name]['field'] = array(
+  $fields[$field_name]['field'] = [
     'field_name' => $field_name,
     'type' => 'text',
-    'entity_types' => array('user'),
+    'entity_types' => ['user'],
     'cardinality' => 1,
     'translatable' => 0,
     'locked' => 1,
     'module' => 'text',
     'no_ui' => 1,
-    'settings' => array(),
-    );
-
-  $fields[$field_name]['instance'] = array(
-      'field_name' => $field_name,
-      'entity_type' => 'user',
-      'bundle' => 'user',
-      'label' => 'LDAP Server ID that puid was derived from.  NULL if puid is independent of server configuration instance.',
-      'description' => 'This field should not be edited.',
-      'required' => 0,
-      'default_value' => array(),
-      'settings' => array(
-        'text_processing' => 0,
-      ),
-      'widget' => array(
-        'type' => 'ldap_user_hidden',
-        'settings' => array(),
-        'module' => 'ldap_user',
-      ),
-      'display' => array(
-        'default' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'full' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'teaser' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      ));
+    'settings' => [],
+  ];
 
+  $fields[$field_name]['instance'] = [
+    'field_name' => $field_name,
+    'entity_type' => 'user',
+    'bundle' => 'user',
+    'label' => 'LDAP Server ID that puid was derived from.  NULL if puid is independent of server configuration instance.',
+    'description' => 'This field should not be edited.',
+    'required' => 0,
+    'default_value' => [],
+    'settings' => [
+      'text_processing' => 0,
+    ],
+    'widget' => [
+      'type' => 'ldap_user_hidden',
+      'settings' => [],
+      'module' => 'ldap_user',
+    ],
+    'display' => [
+      'default' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'full' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'teaser' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+    ],
+  ];
 
   $field_name = 'ldap_user_puid';
-  $fields[$field_name]['field'] = array(
-      'field_name' => $field_name,
-      'type' => 'text',
-      'entity_types' => array('user'),
-      'cardinality' => 1,
-      'translatable' => 0,
-      'locked' => 1,
-      'module' => 'text',
-      'no_ui' => 1,
-      'settings' => array(),
-      );
-
-  $fields[$field_name]['instance'] = array(
-      'field_name' => $field_name,
-      'entity_type' => 'user',
-      'bundle' => 'user',
-      'label' => 'Value of user\'s permanent unique id.  This should never change for a given ldap identified user.',
-      'description' => 'This field should not be edited.',
-      'required' => 0,
-      'default_value' => array(),
-      'settings' => array(
-        'text_processing' => 0,
-      ),
-      'widget' => array(
-        'type' => 'ldap_user_hidden',
-        'settings' => array(),
-        'module' => 'ldap_user',
-      ),
-      'display' => array(
-        'default' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'full' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'teaser' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      ));
+  $fields[$field_name]['field'] = [
+    'field_name' => $field_name,
+    'type' => 'text',
+    'entity_types' => ['user'],
+    'cardinality' => 1,
+    'translatable' => 0,
+    'locked' => 1,
+    'module' => 'text',
+    'no_ui' => 1,
+    'settings' => [],
+  ];
+
+  $fields[$field_name]['instance'] = [
+    'field_name' => $field_name,
+    'entity_type' => 'user',
+    'bundle' => 'user',
+    'label' => 'Value of user\'s permanent unique id.  This should never change for a given ldap identified user.',
+    'description' => 'This field should not be edited.',
+    'required' => 0,
+    'default_value' => [],
+    'settings' => [
+      'text_processing' => 0,
+    ],
+    'widget' => [
+      'type' => 'ldap_user_hidden',
+      'settings' => [],
+      'module' => 'ldap_user',
+    ],
+    'display' => [
+      'default' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'full' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'teaser' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+    ],
+  ];
 
   $field_name = 'ldap_user_puid_property';
-  $fields[$field_name]['field'] = array(
-      'field_name' => $field_name,
-      'type' => 'text',
-      'entity_types' => array('user'),
-      'cardinality' => 1,
-      'translatable' => 0,
-      'locked' => 1,
-      'module' => 'text',
-      'no_ui' => 1,
-      'settings' => array(),
-      );
-
-  $fields[$field_name]['instance'] = array(
-      'field_name' => $field_name,
-      'entity_type' => 'user',
-      'bundle' => 'user',
-      'label' => 'Property specified as user\'s puid.',
-      'description' => 'This field should not be edited.',
-      'required' => 0,
-      'default_value' => array(),
-      'settings' => array(
-        'text_processing' => 0,
-      ),
-      'widget' => array(
-        'type' => 'ldap_user_hidden',
-        'settings' => array(),
-        'module' => 'ldap_user',
-      ),
-      'display' => array(
-        'default' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'full' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'teaser' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      ));
+  $fields[$field_name]['field'] = [
+    'field_name' => $field_name,
+    'type' => 'text',
+    'entity_types' => ['user'],
+    'cardinality' => 1,
+    'translatable' => 0,
+    'locked' => 1,
+    'module' => 'text',
+    'no_ui' => 1,
+    'settings' => [],
+  ];
+
+  $fields[$field_name]['instance'] = [
+    'field_name' => $field_name,
+    'entity_type' => 'user',
+    'bundle' => 'user',
+    'label' => 'Property specified as user\'s puid.',
+    'description' => 'This field should not be edited.',
+    'required' => 0,
+    'default_value' => [],
+    'settings' => [
+      'text_processing' => 0,
+    ],
+    'widget' => [
+      'type' => 'ldap_user_hidden',
+      'settings' => [],
+      'module' => 'ldap_user',
+    ],
+    'display' => [
+      'default' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'full' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'teaser' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+    ],
+  ];
 
   $field_name = 'ldap_user_current_dn';
-  $fields[$field_name]['field'] = array(
-      'field_name' => $field_name,
-      'type' => 'text',
-      'entity_types' => array('user'),
-      'cardinality' => 1,
-      'translatable' => 0,
-      'locked' => 1,
-      'module' => 'text',
-      'no_ui' => 1,
-      'settings' => array(),
-      );
-
-  $fields[$field_name]['instance'] = array(
-      'field_name' => $field_name,
-      'entity_type' => 'user',
-      'bundle' => 'user',
-      'label' => 'User LDAP DN',
-      'description' => 'May change when user\'s DN changes. This field should not be edited.',
-      'required' => 0,
-      'default_value' => array(),
-      'settings' => array(
-        'text_processing' => 0,
-      ),
-      'widget' => array(
-        'type' => 'ldap_user_hidden',
-        'settings' => array(),
-        'module' => 'ldap_user',
-      ),
-      'display' => array(
-        'default' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'full' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'teaser' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      ));
+  $fields[$field_name]['field'] = [
+    'field_name' => $field_name,
+    'type' => 'text',
+    'entity_types' => ['user'],
+    'cardinality' => 1,
+    'translatable' => 0,
+    'locked' => 1,
+    'module' => 'text',
+    'no_ui' => 1,
+    'settings' => [],
+  ];
+
+  $fields[$field_name]['instance'] = [
+    'field_name' => $field_name,
+    'entity_type' => 'user',
+    'bundle' => 'user',
+    'label' => 'User LDAP DN',
+    'description' => 'May change when user\'s DN changes. This field should not be edited.',
+    'required' => 0,
+    'default_value' => [],
+    'settings' => [
+      'text_processing' => 0,
+    ],
+    'widget' => [
+      'type' => 'ldap_user_hidden',
+      'settings' => [],
+      'module' => 'ldap_user',
+    ],
+    'display' => [
+      'default' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'full' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'teaser' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+    ],
+  ];
 
   $field_name = 'ldap_user_prov_entries';
-  $fields[$field_name]['field'] = array(
+  $fields[$field_name]['field'] = [
     'field_name' => $field_name,
     'type' => 'text',
-    'entity_types' => array('user'),
+    'entity_types' => ['user'],
     'cardinality' => FIELD_CARDINALITY_UNLIMITED,
     'translatable' => 0,
     'locked' => 1,
     'module' => 'text',
     'no_ui' => 1,
-    'settings' => array(),
-    );
-
-  $fields[$field_name]['instance'] = array(
-      'field_name' => $field_name,
-      'entity_type' => 'user',
-      'bundle' => 'user',
-      'label' => 'LDAP Entries that have been provisioned from this Drupal user.',
-      'description' => 'This field should not be edited.',
-      'required' => 0,
-      'default_value' => NULL,
-      'settings' => array(
-        'text_processing' => 0,
-      ),
-      'widget' => array(
-        'type' => 'ldap_user_hidden',
-        'settings' => array(),
-        'module' => 'ldap_user',
-      ),
-      'display' => array(
-        'default' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'full' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'teaser' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      ));
+    'settings' => [],
+  ];
+
+  $fields[$field_name]['instance'] = [
+    'field_name' => $field_name,
+    'entity_type' => 'user',
+    'bundle' => 'user',
+    'label' => 'LDAP Entries that have been provisioned from this Drupal user.',
+    'description' => 'This field should not be edited.',
+    'required' => 0,
+    'default_value' => NULL,
+    'settings' => [
+      'text_processing' => 0,
+    ],
+    'widget' => [
+      'type' => 'ldap_user_hidden',
+      'settings' => [],
+      'module' => 'ldap_user',
+    ],
+    'display' => [
+      'default' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'full' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'teaser' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+    ],
+  ];
 
   $field_name = 'ldap_user_last_checked';
-  $fields[$field_name]['field'] = array(
+  $fields[$field_name]['field'] = [
     'field_name' => $field_name,
     'type' => 'number_integer',
-    'entity_types' => array('user'),
+    'entity_types' => ['user'],
     'cardinality' => 1,
     'translatable' => 0,
     'locked' => 1,
     'module' => 'number',
     'no_ui' => 1,
-    'settings' => array(),
-    );
-
-  $fields[$field_name]['instance'] = array(
-      'field_name' => $field_name,
-      'entity_type' => 'user',
-      'bundle' => 'user',
-      'label' => 'Unix timestamp of when Drupal user was compard to ldap entry.  This could be for purposes of synching, deleteing drupal account, etc.',
-      'description' => 'This field should not be edited.',
-      'required' => 0,
-      'default_value' => NULL,
-      'settings' => array(
-      ),
-      'widget' => array(
-        'type' => 'ldap_user_hidden',
-        'settings' => array(),
-        'module' => 'ldap_user',
-      ),
-      'display' => array(
-        'default' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'full' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'teaser' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      ));
+    'settings' => [],
+  ];
+
+  $fields[$field_name]['instance'] = [
+    'field_name' => $field_name,
+    'entity_type' => 'user',
+    'bundle' => 'user',
+    'label' => 'Unix timestamp of when Drupal user was compard to ldap entry.  This could be for purposes of synching, deleteing drupal account, etc.',
+    'description' => 'This field should not be edited.',
+    'required' => 0,
+    'default_value' => NULL,
+    'settings' => [],
+    'widget' => [
+      'type' => 'ldap_user_hidden',
+      'settings' => [],
+      'module' => 'ldap_user',
+    ],
+    'display' => [
+      'default' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'full' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'teaser' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+    ],
+  ];
 
   $field_name = 'ldap_user_ldap_exclude';
-  $fields[$field_name]['field'] = array(
+  $fields[$field_name]['field'] = [
     'field_name' => $field_name,
     'type' => 'number_integer',
-    'entity_types' => array('user'),
+    'entity_types' => ['user'],
     'cardinality' => 1,
     'translatable' => 0,
     'locked' => 1,
     'module' => 'number',
     'no_ui' => 1,
-    'settings' => array(),
-    );
-
-  $fields[$field_name]['instance'] = array(
-      'field_name' => $field_name,
-      'entity_type' => 'user',
-      'bundle' => 'user',
-      'label' => 'Whether to exclude the user from LDAP functionality',
-      'description' => 'This field should not be edited.',
-      'required' => 0,
-      'default_value' => 0,
-      'settings' => array(
-      ),
-      'widget' => array(
-        'type' => 'ldap_user_hidden',
-        'settings' => array(),
-        'module' => 'ldap_user',
-      ),
-      'display' => array(
-        'default' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'full' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      'teaser' => array(
-          'label' => 'hidden',
-          'type' => 'hidden',
-        ),
-      ));
-  
+    'settings' => [],
+  ];
+
+  $fields[$field_name]['instance'] = [
+    'field_name' => $field_name,
+    'entity_type' => 'user',
+    'bundle' => 'user',
+    'label' => 'Whether to exclude the user from LDAP functionality',
+    'description' => 'This field should not be edited.',
+    'required' => 0,
+    'default_value' => 0,
+    'settings' => [],
+    'widget' => [
+      'type' => 'ldap_user_hidden',
+      'settings' => [],
+      'module' => 'ldap_user',
+    ],
+    'display' => [
+      'default' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'full' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+      'teaser' => [
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ],
+    ],
+  ];
+
   return $fields;
 }
 
-
 /**
- * update authmap table, changing ldap_authentication to ldap_user, disable ldap_profile
+ * Update authmap table, changing ldap_authentication to ldap_user, disable ldap_profile.
  */
-
 function ldap_user_update_7201() {
   if (module_exists('ldap_profile')) {
-    module_disable(array('ldap_profile', TRUE));
+    module_disable(['ldap_profile', TRUE]);
   }
   _ldap_user_install_update_authmap();
 }
 
-
 /**
- * attach ldap_user_last_checked field to user entity to track reconciliation of ldap and drupal accounts
+ * Attach ldap_user_last_checked field to user entity to track reconciliation of ldap and drupal accounts.
  */
-
 function ldap_user_update_7202() {
 
   return t('ldap_user_last_checked field added to user entity.');
 
 }
 
-
-
 /**
- * make sure all user entity fields are created
+ * Make sure all user entity fields are created.
  */
 function ldap_user_update_7203() {
 
   if (module_exists('ldap_groups')) {
-    module_disable(array('ldap_groups', TRUE));
+    module_disable(['ldap_groups', TRUE]);
   }
 
   $fields_added = ldap_user_update_check_user_fields();
 
   if (count($fields_added)) {
     $fields = join(', ', $fields_added);
-    return t('%fields added to user entity.', array('%fields' => $fields));
+    return t('%fields added to user entity.', ['%fields' => $fields]);
   }
   else {
     return t('no fields needed to be added to user entity.');
@@ -472,7 +467,7 @@ function ldap_user_update_7203() {
 }
 
 /**
- * make sure all user entity field instances are created
+ * Make sure all user entity field instances are created.
  */
 function ldap_user_update_7204() {
 
@@ -480,7 +475,7 @@ function ldap_user_update_7204() {
 
   if (count($fields_added)) {
     $fields = join(', ', $fields_added);
-    return t('%fields added to user entity.', array('%fields' => $fields));
+    return t('%fields added to user entity.', ['%fields' => $fields]);
   }
   else {
     return t('no fields needed to be added to user entity.');
@@ -489,7 +484,7 @@ function ldap_user_update_7204() {
 }
 
 /**
- * make sure all user entity field instances are created
+ * Make sure all user entity field instances are created.
  */
 function ldap_user_update_7205() {
 
@@ -497,11 +492,14 @@ function ldap_user_update_7205() {
 
 }
 
+/**
+ *
+ */
 function ldap_user_update_check_user_fields($query = FALSE) {
   if (!$query) {
-    module_enable(array('number'));
+    module_enable(['number']);
   }
-  $fields_added = array();
+  $fields_added = [];
   foreach (ldap_user_user_entity_fields() as $field_id => $field_conf) {
     $field_info = field_info_field($field_id);
     if (!$field_info) {
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module
index 1142ba44..2d0b0015 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module
@@ -2,55 +2,54 @@
 
 /**
  * @file
- * Module for the LDAP User Entity
- *
+ * Module for the LDAP User Entity.
  */
 
 define('LDAP_USER_DRUPAL_HELP_URL', 'http://drupal.org/node/997082');
 
-// configurable drupal acct provision triggers
+// Configurable drupal acct provision triggers.
 define('LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE', 1);
 define('LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE', 2);
 define('LDAP_USER_DRUPAL_USER_PROV_ON_ALLOW_MANUAL_CREATE', 3);
 
-// configurable ldap entry provision triggers
+// Configurable ldap entry provision triggers.
 define('LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE', 6);
 define('LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE', 7);
 define('LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE', 8);
 
-// provisioning events (events are triggered by triggers)
+// Provisioning events (events are triggered by triggers)
 define('LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER', 1);
 define('LDAP_USER_EVENT_CREATE_DRUPAL_USER', 2);
 define('LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY', 3);
 define('LDAP_USER_EVENT_CREATE_LDAP_ENTRY', 4);
 define('LDAP_USER_EVENT_LDAP_ASSOCIATE_DRUPAL_ACCT', 5);
 
-// results of ldap entry provisioning
+// Results of ldap entry provisioning.
 define('LDAP_USER_PROVISION_LDAP_ENTRY_EXISTS', 1);
 define('LDAP_USER_PROVISION_LDAP_ENTRY_CREATE_FAILED', 2);
 define('LDAP_USER_PROVISION_LDAP_ENTRY_SYNCH_FAILED', 3);
 
-// options for what to do when existing non ldap associated Drupal account conflicts with ldap account
+// Options for what to do when existing non ldap associated Drupal account conflicts with ldap account.
 define('LDAP_USER_CONFLICT_LOG', 1);
 define('LDAP_USER_CONFLICT_RESOLVE', 2);
 define('LDAP_USER_CONFLICT_RESOLVE_DEFAULT', 2);
 
-// options for what to do if another Drupal account has the same email address
+// Options for what to do if another Drupal account has the same email address.
 define('LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED', 0);
 define('LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_ENABLED', 1);
 
-// options for dealing with manual account creation that conflict with ldap entries
+// Options for dealing with manual account creation that conflict with ldap entries.
 define('LDAP_USER_MANUAL_ACCT_CONFLICT_REJECT', 1);
 define('LDAP_USER_MANUAL_ACCT_CONFLICT_LDAP_ASSOCIATE', 2);
 define('LDAP_USER_MANUAL_ACCT_CONFLICT_SHOW_OPTION_ON_FORM', 3);
 define('LDAP_USER_MANUAL_ACCT_CONFLICT_NO_LDAP_ASSOCIATE', 4);
 
-// options for account creation behavior
+// Options for account creation behavior.
 define('LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR', 4);
 define('LDAP_USER_ACCT_CREATION_USER_SETTINGS_FOR_LDAP', 1);
 define('LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR_DEFAULT', 4);
 
-// provision directions
+// Provision directions.
 define('LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER', 1);
 define('LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY', 2);
 define('LDAP_USER_PROV_DIRECTION_NONE', 3);
@@ -60,7 +59,8 @@ define('LDAP_USER_PROV_RESULT_NO_ERROR', 0);
 define('LDAP_USER_PROV_RESULT_NO_PWD', 1);
 define('LDAP_USER_PROV_RESULT_BAD_PARAMS', 2);
 
-define('LDAP_USER_NO_SERVER_SID', 0); // need to avoid conflicting with server ids
+// Need to avoid conflicting with server ids.
+define('LDAP_USER_NO_SERVER_SID', 0);
 define('LDAP_USER_TEST_FORM_PATH', 'admin/config/people/ldap/user/test');
 define('LDAP_USER_WS_USER_PATH', 'ldap/user/ws');
 
@@ -72,64 +72,49 @@ define('LDAP_USER_SESSION_PROV_SID', 'ldap_user_session_prov_sid');
  * Implements hook_menu().
  */
 function ldap_user_menu() {
-  $items = array();
+  $items = [];
 
-  $items['admin/config/people/ldap/user'] = array(
+  $items['admin/config/people/ldap/user'] = [
     'title' => '3. User',
     'description' => 'Settings related to user provisioning and data synching between ldap and drupal users.',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_user_admin_form'),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_user_admin_form'],
+    'access arguments' => ['administer site configuration'],
     'type' => MENU_LOCAL_TASK,
     'weight' => 2,
     'file' => 'ldap_user.admin.inc',
-  );
+  ];
 
-  $items[LDAP_USER_TEST_FORM_PATH] = array(
+  $items[LDAP_USER_TEST_FORM_PATH] = [
     'title' => 'Test LDAP User Functionality for a given user.',
     'description' => '',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ldap_user_test_form'),
-    'access arguments' => array('administer site configuration'),
+    'page arguments' => ['ldap_user_test_form'],
+    'access arguments' => ['administer site configuration'],
     'file' => 'ldap_user.test_form.inc',
     'type' => MENU_LOCAL_ACTION,
-  );
-
- // $ws_arg_start = count(explode('/', LDAP_USER_WS_USER_PATH));
-// $items[LDAP_USER_WS_USER_PATH] = array(
-//   'title' => 'Webservice Path',
- //   'page callback' => 'ldap_user_ws',
- //   'page arguments' => array($ws_arg_start, $ws_arg_start + 1, $ws_arg_start + 2, $ws_arg_start + 3),
- //   'access arguments' => array('view content'),
- //   'file' => 'ldap_user.ws.inc',
- // );
-
+  ];
   return $items;
 }
 
-/**
- * function ldap_user_ws_urls_item_list() {
-  module_load_include('inc', 'ldap_user', 'ldap_user.ws');
-  return _ldap_user_ws_urls_item_list();
-}
-*/
-
 /**
  * Implements hook_init().
  */
 function ldap_user_init() {
-  ldap_user_ldap_provision_semaphore(NULL, NULL, NULL, TRUE); // reset for simpletest page load behavior
+  // Reset for simpletest page load behavior.
+  ldap_user_ldap_provision_semaphore(NULL, NULL, NULL, TRUE);
 }
 
 /**
  * Implements hook_theme().
  */
 function ldap_user_theme() {
-  return array('ldap_user_conf_form' => array(
-    'render element' => 'form',
-    'file' => 'ldap_user.theme.inc'
-    ),
-  );
+  return [
+    'ldap_user_conf_form' => [
+      'render element' => 'form',
+      'file' => 'ldap_user.theme.inc',
+    ],
+  ];
 }
 
 /**
@@ -141,7 +126,7 @@ function ldap_user_cron() {
     module_load_include('inc', 'ldap_user', 'ldap_user.cron');
     $result = _ldap_user_orphans($ldap_user_conf);
     if ($result !== TRUE) {
-      watchdog('ldap_user', 'LDAP User check for orphaned ldap provisioned Drupal accounts failed', array(), WATCHDOG_ERROR);
+      watchdog('ldap_user', 'LDAP User check for orphaned ldap provisioned Drupal accounts failed', [], WATCHDOG_ERROR);
     }
   }
 }
@@ -155,23 +140,23 @@ function ldap_user_mail($key, &$message, $params) {
       $message['subject'] = variable_get('site_name') . ' ' . t('Orphaned LDAP Users');
       $message['body'][] = t('The following !count Drupal users no longer have
         corresponding LDAP Entries.  Perhaps they have been removed from the LDAP
-        and should be removed:', array('!count' => count($params['accounts'])))
+        and should be removed:', ['!count' => count($params['accounts'])])
         . "\n\n" . t('username,mail,edit url') . "\n" .
         join("\n", $params['accounts']);
       break;
   }
 }
 
-
 /**
  * Implements hook_ldap_derived_user_name_alter().
  */
 function ldap_user_ldap_derived_user_name_alter(&$name, $ldap_user) {
-   // alter $name in some way here
-
+  // Alter $name in some way here.
 }
 
-
+/**
+ *
+ */
 function ldap_user_conf_cache_clear() {
   $discard = ldap_user_conf('admin', TRUE);
   $discard = ldap_user_conf(NULL, TRUE);
@@ -179,12 +164,14 @@ function ldap_user_conf_cache_clear() {
 }
 
 /**
- * get ldapUserConf or ldapUserConfAdmin object
+ * Get ldapUserConf or ldapUserConfAdmin object.
  *
- * @param enum $type is 'admin' for ldapUserConfAdmin object or NULL for ldapUserConf object
- * @param boolean $resect clear static cache of object.
+ * @param enum $type
+ *   is 'admin' for ldapUserConfAdmin object or NULL for ldapUserConf object.
+ * @param bool $resect
+ *   clear static cache of object.
  *
- * @return object ldapUserConf or ldapUserConfAdmin object
+ * @return \LdapUserConf|\LdapUserConfAdmin
  */
 function ldap_user_conf($type = NULL, $reset = FALSE) {
   static $ldap_user_conf;
@@ -202,13 +189,13 @@ function ldap_user_conf($type = NULL, $reset = FALSE) {
   return ($type == 'admin') ? $ldap_user_conf_admin : $ldap_user_conf;
 }
 
-
 /**
  * Implements hook_ldap_attributes_needed_alter().
  */
 function ldap_user_ldap_attributes_needed_alter(&$attributes, $params) {
 
-  if (isset($params['sid']) && $params['sid']) { // puid attributes are server specific
+  // Puid attributes are server specific.
+  if (isset($params['sid']) && $params['sid']) {
     if (is_scalar($params['sid'])) {
       $ldap_server = ldap_servers_get_servers($params['sid'], 'enabled', TRUE);
     }
@@ -216,21 +203,24 @@ function ldap_user_ldap_attributes_needed_alter(&$attributes, $params) {
       $ldap_server = $params['sid'];
     }
 
-    if ($ldap_server === FALSE) { // failed to find enabled server
+    // Failed to find enabled server.
+    if ($ldap_server === FALSE) {
       return;
     }
 
     $ldap_user_conf = ldap_user_conf();
     if (!isset($attributes['dn'])) {
-      $attributes['dn'] = array();
+      $attributes['dn'] = [];
     }
-    $attributes['dn'] = ldap_servers_set_attribute_map($attributes['dn']); // force dn "attribute" to exist
-    switch ($params['ldap_context']) { // Add the attributes required by the user configuration when provisioning drupal users
+    // Force dn "attribute" to exist.
+    $attributes['dn'] = ldap_servers_set_attribute_map($attributes['dn']);
+    // Add the attributes required by the user configuration when provisioning drupal users.
+    switch ($params['ldap_context']) {
       case 'ldap_user_insert_drupal_user':
       case 'ldap_user_update_drupal_user':
       case 'ldap_user_ldap_associate':
       case 'all':
-        $attributes[$ldap_server->user_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->user_attr]); // array($ldap_server->user_attr, 0, NULL);
+        $attributes[$ldap_server->user_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->user_attr]);
         $attributes[$ldap_server->mail_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->mail_attr]);
         if ($ldap_server->picture_attr) {
           $attributes[$ldap_server->picture_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->picture_attr]);
@@ -241,7 +231,7 @@ function ldap_user_ldap_attributes_needed_alter(&$attributes, $params) {
         if ($ldap_server->mail_template) {
           ldap_servers_token_extract_attributes($attributes, $ldap_server->mail_template);
         }
-      break;
+        break;
     }
 
     $ldap_context = empty($params['ldap_context']) ? NULL : $params['ldap_context'];
@@ -263,62 +253,62 @@ function ldap_user_ldap_user_attrs_list_alter(&$available_user_attrs, &$params)
   $direction = isset($params['direction']) ? $params['direction'] : LDAP_USER_PROV_DIRECTION_NONE;
 
   if ($direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
-    $available_user_attrs['[property.name]'] = array(
+    $available_user_attrs['[property.name]'] = [
       'name' => 'Property: Username',
       'source' => '',
       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
       'enabled' => TRUE,
-      'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
+      'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
       'config_module' => 'ldap_user',
       'prov_module' => 'ldap_user',
       'configurable_to_ldap' => TRUE,
-      );
+    ];
 
-    $available_user_attrs['[property.mail]'] = array(
+    $available_user_attrs['[property.mail]'] = [
       'name' => 'Property: Email',
       'source' => '',
       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
       'enabled' => TRUE,
-      'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
+      'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
       'config_module' => 'ldap_user',
       'prov_module' => 'ldap_user',
       'configurable_to_ldap' => TRUE,
-    );
+    ];
 
-    $available_user_attrs['[property.picture]'] = array(
+    $available_user_attrs['[property.picture]'] = [
       'name' => 'Property: picture',
       'source' => '',
       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
       'enabled' => TRUE,
-      'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
+      'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
       'config_module' => 'ldap_user',
       'prov_module' => 'ldap_user',
       'configurable_to_ldap' => TRUE,
-    );
+    ];
 
-    $available_user_attrs['[property.uid]'] = array(
+    $available_user_attrs['[property.uid]'] = [
       'name' => 'Property: Drupal User Id (uid)',
       'source' => '',
       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
       'enabled' => TRUE,
-      'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
+      'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
       'config_module' => 'ldap_user',
       'prov_module' => 'ldap_user',
       'configurable_to_ldap' => TRUE,
-    );
+    ];
 
   }
 
   // 1. Drupal user properties
-  // 1.a make sure empty array are present so array + function works
-  foreach (array('property.status', 'property.timezone', 'property.signature') as $i => $property_id) {
+  // 1.a make sure empty array are present so array + function works.
+  foreach (['property.status', 'property.timezone', 'property.signature'] as $i => $property_id) {
     $property_token = '[' . $property_id . ']';
     if (!isset($available_user_attrs[$property_token]) || !is_array($available_user_attrs[$property_token])) {
-      $available_user_attrs[$property_token] = array();
+      $available_user_attrs[$property_token] = [];
     }
   }
-  //@todo make these merges so they don't override saved values such as 'enabled'
-  $available_user_attrs['[property.status]'] = $available_user_attrs['[property.status]'] + array(
+  // @todo make these merges so they don't override saved values such as 'enabled'
+  $available_user_attrs['[property.status]'] = $available_user_attrs['[property.status]'] + [
     'name' => 'Property: Acount Status',
     'configurable_to_drupal' => 1,
     'configurable_to_ldap' => 1,
@@ -326,45 +316,44 @@ function ldap_user_ldap_user_attrs_list_alter(&$available_user_attrs, &$params)
     'enabled' => FALSE,
     'config_module' => 'ldap_user',
     'prov_module' => 'ldap_user',
-  );
+  ];
 
-  $available_user_attrs['[property.timezone]'] = $available_user_attrs['[property.timezone]'] + array(
+  $available_user_attrs['[property.timezone]'] = $available_user_attrs['[property.timezone]'] + [
     'name' => 'Property: User Timezone',
     'configurable_to_drupal' => 1,
     'configurable_to_ldap' => 1,
     'enabled' => FALSE,
     'config_module' => 'ldap_user',
     'prov_module' => 'ldap_user',
-  );
+  ];
 
-  $available_user_attrs['[property.signature]'] = $available_user_attrs['[property.signature]'] + array(
+  $available_user_attrs['[property.signature]'] = $available_user_attrs['[property.signature]'] + [
     'name' => 'Property: User Signature',
     'configurable_to_drupal' => 1,
     'configurable_to_ldap' => 1,
     'enabled' => FALSE,
     'config_module' => 'ldap_user',
     'prov_module' => 'ldap_user',
-  );
+  ];
 
-  // 2. Drupal user fields
+  // 2. Drupal user fields.
   $user_fields = field_info_instances('user', 'user');
   foreach ($user_fields as $field_name => $field_instance) {
     $field_id = "[field.$field_name]";
     if (!isset($available_user_attrs[$field_id]) || !is_array($available_user_attrs[$field_id])) {
-      $available_user_attrs[$field_id] = array();
+      $available_user_attrs[$field_id] = [];
     }
 
-    $available_user_attrs[$field_id] = $available_user_attrs[$field_id] + array(
+    $available_user_attrs[$field_id] = $available_user_attrs[$field_id] + [
       'name' => t('Field') . ': ' . $field_instance['label'],
       'configurable_to_drupal' => 1,
       'configurable_to_ldap' => 1,
       'enabled' => FALSE,
       'config_module' => 'ldap_user',
       'prov_module' => 'ldap_user',
-    );
+    ];
   }
 
-
   if (!$ldap_user_conf->provisionsDrupalAccountsFromLdap) {
     $available_user_attrs['[property.mail]']['config_module'] = 'ldap_user';
     $available_user_attrs['[property.name]']['config_module'] = 'ldap_user';
@@ -372,44 +361,44 @@ function ldap_user_ldap_user_attrs_list_alter(&$available_user_attrs, &$params)
   }
 
   if ($direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
-    $available_user_attrs['[password.random]'] = array(
+    $available_user_attrs['[password.random]'] = [
       'name' => 'Pwd: Random',
       'source' => '',
       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
       'enabled' => TRUE,
-      'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
+      'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
       'config_module' => 'ldap_user',
       'prov_module' => 'ldap_user',
       'configurable_to_ldap' => TRUE,
-    );
+    ];
 
-    // use user password when available fall back to random pwd
-    $available_user_attrs['[password.user-random]'] = array(
+    // Use user password when available fall back to random pwd.
+    $available_user_attrs['[password.user-random]'] = [
       'name' => 'Pwd: User or Random',
       'source' => '',
       'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
       'enabled' => TRUE,
-      'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
+      'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
       'config_module' => 'ldap_user',
       'prov_module' => 'ldap_user',
       'configurable_to_ldap' => TRUE,
-    );
+    ];
 
-    // use user password, do not modify if unavailable
-    $available_user_attrs['[password.user-only]'] = array(
-        'name' => 'Pwd: User Only',
-        'source' => '',
-        'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
-        'enabled' => TRUE,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-        'config_module' => 'ldap_user',
-        'prov_module' => 'ldap_user',
-        'configurable_to_ldap' => TRUE,
-      );
+    // Use user password, do not modify if unavailable.
+    $available_user_attrs['[password.user-only]'] = [
+      'name' => 'Pwd: User Only',
+      'source' => '',
+      'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
+      'enabled' => TRUE,
+      'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+      'config_module' => 'ldap_user',
+      'prov_module' => 'ldap_user',
+      'configurable_to_ldap' => TRUE,
+    ];
 
   }
 
-  //this is where need to be added to arrays
+  // This is where need to be added to arrays.
   if (!empty($ldap_user_conf->ldapUserSynchMappings[$direction])) {
 
     foreach ($ldap_user_conf->ldapUserSynchMappings[$direction] as $target_token => $mapping) {
@@ -423,7 +412,7 @@ function ldap_user_ldap_user_attrs_list_alter(&$available_user_attrs, &$params)
         continue;
       }
 
-      foreach (array('ldap_attr', 'user_attr', 'convert', 'direction', 'enabled', 'prov_events') as $k) {
+      foreach (['ldap_attr', 'user_attr', 'convert', 'direction', 'enabled', 'prov_events'] as $k) {
         if (isset($mapping[$k])) {
           $available_user_attrs[$key][$k] = $mapping[$k];
         }
@@ -441,23 +430,21 @@ function ldap_user_ldap_user_attrs_list_alter(&$available_user_attrs, &$params)
 
   }
 
-   // 3. profile2 fields
+  // 3. profile2 fields
   // 4. $user->data array.   will need to be added manually.  perhaps better not to implement this at all?
-
-
 }
+
 /**
  * Implements hook_help().
  */
-
 function ldap_user_help($path, $arg) {
 
   $ldap_user_help = t('LDAP user configuration determines how and when
     Drupal accounts are created based on LDAP data and which user fields
     are derived and synched to and from LDAP. See !helplink.',
-    array(
+    [
       '!helplink' => l(LDAP_USER_DRUPAL_HELP_URL, LDAP_USER_DRUPAL_HELP_URL),
-    ));
+    ]);
 
   switch ($path) {
     case 'admin/config/people/ldap/user':
@@ -470,72 +457,68 @@ function ldap_user_help($path, $arg) {
   }
 }
 
-
 /**
- * Implements hook_form_FORM_ID_alter(). for user_login_block
+ * Implements hook_form_FORM_ID_alter(). for user_login_block.
  */
 function ldap_user_form_user_login_block_alter(&$form, &$form_state) {
   array_unshift($form['#validate'], 'ldap_user_grab_password_validate');
 }
 
 /**
- * Implements hook_form_FORM_ID_alter(). for user_login_form
+ * Implements hook_form_FORM_ID_alter(). for user_login_form.
  */
 function ldap_user_form_user_login_alter(&$form, $form_state) {
   array_unshift($form['#validate'], 'ldap_user_grab_password_validate');
 }
 
 /**
- * Implements hook_form_FORM_ID_alter(). for user_register_form
+ * Implements hook_form_FORM_ID_alter(). for user_register_form.
  */
 function ldap_user_form_user_profile_form_alter(&$form, $form_state) {
   array_unshift($form['#submit'], 'ldap_user_grab_password_validate');
 }
 
 /**
-* Implements hook_form_FORM_ID_alter(). for password_policy_password_tab
-*/
+ * Implements hook_form_FORM_ID_alter(). for password_policy_password_tab.
+ */
 function ldap_user_form_password_policy_password_tab_alter(&$form, &$form_state) {
   array_unshift($form['#validate'], 'ldap_user_grab_password_validate');
 }
 
 /**
-* Implements hook_form_FORM_ID_alter(). for user-pass-reset form. Useful for
-* sites where this is the form ID for a user to intially set their password
-* (user clicks an emailed registration link, is prompted to set their password).
-*/
+ * Implements hook_form_FORM_ID_alter(). for user-pass-reset form. Useful for
+ * sites where this is the form ID for a user to intially set their password
+ * (user clicks an emailed registration link, is prompted to set their password).
+ */
 function ldap_user_form_user_pass_reset_alter(&$form, &$form_state) {
   array_unshift($form['#validate'], 'ldap_user_grab_password_validate');
 }
 
 /**
- * store password from logon forms in ldap_user_ldap_provision_pwd static variable
- * for use in provisioning to ldap
+ * Store password from logon forms in ldap_user_ldap_provision_pwd static variable
+ * for use in provisioning to ldap.
  */
 function ldap_user_grab_password_validate($form, &$form_state) {
 
-   // This is not a login form but profile form and user is inserting password to update email
+  // This is not a login form but profile form and user is inserting password to update email.
   if (!empty($form_state['values']['current_pass_required_values'])) {
     if (!empty($form_state['values']['current_pass']) && empty($form_state['values']['pass'])) {
       ldap_user_ldap_provision_pwd('set', $form_state['values']['current_pass']);
     }
-    // Or this is a profile form where the user is updating their own password
+    // Or this is a profile form where the user is updating their own password.
     elseif (!empty($form_state['values']['pass'])) {
-        ldap_user_ldap_provision_pwd('set', $form_state['values']['pass']);
+      ldap_user_ldap_provision_pwd('set', $form_state['values']['pass']);
     }
   }
-  // otherwise a logon form
+  // Otherwise a logon form.
   elseif (!empty($form_state['values']['pass'])) {
     ldap_user_ldap_provision_pwd('set', $form_state['values']['pass']);
   }
 
 }
 
-
-
-
 /**
- * Implements hook_form_FORM_ID_alter(). for user_register_form
+ * Implements hook_form_FORM_ID_alter(). for user_register_form.
  */
 function ldap_user_form_user_register_form_alter(&$form, $form_state) {
 
@@ -553,17 +536,17 @@ function ldap_user_form_user_register_form_alter(&$form, $form_state) {
     $form['account']['pass_disabled'][]['#markup'] = t('An LDAP setting at /admin/config/people/ldap/user has disabled the password fields. Drupal will store a 20 character random password in the Drupal "users" table, and the user will login with their LDAP password.');
   }
 
-  $ldap_fieldset = array();
-  $options = array(
+  $ldap_fieldset = [];
+  $options = [
     LDAP_USER_MANUAL_ACCT_CONFLICT_LDAP_ASSOCIATE => t('Make this an LDAP Associated account.  If a related LDAP account can not be found, a validation error will appear and the account will not be created.'),
     LDAP_USER_MANUAL_ACCT_CONFLICT_NO_LDAP_ASSOCIATE => t('Do not make this an LDAP Associated account.'),
-  );
-  $ldap_fieldset['ldap_user_association'] = array(
+  ];
+  $ldap_fieldset['ldap_user_association'] = [
     '#type' => 'radios',
     '#options' => $options,
     '#required' => FALSE,
     '#title' => t('LDAP Entry Association.'),
-  );
+  ];
 
   if ($ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY, LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE)) {
     $ldap_fieldset['ldap_user_association']['#disabled'] = TRUE;
@@ -579,10 +562,10 @@ function ldap_user_form_user_register_form_alter(&$form, $form_state) {
       admin/config/people/ldap/user and "Show option on user create form..." must be selected.');
   }
 
-  $ldap_fieldset['ldap_user_create_ldap_acct'] = array(
+  $ldap_fieldset['ldap_user_create_ldap_acct'] = [
     '#type' => 'checkbox',
     '#title' => t('Create corresponding LDAP entry.'),
-  );
+  ];
   if (!$ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY, LDAP_USER_DRUPAL_USER_PROV_ON_ALLOW_MANUAL_CREATE)) {
     $ldap_fieldset['ldap_user_create_ldap_acct']['#disabled'] = TRUE;
     $ldap_fieldset['ldap_user_create_ldap_acct']['#description'] = t('To enable
@@ -604,7 +587,9 @@ function ldap_user_form_user_register_form_alter(&$form, $form_state) {
 
 }
 
-
+/**
+ *
+ */
 function ldap_user_form_register_form_validate($form, &$form_state) {
 
   $values = $form_state['values'];
@@ -615,23 +600,23 @@ function ldap_user_form_register_form_validate($form, &$form_state) {
     $form_state['values']['ldap_user_ldap_exclude'][LANGUAGE_NONE][0]['value'] = 1;
   }
 
-  // if corresponding ldap account doesn't exist and provision not selected and make ldap associated is selected, throw error
+  // If corresponding ldap account doesn't exist and provision not selected and make ldap associated is selected, throw error.
   if (!@$values['ldap_user_create_ldap_acct'] && @$values['ldap_user_association'] == LDAP_USER_MANUAL_ACCT_CONFLICT_LDAP_ASSOCIATE) {
     $ldap_user_conf = ldap_user_conf();
     $ldap_user = ldap_servers_get_user_ldap_data($drupal_username, $ldap_user_conf->ldapEntryProvisionServer, 'ldap_user_prov_to_drupal');
     if (!$ldap_user) {
 
       form_set_error('ldap_user_association', t('User %name does not have a corresponding LDAP Entry (dn).
-        Under LDAP options, you may NOT select "Make this an LDAP Associated Account"', array('%name' => $drupal_username)));
+        Under LDAP options, you may NOT select "Make this an LDAP Associated Account"', ['%name' => $drupal_username]));
     }
   }
 
-  // if trying to provision and ldap account and one already exists, throw error.
+  // If trying to provision and ldap account and one already exists, throw error.
   if (@$values['ldap_user_create_ldap_acct']) {
     $ldap_user_conf = ldap_user_conf();
     $ldap_user = ldap_servers_get_user_ldap_data($drupal_username, $ldap_user_conf->ldapEntryProvisionServer, 'ldap_user_prov_to_ldap');
     if ($ldap_user) {
-      $tokens = array('%dn' => $ldap_user['dn'], '%name' => $drupal_username);
+      $tokens = ['%dn' => $ldap_user['dn'], '%name' => $drupal_username];
       form_set_error('ldap_user_create_ldap_acct', t('User %name already has a corresponding LDAP Entry (%dn).
         Uncheck "Create corresponding LDAP entry" to allow this Drupal user to be created.  Select
         "Make this an LDAP associated account" to associate this account with the ldap entry.', $tokens));
@@ -639,8 +624,8 @@ function ldap_user_form_register_form_validate($form, &$form_state) {
   }
 }
 
-
-/** called after user_register_form_submit **/
+/**
+ * Called after user_register_form_submit .**/
 function ldap_user_form_register_form_submit2($form, &$form_state) {
 
   $values = $form_state['values'];
@@ -658,7 +643,7 @@ function ldap_user_form_register_form_submit2($form, &$form_state) {
       }
     }
     else {
-      // don't do anything here.  If account is not created, other user module warnings will exist
+      // don't do anything here.  If account is not created, other user module warnings will exist.
     }
   }
 
@@ -670,43 +655,47 @@ function ldap_user_form_register_form_submit2($form, &$form_state) {
 }
 
 /**
- * @param stdClass $account as drupal user object
- * @param array $edit is a drupal user edit array
- * @param enum int $direction indicating which directions to test for association
+ * @param object $account
+ *   as drupal user object.
+ * @param array $edit
+ *   is a drupal user edit array.
+ * @param enum int $direction
+ *   indicating which directions to test for association.
  *
  *
  * @return boolean TRUE if user should be excluded from ldap provision/synching
  */
-
 function ldap_user_ldap_exclude($account = NULL, $edit = NULL, $direction = LDAP_USER_PROV_DIRECTION_ALL) {
-  // always exclude user 1
+  // Always exclude user 1.
   if (is_object($account) && isset($account->uid) && $account->uid == 1) {
     return TRUE;
   }
 
-  // exclude users who have the field ldap_user_ldap_exclude set to 1
+  // Exclude users who have the field ldap_user_ldap_exclude set to 1.
   if (is_object($account) && isset($account->ldap_user_ldap_exclude[LANGUAGE_NONE][0]['value'])
     && $account->ldap_user_ldap_exclude[LANGUAGE_NONE][0]['value'] == 1) {
     return TRUE;
   }
 
-  // exclude new users who have the value set to 1 in their $edit array
+  // Exclude new users who have the value set to 1 in their $edit array.
   if (is_array($edit) && isset($edit['ldap_user_ldap_exclude'][LANGUAGE_NONE][0]['value'])
     && $edit['ldap_user_ldap_exclude'][LANGUAGE_NONE][0]['value'] == 1) {
     return TRUE;
   }
 
-  // everyone else is fine
+  // Everyone else is fine.
   return FALSE;
 
 }
 
 /**
- * @param stdClass $account as drupal user object
- * @param enum int $direction indicating which directions to test for association
+ * @param object $account
+ *   as drupal user object.
+ * @param enum int $direction
+ *   indicating which directions to test for association
  *   LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER signifies test if drupal account has been provisioned or synched from ldap
  *   LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY signifies test if ldap account has been provisioned or synched from drupal
- *   NULL signifies check for either direction
+ *   NULL signifies check for either direction.
  *
  * @return boolean if user is ldap associated
  */
@@ -722,7 +711,7 @@ function ldap_user_is_ldap_associated($account, $direction = NULL) {
     }
     elseif (isset($account->uid)) {
       $authname = ldap_user_get_authname($account);
-      $to_drupal_user = (boolean)$authname;
+      $to_drupal_user = (boolean) $authname;
     }
   }
 
@@ -742,29 +731,26 @@ function ldap_user_is_ldap_associated($account, $direction = NULL) {
     return ($to_ldap_entry || $to_drupal_user);
   }
 
-
-
-
 }
+
 /**
- * api function for synching
- * note: does no checking if synching is enabled or configured for a given context
+ * Api function for synching
+ * note: does no checking if synching is enabled or configured for a given context.
  */
-
 function ldap_user_synch_to_drupal($username, $prov_event = LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, $ldap_user = NULL) {
 
   $ldap_user_conf = ldap_user_conf();
   $account = user_load_by_name($username);
-  $user_edit = array();
+  $user_edit = [];
   $ldap_user_conf->synchToDrupalAccount($account, $user_edit, $prov_event, $ldap_user, TRUE);
 
 }
 
 /**
- * api function for ldap associated user provisioning
- * note: does no checking if synching is enabled or configured for a given context
+ * Api function for ldap associated user provisioning
+ * note: does no checking if synching is enabled or configured for a given context.
  */
-function ldap_user_provision_to_drupal($ldap_user, $user_edit = array()) {
+function ldap_user_provision_to_drupal($ldap_user, $user_edit = []) {
 
   $sid = $ldap_user['sid'];
   $ldap_user_conf = ldap_user_conf();
@@ -773,22 +759,18 @@ function ldap_user_provision_to_drupal($ldap_user, $user_edit = array()) {
 
 }
 
-
 /**
- * function to:
+ * Function to:
  *   -- store user entered password during pageload
- *   and protect unencrypted user password from other modules
+ *   and protect unencrypted user password from other modules.
  *
- *   @param enum string $action 'get' | 'set'
- *   @param string | FALSE $value as user entered password
+ * @param enum string $action
+ *   'get' | 'set'.
+ * @param string | FALSE $value
+ *   as user entered password.
  */
 function ldap_user_ldap_provision_pwd($action, $value = NULL, $reset = FALSE) {
 
-  //$calling_function = FALSE;
-  //if (function_exists('debug_backtrace') && $backtrace = debug_backtrace()) { //   {
-  //  $calling_function = $backtrace[1]['function'];
-  //}
-
   static $current_user_pass;
 
   if ($reset) {
@@ -799,7 +781,6 @@ function ldap_user_ldap_provision_pwd($action, $value = NULL, $reset = FALSE) {
     $current_user_pass = $value;
   }
   elseif ($action == 'get' && $current_user_pass) {
-       // && (!$calling_function || $calling_function == 'ldap_servers_token_tokenize_user_account')
     return $current_user_pass;
   }
   else {
@@ -808,21 +789,23 @@ function ldap_user_ldap_provision_pwd($action, $value = NULL, $reset = FALSE) {
 
 }
 
-
-
 /**
- * function to avoid multiple synch or provision in same page load (if desired)
+ * Function to avoid multiple synch or provision in same page load (if desired)
+ *
+ * @param enum string $action
+ *   'synch' | 'provision' | 'set_page_load_key' | NULL.
+ * @param enum string $op
+ *   = 'set' or 'get'.
  *
- *   @param enum string $action 'synch' | 'provision' | 'set_page_load_key' | NULL
- *   @param enum string $op = 'set' or 'get'
- *   @value mixed value associate with $op.
+ * @value mixed value associate with $op.
+ *
+ * @return bool|void
  */
-
-
 function ldap_user_ldap_provision_semaphore($action, $op, $value = NULL, $reset = FALSE) {
 
   $calling_function = FALSE;
-  if (function_exists('debug_backtrace') && $backtrace = debug_backtrace()) { //   {
+  // {.
+  if (function_exists('debug_backtrace') && $backtrace = debug_backtrace()) {
     $calling_function = $backtrace[1]['function'];
   }
 
@@ -830,11 +813,11 @@ function ldap_user_ldap_provision_semaphore($action, $op, $value = NULL, $reset
   static $intialized;
 
   if ($reset || !$intialized) {
-    $ldap_accts = array();
+    $ldap_accts = [];
     $intialized = TRUE;
   }
 
-   // mark that the given drupal user has had ldap entry synched or provisioned on this page load.
+  // Mark that the given drupal user has had ldap entry synched or provisioned on this page load.
   if ($op == 'set') {
     if ($action && $value) {
       $ldap_accts[$action][$value] = TRUE;
@@ -842,7 +825,7 @@ function ldap_user_ldap_provision_semaphore($action, $op, $value = NULL, $reset
     return;
   }
 
-  // has the given drupal user x action (synch or provision) been executed.
+  // Has the given drupal user x action (synch or provision) been executed.
   if ($op == 'get') {
     if ($action && $value && isset($ldap_accts[$action][$value])) {
       return $ldap_accts[$action][$value];
@@ -854,7 +837,6 @@ function ldap_user_ldap_provision_semaphore($action, $op, $value = NULL, $reset
 
 }
 
-
 /**
  * Implements hook_user_login().
  */
@@ -864,15 +846,15 @@ function ldap_user_user_login(&$edit, $account) {
     return;
   }
   $ldap_user_conf = ldap_user_conf();
-  $user_edit = array();
+  $user_edit = [];
 
   ldap_user_reset_provision_server($ldap_user_conf, $account);
 
-   // provision or synch to ldap, not both
-  $provision_result = array('status' => 'none');
+  // Provision or synch to ldap, not both.
+  $provision_result = ['status' => 'none'];
 
-   // provision to ldap
-  // if ($account->access == 0 && $account->login != 0) {} check for first time user
+  // Provision to ldap
+  // Check for first time user.
   if (
       $ldap_user_conf->provisionsLdapEntriesFromDrupalUsers
       && ldap_user_ldap_provision_semaphore('provision', 'get', $account->name) === FALSE
@@ -885,10 +867,10 @@ function ldap_user_user_login(&$edit, $account) {
       ldap_user_ldap_provision_semaphore('provision', 'set', $account->name);
     }
   }
-  // don't synch if just provisioned
+  // don't synch if just provisioned.
   if (
     $ldap_user_conf->provisionsLdapEntriesFromDrupalUsers
-    && ldap_user_ldap_provision_semaphore('synch', 'get' , $account->name) === FALSE
+    && ldap_user_ldap_provision_semaphore('synch', 'get', $account->name) === FALSE
     && $provision_result['status'] != 'success'
     && $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY, LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE)
     ) {
@@ -900,14 +882,15 @@ function ldap_user_user_login(&$edit, $account) {
 
   $prov_enabled = $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE);
 
-  // Provision from LDAP if a new account was not just provisioned from LDAP
+  // Provision from LDAP if a new account was not just provisioned from LDAP.
   if (ldap_user_ldap_provision_semaphore('drupal_created', 'get', $account->name) === FALSE) {
     if ($ldap_user_conf->provisionsDrupalAccountsFromLdap && in_array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, array_keys($ldap_user_conf->provisionsDrupalEvents))) {
       $ldap_user = ldap_servers_get_user_ldap_data($account->name, $ldap_user_conf->drupalAcctProvisionServer, 'ldap_user_prov_to_drupal');
       if ($ldap_user) {
         $ldap_server = ldap_servers_get_servers($ldap_user_conf->drupalAcctProvisionServer, NULL, TRUE);
-        $ldap_user_conf->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER));
-        if (empty($account->picture->fid)) { // see #1973352 and #935592
+        $ldap_user_conf->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, [LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER]);
+        // See #1973352 and #935592.
+        if (empty($account->picture->fid)) {
           $account2 = user_load($account->uid);
           $account->picture = $account2->picture;
         }
@@ -918,18 +901,17 @@ function ldap_user_user_login(&$edit, $account) {
 
 }
 
-
 /**
  * Implements hook_user_insert().
- *
  */
 function ldap_user_user_insert(&$user_edit, $account, $category) {
 
   global $user;
   $not_associated = ldap_user_ldap_exclude($account, $user_edit);
-  $new_account_request = (boolean)($user->uid == 0 && $account->access == 0 && $account->login == 0); // check for first time user
-  $already_provisioned_to_ldap = ldap_user_ldap_provision_semaphore('provision', 'get' , $account->name);
-  $already_synched_to_ldap = ldap_user_ldap_provision_semaphore('synch', 'user_action_query' , $account->name);
+  // Check for first time user.
+  $new_account_request = (boolean) ($user->uid == 0 && $account->access == 0 && $account->login == 0);
+  $already_provisioned_to_ldap = ldap_user_ldap_provision_semaphore('provision', 'get', $account->name);
+  $already_synched_to_ldap = ldap_user_ldap_provision_semaphore('synch', 'user_action_query', $account->name);
   if ($not_associated || $already_synched_to_ldap || $already_synched_to_ldap || $new_account_request) {
     return;
   }
@@ -939,7 +921,7 @@ function ldap_user_user_insert(&$user_edit, $account, $category) {
    * in hook_user_insert, account is already created, so never call provisionDrupalAccount(), just
    * synchToDrupalAccount(), even if action is 'provision'
    */
-  $empty_user_edit = array();
+  $empty_user_edit = [];
   if ($account->status && $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE)) {
     $ldap_user_conf->synchToDrupalAccount($account, $empty_user_edit, LDAP_USER_EVENT_CREATE_DRUPAL_USER, NULL, TRUE);
   }
@@ -953,7 +935,7 @@ function ldap_user_user_insert(&$user_edit, $account, $category) {
         if ($provision_result['status'] == 'success') {
           ldap_user_ldap_provision_semaphore('provision', 'set', $account->name);
         }
-       }
+      }
       elseif ($ldap_provision_entry) {
         $bool_result = $ldap_user_conf->synchToLdapEntry($account, $user_edit);
         if ($bool_result) {
@@ -967,35 +949,35 @@ function ldap_user_user_insert(&$user_edit, $account, $category) {
 /**
  * Implements hook_user_update()
  */
-
 function ldap_user_user_update(&$user_edit, $account, $category) {
   if (ldap_user_ldap_exclude($account, $user_edit)) {
     return;
   }
 
   $ldap_user_conf = ldap_user_conf();
-  // check for provisioning to LDAP; this will normally occur on hook_user_insert or other event when drupal user is created.
+  // Check for provisioning to LDAP; this will normally occur on hook_user_insert or other event when drupal user is created.
   if ($ldap_user_conf->provisionsLdapEntriesFromDrupalUsers &&
       $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY, LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE)) {
 
-    $already_provisioned_to_ldap = ldap_user_ldap_provision_semaphore('provision', 'get' , $account->name);
-    $already_synched_to_ldap = ldap_user_ldap_provision_semaphore('synch', 'get' , $account->name);
+    $already_provisioned_to_ldap = ldap_user_ldap_provision_semaphore('provision', 'get', $account->name);
+    $already_synched_to_ldap = ldap_user_ldap_provision_semaphore('synch', 'get', $account->name);
     if ($already_provisioned_to_ldap || $already_synched_to_ldap) {
       return;
     }
 
-    $provision_result = array('status' => 'none');
-    // always check if provisioning to ldap has already occurred this page load
+    $provision_result = ['status' => 'none'];
+    // Always check if provisioning to ldap has already occurred this page load.
     $ldap_entry = $ldap_user_conf->getProvisionRelatedLdapEntry($account);
-    if (!$ldap_entry) { //{
+    // {.
+    if (!$ldap_entry) {
       $provision_result = $ldap_user_conf->provisionLdapEntry($account);
       if ($provision_result['status'] == 'success') {
         ldap_user_ldap_provision_semaphore('provision', 'set', $account->name);
       }
     }
-    // synch if not just provisioned and enabled
-    if ($provision_result['status'] != 'success' ) {
-      // always check if provisioing to ldap has already occurred this page load
+    // Synch if not just provisioned and enabled.
+    if ($provision_result['status'] != 'success') {
+      // Always check if provisioing to ldap has already occurred this page load.
       $provision_enabled = $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY, LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE);
       $ldap_entry = $ldap_user_conf->getProvisionRelatedLdapEntry($account);
       if ($provision_enabled && $ldap_entry) {
@@ -1009,10 +991,9 @@ function ldap_user_user_update(&$user_edit, $account, $category) {
 
 }
 
- /**
+/**
  * Implements hook_user_presave()
  */
-
 function ldap_user_user_presave(&$user_edit, $account, $category) {
 
   if (ldap_user_ldap_exclude($account, $user_edit)) {
@@ -1031,8 +1012,8 @@ function ldap_user_user_presave(&$user_edit, $account, $category) {
 
   ldap_user_reset_provision_server($ldap_user_conf, $account);
 
-  // check for provisioning to drupal and override synched user fields/props
-  // Provision from LDAP if a new account was not just provisioned from LDAP
+  // Check for provisioning to drupal and override synched user fields/props
+  // Provision from LDAP if a new account was not just provisioned from LDAP.
   if (ldap_user_ldap_provision_semaphore('drupal_created', 'get', $drupal_username) === FALSE) {
     if ($ldap_user_conf->provisionsDrupalAccountsFromLdap && in_array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, array_keys($ldap_user_conf->provisionsDrupalEvents))) {
       if ($ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE)) {
@@ -1040,7 +1021,7 @@ function ldap_user_user_presave(&$user_edit, $account, $category) {
           $ldap_user = ldap_servers_get_user_ldap_data($drupal_username, $ldap_user_conf->drupalAcctProvisionServer, 'ldap_user_prov_to_drupal');
           if ($ldap_user) {
             $ldap_server = ldap_servers_get_servers($ldap_user_conf->drupalAcctProvisionServer, NULL, TRUE);
-            $ldap_user_conf->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER));
+            $ldap_user_conf->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, [LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER]);
           }
         }
       }
@@ -1053,36 +1034,36 @@ function ldap_user_user_presave(&$user_edit, $account, $category) {
  * Implements hook_user_delete().
  */
 function ldap_user_user_delete($account) {
-  // drupal user account is about to be deleted.
+  // Drupal user account is about to be deleted.
   $ldap_user_conf = ldap_user_conf();
   if (
       $ldap_user_conf->provisionsLdapEntriesFromDrupalUsers
       && $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY, LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE)
       ) {
     $boolean_result = $ldap_user_conf->deleteProvisionedLdapEntries($account);
-    // no need to watchdog here, because fail in deleteProvisionedLdapEntries provides watchdog entry
+    // No need to watchdog here, because fail in deleteProvisionedLdapEntries provides watchdog entry.
   }
 }
 
 /**
  * Implements hook_field_widget_info().
- * to provide field type for LDAP fields
+ * to provide field type for LDAP fields.
  */
 function ldap_user_field_widget_info() {
-  return array(
-    'ldap_user_hidden' => array(
+  return [
+    'ldap_user_hidden' => [
       'label' => t('Hidden Text Field'),
-      'field types' => array('text'),
-      'settings' => array(),
-    ),
-  );
+      'field types' => ['text'],
+      'settings' => [],
+    ],
+  ];
 }
 
 /**
  * Implements hook_field_widget_settings_form().
  */
 function ldap_user_field_widget_settings_form($field, $instance) {
-  return array();
+  return [];
 }
 
 /**
@@ -1090,46 +1071,52 @@ function ldap_user_field_widget_settings_form($field, $instance) {
  */
 function ldap_user_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
 
-  $main_widget = array();
+  $main_widget = [];
 
   switch ($instance['widget']['type']) {
     case 'ldap_user_hidden':
-      $element['value'] = $element + array(
+      $element['value'] = $element + [
         '#type' => 'value',
         '#value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL,
-        '#attached' => array(
-          'css' => array(
+        '#attached' => [
+          'css' => [
             drupal_get_path('module', 'ldap_user') . '/ldap_user.css',
-          ),
-        ),
-      );
+          ],
+        ],
+      ];
       break;
   }
 
   return $element;
 }
 
+/**
+ *
+ */
 function ldap_user_synch_triggers_key_values() {
 
-  return array(
+  return [
     LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE => t('On synch to Drupal user create or update. Requires a server with binding method of "Service Account Bind" or "Anonymous Bind".'),
     LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE => t('On create or synch to Drupal user when successfully authenticated with LDAP credentials. (Requires LDAP Authentication module).'),
     LDAP_USER_DRUPAL_USER_PROV_ON_ALLOW_MANUAL_CREATE => t('On manual creation of Drupal user from admin/people/create and "Create corresponding LDAP entry" is checked'),
     LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE => t('On creation or synch of an LDAP entry when a Drupal account is created or updated. Only applied to accounts with a status of approved.'),
     LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE => t('On creation or synch of an LDAP entry when a user authenticates.'),
     LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE => t('On deletion of an LDAP entry when the corresponding Drupal Account is deleted.  This only applies when the LDAP entry was provisioned by Drupal by the LDAP User module.'),
-  );
+  ];
 
 }
 
+/**
+ *
+ */
 function ldap_user_all_events() {
-  return array(
+  return [
     LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER,
     LDAP_USER_EVENT_CREATE_DRUPAL_USER,
     LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY,
     LDAP_USER_EVENT_CREATE_LDAP_ENTRY,
     LDAP_USER_EVENT_LDAP_ASSOCIATE_DRUPAL_ACCT,
-  );
+  ];
 
 }
 
@@ -1138,7 +1125,6 @@ function ldap_user_all_events() {
  * @param string $text
  * @return string text with tokens replaced
  */
-
 function ldap_user_token_replace($token, $account, $entity = NULL) {
   $desired_tokens = ldap_servers_token_tokens_needed_for_template($token);
   $tokens = ldap_user_token_tokenize_entry($account, $desired_tokens, LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST, $entity);
@@ -1146,12 +1132,12 @@ function ldap_user_token_replace($token, $account, $entity = NULL) {
   return $result;
 }
 
-
-
 /**
- * Turn an ldap entry into a token array suitable for the t() function
+ * Turn an ldap entry into a token array suitable for the t() function.
+ *
  * @param drupal user object $account
- * @param array $token_keys as list of token/value pairs to generate
+ * @param array $token_keys
+ *   as list of token/value pairs to generate.
  * @param string prefix token prefix such as !,%,[
  * @param string suffix token suffix such as ]
  *
@@ -1160,13 +1146,13 @@ function ldap_user_token_replace($token, $account, $entity = NULL) {
 function ldap_user_token_tokenize_entry($account, $token_keys, $pre = LDAP_SERVERS_TOKEN_PRE, $post = LDAP_SERVERS_TOKEN_POST, $user_entity = NULL) {
 
   $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
-  $tokens = array();
+  $tokens = [];
   if (!$user_entity) {
     list($discard, $user_entity) = ldap_user_load_user_acct_and_entity($account->uid, 'uid');
   }
 
   foreach ($token_keys as $token_key) {
-    // target id is of form field.lname, property.mail, field.dept:0, etc.
+    // Target id is of form field.lname, property.mail, field.dept:0, etc.
     list($type, $attr_ordinal) = explode('.', $token_key);
     $parts = explode(':', $attr_ordinal);
     $attr = $parts[0];
@@ -1175,17 +1161,16 @@ function ldap_user_token_tokenize_entry($account, $token_keys, $pre = LDAP_SERVE
     switch ($type) {
 
       case 'field':
-        if (isset( $user_entity->{$attr}[LANGUAGE_NONE][$ordinal]['value'])) {
+        if (isset($user_entity->{$attr}[LANGUAGE_NONE][$ordinal]['value'])) {
           $tokens[$token] = $user_entity->{$attr}[LANGUAGE_NONE][$ordinal]['value'];
         }
-      break;
-
+        break;
 
       case 'property':
         if (property_exists($account, $attr)) {
           $tokens[$token] = $account->{$attr};
         }
-      break;
+        break;
 
       // @todo: 3. tokenize profile 2
     }
@@ -1195,41 +1180,42 @@ function ldap_user_token_tokenize_entry($account, $token_keys, $pre = LDAP_SERVE
   return $tokens;
 }
 
-  /**
-   * load user $account and $entity, given uid or $username
-   *
-   * @param string $user_id is username or uid
-   * @param enum $user_id_type is 'username' or 'uid'
-   *
-   * return array $account and $user_entity
-   */
-
-  function ldap_user_load_user_acct_and_entity($user_id, $user_id_type = 'username') {
+/**
+ * Load user $account and $entity, given uid or $username.
+ *
+ * @param string $user_id
+ *   is username or uid.
+ * @param enum $user_id_type
+ *   is 'username' or 'uid'
+ *
+ *   return array $account and $user_entity.
+ */
+function ldap_user_load_user_acct_and_entity($user_id, $user_id_type = 'username') {
 
-    if ($user_id_type == 'username') {
-      $account = user_load_by_name($user_id);
-    }
-    else {
-      $account = user_load($user_id);
-    }
-    if ($account) {
-      $user_entities = entity_load('user', array($account->uid));
-      $user_entity = $user_entities[$account->uid];
-    }
-    else {
-      $user_entity = NULL;
-    }
+  if ($user_id_type == 'username') {
+    $account = user_load_by_name($user_id);
+  }
+  else {
+    $account = user_load($user_id);
+  }
+  if ($account) {
+    $user_entities = entity_load('user', [$account->uid]);
+    $user_entity = $user_entities[$account->uid];
+  }
+  else {
+    $user_entity = NULL;
+  }
 
-    return array($account, $user_entity);
+  return [$account, $user_entity];
 
-  }
+}
 
 /**
  * Implements hook_ldap_servers_username_to_ldapname_alter
- * - Set ldap name to auth name
+ * - Set ldap name to auth name.
  */
 function ldap_user_ldap_servers_username_to_ldapname_alter(&$ldap_username, $drupal_username, $context) {
-  // Alter the name only if it has not been altered already, ie php eval code
+  // Alter the name only if it has not been altered already, ie php eval code.
   if ($ldap_username == $drupal_username) {
     $authname = ldap_user_get_authname($ldap_username);
     if (!empty($authname)) {
@@ -1246,40 +1232,40 @@ function ldap_user_ldap_servers_username_to_ldapname_alter(&$ldap_username, $dru
  *   - object: user account object
  *   - string: username
  *
- * @return string|NULL
+ * @return string|null
  *   Returns the LDAP authname of the passed Drupal user.
  */
 function ldap_user_get_authname($data) {
-  $cache = &drupal_static(__FUNCTION__, array());
+  $cache = &drupal_static(__FUNCTION__, []);
 
   $authname = NULL;
   $uid = NULL;
 
   if (is_object($data)) {
-    // Object - set uid if object has uid and uid > 0
+    // Object - set uid if object has uid and uid > 0.
     if (!empty($data->uid)) {
       $uid = $data->uid;
     }
   }
   else {
-    // String - load account and set uid if uid > 0
+    // String - load account and set uid if uid > 0.
     $account = user_load_by_name($data);
     if (!empty($account->uid)) {
       $uid = $account->uid;
     }
   }
 
-  // Exit if no uid found
+  // Exit if no uid found.
   if (empty($uid)) {
     return NULL;
   }
 
-  // Run query if uid is not statically cached
+  // Run query if uid is not statically cached.
   if (!array_key_exists($uid, $cache)) {
-    $authname = db_query('SELECT authname FROM {authmap} WHERE uid = :uid AND module = :module', array(
+    $authname = db_query('SELECT authname FROM {authmap} WHERE uid = :uid AND module = :module', [
       ':uid' => $uid,
       ':module' => 'ldap_user',
-    ))->fetchField();
+    ])->fetchField();
 
     $cache[$uid] = !empty($authname) ? $authname : NULL;
   }
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.test_form.inc b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.test_form.inc
index 32e573eb..42cd77bb 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.test_form.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.test_form.inc
@@ -17,7 +17,6 @@
  * @return
  *   The form structure.
  */
-
 function ldap_user_test_form($form, &$form_state, $op = NULL) {
 
   $username = @$_SESSION['ldap_user_test_form']['testing_drupal_username'];
@@ -27,7 +26,7 @@ function ldap_user_test_form($form, &$form_state, $op = NULL) {
   $form['#prefix'] .= t('This form simply tests an LDAP User configuration against an individual ldap or drupal user.
     It makes no changes to the drupal or ldap user.');
 
-  $form['testing_drupal_username'] = array(
+  $form['testing_drupal_username'] = [
     '#type' => 'textfield',
     '#title' => t('Testing Drupal Username'),
     '#default_value' => $username,
@@ -35,51 +34,53 @@ function ldap_user_test_form($form, &$form_state, $op = NULL) {
     '#size' => 30,
     '#maxlength' => 255,
     '#description' => t('This is optional and used for testing this server\'s configuration against an actual username.  The user need not exist in Drupal and testing will not affect the user\'s LDAP or Drupal Account.'),
-  );
-
-  $form['test_mode'] = array(
-      '#type' => 'radios',
-      '#title' => t('Testing Mode'),
-      '#required' => 0,
-      '#default_value' => isset( $_SESSION['ldap_user_test_form']['test_mode']) ? $_SESSION['ldap_user_test_form']['test_mode'] : 'query',
-      '#options' => array(
-        'query' => t('Test Query.  Will not alter anything in drupal or LDAP'),
-        'execute' => t('Execute Action.  Will perform provisioning configured for events below.  If this is selected only one action should be selected below'),
-      ),
-    );
+  ];
+
+  $form['test_mode'] = [
+    '#type' => 'radios',
+    '#title' => t('Testing Mode'),
+    '#required' => 0,
+    '#default_value' => isset($_SESSION['ldap_user_test_form']['test_mode']) ? $_SESSION['ldap_user_test_form']['test_mode'] : 'query',
+    '#options' => [
+      'query' => t('Test Query.  Will not alter anything in drupal or LDAP'),
+      'execute' => t('Execute Action.  Will perform provisioning configured for events below.  If this is selected only one action should be selected below'),
+    ],
+  ];
 
   $synch_trigger_options = ldap_user_synch_triggers_key_values();
 
-  $selected_actions = isset($_SESSION['ldap_user_test_form']['action']) ? $_SESSION['ldap_user_test_form']['action'] : array();
-  $form['action'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Actions/Event Handlers to Test'),
-      '#required' => 0,
-      '#default_value' => $selected_actions,
-      '#options' => $synch_trigger_options,
-      '#states' => array(
-        'visible' => array(   // action to take.
-          ':input[name="wsEnabled"]' => array('checked' => TRUE),
-        ),
-      ),
-    );
-
-  $form['submit'] = array(
+  $selected_actions = isset($_SESSION['ldap_user_test_form']['action']) ? $_SESSION['ldap_user_test_form']['action'] : [];
+  $form['action'] = [
+    '#type' => 'checkboxes',
+    '#title' => t('Actions/Event Handlers to Test'),
+    '#required' => 0,
+    '#default_value' => $selected_actions,
+    '#options' => $synch_trigger_options,
+    '#states' => [
+      'visible' => [
+        ':input[name="wsEnabled"]' => ['checked' => TRUE],
+      ],
+    ],
+  ];
+
+  $form['submit'] = [
     '#type' => 'submit',
     '#value' => 'test',
     '#weight' => 100,
-  );
+  ];
 
   return $form;
 }
 
+/**
+ *
+ */
 function ldap_user_test_form_validate($form, &$form_state) {
   if ($form_state['values']['test_mode'] == 'execute'  &&
-    count(array_filter($form_state['values']['action'])) > 1 ) {
+    count(array_filter($form_state['values']['action'])) > 1) {
     form_set_error('test_mode', t('Only one action may be selected for "Execute Action" testing mode.'));
   }
 
-
 }
 
 /**
@@ -96,7 +97,7 @@ function ldap_user_test_form_submit($form, &$form_state) {
 
     $user_object = user_load_by_name($username);
     if ($user_object) {
-      $user_entities = entity_load('user', array($user_object->uid));
+      $user_entities = entity_load('user', [$user_object->uid]);
       $user_entity = $user_entities[$user_object->uid];
     }
     else {
@@ -104,7 +105,7 @@ function ldap_user_test_form_submit($form, &$form_state) {
     }
 
     $ldap_user_conf = ldap_user_conf();
-    $test_servers = array();
+    $test_servers = [];
     $user_ldap_entry = FALSE;
     if ($ldap_user_conf->drupalAcctProvisionServer) {
       $test_servers[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER] = $ldap_user_conf->drupalAcctProvisionServer;
@@ -116,7 +117,7 @@ function ldap_user_test_form_submit($form, &$form_state) {
         $user_ldap_entry = ldap_servers_get_user_ldap_data($username, $ldap_user_conf->ldapEntryProvisionServer);
       }
     }
-    $results = array();
+    $results = [];
     $results['username'] = $username;
     $results['user object (before provisioning or synching)'] = $user_object;
     $results['user entity (before provisioning or synching)'] = $user_entity;
@@ -124,11 +125,12 @@ function ldap_user_test_form_submit($form, &$form_state) {
     $results['ldap_user_conf'] = $ldap_user_conf;
 
     if (is_object($user_object)) {
-      $authmaps = db_query("SELECT aid, uid, module, authname FROM {authmap} WHERE uid = :uid", array(':uid' => $user_object->uid))->fetchAllAssoc('aid', PDO::FETCH_ASSOC);
+      $authmaps = db_query("SELECT aid, uid, module, authname FROM {authmap} WHERE uid = :uid", [':uid' => $user_object->uid])->fetchAllAssoc('aid', PDO::FETCH_ASSOC);
     }
     else {
       $authmaps = 'No authmaps available.  Authmaps only shown if user account exists beforehand';
-      $user_object = new stdClass(); // need for testing.
+      // Need for testing.
+      $user_object = new stdClass();
       $user_object->name = $username;
     }
     $results['User Authmap'] = $authmaps;
@@ -136,11 +138,11 @@ function ldap_user_test_form_submit($form, &$form_state) {
 
     $save = ($form_state['values']['test_mode'] == 'execute');
     $test_query = ($form_state['values']['test_mode'] != 'execute');
-    $user_edit = array('name' => $username);
+    $user_edit = ['name' => $username];
 
     foreach (array_filter($selected_actions) as $i => $synch_trigger) {
       $synch_trigger_description = $synch_trigger_options[$synch_trigger];
-      foreach (array(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) as $direction) {
+      foreach ([LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY] as $direction) {
         if ($ldap_user_conf->provisionEnabled($direction, $synch_trigger)) {
           if ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
             $discard = $ldap_user_conf->provisionDrupalAccount(NULL, $user_edit, NULL, $save);
@@ -161,17 +163,18 @@ function ldap_user_test_form_submit($form, &$form_state) {
         }
       }
     }
-    // do all synchs second, in case logic of form changes to allow executing mulitple events
+    // Do all synchs second, in case logic of form changes to allow executing mulitple events.
     foreach (array_filter($selected_actions) as $i => $synch_trigger) {
       $synch_trigger_description = $synch_trigger_options[$synch_trigger];
-      foreach (array(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) as $direction) {
+      foreach ([LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY] as $direction) {
         if ($ldap_user_conf->provisionEnabled($direction, $synch_trigger)) {
           if ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
             $discard = $ldap_user_conf->synchToDrupalAccount(NULL, $user_edit, NULL, $test_query);
             $results['synchToDrupalAccount method results']["context = $synch_trigger_description"]['proposed'] = $user_edit;
           }
-          else { // to ldap
-            $provision_result = $ldap_user_conf->synchToLdapEntry($user_object, $user_edit, array(), $test_query);
+          // To ldap.
+          else {
+            $provision_result = $ldap_user_conf->synchToLdapEntry($user_object, $user_edit, [], $test_query);
             $results['synchToLdapEntry method results']["context = $synch_trigger_description"] = $provision_result;
           }
         }
@@ -179,14 +182,14 @@ function ldap_user_test_form_submit($form, &$form_state) {
           if ($direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
             $results['synchToDrupalAccount method results']["context = $synch_trigger_description"] = 'Not enabled.';
           }
-          else { // to ldap
+          // To ldap.
+          else {
             $results['synchToLdapEntry method results']["context = $synch_trigger_description"] = 'Not enabled.';
           }
         }
       }
     }
 
-
     if (function_exists('dpm')) {
       dpm($results);
     }
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.theme.inc b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.theme.inc
index 47bfd2a6..bd2fcc6f 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.theme.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.theme.inc
@@ -2,16 +2,16 @@
 
 /**
  * @file
- *   theme functions for ldap_user module
+ * Theme functions for ldap_user module.
  */
 
 /**
- * turns array of variables to a form embedded in one table for each ldap server
+ * Turns array of variables to a form embedded in one table for each ldap server.
  */
 function theme_ldap_user_conf_form($variables) {
 
   $form = $variables['form'];
-  $tables = array();
+  $tables = [];
 
   foreach ($form as $key => $element) {
     $parts = explode('__', $key);
@@ -19,7 +19,7 @@ function theme_ldap_user_conf_form($variables) {
       list($direction, $discard, $column_name, $i) = $parts;
       $row = $element['#row'];
       $col = $element['#col'];
-      $tables[$direction]['rows'][$row][$col] = array('data' => drupal_render($form[$key]), 'class' => array('module'), 'colspan' => 1);
+      $tables[$direction]['rows'][$row][$col] = ['data' => drupal_render($form[$key]), 'class' => ['module'], 'colspan' => 1];
     }
   }
 
@@ -31,126 +31,132 @@ function theme_ldap_user_conf_form($variables) {
 
       $direction_text = 'todrupal';
 
-      $header = array(
-        array(
+      $header = [
+        [
           'data' => t('Remove'),
           'rowspan' => 1,
-          'class' => 'mixedcase'
-        ),
-        array(
+          'class' => 'mixedcase',
+        ],
+        [
           'data' => t('Source LDAP Tokens. (See http://drupal.org/node/1245736) ') ,
           'class' => 'mixedcase',
           'rowspan' => 1,
           'colspan' => 2,
-        ),
-        array(
+        ],
+        [
           'data' => t('Target Drupal Attribute'),
           'rowspan' => 1,
           'class' => 'mixedcase',
-        ),
-        array('data' => t('When Should Attribute Be Synchronized to Drupal?'),
+        ],
+        [
+          'data' => t('When Should Attribute Be Synchronized to Drupal?'),
           'colspan' => count($ldap_user_conf_admin->provisionsDrupalEvents),
           'rowspan' => 1,
-          'class' => 'mixedcase'
-        ),
+          'class' => 'mixedcase',
+        ],
 
-      );
+      ];
 
-      $second_header = array(
-        array('data' => t(''),
-              'header' => TRUE,
-              'class' => 'mixedcase',
-              ),
-        array('data' => t('e.g: "[sn]", "[mail:0]", "[ou:last]", "[sn], [givenName]" etc.
+      $second_header = [
+        [
+          'data' => t(''),
+          'header' => TRUE,
+          'class' => 'mixedcase',
+        ],
+        [
+          'data' => t('e.g: "[sn]", "[mail:0]", "[ou:last]", "[sn], [givenName]" etc.
                 Constants such as "17" or "imported" should not be enclosed in [].'),
-              'header' => TRUE,
-              'class' => 'mixedcase',
-              ),
-        array('data' => t('Convert From Binary?'),
-              'class' => 'mixedcase',
-              'header' => TRUE
-              ),
-        array('data' => "",
-              'header' => TRUE,
-              ),
-      );
+          'header' => TRUE,
+          'class' => 'mixedcase',
+        ],
+        [
+          'data' => t('Convert From Binary?'),
+          'class' => 'mixedcase',
+          'header' => TRUE,
+        ],
+        [
+          'data' => "",
+          'header' => TRUE,
+        ],
+      ];
 
       foreach ($ldap_user_conf_admin->provisionsDrupalEvents as $col_id => $col_name) {
-        $second_header[] = array('data' => $col_name, 'header' => TRUE, 'class' => 'mixedcase');
+        $second_header[] = ['data' => $col_name, 'header' => TRUE, 'class' => 'mixedcase'];
       }
     }
-    else { // to ldap
+    // To ldap.
+    else {
 
       $direction_text = 'toldap';
 
-      $header = array(
-        array(
+      $header = [
+        [
           'data' => t('Remove'),
           'rowspan' => 1,
-          'class' => 'mixedcase'
-        ),
-        array(
+          'class' => 'mixedcase',
+        ],
+        [
           'data' => t('Source Drupal User Attribute') ,
           'class' => 'mixedcase',
           'rowspan' => 1,
           'colspan' => 3,
-        ),
-        array(
+        ],
+        [
           'data' => t('Target LDAP Token'),
           'rowspan' => 1,
           'class' => 'mixedcase',
-        ),
-        array(
+        ],
+        [
           'data' => t('When Should Attribute Be Synchronized to LDAP?'),
           'colspan' => count($ldap_user_conf_admin->provisionsLdapEvents),
           'rowspan' => 1,
           'class' => 'mixedcase',
-        ),
-      );
+        ],
+      ];
 
-      $second_header = array(
-        array(
+      $second_header = [
+        [
           'data' => t(''),
-          'header' => TRUE
-        ),
-        array(
+          'header' => TRUE,
+        ],
+        [
           'data' => t('(Select "user tokens" to use token field)'),
           'header' => TRUE,
-          'class' => 'mixedcase'
-        ),
-        array(
+          'class' => 'mixedcase',
+        ],
+        [
           'data' => t('Source Drupal User tokens such as: "[property.name]", "[field.field_fname] [field.field_lname]". Constants such as "from_drupal" or "18" should not be enclosed in []'),
           'header' => TRUE,
-          'class' => 'mixedcase'
-        ),
-        array(
+          'class' => 'mixedcase',
+        ],
+        [
           'data' => t('Convert From Binary'),
           'header' => TRUE,
-          'class' => 'mixedcase'
-        ),
-        array(
+          'class' => 'mixedcase',
+        ],
+        [
           'data' => t('Use singular token format such as [sn], [givenName], etc.'),
           'header' => TRUE,
-          'class' => 'mixedcase'
-        ),
-      );
+          'class' => 'mixedcase',
+        ],
+      ];
       foreach ($ldap_user_conf_admin->provisionsLdapEvents as $col_id => $col_name) {
-        $second_header[] = array('data' => $col_name, 'header' => TRUE, 'class' => 'mixedcase');
+        $second_header[] = ['data' => $col_name, 'header' => TRUE, 'class' => 'mixedcase'];
       }
     }
 
-    // #col is ignored, so sort table columns here
+    // #col is ignored, so sort table columns here.
     foreach ($table['rows'] as $row_id => $row) {
       $discard = ksort($row);
       $table['rows'][$row_id] = $row;
     }
 
     $table['header'] = $header;
-    $table['attributes'] = array('class' => array('ldap-provision-' . $direction_text));
+    $table['attributes'] = ['class' => ['ldap-provision-' . $direction_text]];
     array_unshift($table['rows'], $second_header);
     $table_themed = theme('table', $table);
     $rendered_table = theme('table', $table);
-    $output = str_replace( '[replace_with_table__' . $direction . ']', $rendered_table, $output);
+    $output = str_replace('[replace_with_table__' . $direction . ']', $rendered_table, $output);
   }
 
   return $output;
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.ws.inc b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.ws.inc
index e0e3e748..fcadfa60 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.ws.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.ws.inc
@@ -2,27 +2,23 @@
 
 /**
  * @file
- * functions related to REST webservices for LDAP User module
- *
- * ldap/user/ws/<action>/<direction_tag>/<drupal username|dn>/<api_key>
- *
- * action = 'create', 'synch', 'query', 'disable', or 'delete'
- * direction_tag = 'todrupal', 'toldap', or '', or 'none'
- * drupal_user_name = drupal user.  if direction is toldap, its the ldap associatied drupal user name.
- * key = user entered api key
- *
- * e.g.
- * https://intranet.mycompany.com/ldap/user/ws/create/todrupal/jdoe/dsfew32423rewr3224243
- * https://intranet.mycompany.com/ldap/user/ws/synch/todrupal/jdoe/dsfew32423rewr3224243
+ * Functions related to REST webservices for LDAP User module.
  *
+ * DO NOT USE THIS CODE, it is unsupported and only left for those relying on
+ * these functions already.
+ * 
+ * @codingStandardsIgnoreFile
  */
 
+/**
+ * @deprecated
+ */
 function _ldap_user_ws_urls_item_list() {
   global $base_url;
   $base = '<br/>' . $base_url . '/' . LDAP_USER_WS_USER_PATH;
   $ldap_user_conf = new LdapUserConf();
   $key = $ldap_user_conf->wsKey;
-  $item_list = array(
+  $item_list = [
     'Create: Drupal User based on LDAP Entry: ' . $base . "/create/todrupal/[username]|[dn]/$key",
     'Synch:  LDAP Entry to Drupal User: ' . $base . "/synch/todrupal/[username]|[dn]/$key",
     'Disable:  Drupal User: ' . $base . "/disable/todrupal/[username]|[dn]/$key",
@@ -30,32 +26,27 @@ function _ldap_user_ws_urls_item_list() {
     'Create:  LDAP Entry based on Drupal User: ' . $base . "/create/toldap/[username]/$key",
     'Synch:  Drupal User to LDAP Entry: ' . $base . "/synch/toldap/[username]/$key",
     'Query: LDAP Associated Drupal User Exists: ' . $base . "/query/none/[username]|[dn]/$key",
-  );
+  ];
   return $item_list;
 }
 
-
 /**
- * @todo: this needs work in a few areas:
- * - urls shoudl follow REST conventions
- * - returns should also follow REST conventions
- * - more error catching and $out should be an array that is output in a REST format
+ * @deprecated
  */
-
 function ldap_user_ws($action, $direction_tag, $drupal_user_name_or_dn, $key) {
 
   $action = check_plain($action);
   $key = urldecode($key);
 
-
   if (!$ldap_user_conf->wsEnabled) {
-    return ldap_user_ws_out(array(0, t('Webservice Not Enabled')));
+    return ldap_user_ws_out([0, t('Webservice Not Enabled')]);
   }
-  elseif ($key != $ldap_user_conf->wsKey) { // ldap_servers_encrypt($ldap_user_conf->wsKey, LDAP_SERVERS_ENC_TYPE_BLOWFISH)
-    return ldap_user_ws_out(array(0, t('Bad Webservice Key')));
+  // ldap_servers_encrypt($ldap_user_conf->wsKey, LDAP_SERVERS_ENC_TYPE_BLOWFISH)
+  elseif ($key != $ldap_user_conf->wsKey) {
+    return ldap_user_ws_out([0, t('Bad Webservice Key')]);
   }
   elseif (!in_array($_SERVER['REMOTE_ADDR'], array_values($ldap_user_conf->wsUserIps))) {
-    return ldap_user_ws_out(array(0, t('Request from non-allowed IP Address')));
+    return ldap_user_ws_out([0, t('Request from non-allowed IP Address')]);
   }
 
   if ($direction_tag == 'todrupal') {
@@ -68,7 +59,7 @@ function ldap_user_ws($action, $direction_tag, $drupal_user_name_or_dn, $key) {
     $sid = $ldap_user_conf->ldapEntryProvisionServer;
     $ldap_server = ldap_servers_get_servers($sid, NULL, TRUE);
   }
-  else  {
+  else {
     $direction = LDAP_USER_PROV_DIRECTION_NONE;
     $sid = LDAP_USER_NO_SERVER_SID;
     $ldap_server = FALSE;
@@ -85,8 +76,8 @@ function ldap_user_ws($action, $direction_tag, $drupal_user_name_or_dn, $key) {
   $ldap_user_conf = new LdapUserConf();
 
   $drupal_user = ($action == 'create' || $drupal_user_name === FALSE) ? FALSE : user_load_by_name($drupal_user_name);
-  $user_edit = array();
-  $account = array();
+  $user_edit = [];
+  $account = [];
 
   switch ($action) {
     case 'create':
@@ -95,49 +86,53 @@ function ldap_user_ws($action, $direction_tag, $drupal_user_name_or_dn, $key) {
         $new_account = $ldap_user_conf->provisionDrupalAccount($account, $user_edit, $ldap_user, TRUE);
         // @todo return boolean on first line, not human readable message
         $text = ($new_account) ? 'Created Account ' . $drupal_user_name : 'Fails to Create Account ' . $drupal_user_name;
-        return ldap_user_ws_out(array((boolean)($new_account), $text));
+        return ldap_user_ws_out([(boolean) ($new_account), $text]);
       }
       elseif ($direction = LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
-        $provision_result = $ldap_user_conf->provisionLdapEntry($drupal_user_name); // no need for ldap_user_ldap_provision_semaphore call with webservice since not tied to single user like logon process
+        // No need for ldap_user_ldap_provision_semaphore call with webservice since not tied to single user like logon process.
+        $provision_result = $ldap_user_conf->provisionLdapEntry($drupal_user_name);
         // @todo turn result array into response
       }
-    break;
+      break;
 
     case 'synch':
       if ($direction = LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
         $saved_account = $ldap_user_conf->synchToDrupalAccount($drupal_user, $user_edit, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, $ldap_user, TRUE);
         $text = ($saved_account) ? 'Updated Account ' . $drupal_user_name : 'Failed to Update Account ' . $drupal_user_name;
-        return ldap_user_ws_out(array((boolean)($saved_account), $text));
+        return ldap_user_ws_out([(boolean) ($saved_account), $text]);
       }
       elseif ($direction = LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
         $boolean_result = $ldap_user_conf->synchToLdapEntry($drupal_user_name);
         // @todo turn result array into response
       }
-    break;
+      break;
 
     case 'disable':
       if ($direction = LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
         $drupal_user->status = 0;
-        $edit = array('status' => 0);
-        $saved_account = user_save($drupal_user, array('status' => 0));
-        return ldap_user_ws_out(array((boolean)($saved_account), 'Disabled Account ' . $drupal_user_name));
+        $edit = ['status' => 0];
+        $saved_account = user_save($drupal_user, ['status' => 0]);
+        return ldap_user_ws_out([(boolean) ($saved_account), 'Disabled Account ' . $drupal_user_name]);
       }
-    break;
+      break;
 
     case 'delete':
       if ($direction = LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) {
         user_delete($drupal_user->uid);
-        return ldap_user_ws_out(array(1, 'Deleted Account ' . $drupal_user_name));
+        return ldap_user_ws_out([1, 'Deleted Account ' . $drupal_user_name]);
       }
       elseif ($direction = LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
         // @todo implement delete ldap record and call ldap_user event handler for delete account
       }
-    break;
+      break;
   }
   return $out;
 
 }
 
+/**
+ * @deprecated
+ */
 function ldap_user_ws_out($response) {
   return join("\n", $response);
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/tests/ldap_user.test b/drupal7/sites/all/modules/ldap/ldap_user/tests/ldap_user.test
index 1be7a6e1..700d924b 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/tests/ldap_user.test
+++ b/drupal7/sites/all/modules/ldap/ldap_user/tests/ldap_user.test
@@ -1,28 +1,34 @@
 <?php
 
-
-
 /**
  * @file
- * see getInfo() for test summary
- *
- *  @todo test for ldapUserConf->setSynchMapping()
- *  @todo test for ldapUserConf->ldapAssociateDrupalAccount($drupal_username)
+ * See getInfo() for test summary.
  *
+ * @todo test for ldapUserConf->setSynchMapping()
+ * @todo test for ldapUserConf->ldapAssociateDrupalAccount($drupal_username)
  */
 
 module_load_include('php', 'ldap_test', 'LdapTestCase.class');
-
+/**
+ *
+ */
 class LdapUserUnitTests extends LdapTestCase {
+
+  /**
+   *
+   */
   public static function getInfo() {
-    return array(
+    return [
       'name' => 'LDAP User Unit Tests',
       'description' => 'Test functions outside of real contexts.',
-      'group' => 'LDAP User'
-    );
+      'group' => 'LDAP User',
+    ];
   }
 
-  function __construct($test_id = NULL) {
+  /**
+   *
+   */
+  public function __construct($test_id = NULL) {
     parent::__construct($test_id);
   }
 
@@ -30,29 +36,31 @@ class LdapUserUnitTests extends LdapTestCase {
   protected $ldap_test_data;
 
   /**
-   *  create one or more server configurations in such as way
-   *  that this setUp can be a prerequisite for ldap_authentication and ldap_authorization
+   * Create one or more server configurations in such as way
+   *  that this setUp can be a prerequisite for ldap_authentication and ldap_authorization.
    */
-
-  function setUp() {
-    parent::setUp(array('ldap_servers', 'ldap_user', 'ldap_authentication', 'ldap_test'));
+  public function setUp() {
+    parent::setUp(['ldap_servers', 'ldap_user', 'ldap_authentication', 'ldap_test']);
     variable_set('ldap_simpletest', 2);
   }
 
-  function tearDown() {
+  /**
+   *
+   */
+  public function tearDown() {
     parent::tearDown();
     variable_del('ldap_help_watchdog_detail');
     variable_del('ldap_simpletest');
   }
 
   /**
-   * make sure install succeeds and ldap user functions/methods work
+   * Make sure install succeeds and ldap user functions/methods work.
    */
-  function testUnitTests() {
+  public function testUnitTests() {
     // TODO: Fix failing tests, excluding to make branch pass.
     return;
 
-    // just to give warning if setup doesn't succeed.
+    // Just to give warning if setup doesn't succeed.
     $setup_success = (
         module_exists('ldap_user') &&
         module_exists('ldap_servers') &&
@@ -60,27 +68,27 @@ class LdapUserUnitTests extends LdapTestCase {
       );
     $this->assertTrue($setup_success, ' ldap_user setup successful', $this->testId('setup'));
 
-    $api_functions = array(
-      'ldap_user_conf' => array(2, 0),
-      'ldap_user_synch_to_drupal' => array(3, 1),
-      'ldap_user_provision_to_drupal' => array(2, 1),
-      'ldap_user_ldap_provision_semaphore' => array(4, 2),
-      'ldap_user_token_replace' => array(3, 2),
-      'ldap_user_token_tokenize_entry' => array(5, 2)
-    );
+    $api_functions = [
+      'ldap_user_conf' => [2, 0],
+      'ldap_user_synch_to_drupal' => [3, 1],
+      'ldap_user_provision_to_drupal' => [2, 1],
+      'ldap_user_ldap_provision_semaphore' => [4, 2],
+      'ldap_user_token_replace' => [3, 2],
+      'ldap_user_token_tokenize_entry' => [5, 2],
+    ];
 
     foreach ($api_functions as $api_function_name => $param_count) {
       $reflector = new ReflectionFunction($api_function_name);
       $this->assertTrue(
         function_exists($api_function_name) &&
         $param_count[1] == $reflector->getNumberOfRequiredParameters() &&
-        $param_count[0] == $reflector->getNumberOfParameters()
-        , ' api function ' . $api_function_name . ' parameters and required parameters count unchanged.', $this->testId($api_function_name . ' unchanged'));
+        $param_count[0] == $reflector->getNumberOfParameters(),
+         ' api function ' . $api_function_name . ' parameters and required parameters count unchanged.', $this->testId($api_function_name . ' unchanged'));
     }
 
     $this->assertTrue(drupal_cron_run(), t('Cron can run with ldap user enabled.'), $this->testId('cron works'));
 
-    // test user token functions
+    // Test user token functions.
     $entity = new stdClass();
     $entity->lname[LANGUAGE_NONE][0]['value'] = 'potter';
     $entity->house[LANGUAGE_NONE][0]['value'] = 'Gryffindor';
@@ -93,25 +101,24 @@ class LdapUserUnitTests extends LdapTestCase {
     $this->assertTrue($lname == $entity->lname[LANGUAGE_NONE][0]['value'], t('[field.lname] token worked on ldap_user_token_replace().'), $this->testId('tokens.property.field'));
     $house1 = ldap_user_token_replace('[field.house:1]', $account, $entity);
     $this->assertTrue($house1 == $entity->house[LANGUAGE_NONE][1]['value'], t('[field.house:1] token worked on ldap_user_token_replace().'), $this->testId('tokens.property.field.ordinal'));
-    //@todo need tests for :last and a multivalued attribute.  see http://drupal.org/node/1245736
-
+    // @todo need tests for :last and a multivalued attribute.  see http://drupal.org/node/1245736
 
-    $sids = array('activedirectory1');
-    $this->prepTestData('hogwarts', $sids, 'default'); // prepTestData($sids, 'provisionToDrupal', 'default');
+    $sids = ['activedirectory1'];
+    $this->prepTestData('hogwarts', $sids, 'default');
     $ldap_server = ldap_servers_get_servers('activedirectory1', NULL, TRUE, TRUE);
     $ldap_user_conf = ldap_user_conf('admin', TRUE);
 
     $this->assertTrue(is_object($ldap_user_conf), t('ldap_conf class instantiated'), $this->testId('construct ldapUserConf object'));
 
-    $user_edit = array();
+    $user_edit = [];
     $ldap_user = ldap_servers_get_user_ldap_data('hpotter', $ldap_user_conf->drupalAcctProvisionServer, 'ldap_user_prov_to_drupal');
 
-    $desired_result = array(
+    $desired_result = [
       'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
       'mail' => 'hpotter@hogwarts.edu',
       'attr' => $ldap_server->entries['cn=hpotter,ou=people,dc=hogwarts,dc=edu'],
       'sid' => 'activedirectory1',
-    );
+    ];
 
     if (is_array($ldap_user)) {
       $array_diff = array_diff($ldap_user, $desired_result);
@@ -124,96 +131,96 @@ class LdapUserUnitTests extends LdapTestCase {
     $ldap_user_conf->entryToUserEdit($ldap_user, $user_edit, $ldap_todrupal_prov_server);
 
     unset($user_edit['pass']);
-    $desired_result = array(
-        'mail' => 'hpotter@hogwarts.edu',
-        'name' => 'hpotter',
-        'init' => 'hpotter@hogwarts.edu',
-        'status' => 1,
-        'signature' => '',
-        'data' =>
-        array(
+    $desired_result = [
+      'mail' => 'hpotter@hogwarts.edu',
+      'name' => 'hpotter',
+      'init' => 'hpotter@hogwarts.edu',
+      'status' => 1,
+      'signature' => '',
+      'data' =>
+        [
           'ldap_authentication' =>
-          array(
+          [
             'init' =>
-            array(
+            [
               'sid' => 'activedirectory1',
               'dn' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
               'mail' => 'hpotter@hogwarts.edu',
-            ),
-          ),
-        ),
-        'ldap_user_puid' =>
-        array(
+            ],
+          ],
+        ],
+      'ldap_user_puid' =>
+        [
           LANGUAGE_NONE =>
-          array(
+          [
             0 =>
-            array(
+            [
               'value' => '101',
-            ),
-          ),
-        ),
-        'ldap_user_puid_property' =>
-        array(
+            ],
+          ],
+        ],
+      'ldap_user_puid_property' =>
+        [
           LANGUAGE_NONE =>
-          array(
+          [
             0 =>
-            array(
+            [
               'value' => 'guid',
-            ),
-          ),
-        ),
-        'ldap_user_puid_sid' =>
-        array(
+            ],
+          ],
+        ],
+      'ldap_user_puid_sid' =>
+        [
           LANGUAGE_NONE =>
-          array(
+          [
             0 =>
-            array(
+            [
               'value' => 'activedirectory1',
-            ),
-          ),
-        ),
-        'ldap_user_current_dn' =>
-        array(
+            ],
+          ],
+        ],
+      'ldap_user_current_dn' =>
+        [
           LANGUAGE_NONE =>
-          array(
+          [
             0 =>
-            array(
+            [
               'value' => 'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
-            ),
-          ),
-        ),
-      );
+            ],
+          ],
+        ],
+    ];
     // @FIXME: Wrapper for failing test.
-    if(is_array($user_edit)) {
+    if (is_array($user_edit)) {
       $array_diff = array_diff($user_edit, $desired_result);
     }
-    //@todo need better diff, this will give false positives in most cases
+    // @todo need better diff, this will give false positives in most cases
     $this->assertTrue(count($array_diff) == 0, t('ldapUserConf::entryToUserEdit retrieved correct property, field, and data values.'), $this->testId('ldapUserConf::entryToUserEdit'));
     if (count($array_diff) != 0) {
       debug('ldapUserConf::entryToUserEdit failed.  resulting user edit array:'); debug($user_edit); debug('desired result:'); debug($desired_result); debug('array_diff:'); debug($array_diff);
     }
 
-    $is_synched_tests = array(
-      LDAP_USER_EVENT_CREATE_DRUPAL_USER => array(
-        0 => array('[property.fake]', '[property.data]', '[property.uid]'),
-        1 => array('[property.mail]', '[property.name]', '[field.ldap_user_puid]', '[field.ldap_user_puid_property]', '[field.ldap_user_puid_sid]', '[field.ldap_user_current_dn]'),
-      ),
-      LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER => array(
-        0 => array('[property.fake]', '[property.data]', '[property.uid]', '[field.ldap_user_puid]', '[field.ldap_user_puid_property]', '[field.ldap_user_puid_sid]'),
-        1 => array('[property.mail]', '[property.name]', '[field.ldap_user_current_dn]'),
-      ),
-    );
-
-    $debug = array();
+    $is_synched_tests = [
+      LDAP_USER_EVENT_CREATE_DRUPAL_USER => [
+        0 => ['[property.fake]', '[property.data]', '[property.uid]'],
+        1 => ['[property.mail]', '[property.name]', '[field.ldap_user_puid]', '[field.ldap_user_puid_property]', '[field.ldap_user_puid_sid]', '[field.ldap_user_current_dn]'],
+      ],
+      LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER => [
+        0 => ['[property.fake]', '[property.data]', '[property.uid]', '[field.ldap_user_puid]', '[field.ldap_user_puid_property]', '[field.ldap_user_puid_sid]'],
+        1 => ['[property.mail]', '[property.name]', '[field.ldap_user_current_dn]'],
+      ],
+    ];
+
+    $debug = [];
     $fail = FALSE;
     foreach ($is_synched_tests as $prov_event => $tests) {
       foreach ($tests as $boolean_result => $attribute_tokens) {
         foreach ($attribute_tokens as $attribute_token) {
-          $is_synched = $ldap_user_conf->isSynched($attribute_token, array($prov_event), LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER);
-          if ((int)$is_synched !== (int)$boolean_result) {
+          $is_synched = $ldap_user_conf->isSynched($attribute_token, [$prov_event], LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER);
+          if ((int) $is_synched !== (int) $boolean_result) {
             $fail = TRUE;
             $debug[$attribute_token] = "isSynched($attribute_token, array($prov_event),
-              LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) returned $is_synched when it should have returned ". (int)$boolean_result;
+              LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) returned $is_synched when it should have returned " . (int) $boolean_result;
           }
         }
       }
@@ -229,7 +236,7 @@ class LdapUserUnitTests extends LdapTestCase {
 
     $ldap_user_required_attributes = $ldap_user_conf->getLdapUserRequiredAttributes(LDAP_USER_PROV_DIRECTION_ALL);
 
-    $provision_enabled_truth = (boolean)(
+    $provision_enabled_truth = (boolean) (
       $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE)
       && $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE)
       && !$ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY, LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE)
@@ -242,17 +249,15 @@ class LdapUserUnitTests extends LdapTestCase {
     $ldap_user_conf->provisionEnabled(LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE));
     $this->assertFalse($provision_enabled_false, t('provisionEnabled works'), $this->testId('provisionEnabled.2'));
 
-
     $account = new stdClass();
     $account->name = 'hpotter';
-    $params = array('ldap_context' => 'ldap_user_prov_to_drupal', 'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER);
+    $params = ['ldap_context' => 'ldap_user_prov_to_drupal', 'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER];
     list($ldap_entry, $error) = $ldap_user_conf->drupalUserToLdapEntry($account, 'activedirectory1', $params);
 
     $account = NULL;
-    $user_edit = array('name' => 'hpotter');
-
-    // test method provisionDrupalAccount()
+    $user_edit = ['name' => 'hpotter'];
 
+    // Test method provisionDrupalAccount()
     $hpotter = $ldap_user_conf->provisionDrupalAccount($account, $user_edit, NULL, TRUE);
 
     $hpotter = user_load_by_name('hpotter');
@@ -281,43 +286,43 @@ class LdapUserUnitTests extends LdapTestCase {
     if (is_array($hpotter->data['ldap_user'])) {
       $data_diff = array_diff(
         $hpotter->data['ldap_user'],
-        array(
+        [
           'init' =>
-            array(
+            [
               'sid' => 'activedirectory1',
               'dn' => NULL,
               'mail' => 'hpotter@hogwarts.edu',
-            ),
-        )
+            ],
+        ]
       );
       $this->assertTrue(count($data_diff) == 0, t('user->data array correctly populated for hpotter'), $this->testId());
     }
-    // test account exists with correct username, mail, fname, puid, puidfield, dn
-
-    // change some user mock ldap data first, (mail and fname) then synch
+    // Test account exists with correct username, mail, fname, puid, puidfield, dn
+    // Change some user mock ldap data first, (mail and fname) then synch.
     $account = user_load_by_name('hpotter');
 
     $user_edit = NULL;
-    $ldap_user_conf->ldapUserSynchMappings = array();
+    $ldap_user_conf->ldapUserSynchMappings = [];
     $sid = 'activedirectory1';
-    $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER]['[property.mail]'] = array(
+    $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER]['[property.mail]'] = [
       'sid' => $sid,
       'ldap_attr' => '[mail]',
       'user_attr' => '[property.mail]',
       'convert' => 0,
       'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-      'ldap_contexts' => array('ldap_user_insert_drupal_user', 'ldap_user_update_drupal_user', 'ldap_authentication_authenticate'),
-      'prov_events' => array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+      'ldap_contexts' => ['ldap_user_insert_drupal_user', 'ldap_user_update_drupal_user', 'ldap_authentication_authenticate'],
+      'prov_events' => [LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
       'name' => 'Property: Mail',
       'enabled' => TRUE,
       'config_module' => 'ldap_servers',
       'prov_module' => 'ldap_user',
       'user_tokens' => '',
-      );
+    ];
     $ldap_user_conf->save();
 
     $this->testFunctions->setFakeServerUserAttribute($sid, 'cn=hpotter,ou=people,dc=hogwarts,dc=edu', 'mail', 'hpotter@owlcarriers.com', 0);
-    $ldap_server = ldap_servers_get_servers('activedirectory1', NULL, TRUE, TRUE); // clear server cache;
+    // Clear server cache.
+    $ldap_server = ldap_servers_get_servers('activedirectory1', NULL, TRUE, TRUE);
     $user = $ldap_user_conf->synchToDrupalAccount($account, $user_edit, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, NULL, TRUE);
 
     $hpotter = user_load_by_name('hpotter');
@@ -340,7 +345,7 @@ class LdapUserUnitTests extends LdapTestCase {
 
     $this->testFunctions->setFakeServerUserAttribute('activedirectory1', 'cn=hpotter,ou=people,dc=hogwarts,dc=edu', 'samaccountname', 'hpotter-granger', 0);
     $account = NULL;
-    $user_edit = array('name' => 'hpotter-granger');
+    $user_edit = ['name' => 'hpotter-granger'];
     $hpottergranger = $ldap_user_conf->provisionDrupalAccount($account, $user_edit, NULL, TRUE);
 
     $this->testFunctions->setFakeServerUserAttribute('activedirectory1', 'cn=hpotter,ou=people,dc=hogwarts,dc=edu', 'samaccountname', 'hpotter', 0);
@@ -356,32 +361,34 @@ class LdapUserUnitTests extends LdapTestCase {
     $pass = is_object($hpottergranger) && $hpottergranger->name == 'hpotter-granger';
     $this->assertTrue($pass, t('provisionDrupalAccount recognized PUID conflict and fixed username.'), $this->testId());
 
-    $user_edit = array('name' => 'hpotter');
+    $user_edit = ['name' => 'hpotter'];
     $hpotter = user_save($hpottergranger, $user_edit, 'ldap_user');
 
-
-    // delete and recreate test account to make sure account is in correct state
+    // Delete and recreate test account to make sure account is in correct state.
     $ldap_user_conf->deleteDrupalAccount('hpotter');
     $this->assertFalse(user_load($hpotter_uid, TRUE), t('deleteDrupalAccount deleted hpotter successfully'), $this->testId());
 
     $ldap_server = ldap_servers_get_servers('activedirectory1', 'enabled', TRUE, TRUE);
     $ldap_server->refreshFakeData();
     $account = NULL;
-    $user_edit = array('name' => 'hpotter');
+    $user_edit = ['name' => 'hpotter'];
     $hpotter = $ldap_user_conf->provisionDrupalAccount($account, $user_edit, NULL, TRUE);
 
   }
 
-  function testProvisionToDrupal() {
+  /**
+   *
+   */
+  public function testProvisionToDrupal() {
     // TODO: Fix failing tests, excluding to make branch pass.
     return;
-      /**
+    /**
      * test that $ldap_user_conf->synchToDrupalAccount() works for various contexts.
      * make sure changing when a given field/property is flagged for a particular context, everything works
      * tests one property (property.mail) and one field (field.field_lname) as well as username, puid
      */
 
-      // just to give warning if setup doesn't succeed.  may want to take these out at some point.
+    // Just to give warning if setup doesn't succeed.  may want to take these out at some point.
     $setup_success = (
         module_exists('ldap_user') &&
         module_exists('ldap_servers') &&
@@ -389,178 +396,181 @@ class LdapUserUnitTests extends LdapTestCase {
       );
     $this->assertTrue($setup_success, ' ldap_user setup successful', $this->testId("setup"));
 
-
     $sid = 'activedirectory1';
-    $sids = array($sid);
+    $sids = [$sid];
     $this->prepTestData('hogwarts', $sids, 'provisionToDrupal', 'default');
-    $tests = array();
+    $tests = [];
 
-    $tests[] = array(
+    $tests[] = [
       'disabled' => 0,
       'user' => 'hpotter',
       'field_name' => 'field_lname',
-      'field_values' => array(array('sn' => 'Potter'), array('sn' => 'Pottery-Chard')),
-      'field_results' => array('Potter', 'Pottery-Chard'), // first value is what is desired on synch, second if no sycn
-      'mapping' => array(
+      'field_values' => [['sn' => 'Potter'], ['sn' => 'Pottery-Chard']],
+    // First value is what is desired on synch, second if no sycn.
+      'field_results' => ['Potter', 'Pottery-Chard'],
+      'mapping' => [
         'sid' => $sid,
         'name' => 'Field: Last Name',
         'ldap_attr' => '[SN]',
         'user_attr' => '[field.field_lname]',
         'convert' => 0,
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
         'user_tokens' => '',
         'config_module' => 'ldap_user',
         'prov_module' => 'ldap_user',
         'enabled' => TRUE,
-      ),
-    );
+      ],
+    ];
 
-    // test for compound tokens
-    $tests[] = array(
+    // Test for compound tokens.
+    $tests[] = [
       'disabled' => 0,
       'user' => 'hpotter',
       'field_name' => 'field_display_name',
-      'field_values' => array(array('givenname' => 'Harry', 'sn' => 'Potter'), array('givenname' => 'Sir Harry', 'sn' => 'Potter')),
-      'field_results' => array('Harry Potter', 'Sir Harry Potter'), // desired results
-      'mapping' => array(
+      'field_values' => [['givenname' => 'Harry', 'sn' => 'Potter'], ['givenname' => 'Sir Harry', 'sn' => 'Potter']],
+    // Desired results.
+      'field_results' => ['Harry Potter', 'Sir Harry Potter'],
+      'mapping' => [
         'sid' => $sid,
         'ldap_attr' => '[givenName] [sn]',
         'user_attr' => '[field.field_display_name]',
         'convert' => 0,
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
         'name' => 'Field: Display Name',
         'enabled' => TRUE,
         'config_module' => 'ldap_user',
         'prov_module' => 'ldap_user',
         'user_tokens' => '',
-      ),
-    );
+      ],
+    ];
 
-
-    // test for constants in use (e.g. "Smith" and "0") instead of tokens e.g. "[sn]" and "[enabled]"
-    $tests[] = array(
+    // Test for constants in use (e.g. "Smith" and "0") instead of tokens e.g. "[sn]" and "[enabled]".
+    $tests[] = [
       'disabled' => 0,
       'user' => 'hpotter',
       'field_name' => 'field_lname',
-      'field_values' => array(array('sn' => 'Potter1'), array('sn' => 'Potter2')),
-      'field_results' => array('Smith', 'Smith'),
-      'mapping' => array(
+      'field_values' => [['sn' => 'Potter1'], ['sn' => 'Potter2']],
+      'field_results' => ['Smith', 'Smith'],
+      'mapping' => [
         'sid' => $sid,
         'name' => 'Field: Last Name',
-        'ldap_attr' => 'Smith', // testing of a constant mapped to a field.  that is everyone should have last name smith
+    // Testing of a constant mapped to a field.  that is everyone should have last name smith.
+        'ldap_attr' => 'Smith',
         'user_attr' => '[field.field_lname]',
         'convert' => 0,
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
         'user_tokens' => '',
         'config_module' => 'ldap_user',
         'prov_module' => 'ldap_user',
         'enabled' => TRUE,
 
-      ),
-    );
+      ],
+    ];
 
-    // test for compound tokens
-    $tests[] = array(
+    // Test for compound tokens.
+    $tests[] = [
       'disabled' => 0,
       'user' => 'hpotter',
       'property_name' => 'signature',
-      'property_values' => array(array('cn' => 'hpotter'), array('cn' => 'hpotter2')),
-      'property_results' => array('hpotter@hogwarts.edu', 'hpotter2@hogwarts.edu'),
-      'mapping' => array(
+      'property_values' => [['cn' => 'hpotter'], ['cn' => 'hpotter2']],
+      'property_results' => ['hpotter@hogwarts.edu', 'hpotter2@hogwarts.edu'],
+      'mapping' => [
         'sid' => $sid,
         'ldap_attr' => '[cn]@hogwarts.edu',
         'user_attr' => '[property.signature]',
         'convert' => 0,
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
         'name' => 'Property: Signature',
         'enabled' => TRUE,
         'config_module' => 'ldap_servers',
         'prov_module' => 'ldap_user',
         'user_tokens' => '',
-      ),
-    );
+      ],
+    ];
 
-    $tests[] = array(
+    $tests[] = [
       'disabled' => 0,
       'user' => 'hpotter',
       'property_name' => 'mail',
-      'property_values' => array(array('mail' => 'hpotter@hogwarts.edu'), array('mail' => 'hpotter@owlmail.com')),
-      'property_results' => array('hpotter@hogwarts.edu', 'hpotter@owlmail.com'),
-      'mapping' => array(
+      'property_values' => [['mail' => 'hpotter@hogwarts.edu'], ['mail' => 'hpotter@owlmail.com']],
+      'property_results' => ['hpotter@hogwarts.edu', 'hpotter@owlmail.com'],
+      'mapping' => [
         'sid' => $sid,
         'ldap_attr' => '[mail]',
         'user_attr' => '[property.mail]',
         'convert' => 0,
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER, LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER],
         'name' => 'Property: Mail',
         'enabled' => TRUE,
         'config_module' => 'ldap_servers',
         'prov_module' => 'ldap_user',
         'user_tokens' => '',
-      ),
-    );
+      ],
+    ];
 
-    $tests[] = array(
+    $tests[] = [
       'disabled' => 0,
       'user' => 'hpotter',
       'property_name' => 'status',
-      'property_values' => array(array(0 => 'z'), array(0 => 'z')),
-      'property_results' => array(0, 0),
-      'mapping' => array(
+      'property_values' => [[0 => 'z'], [0 => 'z']],
+      'property_results' => [0, 0],
+      'mapping' => [
         'sid' => $sid,
         'ldap_attr' => '0',
-        'user_attr' => '[property.status]', // testing of a constant mapped to property
+    // Testing of a constant mapped to property.
+        'user_attr' => '[property.status]',
         'convert' => 0,
         'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_DRUPAL_USER),
+        'prov_events' => [LDAP_USER_EVENT_CREATE_DRUPAL_USER],
         'name' => 'Property: Status',
         'enabled' => TRUE,
         'config_module' => 'ldap_servers',
         'prov_module' => 'ldap_user',
         'user_tokens' => '',
-      ),
-    );
+      ],
+    ];
 
     // @todo test with binary field
     // @todo case sensitivity in tokens and user_attr in mappings
 
-    $test_prov_events = array(
-      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => array(
+    $test_prov_events = [
+      LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER => [
         LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER,
         LDAP_USER_EVENT_CREATE_DRUPAL_USER,
-      ),
+      ],
 
-      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => array(
+      LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY => [
         LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY,
         LDAP_USER_EVENT_CREATE_LDAP_ENTRY,
-      ),
-    );
+      ],
+    ];
 
-    $this->privileged_user = $this->drupalCreateUser(array(
+    $this->privileged_user = $this->drupalCreateUser([
       'administer site configuration',
-      'administer users'
-      ));
-    
+      'administer users',
+    ]);
+
     /** Tests for various synch contexts **/
     foreach ($tests as $j => $test) {
 
       $field_name = isset($test['field_name']) ? $test['field_name'] : FALSE;
       $property_name = isset($test['property_name']) ? $test['property_name'] : FALSE;
       $direction = ($property_name) ? $test['mapping']['direction'] : $test['mapping']['direction'];
-      foreach ($test_prov_events[$direction] as $i => $prov_event) {  // test for each provision event
+      // Test for each provision event.
+      foreach ($test_prov_events[$direction] as $i => $prov_event) {
 
         // 1. set fake ldap values for field and property in fake ldap server
-        // and clear out mappings and set to provision account with test field and prop[0] on provision
+        // and clear out mappings and set to provision account with test field and prop[0] on provision.
         $ldap_server = ldap_servers_get_servers('activedirectory1', 'enabled', TRUE);
         $this->prepTestData('hogwarts', $sids, 'provisionToDrupal', 'default');
         $ldap_user_conf = ldap_user_conf('admin', TRUE);
         if ($property_name) {
-          $token_attributes = array();
+          $token_attributes = [];
           ldap_servers_token_extract_attributes($token_attributes, $test['mapping']['ldap_attr']);
           foreach ($token_attributes as $attr_name => $attr_parts) {
             $this->testFunctions->setFakeServerUserAttribute(
@@ -574,9 +584,9 @@ class LdapUserUnitTests extends LdapTestCase {
           $ldap_user_conf->ldapUserSynchMappings[$direction][$property_token] = $test['mapping'];
         }
         if ($field_name) {
-          $token_attributes = array();
+          $token_attributes = [];
           ldap_servers_token_extract_attributes($token_attributes, $test['mapping']['ldap_attr']);
-          foreach ($token_attributes as $attr_name => $attr_parts ) {
+          foreach ($token_attributes as $attr_name => $attr_parts) {
             $this->testFunctions->setFakeServerUserAttribute(
               'activedirectory1',
               'cn=hpotter,ou=people,dc=hogwarts,dc=edu',
@@ -593,36 +603,39 @@ class LdapUserUnitTests extends LdapTestCase {
         ldap_user_ldap_provision_semaphore(NULL, NULL, NULL, TRUE);
         ldap_servers_flush_server_cache();
 
-        // 2. delete user
+        // 2. delete user.
         $username = $test['user'];
         $user_object = user_load_by_name($username);
         if (is_object($user_object)) {
-          user_delete($user_object->uid); // watch out for this.
+          // Watch out for this.
+          user_delete($user_object->uid);
         }
 
-        // 3. create new user with provisionDrupalAccount
+        // 3. create new user with provisionDrupalAccount.
         $account = NULL;
-        $user_edit = array('name' => $username);
-       // $this->ldapTestId = $this->module_name . ': provisionDrupalAccount function test';
+        $user_edit = ['name' => $username];
         $result = $ldap_user_conf->provisionDrupalAccount($account, $user_edit, NULL, TRUE);
         list($user_object, $user_entity) = ldap_user_load_user_acct_and_entity($username);
         if ($property_name) {
-          if (in_array($prov_event, $ldap_user_conf->ldapUserSynchMappings[$direction][$property_token]['prov_events'])) { // if intended to synch
+          // If intended to synch.
+          if (in_array($prov_event, $ldap_user_conf->ldapUserSynchMappings[$direction][$property_token]['prov_events'])) {
             $property_success = ($user_object->{$property_name} == $test['property_results'][0]);
             $this->assertTrue($property_success, t("provisionDrupalAccount worked for property $property_name"), $this->testId(":provisionDrupalAccount.i=$j.prov_event=$prov_event"));
             if (!$property_success) {
-              debug('field fail,' . $property_name); debug($user_entity->{$property_name}); debug($test['property_results'][0]); //debug($user_entity);
+              debug('field fail,' . $property_name); debug($user_entity->{$property_name}); debug($test['property_results'][0]);
             }
           }
         }
         if ($field_name) {
 
-          if (in_array($prov_event, $ldap_user_conf->ldapUserSynchMappings[$direction][$field_token]['prov_events'])) { // if intended to synch
+          // If intended to synch.
+          if (in_array($prov_event, $ldap_user_conf->ldapUserSynchMappings[$direction][$field_token]['prov_events'])) {
             $field_success = isset($user_entity->{$field_name}[LANGUAGE_NONE][0]['value']) &&
               $user_entity->{$field_name}[LANGUAGE_NONE][0]['value'] == $test['field_results'][0];
             $this->assertTrue($field_success, t("provisionDrupalAccount worked for field $field_name"), $this->testId(":provisionDrupalAccount.i=$j.prov_event=$prov_event"));
             if (!$field_success) {
-              debug('field fail,' . $field_name); debug($user_entity->{$field_name}); debug($test['field_results'][0]); //debug($user_entity);
+              // debug($user_entity);
+              debug('field fail,' . $field_name); debug($user_entity->{$field_name}); debug($test['field_results'][0]);
             }
           }
           else {
@@ -631,56 +644,57 @@ class LdapUserUnitTests extends LdapTestCase {
         }
         ldap_user_ldap_provision_semaphore(NULL, NULL, NULL, TRUE);
       }
-      
-            /**
+
+      /**
         * manually create drupal user with option of not ldap associated checked
         */
-   
+
       if ($hpotter = user_load_by_name('hpotter')) {
         user_delete($hpotter->uid);
       }
       $this->assertFalse(user_load_by_name('hpotter'), t('hpotter removed before manual account creation test'), $this->testId('manual non ldap account created'));
-      
+
       $this->drupalLogout();
       $this->drupalLogin($this->privileged_user);
       $this->drupalGet('admin/people/create');
-      $edit = array(
+      $edit = [
         'name' => 'hpotter',
         'mail' => 'hpotter@hogwarts.edu',
         'pass[pass1]' => 'goodpwd',
         'pass[pass2]' => 'goodpwd',
         'notify' => FALSE,
         'ldap_user_association' => LDAP_USER_MANUAL_ACCT_CONFLICT_NO_LDAP_ASSOCIATE,
-      );
+      ];
       $this->drupalPost('admin/people/create', $edit, t('Create new account'));
-      
+
       $hpotter = user_load_by_name('hpotter');
       $this->assertTrue($hpotter, t('hpotter created via ui form'), $this->testId('manual non ldap account created'));
       $this->assertTrue($hpotter && !ldap_user_is_ldap_associated($hpotter), t('hpotter not ldap associated'), $this->testId('manual non ldap account created'));
-       
-     
-     
-    }
-         /**
-     * $entry = $servers['activedirectory1']->dnExists($desired_dn, 'ldap_entry');
 
-     * $this->assertFalse($entry, t("Corresponding LDAP entry deleted when Drupal Account deleted for " . $username), $this->ldapTestId);
-     */
+    }
   }
 
 }
-
+/**
+ *
+ */
 class LdapUserIntegrationTests extends LdapTestCase {
 
+  /**
+   *
+   */
   public static function getInfo() {
-    return array(
+    return [
       'name' => 'LDAP User Integration Tests',
       'description' => 'Test provisioning and synching in real contexts such as account creation on logon, synching on user edit, etc.',
-      'group' => 'LDAP User'
-    );
+      'group' => 'LDAP User',
+    ];
   }
 
-  function __construct($test_id = NULL) {
+  /**
+   *
+   */
+  public function __construct($test_id = NULL) {
     parent::__construct($test_id);
   }
 
@@ -688,27 +702,29 @@ class LdapUserIntegrationTests extends LdapTestCase {
   protected $ldap_test_data;
 
   /**
-   *  create one or more server configurations in such as way
-   *  that this setUp can be a prerequisite for ldap_authentication and ldap_authorization
+   * Create one or more server configurations in such as way
+   *  that this setUp can be a prerequisite for ldap_authentication and ldap_authorization.
    */
-
-  function setUp() {
-    parent::setUp(array('ldap_user', 'ldap_test'));
+  public function setUp() {
+    parent::setUp(['ldap_user', 'ldap_test']);
     variable_set('ldap_simpletest', 2);
   }
 
-  function tearDown() {
+  /**
+   *
+   */
+  public function tearDown() {
     parent::tearDown();
     variable_del('ldap_help_watchdog_detail');
     variable_del('ldap_simpletest');
   }
 
- /**
-   * integration tests for provisioning to ldap
+  /**
+   * Integration tests for provisioning to ldap.
    */
-  function testProvisionToLdap() {
+  public function testProvisionToLdap() {
 
-    // just to give warning if setup doesn't succeed.  may want to take these out at some point.
+    // Just to give warning if setup doesn't succeed.  may want to take these out at some point.
     $setup_success = (
         module_exists('ldap_user') &&
         module_exists('ldap_servers') &&
@@ -716,9 +732,10 @@ class LdapUserIntegrationTests extends LdapTestCase {
       );
     $this->assertTrue($setup_success, ' ldap_user setup successful', $this->testId("setup"));
 
-    foreach (array('activedirectory1', 'openldap1') as $test_sid) {
-      $sids = array($test_sid);
-      $this->prepTestData('hogwarts', $sids, 'provisionToLdap_' . $test_sid); // this will create the proper ldap_user configuration from ldap_test/ldap_user.conf.inc
+    foreach (['activedirectory1', 'openldap1'] as $test_sid) {
+      $sids = [$test_sid];
+      // This will create the proper ldap_user configuration from ldap_test/ldap_user.conf.inc.
+      $this->prepTestData('hogwarts', $sids, 'provisionToLdap_' . $test_sid);
       $ldap_user_conf = ldap_user_conf('default', TRUE);
 
       // 9.B. Create and approve new user, populating first and last name.
@@ -726,12 +743,12 @@ class LdapUserIntegrationTests extends LdapTestCase {
       if ($user = user_load_by_name($username)) {
         user_delete($user->uid);
       }
-      $user_edit = array(
+      $user_edit = [
         'name' => $username,
         'mail' => $username . '@hogwarts.org',
         'pass' => user_password(),
         'status' => 1,
-      );
+      ];
       $user_acct = new stdClass();
       $user_acct->is_new = TRUE;
       $user_acct->field_fname[LANGUAGE_NONE][0]['value'] = 'Bercilak';
@@ -760,20 +777,21 @@ class LdapUserIntegrationTests extends LdapTestCase {
         debug('ldap_user_conf'); debug($ldap_user_conf);
       }
 
-
-      ldap_user_ldap_provision_semaphore(NULL, NULL, NULL, TRUE);  // need to reset for simpletests
+      // Need to reset for simpletests.
+      ldap_user_ldap_provision_semaphore(NULL, NULL, NULL, TRUE);
 
       // Change lastname and first name (in drupal) and save user to test ldapSynch event handler
-      // confirm that appropriate attributes were changed in ldap entry
+      // confirm that appropriate attributes were changed in ldap entry.
       $ldap_entry_pre = $servers[$test_sid]->dnExists($desired_dn, 'ldap_entry');
       $user_acct_pre = user_load_by_name('bhautdeser');
-      $edit = array();
+      $edit = [];
       $edit['field_fname'][LANGUAGE_NONE][0]['value'] = 'Bredbeddle';
       $edit['field_lname'][LANGUAGE_NONE][0]['value'] = 'Hautdesert';
       $user_acct = user_save($user_acct, $edit);
       $user_acct_post = user_load_by_name('bhautdeser');
 
-      $servers = ldap_servers_get_servers(NULL, NULL, FALSE, TRUE); // clear cache
+      // Clear cache.
+      $servers = ldap_servers_get_servers(NULL, NULL, FALSE, TRUE);
       $ldap_entry_post = $servers[$test_sid]->dnExists($desired_dn, 'ldap_entry');
 
       $ldap_entry_success = (
@@ -792,18 +810,18 @@ class LdapUserIntegrationTests extends LdapTestCase {
         debug('ldap_user_conf'); debug($ldap_user_conf);
       }
 
-
-    // Change username and first name (in drupal) and save user to test ldapSynch event handler
-      // confirm that appropriate attributes were changed in ldap entry
+      // Change username and first name (in drupal) and save user to test ldapSynch event handler
+      // confirm that appropriate attributes were changed in ldap entry.
       $ldap_entry_pre = $servers[$test_sid]->dnExists($desired_dn, 'ldap_entry');
       $user_acct_pre = user_load_by_name('bhautdeser');
-      $edit = array();
+      $edit = [];
       $edit['field_fname'][LANGUAGE_NONE][0]['value'] = 'Bredbeddle';
       $edit['field_lname'][LANGUAGE_NONE][0]['value'] = 'Hautdesert';
       $user_acct = user_save($user_acct, $edit);
       $user_acct_post = user_load_by_name('bhautdeser');
 
-      $servers = ldap_servers_get_servers(NULL, NULL, FALSE, TRUE); // clear cache
+      // Clear cache.
+      $servers = ldap_servers_get_servers(NULL, NULL, FALSE, TRUE);
       $ldap_entry_post = $servers[$test_sid]->dnExists($desired_dn, 'ldap_entry');
 
       $ldap_entry_success = (
@@ -828,27 +846,30 @@ class LdapUserIntegrationTests extends LdapTestCase {
      * use case where a user self creates and confirms a drupal account and
      *  a corresponding ldap entry with password is created
      */
-    $password_tests = array(
+    $password_tests = [
       '[password.user-random]' => 'goodpwd',
       '[password.random]' => 'random',
-    );
+    ];
 
     foreach ($password_tests as $password_token => $password_result) {
       $test_id = "provisionToLdapEmailVerification $password_token, $test_sid";
-      ldap_user_ldap_provision_semaphore(NULL, NULL, NULL, TRUE); // need to reset for simpletests
+      // Need to reset for simpletests.
+      ldap_user_ldap_provision_semaphore(NULL, NULL, NULL, TRUE);
       /**
        * provisionToLdapEmailVerification setup
        */
-      $this->prepTestData('hogwarts', $sids, 'provisionToLdap_' . $test_sid); // this will create the proper ldap_user configuration from ldap_test/ldap_user.conf.inc
+      // This will create the proper ldap_user configuration from ldap_test/ldap_user.conf.inc.
+      $this->prepTestData('hogwarts', $sids, 'provisionToLdap_' . $test_sid);
       $ldap_user_conf = ldap_user_conf('admin', TRUE);
-      $ldap_user_conf->drupalAcctProvisionServer = 0; // turn off provisioning to drupal
+      // Turn off provisioning to drupal.
+      $ldap_user_conf->drupalAcctProvisionServer = 0;
       $ldap_user_conf->ldapEntryProvisionServer = $test_sid;
-      $ldap_user_conf->ldapEntryProvisionTriggers = array(
+      $ldap_user_conf->ldapEntryProvisionTriggers = [
         LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE,
-        LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE
-      );
+        LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE,
+      ];
 
-      $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY]['[password]'] = array(
+      $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY]['[password]'] = [
         'sid' => $test_sid,
         'ldap_attr' => '[password]',
         'user_attr' => 'user_tokens',
@@ -857,15 +878,17 @@ class LdapUserIntegrationTests extends LdapTestCase {
         'config_module' => 'ldap_user',
         'synch_module' => 'ldap_user',
         'enabled' => 1,
-        'prov_events' => array(LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY),
-      );
+        'prov_events' => [LDAP_USER_EVENT_CREATE_LDAP_ENTRY, LDAP_USER_EVENT_SYNCH_TO_LDAP_ENTRY],
+      ];
 
       $ldap_user_conf->save();
       $ldap_user_conf = ldap_user_conf('default', TRUE);
 
       variable_set('user_email_verification', TRUE);
-      variable_set('user_register', USER_REGISTER_VISITORS); // or USER_REGISTER_ADMINISTRATORS_ONLY, USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL
-      variable_set('user_cancel_method', 'user_cancel_block'); // user_cancel_block_unpublish, user_cancel_reassign, user_cancel_delete
+      // Or USER_REGISTER_ADMINISTRATORS_ONLY, USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL.
+      variable_set('user_register', USER_REGISTER_VISITORS);
+      // user_cancel_block_unpublish, user_cancel_reassign, user_cancel_delete.
+      variable_set('user_cancel_method', 'user_cancel_block');
       $username = 'sstephens';
       $this->drupalLogout();
       if ($sstephens = user_load_by_name($username)) {
@@ -875,43 +898,46 @@ class LdapUserIntegrationTests extends LdapTestCase {
       /**
        * provisionToLdapEmailVerification test
        */
-      $this->drupalGet('user/register');  // user register form
-      $edit = array(
+      // User register form.
+      $this->drupalGet('user/register');
+      $edit = [
         'name' => $username,
         'mail' => $username . '@hogwarts.edu',
-        );
+      ];
 
-      $this->createTestUserFields(); // this will create last and first name fields
+      // This will create last and first name fields.
+      $this->createTestUserFields();
 
       $this->drupalPost('user/register', $edit, t('Create new account'));
 
       $sstephens = user_load_by_name($username);
 
-
-       //can't derive login url, must get it from outgoing email because timestamp in hash is not stored in user_mail_tokens()
-
+      // can't derive login url, must get it from outgoing email because timestamp in hash is not stored in user_mail_tokens()
       $emails = $this->drupalGetMails();
-      $email_body = $emails[count($emails) - 1]['body']; // most recent email is the one of interest
-      $result = array();
+      // Most recent email is the one of interest.
+      $email_body = $emails[count($emails) - 1]['body'];
+      $result = [];
       preg_match_all('/(user\/reset\/.*)This link can only be/s', $email_body, $result, PREG_PATTERN_ORDER);
       if (count($result == 2)) {
         $login_path = trim($result[1][0]);
-        $this->drupalGet($login_path);  // user login form
+        // User login form.
+        $this->drupalGet($login_path);
         $sstephens = user_load_by_name($username);
-        $this->drupalPost($login_path, array(), t('Log in'));
+        $this->drupalPost($login_path, [], t('Log in'));
         $sstephens = user_load_by_name($username);
 
-        $edit = array(
+        $edit = [
           'mail' => $username . '@hogwarts.edu',
           'pass[pass1]' => 'goodpwd',
           'pass[pass2]' => 'goodpwd',
           'field_fname[und][0][value]' => 'Samantha',
-          'field_lname[und][0][value]' => 'Stephens'
-        );
+          'field_lname[und][0][value]' => 'Stephens',
+        ];
 
         $this->drupalPost(NULL, $edit, t('Save'));
         $sstephens = user_load_by_name($username);
-        $servers = ldap_servers_get_servers(NULL, NULL, FALSE, TRUE); // clear cache
+        // Clear cache.
+        $servers = ldap_servers_get_servers(NULL, NULL, FALSE, TRUE);
         $desired_dn = "cn=$username,ou=people,dc=hogwarts,dc=edu";
         $ldap_entry_post = $servers[$test_sid]->dnExists($desired_dn, 'ldap_entry');
 
@@ -946,20 +972,21 @@ class LdapUserIntegrationTests extends LdapTestCase {
       }
       /**
        * @todo functional tests
-
-       do a password reset of some sort
-       try to add a drupal user that conflicts with an ldap user
-       try a binary fields such as a user profile image
+       *
+       * do a password reset of some sort
+       * try to add a drupal user that conflicts with an ldap user
+       * try a binary fields such as a user profile image
        */
 
     }
 
-    // test deletion of drupal entry on deletion of drupal user
-    foreach (array('activedirectory1', 'openldap1') as $test_sid) {
+    // Test deletion of drupal entry on deletion of drupal user.
+    foreach (['activedirectory1', 'openldap1'] as $test_sid) {
       $test_id = $test_sid;
-      // 1. setup
-      $sids = array($test_sid);
-      $this->prepTestData('hogwarts', $sids, 'provisionToLdap_' . $test_sid); // this will create the proper ldap_user configuration from ldap_test/ldap_user.conf.inc
+      // 1. setup.
+      $sids = [$test_sid];
+      // This will create the proper ldap_user configuration from ldap_test/ldap_user.conf.inc.
+      $this->prepTestData('hogwarts', $sids, 'provisionToLdap_' . $test_sid);
       $ldap_user_conf = ldap_user_conf('admin', TRUE);
       if (!in_array(LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE, $ldap_user_conf->ldapEntryProvisionTriggers)) {
         $ldap_user_conf->ldapEntryProvisionTriggers[] = LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE;
@@ -971,12 +998,12 @@ class LdapUserIntegrationTests extends LdapTestCase {
       if ($user = user_load_by_name($username)) {
         user_delete($user->uid);
       }
-      $user_edit = array(
+      $user_edit = [
         'name' => $username,
         'mail' => $username . '@hogwarts.org',
         'pass' => user_password(),
         'status' => 1,
-      );
+      ];
       $user_acct = new stdClass();
       $user_acct->is_new = TRUE;
       $user_acct->field_fname[LANGUAGE_NONE][0]['value'] = 'Bercilak';
@@ -991,12 +1018,11 @@ class LdapUserIntegrationTests extends LdapTestCase {
 
       $ldap_entry = $ldap_user_conf->getProvisionRelatedLdapEntry($drupal_account);
 
-      // 2. test
+      // 2. test.
       user_delete($drupal_account->uid);
       $ldap_server = ldap_servers_get_servers($test_sid, 'all', TRUE, TRUE);
       $ldap_entry_post_delete = $ldap_server->dnExists($desired_dn, 'ldap_entry');
 
-
       $success = (!$ldap_entry_post_delete);
       $this->assertTrue($success, t("ldap entry removed for $username on drupal user delete with deletion enabled."), $this->testId($test_id));
 
@@ -1007,26 +1033,26 @@ class LdapUserIntegrationTests extends LdapTestCase {
     }
   }
 
-   /**
-   * test cron function for dealing with ldap associated users who no longer have
+  /**
+   * Test cron function for dealing with ldap associated users who no longer have
    * ldap entries
-   *  - fix search in fake server to deal with general or queries
-  *
-  *  simpletest approach:
-  *  - loop through all options for user_cancel
-  *      ldap_user_orphan_email
-          user_cancel_block, user_cancel_block_unpublish,
-           user_cancel_reassign, user_cancel_delete
-  *    - automatically generate 70 ldap users with cns hpotter1-hpotter300
-  *    - create 75 corresponding drupal uses that are ldap identified
-  *    - delete 10 of the ldap entries
-  *    - run cron
-  *    - test for drupal accounts being dealt with correctly and or email sent
+   *  - fix search in fake server to deal with general or queries.
+   *
+   *  Simpletest approach:
+   *  - loop through all options for user_cancel
+   *      ldap_user_orphan_email
+   * user_cancel_block, user_cancel_block_unpublish,
+   * user_cancel_reassign, user_cancel_delete
+   *    - automatically generate 70 ldap users with cns hpotter1-hpotter300
+   *    - create 75 corresponding drupal uses that are ldap identified
+   *    - delete 10 of the ldap entries
+   *    - run cron
+   *    - test for drupal accounts being dealt with correctly and or email sent.
    */
-  function testDrupalAccountsOrphaned() {
+  public function testDrupalAccountsOrphaned() {
     // TODO: Fix failing tests, excluding to make branch pass.
     return;
-  // just to give warning if setup doesn't succeed.  may want to take these out at some point.
+    // Just to give warning if setup doesn't succeed.  may want to take these out at some point.
     $setup_success = (
         module_exists('ldap_user') &&
         module_exists('ldap_servers') &&
@@ -1034,17 +1060,17 @@ class LdapUserIntegrationTests extends LdapTestCase {
       );
     $this->assertTrue($setup_success, ' ldap_user setup successful', $this->testId('orphaned entries tests'));
 
-    $sids = array('activedirectory1');
+    $sids = ['activedirectory1'];
     $this->prepTestData('hogwarts', $sids, 'provisionToDrupal', 'default');
 
     $ldap_user_conf = ldap_user_conf('admin');
     $drupal_form = $ldap_user_conf->drupalForm();
     $account_options = $drupal_form['basic_to_drupal']['orphanedDrupalAcctBehavior']['#options'];
-    $cn_to_account = array();
+    $cn_to_account = [];
     $ldap_server = ldap_servers_get_servers('activedirectory1', NULL, TRUE, TRUE);
 
     foreach ($account_options as $account_option => $account_option_text) {
-      $sids = array('activedirectory1');
+      $sids = ['activedirectory1'];
       $this->prepTestData('hogwarts', $sids, 'provisionToDrupal', 'default');
       $ldap_user_conf->orphanedDrupalAcctBehavior = $account_option;
       $ldap_user_conf->save();
@@ -1052,10 +1078,11 @@ class LdapUserIntegrationTests extends LdapTestCase {
       $test_text = "Test of orphaned Drupal account option: $account_option_text";
       $success = FALSE;
 
-      // create 70 drupal accounts (clone0 to clone69) based on corresponding ldap entries
+      // Create 70 drupal accounts (clone0 to clone69) based on corresponding ldap entries.
       $first_clone_username = 'clone0';
       $last_clone_username = 'clone' . (LDAP_TEST_USER_ORPHAN_CLONE_COUNT - 1);
-      for ($i = 0; $i < LDAP_TEST_USER_ORPHAN_CLONE_COUNT; $i++) { // 70
+      // 70.
+      for ($i = 0; $i < LDAP_TEST_USER_ORPHAN_CLONE_COUNT; $i++) {
         $name = "clone" . $i;
         $account = $this->createLdapIdentifiedDrupalAccount(
           $ldap_user_conf,
@@ -1065,7 +1092,7 @@ class LdapUserIntegrationTests extends LdapTestCase {
         $cn_to_account[$name] = $account;
       }
 
-      // delete 10 ldap entries
+      // Delete 10 ldap entries.
       // @FIXME: Wrapper for broken test.
       if (is_object($cn_to_account[$first_clone_username])) {
         $clone_first_uid = $cn_to_account[$first_clone_username]->uid;
@@ -1090,8 +1117,9 @@ class LdapUserIntegrationTests extends LdapTestCase {
       switch ($account_option) {
 
         case 'ldap_user_orphan_do_not_check':
-          $test_uids = array();
-          for ($i = 0; $i < LDAP_TEST_USER_ORPHAN_CLONE_COUNT; $i++) { // 70
+          $test_uids = [];
+          // 70.
+          for ($i = 0; $i < LDAP_TEST_USER_ORPHAN_CLONE_COUNT; $i++) {
             $name = "clone" . $i;
             $test_uids[] = @$cn_to_account[$name]->uid;
           }
@@ -1107,27 +1135,29 @@ class LdapUserIntegrationTests extends LdapTestCase {
             $success = ($clone_last && $clone_last->status == 1);
           }
 
-        break;
+          break;
 
-        case 'ldap_user_orphan_email' :
-          // test is if email has 10 users and was sent
+        case 'ldap_user_orphan_email':
+          // Test is if email has 10 users and was sent.
           $emails = $this->drupalGetMails();
           if (count($emails)) {
-            $email_body = $emails[count($emails) - 1]['body']; // most recent email is the one of interest
+            // Most recent email is the one of interest.
+            $email_body = $emails[count($emails) - 1]['body'];
             $success = (strpos($email_body, "The following $delete Drupal users") !== FALSE);
           }
           else {
             $success = FALSE;
           }
 
-        break;
+          break;
 
         case 'user_cancel_block':
         case 'user_cancel_block_unpublish':
-          // test is if clone0-clone9 have a status of 0
-          // and clone12,11... have a status of 1
-          $test_uids = array();
-          for ($i = 0; $i < $delete; $i++) { // 70
+          // Test is if clone0-clone9 have a status of 0
+          // and clone12,11... have a status of 1.
+          $test_uids = [];
+          // 70.
+          for ($i = 0; $i < $delete; $i++) {
             $name = "clone" . $i;
             $test_uids[] = @$cn_to_account[$name]->uid;
           }
@@ -1143,14 +1173,15 @@ class LdapUserIntegrationTests extends LdapTestCase {
             $clone_last = user_load($clone_last_uid, TRUE);
             $success = ($clone_last && $clone_last->status == 1);
           }
-        break;
+          break;
 
         case 'user_cancel_reassign':
         case 'user_cancel_delete':
-          // test is if clone0-clone9 are deleted
-          // and clone12,11... have a status of 1
-          $test_uids = array();
-          for ($i = 0; $i < $delete; $i++) { // 70
+          // Test is if clone0-clone9 are deleted
+          // and clone12,11... have a status of 1.
+          $test_uids = [];
+          // 70.
+          for ($i = 0; $i < $delete; $i++) {
             $name = "clone" . $i;
             $test_uids[] = @$cn_to_account[$name]->uid;
           }
@@ -1162,12 +1193,12 @@ class LdapUserIntegrationTests extends LdapTestCase {
             $clone_last = user_load($clone_last_uid, TRUE);
             $success = ($clone_last && $clone_last->status == 1);
           }
-        break;
+          break;
       }
 
       $this->assertTrue($success, $test_id, $test_text);
 
-      // remove all drupal users except 1 for next test
+      // Remove all drupal users except 1 for next test.
       foreach ($cn_to_account as $cn => $account) {
         @user_delete($account->uid);
       }
@@ -1176,28 +1207,39 @@ class LdapUserIntegrationTests extends LdapTestCase {
 
   }
 
-  function createLdapIdentifiedDrupalAccount($ldap_user_conf, $name, $sid) {
+  /**
+   *
+   */
+  public function createLdapIdentifiedDrupalAccount($ldap_user_conf, $name, $sid) {
 
     $account = NULL;
-    $user_edit = array('name' => $name);
+    $user_edit = ['name' => $name];
     $user = $ldap_user_conf->provisionDrupalAccount($account, $user_edit, NULL, TRUE);
 
     return user_load($user->uid, TRUE);
   }
 
 }
-
+/**
+ *
+ */
 class LdapUserUITests extends LdapTestCase {
 
+  /**
+   *
+   */
   public static function getInfo() {
-    return array(
+    return [
       'name' => 'LDAP User User Interface',
       'description' => 'Test ldap user admin interface.',
-      'group' => 'LDAP User'
-    );
+      'group' => 'LDAP User',
+    ];
   }
 
-  function __construct($test_id = NULL) {
+  /**
+   *
+   */
+  public function __construct($test_id = NULL) {
     parent::__construct($test_id);
   }
 
@@ -1205,27 +1247,29 @@ class LdapUserUITests extends LdapTestCase {
   protected $ldap_test_data;
 
   /**
-   *  create one or more server configurations in such as way
-   *  that this setUp can be a prerequisite for ldap_authentication and ldap_authorization
+   * Create one or more server configurations in such as way
+   *  that this setUp can be a prerequisite for ldap_authentication and ldap_authorization.
    */
-
-  function setUp() {
-    parent::setUp(array('ldap_user', 'ldap_test'));
+  public function setUp() {
+    parent::setUp(['ldap_user', 'ldap_test']);
     variable_set('ldap_simpletest', 2);
   }
 
-  function tearDown() {
+  /**
+   *
+   */
+  public function tearDown() {
     parent::tearDown();
     variable_del('ldap_help_watchdog_detail');
     variable_del('ldap_simpletest');
   }
 
   /**
-   * make sure user admin interface works.  (its a beast)
+   * Make sure user admin interface works.  (its a beast)
    */
-  function testUI() {
+  public function testUI() {
 
-    // just to give warning if setup doesn't succeed.  may want to take these out at some point.
+    // Just to give warning if setup doesn't succeed.  may want to take these out at some point.
     $setup_success = (
         module_exists('ldap_user') &&
         module_exists('ldap_servers') &&
@@ -1233,13 +1277,13 @@ class LdapUserUITests extends LdapTestCase {
       );
     $this->assertTrue($setup_success, ' ldap_user setup successful', $this->testId('user interface tests'));
 
-    $sids = array('activedirectory1');
+    $sids = ['activedirectory1'];
     $this->prepTestData('hogwarts', $sids, 'provisionToDrupal', 'default');
 
-    $this->privileged_user = $this->drupalCreateUser(array(
+    $this->privileged_user = $this->drupalCreateUser([
       'administer site configuration',
-      'administer users'
-      ));
+      'administer users',
+    ]);
 
     $this->drupalLogin($this->privileged_user);
 
@@ -1250,7 +1294,7 @@ class LdapUserUITests extends LdapTestCase {
     // Populate the field settings with new settings.
     $sid = 'activedirectory1';
 
-    $edit_direct_map = array(
+    $edit_direct_map = [
 
       'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_LDAP_ASSOCIATE,
       'drupalAcctProvisionServer' => $sid,
@@ -1259,12 +1303,8 @@ class LdapUserUITests extends LdapTestCase {
       'orphanedDrupalAcctBehavior' => 'ldap_user_orphan_email',
       'orphanedCheckQty' => '50',
       'ldapEntryProvisionServer' => $sid,
-    );
-    // 'wsEnabled' => TRUE, 'wsKey' => $wsKey,
-
-
-// 'wsUserIps' => join("\n", $wsUserIps),
-    $edit = $edit_direct_map + array(
+    ];
+    $edit = $edit_direct_map + [
       'drupalAcctProvisionTriggers[' . LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE . ']' => TRUE,
       'drupalAcctProvisionTriggers[' . LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE . ']' => TRUE,
 
@@ -1304,7 +1344,7 @@ class LdapUserUITests extends LdapTestCase {
       '2__sm__ldap_attr__2' => '[dn]',
       '2__sm__4__2' => TRUE,
       '2__sm__4__2' => TRUE,
-    );
+    ];
 
     $this->drupalPost('admin/config/people/ldap/user', $edit, t('Save'));
 
@@ -1314,20 +1354,16 @@ class LdapUserUITests extends LdapTestCase {
       $this->assertTrue($ldap_user_conf->{$property} == $value, $property . ' ' . t('field set correctly'), $this->testId('user interface tests'));
     }
 
-   // $this->assertTrue(
-   //   ($ldap_user_conf->wsUserIps[0] == $wsUserIps[0] && $ldap_user_conf->wsUserIps[1] == $wsUserIps[1])
-    //  , t('webserice ips set correctly'), $this->testId('user interface tests'));
-
     $this->assertTrue(
       isset($ldap_user_conf->drupalAcctProvisionTriggers[LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE]) &&
-      isset($ldap_user_conf->drupalAcctProvisionTriggers[LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE])
-      , t('drupal provision triggers set correctly'), $this->testId('user interface tests'));
+      isset($ldap_user_conf->drupalAcctProvisionTriggers[LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE]),
+       t('drupal provision triggers set correctly'), $this->testId('user interface tests'));
 
     $this->assertTrue(
       isset($ldap_user_conf->ldapEntryProvisionTriggers[LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE]) &&
       isset($ldap_user_conf->ldapEntryProvisionTriggers[LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE]) &&
-      isset($ldap_user_conf->ldapEntryProvisionTriggers[LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE])
-      , t('ldap provision triggers  set correctly'), $this->testId('user interface tests'));
+      isset($ldap_user_conf->ldapEntryProvisionTriggers[LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE]),
+       t('ldap provision triggers  set correctly'), $this->testId('user interface tests'));
 
     $field_token = '[field.field_lname]';
     $field_lname_set_correctly = (
@@ -1350,13 +1386,6 @@ class LdapUserUITests extends LdapTestCase {
       debug('ldap_user_conf->synchMapping[direction][field.field_lname]'); debug($ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER]['field.field_lname']);
     }
 
-
-
-    
   }
 
-
-
-  
-
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_argument.inc b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_argument.inc
index 0aba42c1..fb0a9608 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_argument.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_argument.inc
@@ -2,15 +2,18 @@
 
 /**
  * @file
- * Basic textfield argument to handle known ldap attributes
+ * Basic textfield argument to handle known ldap attributes.
  */
 
+/**
+ *
+ */
 class ldap_views_handler_argument extends views_handler_argument {
 
   /**
-   * Build the query based upon the formula
+   * Build the query based upon the formula.
    */
-  function query() {
+  public function query() {
     if ($this->real_field == 'basedn' || $this->real_field == 'filter') {
       $add_method = 'add_' . $this->real_field;
       $this->query->$add_method($this->argument);
@@ -19,4 +22,5 @@ class ldap_views_handler_argument extends views_handler_argument {
       $this->query->add_where(0, $this->real_field, $this->argument, '=');
     }
   }
+
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_argument_attribute.inc b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_argument_attribute.inc
index d00e6685..d963d1cc 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_argument_attribute.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_argument_attribute.inc
@@ -2,54 +2,59 @@
 
 /**
  * @file
- * Basic textfield argument to handle dynamic ldap attributes
+ * Basic textfield argument to handle dynamic ldap attributes.
  */
 
+/**
+ *
+ */
 class ldap_views_handler_argument_attribute extends views_handler_argument {
 
-  function option_definition() {
+  /**
+   *
+   */
+  public function option_definition() {
     $options = parent::option_definition();
-    $options['attribute_name'] = array('default' => '');
+    $options['attribute_name'] = ['default' => ''];
     return $options;
   }
 
-  function options_form(&$form, &$form_state) {
-/**
-    $current_display = $this->view->display[$this->view->current_display];
-    $qid             = isset($current_display->display_options['query']['options']['qid']) ? $current_display->display_options['query']['options']['qid']
-                                                                                           : $current_display->handler->default_display->display->display_options['query']['options']['qid'];
- */
-    $ldap_data       = new LdapQuery(ldap_views_get_qid($this->view)); //ldap_data_load($qid);
+  /**
+   *
+   */
+  public function options_form(&$form, &$form_state) {
+    $ldap_data = new LdapQuery(ldap_views_get_qid($this->view));
 
     if (empty($ldap_data)) {
-      $form['attribute_name'] = array(
+      $form['attribute_name'] = [
         '#markup' => 'You must select a valid LDAP search (Advanced::Query settings)',
-      );
+      ];
       return;
     }
 
     parent::options_form($form, $form_state);
 
-    $options         = array();
+    $options = [];
     foreach ($ldap_data->attributes as $attribute) {
       $options[$attribute] = $attribute;
     }
 
-    $form['attribute_name'] = array(
+    $form['attribute_name'] = [
       '#type' => 'select',
       '#title' => t('Attribute name'),
       '#description' => t('The attribute name from LDAP response'),
       '#options' => $options,
       '#default_value' => $this->options['attribute_name'],
       '#required' => TRUE,
-    );
+    ];
 
   }
 
   /**
-   * Build the query
+   * Build the query.
    */
-  function query($group_by = FALSE) {
+  public function query($group_by = FALSE) {
     $this->query->add_where(0, $this->options['attribute_name'], $this->argument, '=');
   }
+
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_field.inc b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_field.inc
index 7c631ccc..42f9c3be 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_field.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_field.inc
@@ -2,18 +2,27 @@
 
 /**
  * @file
- * LDAP field handler
+ * LDAP field handler.
  *
- * Defines a new class field handler for a default ldap field
+ * Defines a new class field handler for a default ldap field.
  */
 
+/**
+ *
+ */
 class ldap_views_handler_field extends views_handler_field {
 
-  function render($values) {
+  /**
+   *
+   */
+  public function render($values) {
     return array_key_exists($this->field_alias, $values) ? check_plain($values[$this->field_alias]) : '';
   }
 
-  function element_type($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
+  /**
+   *
+   */
+  public function element_type($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
     if (isset($this->definition['element type'])) {
       return $this->definition['element type'];
     }
@@ -21,48 +30,53 @@ class ldap_views_handler_field extends views_handler_field {
     return 'div';
   }
 
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['multivalue']      = array('default' => 'v-all');
-    $options['value_separator'] = array('default' => '');
-    $options['index_value']     = array('default' => 0);
+  /**
+   *
+   */
+  public function option_definition() {
+    $options                    = parent::option_definition();
+    $options['multivalue']      = ['default' => 'v-all'];
+    $options['value_separator'] = ['default' => ''];
+    $options['index_value']     = ['default' => 0];
     return $options;
   }
 
-  /*
-   * Add the field for the LDAP Attribute
+  /**
+   * Add the field for the LDAP Attribute.
    */
-  function options_form(&$form, &$form_state) {
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
-    $form['multivalue'] = array(
-      '#type' => 'select', // it should be 'radios', but it makes #dependency not to work
+    $form['multivalue'] = [
+    // It should be 'radios', but it makes #dependency not to work.
+      '#type' => 'select',
       '#title' => t('Values to show'),
       '#description' => t('What to do whith  multivalue attributes'),
-      '#options' => array(
+      '#options' => [
         'v-all' => t('All values'),
         'v-index' => t('Show Nth value'),
         'v-count' => t('Count values'),
-      ),
+      ],
       '#default_value' => $this->options['multivalue'],
       '#required' => TRUE,
-    );
-    $form['value_separator'] = array(
+    ];
+    $form['value_separator'] = [
       '#type' => 'textfield',
       '#title' => t('Value separator'),
       '#description' => t('Separator to use between values in multivalued attributes'),
       '#default_value' => $this->options['value_separator'],
-      '#dependency' => array(
-        'edit-options-multivalue' => array('v-all'),
-      ),
-    );
-    $form['index_value'] = array(
+      '#dependency' => [
+        'edit-options-multivalue' => ['v-all'],
+      ],
+    ];
+    $form['index_value'] = [
       '#type' => 'textfield',
       '#title' => t('Index'),
       '#description' => t('Index of the value to show. Use negative numbers to index from last item (0=First, -1=Last)'),
       '#default_value' => $this->options['index_value'],
-      '#dependency' => array(
-        'edit-options-multivalue' => array('v-index'),
-      ),
-    );
+      '#dependency' => [
+        'edit-options-multivalue' => ['v-index'],
+      ],
+    ];
   }
+
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_field_attribute.inc b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_field_attribute.inc
index 4afba50f..cf0e8c26 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_field_attribute.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_field_attribute.inc
@@ -2,60 +2,61 @@
 
 /**
  * @file
- * LDAP field handler
+ * LDAP field handler.
  *
- * Defines a new class field handler for a default ldap field
+ * Defines a new class field handler for a default ldap field.
  */
 
+/**
+ *
+ */
 class ldap_views_handler_field_attribute extends ldap_views_handler_field {
 
-
-  function option_definition() {
+  /**
+   *
+   */
+  public function option_definition() {
     $options = parent::option_definition();
-    $options['attribute_name'] = array('default' => '');
+    $options['attribute_name'] = ['default' => ''];
     return $options;
   }
 
-  /*
-   * Add the field for the LDAP Attribute
+  /**
+   * Add the field for the LDAP Attribute.
    */
-  function options_form(&$form, &$form_state) {
-/**
-    $current_display = $this->view->display[$this->view->current_display];
-    $qid             = isset($current_display->display_options['query']['options']['qid']) ? $current_display->display_options['query']['options']['qid']
-                                                                                           : $current_display->handler->default_display->display->display_options['query']['options']['qid'];
- */
-    $ldap_data       = new LdapQuery(ldap_views_get_qid($this->view)); //ldap_data_load($qid);
+  public function options_form(&$form, &$form_state) {
+    $ldap_data = new LdapQuery(ldap_views_get_qid($this->view));
 
     if (empty($ldap_data)) {
-      $form['attribute_name'] = array(
+      $form['attribute_name'] = [
         '#markup' => 'You must select a valid LDAP search (Advanced::Query settings)',
-      );
+      ];
       return;
     }
 
     parent::options_form($form, $form_state);
 
-    $options         = array();
+    $options = [];
     foreach ($ldap_data->attributes as $attribute) {
       $options[$attribute] = $attribute;
     }
 
-    $form['attribute_name'] = array(
+    $form['attribute_name'] = [
       '#type' => 'select',
       '#title' => t('Attribute name'),
       '#description' => t('The attribute name from LDAP response'),
       '#options' => $options,
       '#default_value' => $this->options['attribute_name'],
       '#required' => TRUE,
-    );
+    ];
   }
 
   /**
    * Called to add the field to a query.
    */
-  function query() {
+  public function query() {
     $this->real_field = $this->options['attribute_name'];
     parent::query();
   }
+
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_filter.inc b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_filter.inc
index df012d0f..ae2ec958 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_filter.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_filter.inc
@@ -6,13 +6,21 @@
  * including equality, contains, not contains, etc.
  */
 
+/**
+ *
+ */
 class ldap_views_handler_filter extends views_handler_filter {
-  // exposed filter options
-  var $always_multiple = TRUE;
+  /**
+   * Exposed filter options.
+   */
+  public $always_multiple = TRUE;
 
-  function option_definition() {
+  /**
+   *
+   */
+  public function option_definition() {
     $options = parent::option_definition();
-    $options['expose']['contains']['required'] = array('default' => FALSE);
+    $options['expose']['contains']['required'] = ['default' => FALSE];
     return $options;
   }
 
@@ -21,78 +29,78 @@ class ldap_views_handler_filter extends views_handler_filter {
    * to add or remove functionality by overriding this function and
    * adding/removing items from this array.
    */
-  function operators() {
-    $operators = array(
-      '=' => array(
+  public function operators() {
+    $operators = [
+      '=' => [
         'title' => t('Is equal to'),
         'short' => t('='),
         'method' => 'op_equal',
         'values' => 1,
-      ),
-      '!=' => array(
+      ],
+      '!=' => [
         'title' => t('Is not equal to'),
         'short' => t('!='),
         'method' => 'op_equal',
         'values' => 1,
-      ),
-      'contains' => array(
+      ],
+      'contains' => [
         'title' => t('Contains'),
         'short' => t('contains'),
         'method' => 'op_contains',
         'values' => 1,
-      ),
-      'starts' => array(
+      ],
+      'starts' => [
         'title' => t('Starts with'),
         'short' => t('begins'),
         'method' => 'op_starts',
         'values' => 1,
-      ),
-      'not_starts' => array(
+      ],
+      'not_starts' => [
         'title' => t('Does not start with'),
         'short' => t('not_begins'),
         'method' => 'op_not_starts',
         'values' => 1,
-      ),
-      'ends' => array(
+      ],
+      'ends' => [
         'title' => t('Ends with'),
         'short' => t('ends'),
         'method' => 'op_ends',
         'values' => 1,
-      ),
-      'not_ends' => array(
+      ],
+      'not_ends' => [
         'title' => t('Does not end with'),
         'short' => t('not_ends'),
         'method' => 'op_not_ends',
         'values' => 1,
-      ),
-      'not' => array(
+      ],
+      'not' => [
         'title' => t('Does not contain'),
         'short' => t('!has'),
         'method' => 'op_not',
         'values' => 1,
-      ),
-      'greater' => array(
+      ],
+      'greater' => [
         'title' => t('Greater than or equal to'),
         'short' => t('greater_eq'),
         'method' => 'op_greater_eq',
         'values' => 1,
-      ),
-      'less' => array(
+      ],
+      'less' => [
         'title' => t('Less than or equal to'),
         'short' => t('less_eq'),
         'method' => 'op_less_eq',
         'values' => 1,
-      ),
-    );
+      ],
+    ];
 
     return $operators;
   }
 
   /**
-   * Build strings from the operators() for 'select' options
+   * Build strings from the operators() for 'select' options.
    */
-  function operator_options($which = 'title') {
-    $options = array();
+  public function operator_options($which = 'title') {
+    $options = [];
     foreach ($this->operators() as $id => $info) {
       $options[$id] = $info[$which];
     }
@@ -100,7 +108,10 @@ class ldap_views_handler_filter extends views_handler_filter {
     return $options;
   }
 
-  function admin_summary() {
+  /**
+   *
+   */
+  public function admin_summary() {
     if (!empty($this->options['exposed'])) {
       return t('exposed');
     }
@@ -116,8 +127,11 @@ class ldap_views_handler_filter extends views_handler_filter {
     return $output;
   }
 
-  function operator_values($values = 1) {
-    $options = array();
+  /**
+   *
+   */
+  public function operator_values($values = 1) {
+    $options = [];
     foreach ($this->operators() as $id => $info) {
       if (isset($info['values']) && $info['values'] == $values) {
         $options[] = $id;
@@ -128,9 +142,9 @@ class ldap_views_handler_filter extends views_handler_filter {
   }
 
   /**
-   * Provide a simple textfield for equality
+   * Provide a simple textfield for equality.
    */
-  function value_form(&$form, &$form_state) {
+  public function value_form(&$form, &$form_state) {
     // We have to make some choices when creating this as an exposed
     // filter form. For example, if the operator is locked and thus
     // not rendered, we can't render dependencies; instead we only
@@ -143,7 +157,7 @@ class ldap_views_handler_filter extends views_handler_filter {
       $identifier = $this->options['expose']['identifier'];
 
       if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) {
-        // exposed and locked.
+        // Exposed and locked.
         $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none';
       }
       else {
@@ -152,29 +166,29 @@ class ldap_views_handler_filter extends views_handler_filter {
     }
 
     if ($which == 'all' || $which == 'value') {
-      $form['value'] = array(
+      $form['value'] = [
         '#type' => 'textfield',
         '#title' => t('Value'),
         '#size' => 30,
         '#default_value' => $this->value,
-      );
+      ];
       if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
         $form_state['input'][$identifier] = $this->value;
       }
 
       if ($which == 'all') {
-        $form['value'] += array(
-          '#dependency' => array($source => $this->operator_values(1)),
-        );
+        $form['value'] += [
+          '#dependency' => [$source => $this->operator_values(1)],
+        ];
       }
     }
 
     if (!isset($form['value'])) {
       // Ensure there is something in the 'value'.
-      $form['value'] = array(
+      $form['value'] = [
         '#type' => 'value',
-        '#value' => NULL
-      );
+        '#value' => NULL,
+      ];
     }
   }
 
@@ -185,7 +199,7 @@ class ldap_views_handler_filter extends views_handler_filter {
    * level of indirection. You will find them in $this->operator
    * and $this->value respectively.
    */
-  function query() {
+  public function query() {
     $this->ensure_my_table();
     $field = $this->real_field;
 
@@ -195,43 +209,73 @@ class ldap_views_handler_filter extends views_handler_filter {
     }
   }
 
-  function op_equal($field) {
+  /**
+   *
+   */
+  public function op_equal($field) {
     $this->query->add_where($this->options['group'], $field, $this->value, $this->operator);
   }
 
-  function op_contains($field) {
+  /**
+   *
+   */
+  public function op_contains($field) {
     $this->query->add_where($this->options['group'], $field, "*$this->value*", '=');
   }
 
-  function op_starts($field) {
+  /**
+   *
+   */
+  public function op_starts($field) {
     $this->query->add_where($this->options['group'], $field, "$this->value*", '=');
   }
 
-  function op_not_starts($field) {
+  /**
+   *
+   */
+  public function op_not_starts($field) {
     $this->query->add_where($this->options['group'], $field, "$this->value*", '!=');
   }
 
-  function op_ends($field) {
+  /**
+   *
+   */
+  public function op_ends($field) {
     $this->query->add_where($this->options['group'], $field, "*$this->value", '=');
   }
 
-  function op_not_ends($field) {
+  /**
+   *
+   */
+  public function op_not_ends($field) {
     $this->query->add_where($this->options['group'], $field, "*$this->value", '!=');
   }
 
-  function op_not($field) {
+  /**
+   *
+   */
+  public function op_not($field) {
     $this->query->add_where($this->options['group'], $field, "*$this->value*", '!=');
   }
 
-  function op_greater_eq($field) {
+  /**
+   *
+   */
+  public function op_greater_eq($field) {
     $this->query->add_where($this->options['group'], $field, $this->value, '>=');
   }
 
-  function op_less_eq($field) {
+  /**
+   *
+   */
+  public function op_less_eq($field) {
     $this->query->add_where($this->options['group'], $field, $this->value, '<=');
   }
 
-  function op_exists($field) {
+  /**
+   *
+   */
+  public function op_exists($field) {
     $this->query->add_where($this->options['group'], $field, '*', $this->operator == 'exists' ? '=' : '!=');
   }
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_filter_attribute.inc b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_filter_attribute.inc
index dbd80bad..734c4ba3 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_filter_attribute.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_filter_attribute.inc
@@ -3,21 +3,27 @@
 /**
  * @file
  * Basic textfield filter to handle string filtering commands for a generic ldap attribute
- * Includes new criterias
+ * Includes new criterias.
  */
 
+/**
+ *
+ */
 class ldap_views_handler_filter_attribute extends ldap_views_handler_filter {
 
   /**
    * Determine if a filter can be exposed.
    */
-  function can_expose() {
+  public function can_expose() {
     return TRUE;
   }
 
-  function option_definition() {
+  /**
+   *
+   */
+  public function option_definition() {
     $options = parent::option_definition();
-    $options['attribute_name'] = array('default' => '');
+    $options['attribute_name'] = ['default' => ''];
     return $options;
   }
 
@@ -26,97 +32,124 @@ class ldap_views_handler_filter_attribute extends ldap_views_handler_filter {
    * to add or remove functionality by overriding this function and
    * adding/removing items from this array.
    */
-  function operators() {
-    $operators = array(
-      'exists' => array(
+  public function operators() {
+    $operators = [
+      'exists' => [
         'title' => t('Exists'),
         'method' => 'op_exists',
         'short' => t('exists'),
         'values' => 0,
-      ),
-      'not exists' => array(
+      ],
+      'not exists' => [
         'title' => t('Not exists'),
         'method' => 'op_exists',
         'short' => t('not exists'),
         'values' => 0,
-      ),
-    );
+      ],
+    ];
 
     return parent::operators() + $operators;
   }
+
   /**
-   * Provide a simple textfield for equality
+   * Provide a simple textfield for equality.
    */
-  function value_form(&$form, &$form_state) {
-/*
-    $current_display = $this->view->display[$this->view->current_display];
-    $qid             = isset($current_display->display_options['query']['options']['qid']) ? $current_display->display_options['query']['options']['qid']
-                                                                                           : $current_display->handler->default_display->display->display_options['query']['options']['qid'];
- */
-    $ldap_data       = new LdapQuery(ldap_views_get_qid($this->view)); //ldap_data_load($qid);
+  public function value_form(&$form, &$form_state) {
+    $ldap_data = new LdapQuery(ldap_views_get_qid($this->view));
 
     if (empty($ldap_data)) {
-      $form['attribute_name'] = array(
+      $form['attribute_name'] = [
         '#markup' => 'You must select a valid LDAP search (Advanced::Query settings)',
-      );
+      ];
       return;
     }
 
-    $options         = array();
+    $options = [];
     foreach ($ldap_data->attributes as $attribute) {
       $options[$attribute] = $attribute;
     }
 
     if (empty($form_state['exposed'])) {
-      $form['attribute_name'] = array(
+      $form['attribute_name'] = [
         '#type' => 'select',
         '#title' => t('Attribute name'),
         '#description' => t('The attribute name from LDAP response'),
         '#options' => $options,
         '#default_value' => $this->options['attribute_name'],
         '#required' => TRUE,
-      );
+      ];
     }
 
     parent::value_form($form, $form_state);
   }
-  function op_equal($field) {
+
+  /**
+   *
+   */
+  public function op_equal($field) {
     parent::op_equal($this->options['attribute_name']);
   }
 
-  function op_contains($field) {
+  /**
+   *
+   */
+  public function op_contains($field) {
     parent::op_contains($this->options['attribute_name']);
   }
 
-  function op_starts($field) {
+  /**
+   *
+   */
+  public function op_starts($field) {
     parent::op_starts($this->options['attribute_name']);
   }
 
-  function op_not_starts($field) {
+  /**
+   *
+   */
+  public function op_not_starts($field) {
     parent::op_not_starts($this->options['attribute_name']);
   }
 
-  function op_ends($field) {
+  /**
+   *
+   */
+  public function op_ends($field) {
     parent::op_ends($this->options['attribute_name']);
   }
 
-  function op_not_ends($field) {
+  /**
+   *
+   */
+  public function op_not_ends($field) {
     parent::op_not_ends($this->options['attribute_name']);
   }
 
-  function op_not($field) {
+  /**
+   *
+   */
+  public function op_not($field) {
     parent::op_not($this->options['attribute_name']);
   }
 
-  function op_greater_eq($field) {
+  /**
+   *
+   */
+  public function op_greater_eq($field) {
     parent::op_greater_eq($this->options['attribute_name']);
   }
 
-  function op_less_eq($field) {
+  /**
+   *
+   */
+  public function op_less_eq($field) {
     parent::op_less_eq($this->options['attribute_name']);
   }
 
-  function op_exists($field) {
+  /**
+   *
+   */
+  public function op_exists($field) {
     parent::op_exists($this->options['attribute_name']);
   }
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_sort.inc b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_sort.inc
index e96a2c16..cb552963 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_sort.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_sort.inc
@@ -2,8 +2,11 @@
 
 /**
  * @file
- * Base sort handler for a ldap attributes
+ * Base sort handler for a ldap attributes.
  */
 
+/**
+ *
+ */
 class ldap_views_handler_sort extends views_handler_sort {
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_sort_attribute.inc b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_sort_attribute.inc
index 83d72a22..2e8a4dee 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_sort_attribute.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/handlers/ldap_views_handler_sort_attribute.inc
@@ -2,49 +2,55 @@
 
 /**
  * @file
- * Base sort handler for a ldap attributes
+ * Base sort handler for a ldap attributes.
  */
 
+/**
+ *
+ */
 class ldap_views_handler_sort_attribute extends ldap_views_handler_sort {
-  function option_definition() {
+
+  /**
+   *
+   */
+  public function option_definition() {
     $options = parent::option_definition();
-    $options['attribute_name'] = array('default' => '');
+    $options['attribute_name'] = ['default' => ''];
     return $options;
   }
 
-  function options_form(&$form, &$form_state) {
-/*
-    $current_display = $this->view->display[$this->view->current_display];
-    $did             = isset($current_display->display_options['query']['options']['did']) ? $current_display->display_options['query']['options']['did']
-                                                                                           : $current_display->handler->default_display->display->display_options['query']['options']['did'];
- */
-    $ldap_data       = new LdapQuery(ldap_views_get_qid($this->view)); //ldap_data_load($did);
+  /**
+   *
+   */
+  public function options_form(&$form, &$form_state) {
+    $ldap_data = new LdapQuery(ldap_views_get_qid($this->view));
     if (empty($ldap_data)) {
-      $form['attribute_name'] = array(
+      $form['attribute_name'] = [
         '#markup' => 'You must select a valid LDAP search (Advanced::Query settings)',
-      );
+      ];
       return;
     }
 
     parent::options_form($form, $form_state);
-    $options         = array();
+    $options = [];
     foreach ($ldap_data->attributes as $attribute) {
       $options[$attribute] = $attribute;
     }
-    $form['attribute_name'] = array(
+    $form['attribute_name'] = [
       '#type' => 'select',
       '#title' => t('Attribute name'),
       '#description' => t('The attribute name from LDAP response'),
       '#options' => $options,
       '#default_value' => $this->options['attribute_name'],
       '#required' => TRUE,
-    );
+    ];
   }
 
   /**
    * Called to add the sort to a query.
    */
-  function query() {
+  public function query() {
     $this->query->add_orderby($this->table, $this->options['attribute_name'], $this->options['order']);
   }
+
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info
index 63f3bb2c..ea5d7f67 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info
+++ b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info
@@ -5,6 +5,7 @@ package = Lightweight Directory Access Protocol
 dependencies[] = ldap_query
 dependencies[] = views
 core = 7.x
+php = 5.4
 
 files[] = ldap_views.module
 files[] = ldap_views.install
@@ -22,8 +23,8 @@ files[] = handlers/ldap_views_handler_filter_attribute.inc
 files[] = handlers/ldap_views_handler_sort.inc
 files[] = handlers/ldap_views_handler_sort_attribute.inc
 
-; Information added by Drupal.org packaging script on 2018-08-13
-version = "7.x-2.4"
+; Information added by Drupal.org packaging script on 2019-04-20
+version = "7.x-2.5"
 core = "7.x"
 project = "ldap"
-datestamp = "1534201086"
+datestamp = "1555751588"
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.module b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.module
index 248b6a74..4cac7d2b 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.module
+++ b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.module
@@ -8,15 +8,18 @@
  * Implements hook_views_api().
  */
 function ldap_views_views_api() {
-  return array(
+  return [
     'api' => 3,
     'path' => drupal_get_path('module', 'ldap_views'),
-  );
+  ];
 }
 
+/**
+ *
+ */
 function ldap_views_get_qid(&$view) {
-    $current_display = $view->display[$view->current_display];
-    return isset($current_display->display_options['query']['options']['qid']) ?
+  $current_display = $view->display[$view->current_display];
+  return isset($current_display->display_options['query']['options']['qid']) ?
       $current_display->display_options['query']['options']['qid'] :
       $current_display->handler->default_display->display->display_options['query']['options']['qid'];
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.views.inc b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.views.inc
index b9447569..28d8cf52 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.views.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.views.inc
@@ -2,94 +2,92 @@
 
 /**
  * @file
- * Definition of ldap_views module
+ * Definition of ldap_views module.
  */
 
 /**
  * Implements hook_views_data().
  */
-
 function ldap_views_views_data() {
   $data['ldap']['table']['group'] = t('LDAP Query');
 
-  $data['ldap']['table']['base'] = array(
+  $data['ldap']['table']['base'] = [
     'field' => 'dn',
     'title' => t('LDAP Query'),
     'help' => t('Data from LDAP Server.'),
     'query class' => 'ldap_views',
-  );
-  // basedn
-  $data['ldap']['basedn'] = array(
+  ];
+  // Basedn.
+  $data['ldap']['basedn'] = [
     'title' => t('LDAP Base DN'),
     'help' => t('The LDAP search base entry'),
-    'argument' => array(
+    'argument' => [
       'handler' => 'ldap_views_handler_argument',
-    ),
-  );
+    ],
+  ];
   // filter
-  // Generic column
-  $data['ldap']['attribute'] = array(
+  // Generic column.
+  $data['ldap']['attribute'] = [
     'title' => t('LDAP Attribute'),
     'help' => t('An attribute in LDAP Server'),
-    'argument' => array(
+    'argument' => [
       'handler' => 'ldap_views_handler_argument_attribute',
-    ),
-    'field' => array(
+    ],
+    'field' => [
       'handler' => 'ldap_views_handler_field_attribute',
-    ),
-    'sort' => array(
+    ],
+    'sort' => [
       'handler' => 'ldap_views_handler_sort_attribute',
-    ),
-    'filter' => array(
+    ],
+    'filter' => [
       'handler' => 'ldap_views_handler_filter_attribute',
-    ),
-  );
-  $data['ldap']['dn'] = array(
+    ],
+  ];
+  $data['ldap']['dn'] = [
     'title' => t('DN'),
     'help' => t('Distinguished name'),
-    'field' => array(
+    'field' => [
       'handler' => 'ldap_views_handler_field',
-    ),
-    'sort' => array(
+    ],
+    'sort' => [
       'handler' => 'ldap_views_handler_sort',
-    ),
-    'filter' => array(
+    ],
+    'filter' => [
       'handler' => 'views_handler_filter_string',
-    ),
-  );
-  $data['ldap']['cn'] = array(
+    ],
+  ];
+  $data['ldap']['cn'] = [
     'title' => t('CN'),
     'help' => t('Common name'),
-    'argument' => array(
+    'argument' => [
       'handler' => 'ldap_views_handler_argument',
-    ),
-    'field' => array(
+    ],
+    'field' => [
       'handler' => 'ldap_views_handler_field',
-    ),
-    'sort' => array(
+    ],
+    'sort' => [
       'handler' => 'ldap_views_handler_sort',
-    ),
-    'filter' => array(
+    ],
+    'filter' => [
       'handler' => 'ldap_views_handler_filter',
-    ),
-  );
-  $data['ldap']['objectClass'] = array(
+    ],
+  ];
+  $data['ldap']['objectClass'] = [
     'title' => t('Object Class'),
     'help' => t('The LDAP objectClass'),
-    'argument' => array(
+    'argument' => [
       'handler' => 'ldap_views_handler_argument',
-    ),
-    'field' => array(
+    ],
+    'field' => [
       'handler' => 'ldap_views_handler_field',
-    ),
-    'sort' => array(
+    ],
+    'sort' => [
       'handler' => 'ldap_views_handler_sort',
-    ),
-    'filter' => array(
+    ],
+    'filter' => [
       'handler' => 'ldap_views_handler_filter',
-    ),
-  );
-
+    ],
+  ];
 
   return $data;
 }
@@ -97,13 +95,13 @@ function ldap_views_views_data() {
 /*
 Alternative to 'attribute' field: add fields here, but we need the qid. Alternative: bundles + entity fields
 function ldap_views_views_data_alter(&$data) {
-  $data['ldap']['example_field'] = array(
-    'title' => t('Example field'),
-    'help' => t('Some example content that references a user'),
-    'field' => array(
-      'handler' => 'ldap_views_handler_field',
-    ),
-  );
+$data['ldap']['example_field'] = array(
+'title' => t('Example field'),
+'help' => t('Some example content that references a user'),
+'field' => array(
+'handler' => 'ldap_views_handler_field',
+),
+);
 
 }
  */
@@ -112,13 +110,13 @@ function ldap_views_views_data_alter(&$data) {
  * Implements hook_views_plugins().
  */
 function ldap_views_views_plugins() {
-  return array(
-    'query' => array(
-      'ldap_views' => array(
+  return [
+    'query' => [
+      'ldap_views' => [
         'title' => t('LDAP'),
         'help' => t('Reads from an ldap server.'),
         'handler' => 'ldap_views_plugin_query_ldap',
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 }
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.views_default.inc b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.views_default.inc
index 7114c3d6..787c5b79 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.views_default.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.views_default.inc
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Defines a default ldap_view
+ * Defines a default ldap_view.
  */
 
 /**
@@ -12,7 +12,7 @@ function ldap_views_views_default_views() {
   /*
    * View 'ad_users'
    */
-  $view = new view;
+  $view = new view();
   $view->name = 'ad_users_example';
   $view->description = 'Users from AD. You must define a ldap data source whith ad_users identifier, and mail, name and samaccountname attributes';
   $view->tag = 'default';
@@ -33,36 +33,36 @@ function ldap_views_views_default_views() {
   $handler->display->display_options['pager']['type'] = 'full';
   $handler->display->display_options['pager']['options']['items_per_page'] = '10';
   $handler->display->display_options['style_plugin'] = 'table';
-  $handler->display->display_options['style_options']['columns'] = array(
+  $handler->display->display_options['style_options']['columns'] = [
     'attribute' => 'attribute',
     'attribute_1' => 'attribute_1',
     'attribute_2' => 'attribute_2',
     'attribute_3' => 'attribute_3',
     'attribute_4' => 'attribute_4',
-  );
+  ];
   $handler->display->display_options['style_options']['default'] = '-1';
-  $handler->display->display_options['style_options']['info'] = array(
-    'attribute' => array(
+  $handler->display->display_options['style_options']['info'] = [
+    'attribute' => [
       'align' => '',
       'separator' => '',
-    ),
-    'attribute_1' => array(
+    ],
+    'attribute_1' => [
       'align' => '',
       'separator' => '',
-    ),
-    'attribute_2' => array(
+    ],
+    'attribute_2' => [
       'align' => '',
       'separator' => '',
-    ),
-    'attribute_3' => array(
+    ],
+    'attribute_3' => [
       'align' => '',
       'separator' => '',
-    ),
-    'attribute_4' => array(
+    ],
+    'attribute_4' => [
       'align' => '',
       'separator' => '',
-    ),
-  );
+    ],
+  ];
   $handler->display->display_options['style_options']['override'] = 1;
   $handler->display->display_options['style_options']['sticky'] = 0;
   $handler->display->display_options['style_options']['empty_table'] = 0;
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc b/drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc
index c705aa65..436e8919 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc
@@ -2,32 +2,38 @@
 
 /**
  * @file
- * Defines the default query object which builds and execute a ldap query
+ * Defines the default query object which builds and execute a ldap query.
  */
 
+/**
+ *
+ */
 class ldap_views_plugin_query_ldap extends views_plugin_query {
 
   /**
-   * The base dn for the LDAP search
+   * The base dn for the LDAP search.
    */
   private $basedn = '';
 
   /**
-   * A list of filters to apply to the LDAP search
+   * A list of filters to apply to the LDAP search.
    */
-  private $filter = array();
+  private $filter = [];
 
   /**
    * Builds the necessary info to execute the query.
    */
-  function build(&$view) {
+  public function build(&$view) {
     $view->init_pager($view);
 
     // Let the pager modify the query to add limits.
     $this->pager->query();
   }
 
-  function add_field($table, $field, $alias = '', $params = array()) {
+  /**
+   *
+   */
+  public function add_field($table, $field, $alias = '', $params = []) {
     // We check for this specifically because it gets a special alias.
     if ($table == $this->base_table && $field == $this->base_field && empty($alias)) {
       $alias = $this->base_field;
@@ -37,21 +43,20 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
       $alias = $table . '_' . $field;
     }
 
-    // Make sure an alias is assigned
+    // Make sure an alias is assigned.
     $alias = $alias ? $alias : $field;
 
     // PostgreSQL truncates aliases to 63 characters: http://drupal.org/node/571548
-
     // We limit the length of the original alias up to 60 characters
-    // to get a unique alias later if its have duplicates
+    // to get a unique alias later if its have duplicates.
     $alias = drupal_substr($alias, 0, 60);
 
     // Create a field info array.
-    $field_info = array(
+    $field_info = [
       'field' => $field,
       'table' => $table,
       'alias' => $alias,
-    ) + $params;
+    ] + $params;
 
     // Test to see if the field is actually the same or not. Due to
     // differing parameters changing the aggregation function, we need
@@ -69,18 +74,27 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
     return $alias;
   }
 
-  function add_orderby($table, $field, $order, $alias = '', $params = array()) {
-    $this->orderby[] = array(
+  /**
+   *
+   */
+  public function add_orderby($table, $field, $order, $alias = '', $params = []) {
+    $this->orderby[] = [
       'field' => $field,
-      'direction' => drupal_strtoupper($order)
-    );
+      'direction' => drupal_strtoupper($order),
+    ];
   }
 
-  function add_basedn($basedn) {
+  /**
+   *
+   */
+  public function add_basedn($basedn) {
     $this->basedn = !empty($this->basedn) ? $this->basedn : $basedn;
   }
 
-  function add_filter($filter) {
+  /**
+   *
+   */
+  public function add_filter($filter) {
     if (empty($filter)) {
       return;
     }
@@ -109,7 +123,7 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
    *
    * @see QueryConditionInterface::condition()
    */
-  function add_where($group, $field, $value = NULL, $operator = NULL) {
+  public function add_where($group, $field, $value = NULL, $operator = NULL) {
     // Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all
     // the default group.
     if (empty($group)) {
@@ -121,25 +135,28 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
       $this->set_where_group('AND', $group);
     }
 
-    $this->where[$group]['conditions'][] = array(
+    $this->where[$group]['conditions'][] = [
       'field' => $field,
       'value' => $value,
       'operator' => ltrim($operator, '!'),
       'negate' => drupal_substr($operator, 0, 1) == '!',
-    );
+    ];
   }
 
   /**
-   * Construct the filter
+   * Construct the filter.
    *
    * @param $where
    *   'where' or 'having'.
+   *
+   * @return string
    */
-  function build_condition() {
-    $operator = array('AND' => '&', 'OR' => '|');
+  public function build_condition() {
+    $operator = ['AND' => '&', 'OR' => '|'];
     $main_group = '';
     if (!isset($this->where)) {
-      $this->where = array(); // Initialize where clause if not set
+      // Initialize where clause if not set.
+      $this->where = [];
     }
     foreach ($this->where as $group => $info) {
       if (!empty($info['conditions'])) {
@@ -154,11 +171,17 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
     return count($this->where) <= 1 ? $main_group : '(' . $operator[$this->group_operator] . $main_group . ')';
   }
 
-  function build_ldap_basedn($basedn) {
-    return !empty($this->basedn) ? array($this->basedn) : $basedn;
+  /**
+   *
+   */
+  public function build_ldap_basedn($basedn) {
+    return !empty($this->basedn) ? [$this->basedn] : $basedn;
   }
 
-  function build_contextual_filter() {
+  /**
+   *
+   */
+  public function build_contextual_filter() {
     $contextual_filter = '';
     foreach ($this->filter as $condition) {
       $contextual_filter .= drupal_substr($condition, 0, 1) != '(' ? "($condition)" : $condition;
@@ -166,7 +189,10 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
     return $contextual_filter;
   }
 
-  function build_ldap_filter($filter) {
+  /**
+   *
+   */
+  public function build_ldap_filter($filter) {
     $condition     = $this->build_condition();
     $contextual    = $this->build_contextual_filter();
     $search_filter = !empty($contextual) && !empty($condition) ? '(&' . $condition . $contextual . ')' : $condition . $contextual;
@@ -191,7 +217,7 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
    *   The alias used to refer to this specific table, or NULL if the table
    *   cannot be ensured.
    */
-  function ensure_table($table, $relationship = NULL, $join = NULL) {
+  public function ensure_table($table, $relationship = NULL, $join = NULL) {
     return $table;
   }
 
@@ -204,9 +230,9 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
    *
    * $view->result should contain an array of objects.
    */
-  function execute(&$view) {
+  public function execute(&$view) {
     $start       = microtime(TRUE);
-    $entries     = array();
+    $entries     = [];
     $num_entries = 0;
 
     if (empty($this->options['qid'])) {
@@ -224,35 +250,28 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
     $ldap_server->bind();
     // TODO: Can't use sizelimit if it must be ordered || cache?
     // $ldap_server->search() hasn't orderby (ldap_sort)
-    // But we can't use ldap_sort because there's no DESC option
+    // But we can't use ldap_sort because there's no DESC option.
     foreach ($this->build_ldap_basedn($ldap_data->baseDn) as $basedn) {
 
       $result = $ldap_server->search($basedn, $this->build_ldap_filter($ldap_data->filter), array_values($attributes), 0, $ldap_data->sizelimit, $ldap_data->timelimit, $ldap_data->deref, $ldap_data->scope);
-/**
-    // ldap_sort can't be used because there's no DESC option
-    if (!empty($this->orderby)) {
-      // Array reverse, because the most specific are first - PHP works the opposite way of SQL.
-      foreach (array_reverse($this->orderby) as $field) {
-        @ldap_sort($ldap_server->connection, $result, $field['field']);
-      }
-    }
- */
-    if ($result !== FALSE) { // not an error
+      // ldap_sort can't be used because there's no DESC option
+      // Not an error.
+      if ($result !== FALSE) {
         $entries = array_merge($entries, $result);
         $num_entries += $result['count'];
         unset($result['count']);
       }
     }
     if (property_exists($view->query, 'limit')) {
-      $limit     = $view->query->limit;
+      $limit = $view->query->limit;
     }
-    $offset = property_exists($view->query, 'offset') ? $view->query->offset : 0;
-    $result      = array();
-    $sort_fields = array();
+    $offset      = property_exists($view->query, 'offset') ? $view->query->offset : 0;
+    $result      = [];
+    $sort_fields = [];
     if (!empty($this->orderby)) {
       foreach ($this->orderby as $orderby) {
         $sort_fields[drupal_strtolower($orderby['field'])]['direction'] = $orderby['direction'];
-        $sort_fields[drupal_strtolower($orderby['field'])]['data']      = array();
+        $sort_fields[drupal_strtolower($orderby['field'])]['data']      = [];
       }
 
     }
@@ -265,7 +284,7 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
         $entry['thumbnailphoto'][0] = '<img src="data:image/jpeg;base64,' . base64_encode($entry['thumbnailphoto'][0]) . '" alt="photo" />';
       }
       foreach ($view->field as $field) {
-        if (! isset($field_alias[$field->field_alias])) {
+        if (!isset($field_alias[$field->field_alias])) {
           continue;
         }
         $alias = $field_alias[$field->field_alias];
@@ -273,13 +292,15 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
           if (is_array($entry[$alias])) {
             switch ($field->options['multivalue']) {
               case 'v-all':
-                // remove 'count' index
+                // Remove 'count' index.
                 unset($entry[$alias]['count']);
                 $entry[$alias] = implode($field->options['value_separator'], $entry[$alias]);
                 break;
+
               case 'v-count':
                 $entry[$alias] = $entry[$alias]['count'];
                 break;
+
               case 'v-index':
                 $index = $field->options['index_value'] >= 0 ? intval($field->options['index_value']) : $entry[$alias]['count'] + $field->options['index_value'];
                 $entry[$alias] = array_key_exists($index, $entry[$alias]) ? $entry[$alias][$index] :
@@ -287,8 +308,8 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
                 break;
             }
           }
-          // order criteria
-          //If the field with alias $alias has a corresponding entry in $sort_fields, copy its value into the data key of $sort_fields for later sorting.
+          // Order criteria
+          // If the field with alias $alias has a corresponding entry in $sort_fields, copy its value into the data key of $sort_fields for later sorting.
           if (array_key_exists($alias, $sort_fields)) {
             $sort_fields[$alias]['data'][$key] = $entry[$alias];
           }
@@ -296,9 +317,9 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
       }
     }
     if (!empty($this->orderby) && !empty($entries)) {
-      $params = array();
+      $params = [];
       // In PHP 5.3 every parameter in the array has to be a reference when calling array_multisort() with call_user_func_array().
-      $asc  = SORT_ASC;
+      $asc = SORT_ASC;
       $desc = SORT_DESC;
       foreach ($sort_fields as &$field) {
         $params[] = &$field['data'];
@@ -311,10 +332,12 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
       }
       $params[] = &$entries;
 
-      // Some LDAP setups output a 'count' variable in the array, which changes the array size;
-      // temporarily remove it, sort the arrays, and then put it back.
+      // Some LDAP setups output a 'count' variable in the array, which changes
+      // the array size; temporarily remove it, sort the arrays, and then put it
+      // back.
       if (array_key_exists('count', $entries)) {
-        $countValue = $entries['count']; // remove the count variable
+        // Remove the count variable.
+        $countValue = $entries['count'];
         unset($entries['count']);
         $params[] = &$entries;
         call_user_func_array('array_multisort', $params);
@@ -327,10 +350,10 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
     }
 
     for ($i = 0; (!isset($limit) || $i < $limit) && $offset + $i < $num_entries; $i++) {
-      $row = array();
+      $row = [];
       $entry = &$entries[$offset + $i];
       foreach ($view->field as $field) {
-        if (! isset($field_alias[$field->field_alias])) {
+        if (!isset($field_alias[$field->field_alias])) {
           continue;
         }
         if (array_key_exists($field_alias[$field->field_alias], $entry)) {
@@ -340,65 +363,53 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
       $result[] = $row;
     }
 
-    $view->result       = $result;
-    $view->total_rows   = $num_entries;
-    $view->execute_time = microtime(TRUE) - $start;
-    $view->query->pager->total_items  = $num_entries;
+    $view->result                    = $result;
+    $view->total_rows                = $num_entries;
+    $view->execute_time              = microtime(TRUE) - $start;
+    $view->query->pager->total_items = $num_entries;
     $view->query->pager->update_page_info();
 
   }
 
-  function option_definition() {
+  /**
+   *
+   */
+  public function option_definition() {
     $options = parent::option_definition();
-    $options['qid'] = array('default' => '');
+    $options['qid'] = ['default' => ''];
 
     return $options;
   }
 
-  function options_form(&$form, &$form_state) {
-/**
-    $ldap_data = entity_load('ldap_data', FALSE);
-    $options   = array();
-    foreach ($ldap_data as $data) {
-        $options[$data->qid] = $data->name;
-    }
- */
-    $queries = array();
+  /**
+   *
+   */
+  public function options_form(&$form, &$form_state) {
+    $queries = [];
     $queries['all'] = LdapQueryAdmin::getLdapQueryObjects();
 
-  foreach ($queries['all'] as $_sid => $ldap_query) {
-    if ($ldap_query->status == 1) {
-      //$queries['enabled'][$_qid] = $ldap_query;
-      $options[$ldap_query->qid] = $ldap_query->name;
+    foreach ($queries['all'] as $_sid => $ldap_query) {
+      if ($ldap_query->status == 1) {
+        $options[$ldap_query->qid] = $ldap_query->name;
+      }
     }
-  }
-// ******************************************************
-      $form['qid'] = array(
+    $form['qid'] = [
       '#type' => 'select',
       '#title' => t('LDAP Search'),
       '#options' => $options,
       '#default_value' => $this->options['qid'],
       '#description' => t("The LDAP server to query."),
-    );
+    ];
   }
 
-
   /**
    * Let modules modify the query just prior to finalizing it.
    */
-  function alter(&$view) {
+  public function alter(&$view) {
     foreach (module_implements('views_query_alter') as $module) {
       $function = $module . '_views_query_alter';
       $function($view, $this);
     }
   }
 
-/* Only when adding dynamic fields in ldap_views_views_data_alter()
-  function options_submit(&$form, &$form_state) {
-    parent::options_submit(&$form, &$form_state);
-    if ($form_state['values']['query']['options']['qid'] != $form_state['view']->query->options['qid']) {
-      views_invalidate_cache();
-    }
-  }
- */
 }
