Code Duplication    Length = 13-15 lines in 2 locations

src/API/Query.php 2 locations

@@ 712-726 (lines=15) @@
709
    /**
710
     * @return string A string representation of all of the currently set refinements.
711
     */
712
    public function getRefinementString()
713
    {
714
        if (!empty($this->navigations)) {
715
            $builder = new StringBuilder();
716
            foreach ($this->navigations as $n) {
717
                foreach ($n->getRefinements() as $r) {
718
                    $builder->append(Symbol::TILDE)->append($n->getName())->append($r->toTildeString());
719
                }
720
            }
721
            if ($builder->length() > 0) {
722
                return $builder->__toString();
723
            }
724
        }
725
        return null;
726
    }
727
728
    /**
729
     * @return string A string representation of all of the currently set custom url parameters.
@@ 731-743 (lines=13) @@
728
    /**
729
     * @return string A string representation of all of the currently set custom url parameters.
730
     */
731
    public function getCustomUrlParamsString()
732
    {
733
        if (!empty($this->customUrlParams)) {
734
            $builder = new StringBuilder();
735
            foreach ($this->customUrlParams as $c) {
736
                $builder->append(Symbol::TILDE)->append($c->getKey())->append(Symbol::EQUAL)->append($c->getValue());
737
            }
738
            if ($builder->length() > 0) {
739
                return $builder->__toString();
740
            }
741
        }
742
        return null;
743
    }
744
745
    /**
746
     * @param MSort $sort