urls = $urls; $this->type = $type; $this->method = $method; } public function getType() { return $this->type; } public function add($url) { $this->urls[] = $url; } function jsonSerialize() { $data = [ $this->type . '_url' => $this->urls ]; if(isset($this->method)){ $data[$this->type . '_method'] = $this->method; } return $data; } }