@param string $name
@param mixed  $value

@return mixed

@throws \InvalidArgumentException
175147
public function flash($name, $value = null)
    {
        $name .= 'DeimosFlash';

        if ($value === null)
        {
            $value = $this->get($name);
            $this->remove($name);
        }
        else
        {
            $this->set($name, $value);
        }

        return $value;
    }
462351
public function setPathParameter($name, $value) {
		
		// check whether path parameter $name exists

		if(empty($this->placeholders)) {
			throw new \InvalidArgumentException(sprintf("Unknown path parameter '%s'.", $name));
		}
		
		$found = false;

		foreach($this->placeholders as $placeholder) {
			if($placeholder['name'] === $name) {
				$found = true;
				break;
			}
		}

		if(!$found) {
			throw new \InvalidArgumentException(sprintf("Unknown path parameter '%s'.", $name));
		}
		
		$this->pathParameters[$name] = $value;

		return $this;
	}
628290
public final function withHeader($name, $value): MessageInterface
   {
       $value = $this->parseHeaderValue($value);
       if (!is_string($name) || [] === $value) {
           throw new InvalidArgumentException(
               "Can't get instance for header: invalid " . $name);
       }
       $header = $this->header;
       $header[$this->parseHeaderName($name)] = $value;
       return $this->with("header", $header);
   }
1236813
protected static function formatFieldValue($name, $value) {
		$field	= static::$validator->getField($name);
		if( $field ) {
			$field->getType()->formatValue($field, $value);
		}
		return parent::formatFieldValue($name, $value);
	}
366508
public function get($name, $value)
    {
        if ($this->has($name)) {
            return new self::$classMap[$name]($value);
        }

        return new Custom($name, $value);
    }
129490
public function setHeader($name, $value) {
        if (!is_string($name))                   throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
        if (!strlen($name))                      throw new InvalidArgumentException('Invalid argument $name: '.$name);
        if (isset($value) && !is_string($value)) throw new IllegalTypeException('Illegal type of parameter $value: '.gettype($value));

        $name  = trim($name);
        $value = trim($value);

        // drop existing headers of the same name (ignore case)
        $existing = \array_intersect_ukey($this->headers, [$name => '1'], 'strCaseCmp');
        foreach ($existing as $key => $v) {
            unset($this->headers[$key]);
        }

        // set new header if non-empty
        if (!empty($value)) {
            $this->headers[$name] = $value;
        }
        return $this;
    }
391469
public function getValueAttribute($name, $value = null)
    {
        if (is_null($name)) {
            return $value;
        }

        if (!str_contains($name, ['[', ']']) && !is_null($this->old($name))) {
            return $this->old($name);
        }


        if (!is_null($value)) {
            return $value;
        }

        if (isset($this->model)) {
            return $this->getModelValueAttribute($name);
        }
    }
538586
public function offsetGet($name)
    {
        if (!$this->offsetExists($name)) {
            throw new \InvalidArgumentException(sprintf('Fact "%s" is not defined.', $name));
        }

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

        // If the value is already frozen, or if it's not callable, or if it's protected, return the raw value
        if (isset($this->frozen[$name]) || !is_object($value) || $this->protected->contains($value) || !$this->isCallable($value)) {
            return $value;
        }

        // If this is a shared value, resolve, freeze, and return the result
        if ($this->shared->contains($value)) {
            $this->frozen[$name] = true;
            $this->raw[$name]    = $value;

            return $this->values[$name] = $value($this);
        }

        // Otherwise, resolve and return the result
        return $value($this);
    }
1323821
public static function request(String $name = NULL, $value = NULL)
    {
        return self::_method($name, $value, $_REQUEST, __FUNCTION__);
    }
184575
public function setArgument($name, $value) {
        if (!$this->definition->hasArgument($name)) {
            throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
        }

        $this->arguments[$name] = $value;
    }
325297
public function get(string $value)
    {
        if (!$this->has($value)) {
            throw new \InvalidArgumentException(\sprintf(
                'Value %s is not a valid key, expecting one of %s',
                $value,
                \implode(', ', \array_keys($this->values))
            ));
        }

        return $this->values[$value];
    }
311898
public function parameter(string $name, $value): HttpRequest
    {
        $this->parameters[$name] = $value;

        return $this;
    }
786347
public function offsetSet($name, $value)
    {
        if (is_null($name)) {
            throw new \InvalidArgumentException('The key name cannot be null.');
        }

        $this->set($name, $value);
    }
905075
public function set($name, $value)
    {
        $this->instance->unlock();
        $result = $this->instance->set($name, $value);
        $this->instance->lock();

        return $result;
    }
1230541
private function setParameter($name, $value)
    {
        switch ($name) {

            case 'email':
                $this->email = (string) $value;
                break;

            default:
                throw new \InvalidArgumentException('Not allowed parameter: '.$name);
                break;
        }
    }
586213
public function getParameter($name)
    {
        if (!array_key_exists($name, $this->parameters)) {
            throw new InvalidArgumentException(sprintf('Parameter: "%s" does not exist', $name));
        }

        return $this->parameters[$name];
    }
882876
public static function fromValue($value)
    {
        $values = static::getValues();
        if (array_key_exists($value, $values)) {
            return new static($values[$value], $value);
        }
        throw new \InvalidArgumentException("No enum constant value '$value' class " . get_called_class());
    }