src/Clause/Expression/Path.php
public function withParameter(string $key, $value): self
    {
        if ($this->lastOperation === Node::class) {
            $element = $this->elements->last();
        } else {
            $element = $this->elements->dropEnd(1)->last();
        }

        $element = $element->withParameter($key, $value);
        $path = new self;
        $path->lastOperation = $this->lastOperation;

        if ($this->lastOperation === Node::class) {
            $path->elements = $this
                ->elements
                ->dropEnd(1)
                ->add($element);
        } else {
            $path->elements = $this
                ->elements
                ->dropEnd(2)
                ->add($element)
                ->add($this->elements->last());
        }

        return $path;
    }
public function withParameter(string $key, $value): self
    {
        if ($this->lastOperation === Node::class) {
            $element = $this->elements->last();
        } else {
            $element = $this->elements->dropEnd(1)->last();
        }

        $element = $element->withParameter($key, $value);
        $path = new self;
        $path->lastOperation = $this->lastOperation;

        if ($this->lastOperation === Node::class) {
            $path->elements = $this
                ->elements
                ->dropEnd(1)
                ->add($element);
        } else {
            $path->elements = $this
                ->elements
                ->dropEnd(2)
                ->add($element)
                ->add($this->elements->last());
        }

        return $path;
    }
public function withParameter ( string $ key , $ value ) : self { if ( $ this -> lastOperation === Node :: class ) { $ element = $ this -> elements -> last ( ) ; } else { $ element = $ this -> elements -> dropEnd ( 1 ) -> last ( ) ; } $ element = $ element -> withParameter ( $ key , $ value ) ; $ path = new self ; $ path -> lastOperation = $ this -> lastOperation ; if ( $ this -> lastOperation === Node :: class ) { $ path -> elements = $ this -> elements -> dropEnd ( 1 ) -> add ( $ element ) ; } else { $ path -> elements = $ this -> elements -> dropEnd ( 2 ) -> add ( $ element ) -> add ( $ this -> elements -> last ( ) ) ; } return $ path ; }
Add the given parameter to the last operation

@param string $key
@param mixed $value

@return self
Add the given parameter to the last operation