@param string $key
@param string $value

@return $this

@throws Exception\PropertyException
486014
public function setString($key, $value)
    {
        if (!settype($value, 'string')) {
            $errMsg = 'Ошибка при конвертации к типу string';
            throw new Exception\PropertyException($errMsg);
        }
        if (strlen($value) > 255) {
            $errMsg = 'Строка не должна быть больше 255 символов';
            throw new Exception\PropertyException($errMsg);
        }
        $this->set(self::STRING, $key, $value);

        return $this;
    }
1335748
public function with($key, $value = '')
    {
        if (is_array($key)) {
            $this->appends = $key;
        } elseif (is_callable($value)) {
            $this->appends[$key] = value($value);
        } else {
            $this->appends[$key] = value($value);
        }

        return $this;
    }
230551
public function setValue($key, $value) {
		if( !isset($key) ) {
			// Invalid key
			throw new Exception("nullKey");
			
		} else if( !in_array($key, static::$fields) ) {
			// Unknown key
			throw new FieldNotFoundException($key, static::getClass());
			
		} else if( $key === static::$IDFIELD ) {
			// ID is not editable
			throw new Exception("idNotEditable");
			
		} else if( $value !== $this->data[$key] ) {
			// The value is different
			$this->addModFields($key);
			$this->data[$key] = $value;
		}
		return $this;
	}
347872
protected function setProperty($key, $value) {
        // convert string representations of special values
        if (is_string($value)) {
            switch (strtolower($value)) {
                case  'null' :
                case '(null)':
                    $value = null;
                    break;

                case  'true' :
                case '(true)':
                case  'on'   :
                case  'yes'  :
                    $value = true;
                    break;

                case  'false' :
                case '(false)':
                case  'off'   :
                case  'no'    :
                    $value = false;
                    break;

                default:
                    if (strIsQuoted($value)) {
                        $value = substr($value, 1, strlen($value)-2);
                    }
            }
        }

        // set the property depending on the existing data structure
        $properties  = &$this->properties;
        $subkeys     =  $this->parseSubkeys(strtolower($key));
        $subkeysSize =  sizeof($subkeys);

        for ($i=0; $i < $subkeysSize; ++$i) {
            $subkey = trim($subkeys[$i]);
            if (!strlen($subkey)) throw new InvalidArgumentException('Invalid argument $key: '.$key);

            if ($i+1 < $subkeysSize) {
                // not yet the last subkey
                if (!key_exists($subkey, $properties)) {
                    $properties[$subkey] = [];                              // create another array level
                }
                elseif (!is_array($properties[$subkey])) {
                    $properties[$subkey] = ['' => $properties[$subkey]];    // create another array level and keep the
                }                                                           // existing non-array value
                $properties = &$properties[$subkey];                        // reference the new array level
            }
            else {
                // the last subkey: check for bracket notation
                if (preg_match('/(.+)\b *\[ *\]$/', $subkey, $match)) {
                    // bracket notation
                    $subkey = $match[1];
                    if (!key_exists($subkey, $properties)) {
                        $properties[$subkey] = [$value];                    // create a new array value
                    }
                    else {
                        if (!is_array($properties[$subkey]))                // make the existing value the array root value
                            $properties[$subkey] = ['' => $properties[$subkey]];
                        $properties[$subkey][] = $value;                    // add an array value
                    }
                }
                else {
                    // regular non-bracket notation
                    if (!key_exists($subkey, $properties)) {
                        $properties[$subkey] = $value;                      // store the value regularily
                    }
                    else if (!is_array($properties[$subkey])) {
                        $properties[$subkey] = $value;                      // override the existing value
                    }

                    // modification of an array value
                    else if ($value === null) {
                        $properties[$subkey] = $value;                      // set the array to NULL, don't remove the key
                    }
                    else if (is_array($value)) {
                        $properties[$subkey] = $value;                      // replace the array
                    }
                    else {
                        $properties[$subkey][''] = $value;                  // set/override the array root value
                    }
                }
            }
        }

        // TODO: update the cache if the instance is a cached instance
    }
76307
public function setInt($key, $value)
    {
        if (!settype($value, 'integer')) {
            $errMsg = 'Ошибка при конвертации к типу integer';
            throw new Exception\PropertyException($errMsg);
        }
        $this->set(self::INT, $key, $value);

        return $this;
    }
1261619
public function setBoolean($key, $value)
    {
        if (!settype($value, 'boolean')) {
            $errMsg = 'Ошибка при конвертации к типу bool';
            throw new Exception\PropertyException($errMsg);
        }
        $this->set(self::BOOLEAN, $key, $value);

        return $this;
    }
1120961
public function setRaw(string $key, $value): self
    {
        $this->data[$key] = $value;
        return $this;
    }
961836
public function set($key, $value)
    {
        if (is_null($value)) {
            $value = 'NULL';
        } else if (is_bool($value)) {
            $value = $value ? 'TRUE' : 'FALSE';
        }
        
        $this->set[$key] = $value;
        
        return $this;
    }
1198646
public function set(string $key, $value): self
    {
        $this->data[$key] = $value;

        return $this;
    }
908825
public function set(string $key, $value): void {
		if (!property_exists($this, $key)) {
			throw new EntityException(
				sprintf("Unknown property (%s) in %s.", $key, get_class()),
				EntityException::UNKNOWN_PROPERTY
			);
		}
		
		$this->{$key} = $value;
	}
1331177
public function setArray($key, $value)
    {
        $newValue = null;
        if ($value instanceof Traversable) {
            $newValue = [];
            foreach ($value as $k => $v) {
                $newValue[$k] = $v;
            }
        } else {
            $newValue = $value;
        }

        if (!settype($newValue, 'array')) {
            $errMsg = 'Ошибка при конвертации к типу array';
            throw new Exception\PropertyException($errMsg);
        }
        $this->set(self::DATA_ARRAY, $key, $value);

        return $this;
    }
177165
public function set($value, $key = null)
    {
        if (is_null($key)) {
            $this->registry[] = $value;
        } else {
            $this->registry[$key] = $value;
        }
        return $this;
    }
1279013
public function setParam(string $key, $value): Mapping
    {
        $this->_mapping[$key] = $value;

        return $this;
    }
1365503
public function set($key, $value = null)
    {
        if (is_array($key))
        {
            foreach ($key as $name => $value)
            {
                $this->_data[$name] = $value;
            }
        }
        else
        {
            $this->_data[$key] = $value;
        }

        return $this;
    }
1185226
public function offsetSet($key, $value)
    {
        if (is_null($key)) {
            $this->values[] = $value;
        } else {
            $this->values[$key] = $value;
        }

        return $this;
    }
429846
public function set($key, $value = null)
    {
        if( is_array($key) ) {
            $this->values($key);
        } else {
            $this->value($key, $value);
        }
        return $this;
    }
488216
public function set(string $key, $value){
        if($this->status() !== self::ACTIVE){
            throw Exception\SessionException::notStarted();
        }

        $_SESSION[$key] = $value;
    }