public function to_array() { // Return an array representation of the record. $d = array(); if (!empty($this->valid_since)) { $d['@valid_since'] = PiplApi_Utils::piplapi_datetime_to_str($this->valid_since); } if (!empty($this->match)) { $d['@match'] = $this->match; } if (!empty($this->category)) { $d['@category'] = $this->category; } if (!empty($this->origin_url)) { $d['@origin_url'] = $this->origin_url; } if (!empty($this->sponsored)) { $d['@sponsored'] = $this->sponsored; } if (!empty($this->domain)) { $d['@domain'] = $this->domain; } if (!empty($this->person_id)) { $d['@person_id'] = $this->person_id; } if (!empty($this->id)) { $d['@source_id'] = $this->id; } if (!empty($this->premium)) { $d['@premium'] = $this->premium; } return array_merge($d, $this->fields_to_array()); }
public function to_array() { // Transform the date-range to a dict. $d = array(); if ($this->start) { $d['start'] = PiplApi_Utils::piplapi_date_to_str($this->start); } if ($this->end) { $d['end'] = PiplApi_Utils::piplapi_date_to_str($this->end); } return $d; }