Setter and getter of a specific field.

@param  string $name
@param  Tarsana\Syntax\Syntax|null $value
@return Tarsana\Syntax\Syntax|self

@throws InvalidArgumentException
775199
public function field(string $name, Syntax $value = null)
    {
        if ($value === null) {
            $names = explode('.', $name);
            $syntax = $this;
            foreach ($names as $field) {
                while (method_exists($syntax, 'syntax')) {
                    $syntax = $syntax->syntax();
                }
                if ($syntax instanceof ObjectSyntax && array_key_exists($field, $syntax->fields)) {
                    $syntax = $syntax->fields[$field];
                } else {
                    throw new \InvalidArgumentException("field '{$name}' not found");
                }
            }
            return $syntax;
        }

        $this->fields[$name] = $value;
        return $this;
    }
1118636
public function set($name, $value = null)
    {
        if ($name === 'value') {
            $value = htmlspecialchars($value);
        }
        parent::set($name, $value);

        return $this;
    }
86220
public function addHeader(string $name, string $value) : self
    {
        $name = $this->normalizeHeader($name);
        if (isset($this->headers[$name])) {
            throw new \InvalidArgumentException(
                sprintf("Header %s is already set with value '%s'", $name, $this->headers[$name])
            );
        }

        $this->headers[$name] = $value;

        return $this;
    }
1366451
public function setAttributes($name, $value = null) 
	{
		Argument::i()
			->test(1, 'string', 'array')
			->test(2, 'scalar', 'null');
		
		if(is_array($name)) {
			$this->attributes = $name;
			return $this;
		}
		
		$this->attributes[$name] = $value;
		return $this;
	}
895628
public function set($name, $value = null)
    {
        if ($this->has($name) && $this->get($name) !== $value)
        {
            $this->offsetSet($name, $value);

            //Reset the model
            $this->__model->reset(array($name));
        }

        return $this;
    }
498682
public function setProperty($name, $value)
    {
        if (!is_string($name)) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($name) ? get_class($name) : gettype($name))));
        }

        if (!is_string($value)) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value))));
        }

        $this->parseStyleAttribute();

        $this->properties[$name] = $value;

        $this->updateStyleAttribute();

        return $this;
    }
185520
public function set($name, $value)
    {
        $name = '_' . (string)$name;
        if (property_exists($this, $name) && (!is_array($this->$name))) {
            $this->$name = $value;
        }
        return $this;
    }
1047228
protected function populate($name, $value)
    {
        switch ($name) {
            case 'port':
                if (!is_int($value)) {
                    throw new InvalidArgumentException('Value given to set "'.$name.'" must be a valid int!!');
                }
                if (isset(self::$defaultPorts[$this->scheme]) && $value == self::$defaultPorts[$this->scheme]) {
                    break;
                }
                $this->$name = $value;
                break;
            case 'host':
                if (strpos($value, ':') !== false) {
                    $tmp = explode(':', $value);
                    $this->port((int)$tmp[1]);
                    $value = $tmp[0];
                }
                //Just extract port then go to the default case
            default:
                if (!is_string($value)) {
                    throw new InvalidArgumentException('Value given to set "'.$name.'" must be a valid string!!');
                }
                $this->$name = $value;
                break;
        }
    }
480302
public function setParameterGet($name, $value = null)
	{
		// Verifying if is array
		if (is_array($name)) {
			foreach ($name as $k => $v) {
				$this->setParameterGet($k,$v);
			}
		} else {
			$parray = &$this->paramsGet;
				
			if (is_null($value)) {
				if (isset($parray[$name])) unset($parray[$name]);
			} else {
				$parray[$name] = $value;
			}
		}
	
		return $this;
	}
147533
public function setValue(string $name, $value): self
    {
        $this->data[$name] = $value;

        return $this;
    }
1248054
public function set_property( $name, $value ) {
		$property = $this->get_property( $name );

		$property->setValue( $value );

		return $property;
	}
293299
public function set($name, $value = null)
    {
        if (is_string($name)) {
            $name = $this->cleanAttributeName($name);
            if ($value === null && isset($this->props[$name])) {
                unset($this->props[$name]);
            } elseif ($value !== null) {
                $this->props[$name] = $value;
            }
        }

        return $this;
    }
282209
protected function setData($name, $value = null)
    {
        if (is_array($name)) {
            $this->data = array_merge($this->data, $name);
        }
        elseif (is_string($name)) {
            $this->data[$name] = $value;
        }

        return $this;
    }
1165235
public function setContext($name, $value = null)
    {
        if (is_array($name)) {
            $this->context = $name + $this->context;
        } else {
            $this->context[$name] = $value;
        }
        return $this;
    }
920671
public function set($name, $value)
    {
        if ( !$value ) {
            $this->attributes->remove($name);

            return $this;
        }
        $this->attributes->set($name, $value);

        return $this;
    }
1334996
public function offsetSet($name, $value)
	{
		if ($name === null)
		{
			throw new InvalidArgumentException('The argument name cannot be null.');
		}

		$this->setArgument($name, $value);
	}
642251
public function offsetSet($name, $value)
    {
        if (is_null($name)) {
            throw new \InvalidArgumentException('The argument name cannot be null.');
        }

        $this->setArgument($name, $value);
    }