Exemplo n.º 1
0
 /**
  * Check if the given url has a scheme or not
  *
  * @param UrlModel $url
  *
  * @return bool
  */
 public function isSatisfiedBy(UrlModel $url) : bool
 {
     if ((string) $url->substring(0, 2) === '//') {
         return true;
     }
     return !$url->match('/^[a-zA-Z]*:?\\/\\//');
 }
Exemplo n.º 2
0
 /**
  * Check if the given Url is a relative path
  *
  * @param UrlModel $url
  *
  * @return bool
  */
 public function isSatisfiedBy(UrlModel $url) : bool
 {
     if ((string) $url->substring(0, 2) === './') {
         return true;
     }
     if ((string) $url->substring(0, 3) === '../') {
         return true;
     }
     return !$url->match('/^(\\/|\\?|#)/');
 }
Exemplo n.º 3
0
 /**
  * Check if the given url is a valid url
  *
  * @param UrlModel $url
  *
  * @return bool
  */
 public function isSatisfiedBy(UrlModel $url) : bool
 {
     return $url->match($this->regex);
 }
Exemplo n.º 4
0
 /**
  * Check if the given Url is simply a query string
  *
  * @param UrlModel $url
  *
  * @return bool
  */
 public function isSatisfiedBy(UrlModel $url) : bool
 {
     return (string) $url->substring(0, 1) === '?';
 }