Passed
Pull Request — master (#18)
by Matt
02:33
created
src/Tasks/LDAPMemberSyncTask.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      * @var array
29 29
      */
30 30
     private static $dependencies = [
31
-        'ldapService' => '%$' . LDAPService::class,
31
+        'ldapService' => '%$'.LDAPService::class,
32 32
     ];
33 33
 
34 34
     /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function getTitle()
52 52
     {
53
-        return _t(__CLASS__ . '.SYNCTITLE', 'Sync all users from Active Directory');
53
+        return _t(__CLASS__.'.SYNCTITLE', 'Sync all users from Active Directory');
54 54
     }
55 55
 
56 56
     /**
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
      */
155 155
     protected function log($message)
156 156
     {
157
-        $message = sprintf('[%s] ', date('Y-m-d H:i:s')) . $message;
158
-        echo Director::is_cli() ? ($message . PHP_EOL) : ($message . '<br>');
157
+        $message = sprintf('[%s] ', date('Y-m-d H:i:s')).$message;
158
+        echo Director::is_cli() ? ($message.PHP_EOL) : ($message.'<br>');
159 159
     }
160 160
 
161 161
     /**
Please login to merge, or discard this patch.
src/Tasks/LDAPMemberSyncOneTask.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @var array
28 28
      */
29 29
     private static $dependencies = [
30
-        'ldapService' => '%$' . LDAPService::class,
30
+        'ldapService' => '%$'.LDAPService::class,
31 31
     ];
32 32
 
33 33
     /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function getTitle()
37 37
     {
38
-        return _t(__CLASS__ . '.SYNCONETITLE', 'Sync single user from LDAP');
38
+        return _t(__CLASS__.'.SYNCONETITLE', 'Sync single user from LDAP');
39 39
     }
40 40
 
41 41
     /**
Please login to merge, or discard this patch.
src/Iterators/LDAPIterator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
         } else {
114 114
             $resultResource = ldap_search($resource, $baseDn, $this->getFilter());
115 115
         }
116
-        if (! is_resource($resultResource)) {
116
+        if (!is_resource($resultResource)) {
117 117
             /*
118 118
              * @TODO better exception msg
119 119
              */
120
-            throw new \Exception('ldap_search returned something wrong...' . ldap_error($resource));
120
+            throw new \Exception('ldap_search returned something wrong...'.ldap_error($resource));
121 121
         }
122 122
 
123 123
         $entries = ldap_get_entries($resource, $resultResource);
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         $attributeValue = [];
205 205
 
206 206
         $limit = $offset + $maxPerRequest - 1;
207
-        $searchedAttribute = $attrName . ';range=' . $offset . '-' . $limit;
207
+        $searchedAttribute = $attrName.';range='.$offset.'-'.$limit;
208 208
 
209 209
         $ldap = $this->getLdap();
