public function withADistanceOfAtLeast(int $distance): self
    {
        if ($this->elements->size() < 3) {
            throw new LogicException;
        }

        $path = clone $this;
        $path->elements = $this
            ->elements
            ->dropEnd(2)
            ->add(
                $this->elements->dropEnd(1)->last()->withADistanceOfAtLeast($distance)
            )
            ->add($this->elements->last());

        return $path;
    }
public function withADistanceOfAtLeast(int $distance): self
    {
        if ($this->elements->size() < 3) {
            throw new LogicException;
        }

        $path = clone $this;
        $path->elements = $this
            ->elements
            ->dropEnd(2)
            ->add(
                $this->elements->dropEnd(1)->last()->withADistanceOfAtLeast($distance)
            )
            ->add($this->elements->last());

        return $path;
    }
public function withADistanceOfAtLeast ( int $ distance ) : self { if ( $ this -> elements -> size ( ) < 3 ) { throw new LogicException ; } $ path = clone $ this ; $ path -> elements = $ this -> elements -> dropEnd ( 2 ) -> add ( $ this -> elements -> dropEnd ( 1 ) -> last ( ) -> withADistanceOfAtLeast ( $ distance ) ) -> add ( $ this -> elements -> last ( ) ) ; return $ path ; }
Define the minimum deepness of the relationship

@param int $distance

@throws LogicException If no relationship in the path

@return self
Define the minimum deepness of the relationship