Thruway\Common\Utils::uriIsValid PHP Method

uriIsValid() public static method

Strict URI Test
public static uriIsValid ( $uri ) : boolean
$uri
return boolean
    public static function uriIsValid($uri)
    {
        return !!preg_match('/^([0-9a-z_]+\\.)*([0-9a-z_]+)$/', $uri);
    }

Usage Example

Esempio n. 1
0
 /**
  * @param $uri
  * @param $options
  * @return bool
  */
 public function uriIsValid($uri, $options)
 {
     $uri = $this->fixupUri($uri);
     // if the uri is empty - then match everything
     if ($uri == "") {
         return true;
     }
     // if there is a trailing . then remove it and run it through the
     // regular validator
     $uri = substr($uri, strlen($uri) - 1) == "." ? substr($uri, 0, strlen($uri) - 1) : $uri;
     // allow matches to a normal URI or one with a trailing dot
     return Utils::uriIsValid($uri) || Utils::uriIsValid($uri . ".");
 }
All Usage Examples Of Thruway\Common\Utils::uriIsValid