210 210
         $entry = $ldap->getEntry($dn, [
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
     }
235 235
     public function current()
236 236
     {
237
-        if (! is_array($this->current)) {
237
+        if (!is_array($this->current)) {
238 238
             $this->rewind();
239 239
         }
240
-        if (! is_array($this->current)) {
240
+        if (!is_array($this->current)) {
241 241
             return;
242 242
         }
243 243
 
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
     }
246 246
     public function key()
247 247
     {
248
-        if (! is_array($this->current)) {
248
+        if (!is_array($this->current)) {
249 249
             $this->rewind();
250 250
         }
251
-        if (! is_array($this->current)) {
251
+        if (!is_array($this->current)) {
252 252
             return;
253 253
         }
254 254
 
Please login to merge, or discard this patch.
src/Services/LDAPService.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @var array
58 58
      */
59 59
     private static $dependencies = [
60
-        'gateway' => '%$' . LDAPGateway::class
60
+        'gateway' => '%$'.LDAPGateway::class
61 61
     ];
62 62
 
63 63
     /**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public static function get_cache()
135 135
     {
136
-        return Injector::inst()->get(CacheInterface::class . '.ldap');
136
+        return Injector::inst()->get(CacheInterface::class.'.ldap');
137 137
     }
138 138
 
139 139
     /**
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
         // show better errors than the defaults for various status codes returned by LDAP
216 216
         if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_ACCOUNT_LOCKED_OUT') !== false) {
217 217
             $message = _t(
218
-                __CLASS__ . '.ACCOUNTLOCKEDOUT',
219
-                'Your account has been temporarily locked because of too many failed login attempts. ' .
218
+                __CLASS__.'.ACCOUNTLOCKEDOUT',
219
+                'Your account has been temporarily locked because of too many failed login attempts. '.
220 220
                 'Please try again later.'
221 221
             );
222 222
         }
223 223
         if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_LOGON_FAILURE') !== false) {
224 224
             $message = _t(
225
-                __CLASS__ . '.INVALIDCREDENTIALS',
225
+                __CLASS__.'.INVALIDCREDENTIALS',
226 226
                 'The provided details don\'t seem to be correct. Please try again.'
227 227
             );
228 228
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     public function getNodes($cached = true, $attributes = [])
246 246
     {
247 247
         $cache = self::get_cache();
248
-        $cacheKey = 'nodes' . md5(implode('', $attributes));
248
+        $cacheKey = 'nodes'.md5(implode('', $attributes));
249 249
         $results = $cache->has($cacheKey);
250 250
 
251 251
         if (!$results || !$cached) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     {
276 276
         $searchLocations = $this->config()->groups_search_locations ?: [null];
277 277
         $cache = self::get_cache();
278
-        $cacheKey = 'groups' . md5(implode('', array_merge($searchLocations, $attributes)));
278
+        $cacheKey = 'groups'.md5(implode('', array_merge($searchLocations, $attributes)));
279 279
         $results = $cache->has($cacheKey);
280 280
 
281 281
         if (!$results || !$cached) {
@@ -543,13 +543,13 @@  discard block
 block discarded – undo
543 543
         }
544 544
 
545 545
         $member->IsExpired = ($data['useraccountcontrol'] & 2) == 2;
546
-        $member->LastSynced = (string)DBDatetime::now();
546
+        $member->LastSynced = (string) DBDatetime::now();
547 547
 
548 548
         foreach ($member->config()->ldap_field_mappings as $attribute => $field) {
549 549
             if (!isset($data[$attribute])) {
550 550
                 $this->getLogger()->notice(
551 551
                     sprintf(
552
-                        'Attribute %s configured in Member.ldap_field_mappings, ' .
552
+                        'Attribute %s configured in Member.ldap_field_mappings, '.
553 553
                                 'but no available attribute in AD data (GUID: %s, Member ID: %s)',
554 554
                         $attribute,
555 555
                         $data['objectguid'],
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             $group->Description = $data['description'];
766 766
         }
767 767
         $group->DN = $data['dn'];
768
-        $group->LastSynced = (string)DBDatetime::now();
768
+        $group->LastSynced = (string) DBDatetime::now();
769 769
         $group->write();
770 770
 
771 771
         // Mappings on this group are automatically maintained to contain just the group's DN.
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
                 ),
829 829
             ]);
830 830
         } catch (Exception $e) {
831
-            throw new ValidationException('LDAP synchronisation failure: ' . $e->getMessage());
831
+            throw new ValidationException('LDAP synchronisation failure: '.$e->getMessage());
832 832
         }
833 833
 
834 834
         $user = $this->getUserByUsername($member->Username);
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
                 'distinguishedname' => $dn
873 873
             ]);
874 874
         } catch (Exception $e) {
875
-            throw new ValidationException('LDAP group creation failure: ' . $e->getMessage());
875
+            throw new ValidationException('LDAP group creation failure: '.$e->getMessage());
876 876
         }
877 877
 
878 878
         $data = $this->getGroupByDN($dn);
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
             try {
1038 1038
                 $this->update($groupDn, ['member' => $members]);
1039 1039
             } catch (Exception $e) {
1040
-                throw new ValidationException('LDAP group membership remove failure: ' . $e->getMessage());
1040
+                throw new ValidationException('LDAP group membership remove failure: '.$e->getMessage());
1041 1041
             }
1042 1042
         }
1043 1043
     }
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
         try {
1064 1064
             $this->update($groupDn, ['member' => $members]);
1065 1065
         } catch (Exception $e) {
1066
-            throw new ValidationException('LDAP group membership add failure: ' . $e->getMessage());
1066
+            throw new ValidationException('LDAP group membership add failure: '.$e->getMessage());
1067 1067
         }
1068 1068
     }
1069 1069
 
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
         try {
1147 1147
             $this->delete($data['distinguishedname']);
1148 1148
         } catch (Exception $e) {
1149
-            throw new ValidationException('LDAP delete user failed: ' . $e->getMessage());
1149
+            throw new ValidationException('LDAP delete user failed: '.$e->getMessage());
1150 1150
         }
1151 1151
     }
1152 1152
 
Please login to merge, or discard this patch.