Completed
Push — master ( 808509...f69da3 )
by Christopher
06:05
created
ActiveRecord.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
             return 0;
182 182
         }
183 183
 
184
-        if(($condition = $this->getOldPrimaryKey(true)) !== $this->getPrimaryKey(true)) {
184
+        if (($condition = $this->getOldPrimaryKey(true)) !== $this->getPrimaryKey(true)) {
185 185
             // TODO Change DN
186 186
             static::getDb()->rename($condition, $newRdn, $newParent, true);
187
-            if (!$this->refresh()){
187
+            if (!$this->refresh()) {
188 188
                 Yii::info('Model not refresh.', __METHOD__);
189 189
                 return false;
190 190
             }
191 191
         }
192 192
         
193 193
         foreach ($values as $key => $value) {
194
-            if(empty ($this->getOldAttribute($key)) && $value === ''){
194
+            if (empty ($this->getOldAttribute($key)) && $value === '') {
195 195
                 unset($values[$key]);
196
-            } else if($value === ''){
196
+            } else if ($value === '') {
197 197
                 $attributes[] = ['attrib'  => $key, 'modtype' => LDAP_MODIFY_BATCH_REMOVE];
198 198
             } else if (empty ($this->getOldAttribute($key))) {
199 199
                 $attributes[] = ['attrib'  => $key, 'modtype' => LDAP_MODIFY_BATCH_ADD, 'values' => [$value]];
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public static function updateAll($attributes, $condition = '')
238 238
     {
239
-        if(is_array($condition)){
239
+        if (is_array($condition)) {
240 240
             $condition = $condition['dn'];
241 241
         }        
242 242
         
Please login to merge, or discard this patch.
FilterBuilder.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
             return '('.$this->operator[$operator].'('.implode(") (", $parts).')'.implode($other).')';
133 133
         } else if (!empty($other)) {
134 134
             return '('.$this->operator[$operator].implode($other).')';
135
-        }else {
135
+        } else {
136 136
             return '';
137 137
         }
138 138
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
             return '('.$this->operator[$operator].'('.implode(") (", $parts).')'.implode($other).')';
133 133
         } else if (!empty($other)) {
134 134
             return '('.$this->operator[$operator].implode($other).')';
135
-        }else {
135
+        } else {
136 136
             return '';
137 137
         }
138 138
     }
Please login to merge, or discard this patch.
Connection.php 2 patches
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      * Authenticate user
187 187
      * @param string $username
188 188
      * @param string $password
189
-     * @return int indicate occurrence of error. 
189
+     * @return boolean indicate occurrence of error. 
190 190
      */
191 191
     public function auth($username, $password)
192 192
     {
@@ -460,8 +460,6 @@  discard block
 block discarded – undo
460 460
     
461 461
     /**
462 462
      * Send LDAP pagination control.
463
-     * @param int    $pageSize
464
-     * @param bool   $isCritical
465 463
      * @param string $cookie
466 464
      * @return bool
467 465
      */
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     
140 140
     # Create AD password (Microsoft Active Directory password format)
141 141
     protected static function makeAdPassword($password) {
142
-        $password = "\"" . $password . "\"";
142
+        $password = "\"".$password."\"";
143 143
         $adpassword = mb_convert_encoding($password, "UTF-16LE", "UTF-8");
144 144
         return $adpassword;
145 145
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     protected function open($anonymous = false)
189 189
     {
190
-        $token = 'Opening LDAP connection: ' . LdapUtils::recursive_implode($this->dc, ' or ');
190
+        $token = 'Opening LDAP connection: '.LdapUtils::recursive_implode($this->dc, ' or ');
191 191
         Yii::info($token, __METHOD__);
192 192
         Yii::beginProfile($token, __METHOD__);
193 193
         // Connect to the LDAP server.
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         # Search for user and get user DN
245 245
         $searchResult = ldap_search($this->resource, $this->baseDn, "(&(objectClass=person)($this->loginAttribute=$username))", [$this->loginAttribute]);
246 246
         $entry = $this->getFirstEntry($searchResult);
247
-        if($entry) {
247
+        if ($entry) {
248 248
             $this->userDn = $this->getDn($entry);        
249 249
         } else {
250 250
             $this->userDn = null;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         }
274 274
 
275 275
         // Open connection with user
276
-        if(!$this->auth($username, $oldPassword)){
276
+        if (!$this->auth($username, $oldPassword)) {
277 277
             return false;
278 278
         }
279 279
         
@@ -312,20 +312,20 @@  discard block
 block discarded – undo
312 312
         $this->open();
313 313
         $results = [];
314 314
         $cookie = '';        
315
-        $token = $function . ' - params: ' . LdapUtils::recursive_implode($params, ';');
315
+        $token = $function.' - params: '.LdapUtils::recursive_implode($params, ';');
316 316
 
317
-        Yii::info($token , 'chrmorandi\ldap\Connection::query');
317
+        Yii::info($token, 'chrmorandi\ldap\Connection::query');
318 318
        
319 319
         Yii::beginProfile($token, 'chrmorandi\ldap\Connection::query');
320 320
         do {
321
-            if($this->pageSize > 0) {
321
+            if ($this->pageSize > 0) {
322 322
                 $this->setControlPagedResult($cookie);
323 323
             }
324 324
             
325 325
             // Run the search.
326 326
             $result = call_user_func($function, $this->resource, ...$params);
327 327
             
328
-            if($this->pageSize > 0) {
328
+            if ($this->pageSize > 0) {
329 329
                 $this->setControlPagedResultResponse($result, $cookie);
330 330
             }
331 331
             
Please login to merge, or discard this patch.
Query.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
         
98 98
         $select = (is_array($this->select)) ? $this->select : [];
99 99
         
100
-        if(ctype_digit((string) $this->limit)){
100
+        if (ctype_digit((string) $this->limit)) {
101 101
             $db->pageSize = $this->limit;            
102 102
         }        
103
-        if(ctype_digit((string) $this->offset)){
103
+        if (ctype_digit((string) $this->offset)) {
104 104
             $db->offset = $this->offset == 0 ? 1 : $this->offset;
105 105
         }
106 106
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function all($db = null)
119 119
     {    
120
-        if(!($this->dataReader instanceof DataReader)) {            
120
+        if (!($this->dataReader instanceof DataReader)) {            
121 121
             /** @var $result DataReader */
122 122
             $this->dataReader = $this->execute($db);
123 123
         } else {
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
                 $db = Yii::$app->get('ldap');
126 126
             }
127 127
             
128
-            if(ctype_digit((string) $this->limit)){
128
+            if (ctype_digit((string) $this->limit)) {
129 129
                 $db->pageSize = $this->limit;            
130 130
             }        
131
-            if(ctype_digit((string) $this->offset)){
131
+            if (ctype_digit((string) $this->offset)) {
132 132
                 $db->offset = $this->offset == 0 ? 1 : $this->offset;
133 133
             }
134 134
         }
Please login to merge, or discard this patch.
DataReader.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function __construct(Connection $conn, $results, $config = [])
76 76
     {
77
-        $this->_conn   = $conn;
77
+        $this->_conn = $conn;
78 78
         $this->_results = $results;
79 79
 
80
-        if(is_array($this->_results)){
80
+        if (is_array($this->_results)) {
81 81
             foreach ($this->_results as $result) {
82 82
                 $this->_count += $this->_conn->countEntries($result);
83 83
                 //$this->setEntries($result);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param resource $result
102 102
      * @return void
103 103
      */
104
-    protected function setEntries($result){
104
+    protected function setEntries($result) {
105 105
         $identifier = $this->_conn->getFirstEntry($result);
106 106
 
107 107
         while (false !== $identifier) {
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
             return [];
125 125
         }
126 126
         
127
-        $token = 'Get entries with limit pagination ' . $this->_conn->pageSize;
127
+        $token = 'Get entries with limit pagination '.$this->_conn->pageSize;
128 128
         Yii::beginProfile($token, __METHOD__);
129
-        if($this->_conn->offset > 0){
130
-            $this->setEntries($this->_results[intval($this->_conn->offset/$this->_conn->pageSize -1)]);
129
+        if ($this->_conn->offset > 0) {
130
+            $this->setEntries($this->_results[intval($this->_conn->offset / $this->_conn->pageSize - 1)]);
131 131
         } else {
132 132
             $this->setEntries($this->_results);
133 133
         }
134 134
         Yii::endProfile($token, __METHOD__);
135 135
         
136
-        $token = 'Get Attributes of entries with limit pagination in ' . $this->_conn->pageSize;
136
+        $token = 'Get Attributes of entries with limit pagination in '.$this->_conn->pageSize;
137 137
         Yii::beginProfile($token, __METHOD__);
138 138
         $data = [];
139 139
         foreach ($this as $item) {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function close()
153 153
     {
154
-        if(is_array($this->_results)){
154
+        if (is_array($this->_results)) {
155 155
             foreach ($this->_results as $result) {
156 156
                 $this->_conn->freeResult($result);
157 157
             }
Please login to merge, or discard this patch.