Beispiel #1
0
        for ($i = 0; $i < $paramsC; $i++) {
            $str = str_replace("{{$i}}", isset($colors[$i]) ? sprintf("[;%dm%s", $colors[$i], $params[$i]) : $params[$i], $str);
        }
        echo $str;
    }
    public static function in()
    {
        return fgets(STDIN);
    }
}
if ($argc > 1) {
    function toUpper($char)
    {
        return chr(ord($char) ^ 32);
    }
    function firstLetterToUpper($str)
    {
        $str[0] = toUpper($str[0]);
        return $str;
    }
    $route = explode('/', $argv[1]);
    $controller = 'console\\controllers\\' . firstLetterToUpper(trim($route[0])) . 'Controller';
    $action = 'action' . firstLetterToUpper(isset($route[1]) ? trim($route[1]) : 'Index');
    if ($argc > 2) {
        $params = array_slice($argv, 2);
    } else {
        $params = [];
    }
    $inst = new $controller();
    $inst->{$action}($params);
}
Beispiel #2
0
 }
 switch ($capitalization) {
     case "lower":
         $nextWord = strtolower($nextWord);
         break;
     case "upper":
         $nextWord = strtoupper($nextWord);
         break;
     case "title":
         $nextWord = firstLetterToUpper($nextWord);
         break;
 }
 switch ($separator) {
     case "camel":
         if ($i != 0) {
             $nextWord = firstLetterToUpper($nextWord);
         }
         break;
     case "hyphens":
         if ($i < $wordCount - 1) {
             $nextWord = $nextWord . "-";
         }
         break;
     case "spaces":
         if ($i < $wordCount - 1) {
             $nextWord = $nextWord . " ";
         }
         break;
 }
 $result = $result . $nextWord;
 # Add a special symbol (in a random position), if requested.