Beispiel #1
0
 /**
  * Returns the user info of the URL, or an empty string if the user info is 
  * undefined.
  * 
  * @return string|null
  */
 public function getUserInfo()
 {
     return (MString::isNullOrEmpty($this->user) ? MString::EMPTY_STRING : $this->user) . (MString::isNullOrEmpty($this->password) ? MString::EMPTY_STRING : ':' . $this->password);
 }
 public function addJavascript($src)
 {
     if (MString::isNullOrEmpty($src) === false) {
         $this->javascript[] = array("src" => $src);
     }
 }
 /**
  * Validate the <i>$route</i>.<br>
  * If the route has some invalida data, an exception will be throw.<br>
  * The class name, the type and the role must not be null or empty.<br>
  * If the type is equal to MRouteType::CONTROLLER, the method property must not be null or empty.<br>
  *
  * @param MRoute $route
  * @throws MInvalidClassNameException
  * @throws MInvalidMethodNameException
  * @throws MInvalidRoleException
  * @throws MInvalidRouteTypeException
  */
 private function validateRoute(MRoute $route)
 {
     if (MString::isNullOrEmpty($route->getType())) {
         throw new MInvalidRouteTypeException();
     }
     if (MString::isNullOrEmpty($route->getClass())) {
         throw new MInvalidClassNameException();
     }
     if ($route->getType() != MRouteType::CONTROLLER && MString::isNullOrEmpty($route->getMethod())) {
         throw new MInvalidMethodNameException();
     }
     if (MString::isNullOrEmpty($route->getRole())) {
         throw new MInvalidRoleException();
     }
 }