/** * Set the current stack * * @param mixed $stack Value to be turned into stack for evaluation * @return \MUtil_Lazy_StackInterface */ public static function setStack($stack) { if ($stack instanceof \MUtil_Lazy_StackInterface) { self::$_stack = $stack; } elseif ($stack instanceof \MUtil_Model_Bridge_TableBridgeAbstract) { self::$_stack = new \MUtil_Lazy_Stack_BridgeStack($stack); } elseif ($stack instanceof \MUtil_Lazy_Repeatable) { self::$_stack = new RepeatableStack($stack); } elseif (\MUtil_Ra::is($stack)) { $stack = \MUtil_Ra::to($stack); self::$_stack = new \MUtil_Lazy_Stack_ArrayStack($stack); } elseif (is_object($stack)) { self::$_stack = new \MUtil_Lazy_Stack_ObjectStack($stack); } else { throw new \MUtil_Lazy_LazyException("Lazy stack set to invalid scalar type."); } return self::$_stack; }