[Solar-svn] Revision 3278
pmjones at solarphp.com
pmjones at solarphp.com
Wed Jul 30 07:47:02 CDT 2008
Broad change to factories.
Factory classes are now identified using "instanceof Solar_Factory", not by the exitence of a solarFactory() method. The Solar::factory() method takes this into account. The following classes now extend Solar_Factory and have their (identical) solarFactory() methods removed:
* Solar_Access
* Solar_Auth
* Solar_Cache
* Solar_Http_Request
* Solar_Log
* Solar_Mail_Transport
* Solar_Role
* Solar_Session_Handler
* Solar_Smtp
* Solar_Sql
Modified: trunk/Solar/Access.php
===================================================================
--- trunk/Solar/Access.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Access.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Access extends Solar_Base
+class Solar_Access extends Solar_Factory
{
/**
*
@@ -25,23 +25,4 @@
protected $_Solar_Access = array(
'adapter' => 'Solar_Access_Adapter_Open',
);
-
- /**
- *
- * Factory method for returning adapters.
- *
- * @return Solar_Access_Adapter
- *
- */
- public function solarFactory()
- {
- // bring in the config and get the adapter class.
- $config = $this->_config;
- $class = $config['adapter'];
- unset($config['adapter']);
-
-
- // return the factoried adapter object
- return Solar::factory($class, $config);
- }
}
Modified: trunk/Solar/Auth.php
===================================================================
--- trunk/Solar/Auth.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Auth.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Auth extends Solar_Base
+class Solar_Auth extends Solar_Factory
{
/**
*
@@ -77,22 +77,4 @@
protected $_Solar_Auth = array(
'adapter' => 'Solar_Auth_Adapter_None',
);
-
- /**
- *
- * Factory method for returning adapters.
- *
- * @return Solar_Auth_Adapter
- *
- */
- public function solarFactory()
- {
- // bring in the config and get the adapter class.
- $config = $this->_config;
- $class = $config['adapter'];
- unset($config['adapter']);
-
- // return the factoried adapter object
- return Solar::factory($class, $config);
- }
}
Modified: trunk/Solar/Cache.php
===================================================================
--- trunk/Solar/Cache.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Cache.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Cache extends Solar_Base
+class Solar_Cache extends Solar_Factory
{
/**
*
@@ -32,22 +32,4 @@
protected $_Solar_Cache = array(
'adapter' => 'Solar_Cache_Adapter_File',
);
-
- /**
- *
- * Factory method to create cache adapter objects.
- *
- * @return Solar_Cache_Adapter
- *
- */
- public function solarFactory()
- {
- // bring in the config and get the adapter class.
- $config = $this->_config;
- $class = $config['adapter'];
- unset($config['adapter']);
-
- // return the factoried adapter object
- return Solar::factory($class, $config);
- }
}
Modified: trunk/Solar/Http/Request.php
===================================================================
--- trunk/Solar/Http/Request.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Http/Request.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Http_Request extends Solar_Base
+class Solar_Http_Request extends Solar_Factory
{
/**
*
@@ -48,22 +48,4 @@
}
parent::__construct($config);
}
-
- /**
- *
- * Factory method for returning adapters.
- *
- * @return Solar_Http_Request_Adapter
- *
- */
- public function solarFactory()
- {
- // bring in the config and get the adapter class.
- $config = $this->_config;
- $class = $config['adapter'];
- unset($config['adapter']);
-
- // factory the new class with its config
- return Solar::factory($class, $config);
- }
}
\ No newline at end of file
Modified: trunk/Solar/Log.php
===================================================================
--- trunk/Solar/Log.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Log.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -29,7 +29,7 @@
* @version $Id$
*
*/
-class Solar_Log extends Solar_Base
+class Solar_Log extends Solar_Factory
{
/**
*
@@ -47,22 +47,4 @@
protected $_Solar_Log = array(
'adapter' => 'Solar_Log_Adapter_None',
);
-
- /**
- *
- * Factory method for returning adapters.
- *
- * @return Solar_Log_Adapter
- *
- */
- public function solarFactory()
- {
- // bring in the config and get the adapter class.
- $config = $this->_config;
- $class = $config['adapter'];
- unset($config['adapter']);
-
- // return the factoried adapter object
- return Solar::factory($class, $config);
- }
}
Modified: trunk/Solar/Mail/Transport.php
===================================================================
--- trunk/Solar/Mail/Transport.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Mail/Transport.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Mail_Transport extends Solar_Base
+class Solar_Mail_Transport extends Solar_Factory
{
/**
*
@@ -32,18 +32,4 @@
protected $_Solar_Mail_Transport = array(
'adapter' => 'Solar_Mail_Transport_Adapter_Phpmail',
);
-
- /**
- *
- * Factory method to create transport adapter objects.
- *
- * @return Solar_Mail_Transport_Adapter
- *
- */
- public function solarFactory()
- {
- $class = $this->_config['adapter'];
- unset($this->_config['adapter']);
- return Solar::factory($class, $this->_config);
- }
}
\ No newline at end of file
Modified: trunk/Solar/Role.php
===================================================================
--- trunk/Solar/Role.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Role.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Role extends Solar_Base
+class Solar_Role extends Solar_Factory
{
/**
*
@@ -31,22 +31,4 @@
protected $_Solar_Role = array(
'adapter' => 'Solar_Role_Adapter_None',
);
-
- /**
- *
- * Factory method for returning adapters.
- *
- * @return Solar_Role_Adapter
- *
- */
- public function solarFactory()
- {
- // bring in the config and get the adapter class.
- $config = $this->_config;
- $class = $config['adapter'];
- unset($config['adapter']);
-
- // return the factoried adapter object
- return Solar::factory($class, $config);
- }
}
Modified: trunk/Solar/Session/Handler.php
===================================================================
--- trunk/Solar/Session/Handler.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Session/Handler.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Session_Handler extends Solar_Base
+class Solar_Session_Handler extends Solar_Factory
{
/**
*
@@ -32,22 +32,4 @@
protected $_Solar_Session_Handler = array(
'adapter' => 'Solar_Session_Handler_Adapter_Native',
);
-
- /**
- *
- * Factory method to create session adapter objects.
- *
- * @return Solar_Session_Handler_Adapter
- *
- */
- public function solarFactory()
- {
- // bring in the config and get the adapter class.
- $config = $this->_config;
- $class = $config['adapter'];
- unset($config['adapter']);
-
- // return the factoried adapter object
- return Solar::factory($class, $config);
- }
}
Modified: trunk/Solar/Smtp.php
===================================================================
--- trunk/Solar/Smtp.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Smtp.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Smtp extends Solar_Base
+class Solar_Smtp extends Solar_Factory
{
/**
*
@@ -31,18 +31,4 @@
protected $_Solar_Smtp = array(
'adapter' => 'Solar_Smtp_Adapter_NoAuth',
);
-
- /**
- *
- * Factory method to create SMTP adapter objects.
- *
- * @return Solar_Smtp_Adapter
- *
- */
- public function solarFactory()
- {
- $class = $this->_config['adapter'];
- unset($this->_config['adapter']);
- return Solar::factory($class, $this->_config);
- }
}
\ No newline at end of file
Modified: trunk/Solar/Sql.php
===================================================================
--- trunk/Solar/Sql.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar/Sql.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -14,7 +14,7 @@
* @version $Id$
*
*/
-class Solar_Sql extends Solar_Base
+class Solar_Sql extends Solar_Factory
{
/**
*
@@ -31,22 +31,4 @@
protected $_Solar_Sql = array(
'adapter' => 'Solar_Sql_Adapter_Sqlite',
);
-
- /**
- *
- * Factory method to create SQL adapter objects.
- *
- * @return Solar_Sql_Adapter
- *
- */
- public function solarFactory()
- {
- // bring in the config and get the adapter class.
- $config = $this->_config;
- $class = $config['adapter'];
- unset($config['adapter']);
-
- // return the factoried adapter object
- return Solar::factory($class, $config);
- }
}
Modified: trunk/Solar.php
===================================================================
--- trunk/Solar.php 2008-07-30 12:42:20 UTC (rev 3277)
+++ trunk/Solar.php 2008-07-30 12:47:02 UTC (rev 3278)
@@ -467,9 +467,9 @@
$obj = new $class($config);
// is it an object factory?
- if (method_exists($obj, 'solarFactory')) {
+ if ($obj instanceof Solar_Factory) {
// return an instance from the object factory
- return $obj->solarFactory();
+ return $obj->factory();
}
// return the object itself
More information about the Solar-svn
mailing list