@@ 739-752 (lines=14) @@ | ||
736 | * @param array $params |
|
737 | * @return self |
|
738 | */ |
|
739 | private function extractFields(array $params) |
|
740 | { |
|
741 | if (false === $this->issetNotEmpty(self::PARAM_FIELDSETS, $params)) { |
|
742 | return $this; |
|
743 | } |
|
744 | $fields = $params[self::PARAM_FIELDSETS]; |
|
745 | if (!is_array($fields)) { |
|
746 | throw RestException::invalidQueryParam(self::PARAM_FIELDSETS, 'The field parameter must be an array of entity type keys to fields.'); |
|
747 | } |
|
748 | foreach ($fields as $entityType => $string) { |
|
749 | $this->fields[$entityType] = explode(',', $string); |
|
750 | } |
|
751 | return $this; |
|
752 | } |
|
753 | ||
754 | /** |
|
755 | * Extracts pagination criteria from an array of query params. |
|
@@ 782-795 (lines=14) @@ | ||
779 | * @param array $params |
|
780 | * @return self |
|
781 | */ |
|
782 | private function extractFilters(array $params) |
|
783 | { |
|
784 | if (false === $this->issetNotEmpty(self::PARAM_FILTERING, $params)) { |
|
785 | return $this; |
|
786 | } |
|
787 | $filters = $params[self::PARAM_FILTERING]; |
|
788 | if (!is_array($filters)) { |
|
789 | throw RestException::invalidQueryParam(self::PARAM_FILTERING, 'The filter parameter must be an array keyed by filter name and value.'); |
|
790 | } |
|
791 | foreach ($filters as $key => $value) { |
|
792 | $this->filters[$key] = $value; |
|
793 | } |
|
794 | return $this; |
|
795 | } |
|
796 | ||
797 | /** |
|
798 | * Gets query string parameters that this request supports. |