PageRenderTime 11ms CodeModel.GetById 5ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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