/framework/experimental/couch/CouchModule.php

http://zoop.googlecode.com/ · PHP · 34 lines · 30 code · 4 blank · 0 comment · 2 complexity · 0027e53e0f1c9cfbb8be90b82d236ad9 MD5 · raw file

  1. <?php
  2. class CouchModule extends ZoopModule
  3. {
  4. private static $connections = array();
  5. static function getConnection($name)
  6. {
  7. if(!isset(self::$connections[$name]))
  8. trigger_error("connection '$name' does not exist");
  9. return self::$connections[$name];
  10. }
  11. static function getDefaultConnection()
  12. {
  13. return self::getConnection('default');
  14. }
  15. function getClasses()
  16. {
  17. return array('CouchConnection', 'CouchDocument', 'CouchHttp');
  18. }
  19. function configure()
  20. {
  21. $connections = $this->getConfig();
  22. if($connections)
  23. {
  24. foreach($connections as $name => $params)
  25. {
  26. self::$connections[$name] = new CouchConnection($params);
  27. }
  28. }
  29. }
  30. }