public function __toString() { $tmp = (array) $this; $tmp['loc'] = ['start' => $this->loc->start, 'end' => $this->loc->end]; return json_encode($tmp); }