/** * @since 2.5 * * @param Query $query * * @return string */ public static function get(Query $query) { $serialized = array(); $serialized['conditions'] = $query->getQueryString(); $serialized['parameters'] = array('limit=' . $query->getLimit(), 'offset=' . $query->getOffset(), 'mainlabel=' . $query->getMainlabel()); if ($query->getQuerySource() !== null && $query->getQuerySource() !== '') { $serialized['parameters'] = array_merge($serialized['parameters'], array('source=' . $query->getQuerySource())); } list($serialized['sort'], $serialized['order']) = self::doSerializeSortKeys($query); $serialized['printouts'] = self::doSerializePrintouts($query); $encoded = $serialized['conditions'] . '|' . ($serialized['printouts'] !== array() ? implode('|', $serialized['printouts']) . '|' : '') . implode('|', $serialized['parameters']) . ($serialized['sort'] !== array() ? '|sort=' . implode(',', $serialized['sort']) : '') . ($serialized['order'] !== array() ? '|order=' . implode(',', $serialized['order']) : ''); return $encoded; }