- $cls = new ReflectionClass($classname);
- $val = $cls->getStaticPropertyValue('cli_opts');
- } catch (Exception $e) {
- return;
+ // look up the parent tree for core opts.
+ $val = array();
+ //var_dump($classname);
+ $cls = new ReflectionClass($classname);
+ if (method_exists($classname, 'cli_opts')) {
+ $val = $classname::cli_opts();
+ } else {
+ $ar = $cls->getStaticProperties();
+ if (isset($ar['cli_opts'])) {
+ //echo "getting cli opts?\n";
+ $val = $cls->getStaticPropertyValue('cli_opts');
+ }
+ }
+
+ $val = is_array($val) ? $val : array();
+ while ($cls = $cls->getParentClass()) {
+ //var_dump($cls->name);
+
+ try {
+ $vadd = array();
+ if (method_exists($cls->name, 'cli_opts')) {
+ $cn = $cls->name;
+ $vadd = $cn::cli_opts();
+ } else {
+ $ar = $cls->getStaticProperties();
+ if (isset($ar['cli_opts'])) {
+ $vadd = $cls->getStaticPropertyValue('cli_opts');
+ }
+
+ }
+ $val = array_merge($val, is_array($vadd) ? $vadd : array() );
+ } catch (ReflectionException $e) {
+ continue;
+ }
+ }
+
+
+
+ } catch (ReflectionException $e) {
+ //print_r($e);
+ echo "cliParse:Warning: {$e->getMessage()}\n";
+ exit;