Airship\Engine\Lens::prepend PHP Method

prepend() public method

Maintain an array of values for later rendering, prepending the supplied value.
public prepend ( string $key, mixed $val ) : self
$key string Index
$val mixed Value
return self
    public function prepend(string $key, $val) : self
    {
        if (!isset($this->stored[$key])) {
            $this->stored[$key] = [];
        } elseif (!is_array($this->stored[$key])) {
            // Let's store the existing value as the first index
            $this->stored[$key] = [$this->stored[$key]];
        }
        \array_unshift($this->stored[$key], $val);
        return $this;
    }