@@ -88,11 +88,11 @@ |
||
88 | 88 | |
89 | 89 | $select = (is_array($this->select)) ? $this->select : []; |
90 | 90 | |
91 | - if(ctype_digit((string) $this->limit)){ |
|
91 | + if (ctype_digit((string) $this->limit)) { |
|
92 | 92 | $db->pageSize = $this->limit; |
93 | 93 | } |
94 | 94 | |
95 | - if(ctype_digit((string) $this->offset)){ |
|
95 | + if (ctype_digit((string) $this->offset)) { |
|
96 | 96 | $db->offset = $this->offset == 0 ? 1 : $this->offset; |
97 | 97 | } |
98 | 98 |
@@ -181,19 +181,19 @@ discard block |
||
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 |
||
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 |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function __construct(Connection $conn, $results, $config = []) |
73 | 73 | { |
74 | - $this->_conn = $conn; |
|
74 | + $this->_conn = $conn; |
|
75 | 75 | $this->_results = $results; |
76 | 76 | |
77 | - if(is_array($this->_results)){ |
|
77 | + if (is_array($this->_results)) { |
|
78 | 78 | foreach ($this->_results as $result) { |
79 | 79 | $this->_count += $this->_conn->countEntries($result); |
80 | 80 | $this->setEntries($result); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param resource $result |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - protected function setEntries($result){ |
|
101 | + protected function setEntries($result) { |
|
102 | 102 | $identifier = $this->_conn->getFirstEntry($result); |
103 | 103 | |
104 | 104 | while (false !== $identifier) { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function close() |
137 | 137 | { |
138 | - if(is_array($this->_results)){ |
|
138 | + if (is_array($this->_results)) { |
|
139 | 139 | foreach ($this->_results as $result) { |
140 | 140 | $this->_conn->freeResult($result); |
141 | 141 | } |
@@ -132,7 +132,7 @@ |
||
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 | } |
@@ -132,7 +132,7 @@ |
||
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 | } |
@@ -186,7 +186,7 @@ discard block |
||
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 |
||
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 | */ |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | # Create AD password (Microsoft Active Directory password format) |
138 | 138 | protected static function makeAdPassword($password) { |
139 | - $password = "\"" . $password . "\""; |
|
139 | + $password = "\"".$password."\""; |
|
140 | 140 | $adpassword = mb_convert_encoding($password, "UTF-16LE", "UTF-8"); |
141 | 141 | return $adpassword; |
142 | 142 | } |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | $results[] = $result; |
243 | 243 | } while ($cookie !== null && $cookie != ''); |
244 | 244 | |
245 | - if($this->offset > 0){ |
|
246 | - $results = $results[intval($this->offset/$this->pageSize -1)]; |
|
245 | + if ($this->offset > 0) { |
|
246 | + $results = $results[intval($this->offset / $this->pageSize - 1)]; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | return new DataReader($this, $results); |