@@ -76,7 +76,7 @@ |
||
| 76 | 76 | * Returns the primary key name(s) for this AR class. |
| 77 | 77 | * This method should be overridden by child classes to define the primary key. |
| 78 | 78 | * |
| 79 | - * @return string[] the primary keys of this record. |
|
| 79 | + * @return string the primary keys of this record. |
|
| 80 | 80 | */ |
| 81 | 81 | public static function primaryKey() |
| 82 | 82 | { |
@@ -173,7 +173,7 @@ |
||
| 173 | 173 | $dn = $values[self::primaryKey()]; |
| 174 | 174 | unset($values[self::primaryKey()]); |
| 175 | 175 | |
| 176 | - if (($primaryKeys = static::getDb()->execute('ldap_add', [$dn,$values])) === false) { |
|
| 176 | + if (($primaryKeys = static::getDb()->execute('ldap_add', [$dn, $values])) === false) { |
|
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | $this->setAttribute(self::primaryKey(), $dn); |
@@ -189,7 +189,7 @@ |
||
| 189 | 189 | /** |
| 190 | 190 | * Returns the result of the current item. |
| 191 | 191 | * This method is required by the interface [[\Iterator]]. |
| 192 | - * @return integer the index of the current row. |
|
| 192 | + * @return string the index of the current row. |
|
| 193 | 193 | */ |
| 194 | 194 | public function key() |
| 195 | 195 | { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | Yii::endProfile('ldap_free_result', 'chrmorandi\ldap\DataReader'); |
| 141 | 141 | |
| 142 | 142 | $this->_result = null; |
| 143 | - $this->_row = null; |
|
| 143 | + $this->_row = null; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | $resource = $this->_conn->resource; |
| 213 | 213 | |
| 214 | - Yii::beginProfile('current:' . $this->key(), 'chrmorandi\ldap\DataReader'); |
|
| 214 | + Yii::beginProfile('current:'.$this->key(), 'chrmorandi\ldap\DataReader'); |
|
| 215 | 215 | $name = ldap_first_attribute($resource, $this->_row); |
| 216 | 216 | |
| 217 | 217 | while ($name) { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param string $dn |
| 112 | 112 | * @param array $entry |
| 113 | 113 | * |
| 114 | - * @return mixed |
|
| 114 | + * @return boolean |
|
| 115 | 115 | */ |
| 116 | 116 | public function modAdd($dn, array $entry) |
| 117 | 117 | { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param string $dn |
| 125 | 125 | * @param array $entry |
| 126 | 126 | * |
| 127 | - * @return mixed |
|
| 127 | + * @return boolean |
|
| 128 | 128 | */ |
| 129 | 129 | public function modReplace($dn, array $entry) |
| 130 | 130 | { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param string $dn |
| 138 | 138 | * @param array $entry |
| 139 | 139 | * |
| 140 | - * @return mixed |
|
| 140 | + * @return boolean |
|
| 141 | 141 | */ |
| 142 | 142 | public function modDelete($dn, array $entry) |
| 143 | 143 | { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @param $searchResult |
| 176 | 176 | * |
| 177 | - * @return mixed |
|
| 177 | + * @return resource |
|
| 178 | 178 | */ |
| 179 | 179 | public function getFirstEntry($searchResults) |
| 180 | 180 | { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @param $entry |
| 188 | 188 | * |
| 189 | - * @return mixed |
|
| 189 | + * @return resource |
|
| 190 | 190 | */ |
| 191 | 191 | public function getNextEntry($entry) |
| 192 | 192 | { |
@@ -220,6 +220,7 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | 222 | * {@inheritdoc} |
| 223 | + * @param integer $option |
|
| 223 | 224 | */ |
| 224 | 225 | public function setOption($option, $value) |
| 225 | 226 | { |
@@ -229,10 +230,8 @@ discard block |
||
| 229 | 230 | /** |
| 230 | 231 | * Sets an option on the current connection. |
| 231 | 232 | * |
| 232 | - * @param int $option |
|
| 233 | - * @param mixed $value |
|
| 234 | 233 | * |
| 235 | - * @return mixed |
|
| 234 | + * @return boolean |
|
| 236 | 235 | */ |
| 237 | 236 | public function setRebindCallback(callable $callback) |
| 238 | 237 | { |
@@ -242,7 +241,7 @@ discard block |
||
| 242 | 241 | /** |
| 243 | 242 | * Starts a connection using TLS. |
| 244 | 243 | * |
| 245 | - * @return mixed |
|
| 244 | + * @return boolean |
|
| 246 | 245 | */ |
| 247 | 246 | public function startTLS() |
| 248 | 247 | { |
@@ -253,7 +252,7 @@ discard block |
||
| 253 | 252 | * Returns the error number of the last command |
| 254 | 253 | * executed on the current connection. |
| 255 | 254 | * |
| 256 | - * @return mixed |
|
| 255 | + * @return integer |
|
| 257 | 256 | */ |
| 258 | 257 | public function getErrNo() |
| 259 | 258 | { |
@@ -96,14 +96,14 @@ |
||
| 96 | 96 | return ldap_modify_batch($this->resource, $dn, $values); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Add attribute values to current attributes. |
|
| 101 | - * |
|
| 102 | - * @param string $dn |
|
| 103 | - * @param array $entry |
|
| 104 | - * |
|
| 105 | - * @return mixed |
|
| 106 | - */ |
|
| 99 | + /** |
|
| 100 | + * Add attribute values to current attributes. |
|
| 101 | + * |
|
| 102 | + * @param string $dn |
|
| 103 | + * @param array $entry |
|
| 104 | + * |
|
| 105 | + * @return mixed |
|
| 106 | + */ |
|
| 107 | 107 | public function modAdd($dn, array $entry) |
| 108 | 108 | { |
| 109 | 109 | return ldap_mod_add($this->resource, $dn, $entry); |
@@ -339,7 +339,7 @@ |
||
| 339 | 339 | |
| 340 | 340 | /** |
| 341 | 341 | * Sets the SELECT part of the query. |
| 342 | - * @param string|array $columns the columns to be selected. |
|
| 342 | + * @param string $columns the columns to be selected. |
|
| 343 | 343 | * Columns can be specified in either a string (e.g. "id, name") or an array (e.g. ['id', 'name']). |
| 344 | 344 | * |
| 345 | 345 | * ```php |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $filter = (new FilterBuilder)->build($this->where); |
| 111 | - $select = (is_array($this->select))?$this->select:[]; |
|
| 111 | + $select = (is_array($this->select)) ? $this->select : []; |
|
| 112 | 112 | |
| 113 | 113 | $params = [ |
| 114 | 114 | $db->baseDn, |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $params = $this->createCommand($db); |
| 235 | 235 | |
| 236 | 236 | /** @var $result DataReader */ |
| 237 | - $result = $db->execute($this->scope, array_push($params,1)); |
|
| 237 | + $result = $db->execute($this->scope, array_push($params, 1)); |
|
| 238 | 238 | return $result->toArray(); |
| 239 | 239 | } |
| 240 | 240 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $params = $command->params; |
| 305 | 305 | $command->setSql($command->db->getQueryBuilder()->selectExists($command->getSql())); |
| 306 | 306 | $command->bindValues($params); |
| 307 | - return (boolean)$command->queryScalar(); |
|
| 307 | + return (boolean) $command->queryScalar(); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Get the current resource of connection. |
| 101 | 101 | * |
| 102 | - * @return mixed |
|
| 102 | + * @return Connection |
|
| 103 | 103 | */ |
| 104 | 104 | public function getResource() |
| 105 | 105 | { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * Retrieve the last error on the current |
| 141 | 141 | * connection. |
| 142 | 142 | * |
| 143 | - * @return string |
|
| 143 | + * @return boolean |
|
| 144 | 144 | */ |
| 145 | 145 | public function connect($hostname = [], $port = '389') |
| 146 | 146 | { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | * Closes the current connection. |
| 175 | 175 | * |
| 176 | - * @return mixed |
|
| 176 | + * @return boolean |
|
| 177 | 177 | */ |
| 178 | 178 | public function close() |
| 179 | 179 | { |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | </head> |
| 12 | 12 | <body> |
| 13 | 13 | <?php |
| 14 | - // put your code here |
|
| 14 | + // put your code here |
|
| 15 | 15 | |
| 16 | 16 | ?> |
| 17 | 17 | </body> |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $parts[] = "$column=$value"; |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | - return count($parts) === 1 ? '('.$parts[0].')' : '$(' . implode(') (', $parts) . ')'; |
|
| 101 | + return count($parts) === 1 ? '('.$parts[0].')' : '$('.implode(') (', $parts).')'; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | if (!empty($parts)) { |
| 124 | - return '('.$this->operator[$operator].'(' . implode(") (", $parts) . ')'.implode($other).' )'; |
|
| 124 | + return '('.$this->operator[$operator].'('.implode(") (", $parts).')'.implode($other).' )'; |
|
| 125 | 125 | } else { |
| 126 | 126 | return ''; |
| 127 | 127 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | return ''; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - return '('.$this->operator['NOT'].'('.key($operands) .'='.$operand.'))'; |
|
| 152 | + return '('.$this->operator['NOT'].'('.key($operands).'='.$operand.'))'; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (count($sqlValues) > 1) { |
| 211 | - return "$column $operator (" . implode(', ', $sqlValues) . ')'; |
|
| 211 | + return "$column $operator (".implode(', ', $sqlValues).')'; |
|
| 212 | 212 | } else { |
| 213 | 213 | $operator = $operator === 'IN' ? '=' : '<>'; |
| 214 | - return $column . $operator . reset($sqlValues); |
|
| 214 | + return $column.$operator.reset($sqlValues); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $columns[$i] = $this->db->quoteColumnName($col); |
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | - return '(' . implode(', ', $columns) . ") $operator ($sql)"; |
|
| 235 | + return '('.implode(', ', $columns).") $operator ($sql)"; |
|
| 236 | 236 | } else { |
| 237 | 237 | if (strpos($columns, '(') === false) { |
| 238 | 238 | $columns = $this->db->quoteColumnName($columns); |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | $vs = []; |
| 257 | 257 | foreach ($columns as $column) { |
| 258 | 258 | if (isset($value[$column])) { |
| 259 | - $phName = self::PARAM_PREFIX . count($params); |
|
| 259 | + $phName = self::PARAM_PREFIX.count($params); |
|
| 260 | 260 | $params[$phName] = $value[$column]; |
| 261 | 261 | $vs[] = $phName; |
| 262 | 262 | } else { |
| 263 | 263 | $vs[] = 'NULL'; |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | - $vss[] = '(' . implode(', ', $vs) . ')'; |
|
| 266 | + $vss[] = '('.implode(', ', $vs).')'; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | if (empty($vss)) { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $sqlColumns[] = strpos($column, '(') === false ? $this->db->quoteColumnName($column) : $column; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - return '(' . implode(', ', $sqlColumns) . ") $operator (" . implode(', ', $vss) . ')'; |
|
| 278 | + return '('.implode(', ', $sqlColumns).") $operator (".implode(', ', $vss).')'; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -323,15 +323,15 @@ discard block |
||
| 323 | 323 | return $not ? '' : '0=1'; |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - $not = ($operator == 'NOT LIKE') ? '(' . $this->operator['NOT'] : false; |
|
| 326 | + $not = ($operator == 'NOT LIKE') ? '('.$this->operator['NOT'] : false; |
|
| 327 | 327 | |
| 328 | 328 | $parts = []; |
| 329 | 329 | foreach ($values as $value) { |
| 330 | 330 | $value = empty($escape) ? $value : strtr($value, $escape); |
| 331 | - $parts[] = $not . '(' . $column .'=*'.$value . '*)' . ($not? ')':''); |
|
| 331 | + $parts[] = $not.'('.$column.'=*'.$value.'*)'.($not ? ')' : ''); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - return '('.$this->operator[trim($andor)] . implode($parts). ')'; |
|
| 334 | + return '('.$this->operator[trim($andor)].implode($parts).')'; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @link https://msdn.microsoft.com/en-us/library/ms680932(v=vs.85).aspx |
| 27 | 27 | * @var array |
| 28 | 28 | */ |
| 29 | - protected $objectClass = ['user','person','organizationalPerson', 'top']; |
|
| 29 | + protected $objectClass = ['user', 'person', 'organizationalPerson', 'top']; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * The date when the account expires. This value represents the number of 100-nanosecond |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | protected $wWWHomePage; |
| 290 | 290 | |
| 291 | - public function rules (){ |
|
| 292 | - return [['cn'],'required']; |
|
| 291 | + public function rules() { |
|
| 292 | + return [['cn'], 'required']; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | } |