@@ 728-741 (lines=14) @@ | ||
725 | * @param array $params |
|
726 | * @return self |
|
727 | */ |
|
728 | private function extractFields(array $params) |
|
729 | { |
|
730 | if (false === $this->issetNotEmpty(self::PARAM_FIELDSETS, $params)) { |
|
731 | return $this; |
|
732 | } |
|
733 | $fields = $params[self::PARAM_FIELDSETS]; |
|
734 | if (!is_array($fields)) { |
|
735 | throw RestException::invalidQueryParam(self::PARAM_FIELDSETS, 'The field parameter must be an array of entity type keys to fields.'); |
|
736 | } |
|
737 | foreach ($fields as $entityType => $string) { |
|
738 | $this->fields[$entityType] = explode(',', $string); |
|
739 | } |
|
740 | return $this; |
|
741 | } |
|
742 | ||
743 | /** |
|
744 | * Extracts pagination criteria from an array of query params. |
|
@@ 771-784 (lines=14) @@ | ||
768 | * @param array $params |
|
769 | * @return self |
|
770 | */ |
|
771 | private function extractFilters(array $params) |
|
772 | { |
|
773 | if (false === $this->issetNotEmpty(self::PARAM_FILTERING, $params)) { |
|
774 | return $this; |
|
775 | } |
|
776 | $filters = $params[self::PARAM_FILTERING]; |
|
777 | if (!is_array($filters)) { |
|
778 | throw RestException::invalidQueryParam(self::PARAM_FILTERING, 'The filter parameter must be an array keyed by filter name and value.'); |
|
779 | } |
|
780 | foreach ($filters as $key => $value) { |
|
781 | $this->filters[$key] = $value; |
|
782 | } |
|
783 | return $this; |
|
784 | } |
|
785 | ||
786 | /** |
|
787 | * Gets query string parameters that this request supports. |