original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Add the given parameter to the last operation
  
  @param string $key
  @param mixed $value
  
  @return self
docstring_tokens: Add the given parameter to the last operation