public static function newFromUrlString($urlString) { if (strlen($urlString) <= 7) { return; } if (self::containsSpecialChar($urlString)) { return; } if ($urlString == WEBDIR) { return; } $url = new HttpUrl($urlString); if ($url->getDomainName() == 'localhost') { return; } return new self('', $urlString); }
function testHttpUrlFail() { $url = new HttpUrl(true); $this->assertEquals('', $url->getDomainName()); $this->assertEquals('', $url->getDirectory()); }