public static function getInitialRoute() { $route = null; $input = new TerminalInput(); $input->importFromGlobals(); $input = StructUtils::toArray($input); $route = StructUtils::get($input, '--module'); return $route; }
/** * Converts an object to an array according to specific criteria. * @param mixed $aThing An array or an object which implements ToArrayInterface. * @param bool $aDeep If true, conversion is done recursively. * @return array The array created from the object. * @throws Exception if the object cannot be converted to an array. */ public static function toArray($aThing, $aDeep = false) { if (is_array($aThing)) { $arr = $aThing; } else { if (is_object($aThing) && $aThing instanceof ToArrayInterface) { $arr = $aThing->toArray(); } else { throw new Exception("Could not convert to array: '" . (is_object($aThing) ? get_class($aThing) : $aThing) . "'"); } } if ($aDeep) { foreach ($arr as $k => $v) { if (is_null($v) || is_scalar($v)) { $arr[$k] = $v; } else { $arr[$k] = StructUtils::toArray($v, $aDeep); } } } return $arr; }
public function mergeReverse($aData) { $incomingData = StructUtils::toArray($aData, true); $this->data = StructUtils::merge($incomingData, $this->data); }
public function mergeReverse($aData) { $this->data = StructUtils::merge(StructUtils::toArray($aData), $this->data); }