Ejemplo n.º 1
0
 /**
  * Set url scheme.
  *
  * @param StringObject|string $scheme - Scheme must end with '://'. Example 'http://'.
  *
  * @throws UrlObjectException
  * @return $this
  */
 public function setScheme($scheme)
 {
     // validate scheme
     try {
         $scheme = new StringObject($scheme);
     } catch (\Exception $e) {
         throw new UrlObjectException($e->getMessage());
     }
     if (!$scheme->endsWith('://')) {
         $scheme->val($scheme->val() . '://');
     }
     // set the scheme
     $this->scheme = $scheme->trimRight('://')->val();
     $this->rebuildUrl();
     return $this;
 }
Ejemplo n.º 2
0
 public function testEndsWith2()
 {
     $s = new StringObject('Marry had a little lamb.');
     $this->assertFalse($s->endsWith('Marry'));
 }