コード例 #1
0
ファイル: table.php プロジェクト: deenison/joomla-cms
 /**
  * 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    FOFTable|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 FOFTable, abort! abort!
         if (!$instance || $instance && $instance instanceof FOFTable) {
             self::$instances[$key] = $instance;
             return true;
         }
     }
     return false;
 }