/** * Force an instance inside class cache. Setting arguments to null nukes all or part of the cache * * @param string|null $key TableClass to replace. Set it to null to nuke the entire cache * @param F0FTable|null $instance Instance to replace. Set it to null to nuke $key instances * * @return bool Did I correctly switch the instance? */ public static function forceInstance($key = null, $instance = null) { if (is_null($key)) { self::$instances = array(); return true; } elseif ($key && isset(self::$instances[$key])) { // I'm forcing an instance, but it's not a F0FTable, abort! abort! if (!$instance || $instance && $instance instanceof F0FTable) { self::$instances[$key] = $instance; return true; } } return false; }