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