public function withADistanceOf(int $distance): self
    {
        $clause = $this->clauses->last();

        if (!$clause instanceof Clause\PathAware) {
            throw new NonPathAwareClause;
        }

        $clause = $clause->withADistanceOf($distance);
        $query = new self;
        $query->clauses = $this
            ->clauses
            ->dropEnd(1)
            ->add($clause);

        return $query;
    }
public function withADistanceOf(int $distance): self
    {
        $clause = $this->clauses->last();

        if (!$clause instanceof Clause\PathAware) {
            throw new NonPathAwareClause;
        }

        $clause = $clause->withADistanceOf($distance);
        $query = new self;
        $query->clauses = $this
            ->clauses
            ->dropEnd(1)
            ->add($clause);

        return $query;
    }
public function withADistanceOf ( int $ distance ) : self { $ clause = $ this -> clauses -> last ( ) ; if ( ! $ clause instanceof Clause \ PathAware ) { throw new NonPathAwareClause ; } $ clause = $ clause -> withADistanceOf ( $ distance ) ; $ query = new self ; $ query -> clauses = $ this -> clauses -> dropEnd ( 1 ) -> add ( $ clause ) ; return $ query ; }
Define the deepness of the relationship

@param int $distance

@throws LogicException If no relationship in the path

@return self
Define the deepness of the relationship