Example #1
0
 public static function getopt()
 {
     $bop = new self();
     $opts = $bop->getOptionList();
     $args = getopt(implode('', array_values($opts)), array_keys($opts));
     if ($args === false) {
         trigger_error("Something happend with getopt(), please report a bug", E_USER_ERROR);
     }
     foreach ($args as $k => $v) {
         $handler = $bop->handlerForOption($k);
         if (is_callable($handler)) {
             call_user_func($handler, $k, $v);
         } else {
             var_dump($k, $v);
             trigger_error("Hmh, something weird has happend, I don't know this option", E_USER_ERROR);
         }
     }
 }