Example #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]*:?\\/\\//');
 }
Example #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('/^(\\/|\\?|#)/');
 }
Example #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);
 }
Example #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) === '?';
 }