/**
  * @param string $remote_url
  * 
  * @return string
  * 
  * @throws \Exception if value fails to validate
  */
 protected function assertRemoteUrlValid($remote_url)
 {
     /*
      * Check syntax
      */
     try {
         $url = new \Altumo\String\Url($remote_url);
     } catch (\Exception $e) {
         throw new \Exception('Malformed remote URL.');
     }
     /*
      * check protocol, don't allow ftp or http
      */
     $scheme = $url->getScheme();
     if ($scheme == 'ftp') {
         throw new \Exception('FTP event callbacks are not supported.');
     }
     if ($scheme == 'http') {
         throw new \Exception('HTTP event callbacks are not supported. Please ensure that it is HTTPS for the current URL.');
     }
     return $remote_url;
 }
Example #2
0
 /**
  * Tests the getUrl method
  * 
  */
 public function testGetUrlMethod()
 {
     $url = new \Altumo\String\Url('http://www.domain.com/asdfsadf/fsadf/fasfd/fsdasda-safsd?safdsa=cow&meow=dog');
     $this->assertTrue($url->getUrl() === 'http://www.domain.com/asdfsadf/fsadf/fasfd/fsdasda-safsd?safdsa=cow&meow=dog');
     $url->setPath('/hello');
     $this->assertTrue($url->getUrl() === 'http://www.domain.com/hello?safdsa=cow&meow=dog');
     $url->setAnchor('whats_up');
     $this->assertTrue($url->getUrl() === 'http://www.domain.com/hello?safdsa=cow&meow=dog#whats_up');
 }