private function ToCamelCase($name)
 {
     $result = '';
     $reader = new System\StringReader($name);
     $nextUp = true;
     while (false !== ($ch = $reader->ReadChar())) {
         if (ctype_punct($ch) || ctype_space($ch)) {
             $nextUp = true;
             continue;
         }
         if (System\String::IsLetter($ch)) {
             if ($nextUp) {
                 $result .= System\String::ToUpper($ch);
                 $nextUp = false;
             } else {
                 $result .= $ch;
             }
         }
         //else skip.
     }
     return $result;
 }
Example #2
0
 /**
  * Gathers the obligatory parameters from the url
  * @param string $url The page url
  * @return string[] Array of parameter names
  */
 static function GatherParams($url)
 {
     $reader = new StringReader($url);
     $param = '';
     $params = array();
     $start = false;
     while (false !== ($ch = $reader->ReadChar())) {
         if ($ch == '{') {
             $start = true;
         } else {
             if ($ch == '}' && $start) {
                 $params[] = $param;
                 $param = '';
                 $start = false;
             } else {
                 if ($start) {
                     $param .= $ch;
                 }
             }
         }
     }
     return $params;
 }
 private function GetNiceName($name)
 {
     $reader = new System\StringReader($name);
     $result = '';
     $prevIsLower = false;
     $idx = 0;
     while (false !== ($ch = $reader->ReadChar())) {
         if ($idx == 0) {
             $result .= System\String::ToLower($ch);
         } else {
             if (ctype_upper($ch)) {
                 if ($prevIsLower) {
                     $result .= ' ' . System\String::ToLower($ch);
                 } else {
                     $result .= System\String::ToLower($ch);
                 }
             } else {
                 $result .= $ch;
             }
         }
         $prevIsLower = ctype_lower($ch);
         ++$idx;
     }
     return $result;
 }