/** * @dataProvider urlsProvider */ public function testBasicHasGoodTermination($url, $status) { if ($status) { $this->assertTrue(UrlParserA::hasGoodTermination($url)); } else { $this->assertFalse(UrlParserA::hasGoodTermination($url)); } }
/** * @return string */ public function getModulePath() { $sModulePath = $this->getPath(); if (!SiteMapA::isValidMapPath($sModulePath) && SiteMapA::isValidObjectPath($sModulePath)) { $sModulePath = $this->getModuleMap()->getModulePath(); } if (!UrlParserA::hasGoodTermination($sModulePath, DIRECTORY_SEPARATOR)) { $sModulePath .= DIRECTORY_SEPARATOR; } return $sModulePath; }
public function testBasicIsAbsolutePath() { $test1 = '/'; $test2 = uniqid('/'); $test3 = uniqid('asd:'); $test4 = 'ana/are/mere'; $this->assertTrue(UrlParserA::isAbsolutePath($test1)); $this->assertTrue(UrlParserA::isAbsolutePath($test2)); $this->assertFalse(UrlParserA::isAbsolutePath($test3)); $this->assertFalse(UrlParserA::isAbsolutePath($test4)); }
/** * @return string */ public function getPath() { return UrlParserA::normalizePath($this->path); }
public function testEmptyWithCustomRequest() { $_SERVER = ['HTTP_HOST' => 'example.com', 'REQUEST_URI' => '/test/' . uniqid()]; $uri = sprintf('http://%s%s', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']); $this->assertEquals($uri, UrlParserA::getRequestUri()); }
public static function parse_url($sUrl = null) { return parent::parse_url($sUrl); }
private function getResourcePath($sPath) { if (is_file($this->getModulePath() . $sPath)) { $sPath = $this->getModulePath() . $sPath; } $oUrl = UrlParserA::url($sPath); if ($oUrl->isLocal()) { // I had a bad habit of correcting external URL's $sPath = $oUrl->getPath(); } return $sPath; }
/** * @return Url */ public function getUriObject() { if (!Url::isValid($this->oUri)) { $this->oUri = UrlParserA::url($this->getUri()); } return $this->oUri; }
/** * @returns UrlRWParser */ public static function getUriParser() { if (!UrlParserA::isValid(self::$oUriParser)) { self::$oUriParser = new UrlRWParser(); } return self::$oUriParser; }