@@ -134,6 +134,10 @@ |
||
134 | 134 | protected $userDN; |
135 | 135 | |
136 | 136 | # Create AD password (Microsoft Active Directory password format) |
137 | + |
|
138 | + /** |
|
139 | + * @param string $password |
|
140 | + */ |
|
137 | 141 | protected static function encodePassword($password) |
138 | 142 | { |
139 | 143 | $password = "\"" . $password . "\""; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | # Create AD password (Microsoft Active Directory password format) |
137 | 137 | protected static function encodePassword($password) |
138 | 138 | { |
139 | - $password = "\"" . $password . "\""; |
|
139 | + $password = "\"".$password."\""; |
|
140 | 140 | $adpassword = mb_convert_encoding($password, "UTF-16LE", "UTF-8"); |
141 | 141 | return $adpassword; |
142 | 142 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function open($anonymous = false) |
187 | 187 | { |
188 | - $token = 'Opening LDAP connection: ' . LdapHelper::recursive_implode($this->dc, ' or '); |
|
188 | + $token = 'Opening LDAP connection: '.LdapHelper::recursive_implode($this->dc, ' or '); |
|
189 | 189 | Yii::info($token, __METHOD__); |
190 | 190 | Yii::beginProfile($token, __METHOD__); |
191 | 191 | // Connect to the LDAP server. |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | protected function connect($hostname = [], $port = '389') |
213 | 213 | { |
214 | 214 | if (is_array($hostname)) { |
215 | - $hostname = self::PROTOCOL . implode(' ' . self::PROTOCOL, $hostname); |
|
215 | + $hostname = self::PROTOCOL.implode(' '.self::PROTOCOL, $hostname); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | $this->close(); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $this->open(); |
332 | 332 | $results = []; |
333 | 333 | $cookie = ''; |
334 | - $token = $function . ' - params: ' . LdapHelper::recursive_implode($params, ';'); |
|
334 | + $token = $function.' - params: '.LdapHelper::recursive_implode($params, ';'); |
|
335 | 335 | |
336 | 336 | Yii::info($token, 'chrmorandi\ldap\Connection::query'); |
337 | 337 |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
109 | - return count($parts) === 1 ? '(' . $parts[0] . ')' : '$(' . implode(') (', $parts) . ')'; |
|
109 | + return count($parts) === 1 ? '('.$parts[0].')' : '$('.implode(') (', $parts).')'; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | $operand = $this->build($operand); |
125 | 125 | } |
126 | 126 | if ($operand !== '' && !is_numeric($key)) { |
127 | - $parts[] = $key . '=' . $operand; |
|
127 | + $parts[] = $key.'='.$operand; |
|
128 | 128 | } elseif ($operand !== '') { |
129 | 129 | $other[] = $operand; |
130 | 130 | } |
131 | 131 | } |
132 | 132 | if (!empty($parts)) { |
133 | - return '(' . $this->operator[$operator] . '(' . implode(") (", $parts) . ')' . implode($other) . ')'; |
|
133 | + return '('.$this->operator[$operator].'('.implode(") (", $parts).')'.implode($other).')'; |
|
134 | 134 | } else if (!empty($other)) { |
135 | - return '(' . $this->operator[$operator] . implode($other) . ')'; |
|
135 | + return '('.$this->operator[$operator].implode($other).')'; |
|
136 | 136 | } else { |
137 | 137 | return ''; |
138 | 138 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | return ''; |
161 | 161 | } |
162 | 162 | |
163 | - return '(' . $this->operator['NOT'] . '(' . key($operands) . '=' . $operand . '))'; |
|
163 | + return '('.$this->operator['NOT'].'('.key($operands).'='.$operand.'))'; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | } |
215 | 215 | |
216 | 216 | if (count($sqlValues) > 1) { |
217 | - return "&($column=" . implode(")($column=", $sqlValues) . ')'; |
|
217 | + return "&($column=".implode(")($column=", $sqlValues).')'; |
|
218 | 218 | } else { |
219 | 219 | $operator = $operator === 'IN' ? '=' : '<>'; |
220 | - return $column . $operator . reset($sqlValues); |
|
220 | + return $column.$operator.reset($sqlValues); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | return $operator === 'IN' ? '0=1' : ''; |
247 | 247 | } |
248 | 248 | |
249 | - return '(&' . implode('', $vss) . ')'; |
|
249 | + return '(&'.implode('', $vss).')'; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -294,15 +294,15 @@ discard block |
||
294 | 294 | return $not ? '' : '0=1'; |
295 | 295 | } |
296 | 296 | |
297 | - $not = ($operator == 'NOT LIKE') ? '(' . $this->operator['NOT'] : false; |
|
297 | + $not = ($operator == 'NOT LIKE') ? '('.$this->operator['NOT'] : false; |
|
298 | 298 | |
299 | 299 | $parts = []; |
300 | 300 | foreach ($values as $value) { |
301 | 301 | $value = empty($escape) ? $value : strtr($value, $escape); |
302 | - $parts[] = $not . '(' . $column . '=*' . $value . '*)' . ($not ? ')' : ''); |
|
302 | + $parts[] = $not.'('.$column.'=*'.$value.'*)'.($not ? ')' : ''); |
|
303 | 303 | } |
304 | 304 | |
305 | - return '(' . $this->operator[trim($andor)] . implode($parts) . ')'; |
|
305 | + return '('.$this->operator[trim($andor)].implode($parts).')'; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if (count($values) === 1) { |
47 | 47 | throw new InvalidArgumentException(sprintf('Unable to parse DN piece "%s".', $values[0])); |
48 | 48 | } |
49 | - $dn[$index] = $values[0] . '=' . $values[1]; |
|
49 | + $dn[$index] = $values[0].'='.$values[1]; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return implode(',', $dn); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $rdn = self::explodeDn($dn, 0)[0]; |
64 | 64 | $rdn = explode('=', $rdn, 2); |
65 | 65 | |
66 | - return $rdn[0] . '=' . $rdn[1]; |
|
66 | + return $rdn[0].'='.$rdn[1]; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | |
85 | 85 | // Recursively iterates array and adds key/value to glued string |
86 | 86 | array_walk_recursive($array, function($value, $key) use ($glue, $include_keys, &$glued_string) { |
87 | - $include_keys and $glued_string .= $key . $glue; |
|
88 | - $glued_string .= $value . $glue; |
|
87 | + $include_keys and $glued_string .= $key.$glue; |
|
88 | + $glued_string .= $value.$glue; |
|
89 | 89 | }); |
90 | 90 | |
91 | 91 | // Removes last $glue from string |