Code Duplication    Length = 14-14 lines in 2 locations

src/Rest/RestRequest.php 2 locations

@@ 656-669 (lines=14) @@
653
     * @param   array   $params
654
     * @return  self
655
     */
656
    private function extractFields(array $params)
657
    {
658
        if (false === $this->issetNotEmpty(self::PARAM_FIELDSETS, $params)) {
659
            return $this;
660
        }
661
        $fields = $params[self::PARAM_FIELDSETS];
662
        if (!is_array($fields)) {
663
            throw RestException::invalidQueryParam(self::PARAM_FIELDSETS, 'The field parameter must be an array of entity type keys to fields.');
664
        }
665
        foreach ($fields as $entityType => $string) {
666
            $this->fields[$entityType] = explode(',', $string);
667
        }
668
        return $this;
669
    }
670
671
    /**
672
     * Extracts pagination criteria from an array of query params.
@@ 699-712 (lines=14) @@
696
     * @param   array   $params
697
     * @return  self
698
     */
699
    private function extractFilters(array $params)
700
    {
701
        if (false === $this->issetNotEmpty(self::PARAM_FILTERING, $params)) {
702
            return $this;
703
        }
704
        $filters = $params[self::PARAM_FILTERING];
705
        if (!is_array($filters)) {
706
            throw RestException::invalidQueryParam(self::PARAM_FILTERING, 'The filter parameter must be an array keyed by filter name and value.');
707
        }
708
        foreach ($filters as $key => $value) {
709
            $this->filters[$key] = $value;
710
        }
711
        return $this;
712
    }
713
714
    /**
715
     * Gets query string parameters that this request supports.