public function setAttribute($key, $value, $subKey = null)
    {
        // Normalize key.
        $key = $this->normalizeAttributeKey($key);

        // If the key is equal to 'dn', we'll automatically
        // change it to the full attribute name.
        $key = ($key == 'dn' ? $this->schema->distinguishedName() : $key);

        if (is_null($subKey)) {
            // We need to ensure all attributes are set as arrays so all
            // of our model methods retrieve attributes correctly.
            $this->attributes[$key] = is_array($value) ? $value : [$value];
        } else {
            $this->attributes[$key][$subKey] = $value;
        }

        return $this;
    }
public function setAttribute($key, $value, $subKey = null)
    {
        // Normalize key.
        $key = $this->normalizeAttributeKey($key);

        // If the key is equal to 'dn', we'll automatically
        // change it to the full attribute name.
        $key = ($key == 'dn' ? $this->schema->distinguishedName() : $key);

        if (is_null($subKey)) {
            // We need to ensure all attributes are set as arrays so all
            // of our model methods retrieve attributes correctly.
            $this->attributes[$key] = is_array($value) ? $value : [$value];
        } else {
            $this->attributes[$key][$subKey] = $value;
        }

        return $this;
    }
public function setAttribute ( $ key , $ value , $ subKey = null ) { // Normalize key. $ key = $ this -> normalizeAttributeKey ( $ key ) ; // If the key is equal to 'dn', we'll automatically // change it to the full attribute name. $ key = ( $ key == 'dn' ? $ this -> schema -> distinguishedName ( ) : $ key ) ; if ( is_null ( $ subKey ) ) { // We need to ensure all attributes are set as arrays so all // of our model methods retrieve attributes correctly. $ this -> attributes [ $ key ] = is_array ( $ value ) ? $ value : [ $ value ] ; } else { $ this -> attributes [ $ key ] [ $ subKey ] = $ value ; } return $ this ; }
Sets an attributes value by the specified key and sub-key.

@param int|string $key
@param mixed      $value
@param int|string $subKey

@return $this
Sets an attributes value by the specified key and sub - key .