Passed
Pull Request — master (#20)
by
unknown
05:25
created
src/Services/LDAPService.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @var array
50 50
      */
51 51
     private static $dependencies = [
52
-        'gateway' => '%$' . LDAPGateway::class
52
+        'gateway' => '%$'.LDAPGateway::class
53 53
     ];
54 54
 
55 55
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public static function get_cache()
127 127
     {
128
-        return Injector::inst()->get(CacheInterface::class . '.ldap');
128
+        return Injector::inst()->get(CacheInterface::class.'.ldap');
129 129
     }
130 130
 
131 131
     /**
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
         // show better errors than the defaults for various status codes returned by LDAP
208 208
         if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_ACCOUNT_LOCKED_OUT') !== false) {
209 209
             $message = _t(
210
-                __CLASS__ . '.ACCOUNTLOCKEDOUT',
211
-                'Your account has been temporarily locked because of too many failed login attempts. ' .
210
+                __CLASS__.'.ACCOUNTLOCKEDOUT',
211
+                'Your account has been temporarily locked because of too many failed login attempts. '.
212 212
                 'Please try again later.'
213 213
             );
214 214
         }
215 215
         if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_LOGON_FAILURE') !== false) {
216 216
             $message = _t(
217
-                __CLASS__ . '.INVALIDCREDENTIALS',
217
+                __CLASS__.'.INVALIDCREDENTIALS',
218 218
                 'The provided details don\'t seem to be correct. Please try again.'
219 219
             );
220 220
         }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     public function getNodes($cached = true, $attributes = [])
238 238
     {
239 239
         $cache = self::get_cache();
240
-        $cacheKey = 'nodes' . md5(implode('', $attributes));
240
+        $cacheKey = 'nodes'.md5(implode('', $attributes));
241 241
         $results = $cache->has($cacheKey);
242 242
 
243 243
         if (!$results || !$cached) {
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     {
268 268
         $searchLocations = $this->config()->groups_search_locations ?: [null];
269 269
         $cache = self::get_cache();
270
-        $cacheKey = 'groups' . md5(implode('', array_merge($searchLocations, $attributes)));
270
+        $cacheKey = 'groups'.md5(implode('', array_merge($searchLocations, $attributes)));
271 271
         $results = $cache->has($cacheKey);
272 272
 
273 273
         if (!$results || !$cached) {
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
         }
536 536
 
537 537
         $member->IsExpired = ($data['useraccountcontrol'] & 2) == 2;
538
-        $member->LastSynced = (string)DBDatetime::now();
538
+        $member->LastSynced = (string) DBDatetime::now();
539 539
 
540 540
         foreach ($member->config()->ldap_field_mappings as $attribute => $field) {
541 541
             // Special handling required for attributes that don't exist in the response.
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                 } else {
557 557
                     $this->getLogger()->debug(
558 558
                         sprintf(
559
-                            'Attribute %s configured in Member.ldap_field_mappings, ' .
559
+                            'Attribute %s configured in Member.ldap_field_mappings, '.
560 560
                             'but no available attribute in AD data (GUID: %s, Member ID: %s)',
561 561
                             $attribute,
562 562
                             $data['objectguid'],
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
         }
745 745
 
746 746
         // Lookup the previous mappings and see if there is any mappings no longer present.
747
-        $unmappedGroups = $member->Groups()->alterDataQuery(function (DataQuery $query) {
747
+        $unmappedGroups = $member->Groups()->alterDataQuery(function(DataQuery $query) {
748 748
             // join with the Group_Members table because we only want those group members assigned by this module.
749 749
             $query->leftJoin("Group_Members", '"Group_Members"."GroupID" = "Group"."ID"');
750 750
             $query->where('"Group_Members"."IsImportedFromLDAP" = 1');
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
             $group->Description = $data['description'];
786 786
         }
787 787
         $group->DN = $data['dn'];
788
-        $group->LastSynced = (string)DBDatetime::now();
788
+        $group->LastSynced = (string) DBDatetime::now();
789 789
         $group->write();
790 790
 
791 791
         // Mappings on this group are automatically maintained to contain just the group's DN.
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
                 ),
849 849
             ]);
850 850
         } catch (Exception $e) {
851
-            throw new ValidationException('LDAP synchronisation failure: ' . $e->getMessage());
851
+            throw new ValidationException('LDAP synchronisation failure: '.$e->getMessage());
852 852
         }
853 853
 
854 854
         $user = $this->getUserByUsername($member->Username);
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
                 'distinguishedname' => $dn
893 893
             ]);
894 894
         } catch (Exception $e) {
895
-            throw new ValidationException('LDAP group creation failure: ' . $e->getMessage());
895
+            throw new ValidationException('LDAP group creation failure: '.$e->getMessage());
896 896
         }
897 897
 
898 898
         $data = $this->getGroupByDN($dn);
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
                 $dn = $newDn;
949 949
             }
950 950
         } catch (Exception $e) {
951
-            throw new ValidationException('LDAP move failure: ' . $e->getMessage());
951
+            throw new ValidationException('LDAP move failure: '.$e->getMessage());
952 952
         }
953 953
 
954 954
         try {
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 
973 973
             $this->update($dn, $attributes);
974 974
         } catch (Exception $e) {
975
-            throw new ValidationException('LDAP synchronisation failure: ' . $e->getMessage());
975
+            throw new ValidationException('LDAP synchronisation failure: '.$e->getMessage());
976 976
         }
977 977
     }
978 978
 
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
             try {
1058 1058
                 $this->update($groupDn, ['member' => $members]);
1059 1059
             } catch (Exception $e) {
1060
-                throw new ValidationException('LDAP group membership remove failure: ' . $e->getMessage());
1060
+                throw new ValidationException('LDAP group membership remove failure: '.$e->getMessage());
1061 1061
             }
1062 1062
         }
1063 1063
     }
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
         try {
1084 1084
             $this->update($groupDn, ['member' => $members]);
1085 1085
         } catch (Exception $e) {
1086
-            throw new ValidationException('LDAP group membership add failure: ' . $e->getMessage());
1086
+            throw new ValidationException('LDAP group membership add failure: '.$e->getMessage());
1087 1087
         }
1088 1088
     }
1089 1089
 
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
         try {
1167 1167
             $this->delete($data['distinguishedname']);
1168 1168
         } catch (Exception $e) {
1169
-            throw new ValidationException('LDAP delete user failed: ' . $e->getMessage());
1169
+            throw new ValidationException('LDAP delete user failed: '.$e->getMessage());
1170 1170
         }
1171 1171
     }
1172 1172
 
Please login to merge, or discard this patch.