Exemplo n.º 1
0
 /**
  * @return array
  */
 public function dispatch()
 {
     $argv = $_SERVER['argv'];
     $resource = $argv[2];
     array_shift($argv);
     array_shift($argv);
     $args = \CommandLine::parseArgs($argv);
     foreach ($args as $key => $value) {
         if (is_string($key)) {
             $this->options[$key] = $value;
         } else {
             $this->arguments[$key] = $value;
         }
     }
     return [$resource, 'action', []];
 }
Exemplo n.º 2
0
                $fileName = str_replace($symbols, "_", $cat->getTitle());
                $categoryFile .= "\\categoryfile{" . $fileName . "}" . PHP_EOL;
            }
        }
        return $categoryFile;
    }
    function generateShallowTexStructure($catPage)
    {
        $shallowTex = "\\tree{" . $catPage->getTitle() . "}{" . escape($catPage->intent) . "}{\n";
        foreach ($catPage->members as $m) {
            $shallowTex .= "\\tab\\concept{" . $m->getTitle() . "}{" . escape($m->intent) . "}\n";
        }
        return $shallowTex;
    }
}
$args = CommandLine::parseArgs($_SERVER['argv']);
//$args['mode'] = 'matrixif';
//$args['ilist'] = "../lists/pppjImpls.lst";
//$args['output'] = "pppjif";
if ($args['mode'] == 'singlePage') {
    $title = $args['title'];
    if (startsWith("101implementation:", $title)) {
        echo $title;
        $page = new ImplementationPage($title);
        #var_dump($page);
        #echo $page->dumpToTex();
        var_dump(formatter::toTex($page->illustration));
    }
} else {
    if ($args['mode'] == 'dump') {
        echo "Entering dump mode, please wait..." . PHP_EOL;
Exemplo n.º 3
0
 /** @test */
 public function parseGlobalServerVariable()
 {
     $_SERVER['argv'] = array(self::FILE, 'a');
     $result = CommandLine::parseArgs(array());
     $this->assertEquals(1, count($result));
 }
 /**
  *  取得整理過後的 CLI 參數
  *  @dependency CommandLine class
  */
 public static function getArgs()
 {
     return \CommandLine::parseArgs(self::$args);
 }