public function setUrl($url) { $url = (string) $url; // make sure that the URL is suffixed with a forward slash if (substr($url, -1) !== '/') { $url .= '/'; } $this->url = $url; }