/** * Set url host. * * @param StringObject|string $host Url host. * * @throws UrlObjectException * @return $this */ public function setHost($host) { try { $host = new StringObject($host); } catch (\Exception $e) { throw new UrlObjectException($e->getMessage()); } $this->host = $host->stripTrailingSlash()->trim()->val(); $this->rebuildUrl(); return $this; }
public function testStripTrailingSlash2() { $s = new StringObject("/http://www.webiny.com//"); $s->stripTrailingSlash(); $this->assertSame('/http://www.webiny.com', $s->val()); }