cleanUrl() public static method

Remove unnessary stuff + add http:// for external urls TODO: protocol to lower!
public static cleanUrl ( string $url, boolean $headerRedirect = false ) : string
$url string
$headerRedirect boolean
return string Cleaned Url
Ejemplo n.º 1
0
 /**
  * UtilityTest::testCleanUrl()
  *
  * @covers ::cleanUrl
  * @return void
  */
 public function testCleanUrl()
 {
     $res = Utility::cleanUrl('www.spiegel.de');
     $this->assertEquals('http://www.spiegel.de', $res);
     $res = Utility::cleanUrl('http://');
     $this->assertEquals('', $res);
     $res = Utility::cleanUrl('http://www');
     $this->assertEquals('', $res);
     $res = Utility::cleanUrl('spiegel.de');
     $this->assertEquals('http://spiegel.de', $res);
     $res = Utility::cleanUrl('spiegel.de', true);
     //echo returns($res);
     $this->assertEquals('http://www.spiegel.de', $res);
 }
Ejemplo n.º 2
0
 /**
  * @covers ::cleanUrl
  * @return void
  */
 public function testCleanUrl()
 {
     $res = Utility::cleanUrl('www.spiegel.de');
     $this->assertSame('http://www.spiegel.de', $res);
     $res = Utility::cleanUrl('http://');
     $this->assertSame('', $res);
     $res = Utility::cleanUrl('http://www');
     $this->assertSame('', $res);
     $res = Utility::cleanUrl('spiegel.de');
     $this->assertSame('http://spiegel.de', $res);
     $res = Utility::cleanUrl('spiegel.de', true);
     $this->assertSame('http://www.spiegel.de', $res);
 }