dmBridge PHP API
DMCollectionFactory.php
00001 <?php
00002 #
00003 # dmBridge: a data access framework for CONTENTdm(R)
00004 #
00005 # Copyright © 2009, 2010, 2011 Board of Regents of the Nevada System of Higher
00006 # Education, on behalf of the University of Nevada, Las Vegas
00007 #
00008 
00013 abstract class DMCollectionFactory {
00014 
00019    private static $object_cache = array();
00020 
00021 
00028    public static function getCollection($alias) {
00029       foreach (self::$object_cache as $cache_key => $cache_value) {
00030          if ($cache_key == $alias) {
00031             return $cache_value;
00032          }
00033       }
00034 
00035       if ($alias != "/dmdefault" && !DMCollection::exists($alias)) {
00036          throw new DMUnavailableModelException(
00037                DMLocalizedString::getString("INVALID_COLLECTION"));
00038       }
00039       self::$object_cache[$alias] = new DMCollection($alias);
00040       return self::$object_cache[$alias];
00041    }
00042 
00043 }
 All Data Structures Functions Variables