@@ 716-729 (lines=14) @@ | ||
713 | * @param array $params |
|
714 | * @return self |
|
715 | */ |
|
716 | private function extractFields(array $params) |
|
717 | { |
|
718 | if (false === $this->issetNotEmpty(self::PARAM_FIELDSETS, $params)) { |
|
719 | return $this; |
|
720 | } |
|
721 | $fields = $params[self::PARAM_FIELDSETS]; |
|
722 | if (!is_array($fields)) { |
|
723 | throw RestException::invalidQueryParam(self::PARAM_FIELDSETS, 'The field parameter must be an array of entity type keys to fields.'); |
|
724 | } |
|
725 | foreach ($fields as $entityType => $string) { |
|
726 | $this->fields[$entityType] = explode(',', $string); |
|
727 | } |
|
728 | return $this; |
|
729 | } |
|
730 | ||
731 | /** |
|
732 | * Extracts pagination criteria from an array of query params. |
|
@@ 759-772 (lines=14) @@ | ||
756 | * @param array $params |
|
757 | * @return self |
|
758 | */ |
|
759 | private function extractFilters(array $params) |
|
760 | { |
|
761 | if (false === $this->issetNotEmpty(self::PARAM_FILTERING, $params)) { |
|
762 | return $this; |
|
763 | } |
|
764 | $filters = $params[self::PARAM_FILTERING]; |
|
765 | if (!is_array($filters)) { |
|
766 | throw RestException::invalidQueryParam(self::PARAM_FILTERING, 'The filter parameter must be an array keyed by filter name and value.'); |
|
767 | } |
|
768 | foreach ($filters as $key => $value) { |
|
769 | $this->filters[$key] = $value; |
|
770 | } |
|
771 | return $this; |
|
772 | } |
|
773 | ||
774 | /** |
|
775 | * Gets query string parameters that this request supports. |