We really need to finish this discussion in order to have enough time to
implement the changes before the code-freeze.  I think we're virtually
finished.

To summarize:

Zend::dump() moves to Zend_Debug::dump().  The idea of using a logger is
dropped.

Zend::VERSION and Zend::compareVersion() move to Zend_Version class.

Zend::loadClass(), loadFile(), and isReadable() move to Zend_Loader
class.  Perhaps in the future we will have a Zend_FileSystem class, but
there is no proposal for that now.

Here are the methods proposed for Zend_Registry:

Zend_Registry::getInstance() 
  Returns the default static instance.  It creates the instance if
necessary, based on the classname currently set (default
'Zend_Registry').  After you retrieve the instance, you can use it as an
ArrayObject:
  $r = Zend_Registry::getInstance();
  $r[$key] = $value;
Changes to the ArrayObject apply to the static instance:
  Zend_Registry::get($key) is now $value

Zend_Registry::get( $key )
  Returns an entry from the static registry instance based on key
specified in the argument.  I propose that this _not_ return the whole
registry object when called like ::get(null).  That's what getInstance()
does.

Zend_Registry::set( $key, $value )
  Sets a value in the static registry.

Zend_Registry::setInstance( $registry )
  Initialize the static registry instance to an object of type
Zend_Registry or a subclass.  Developers don't normally need to do this;
it's done implicitly by any of the three above methods.  But this method
exists in the proposed class code already, why not make it public?

Zend_Registry::setClassName( string )
  Specifies the name of the class to use for the default static instance
of the registry.  This is optional and it defaults to 'Zend_Registry'.
You must do this before the registry has been initialized by any of the
four above methods.

Zend_Registry::__unsetRegistry()
  Sets the current static registry instance to null.  This is currently
only used by unit tests, but there might be cases where you want to do
this too.  For example, if you have an initialized static registry and
you need to empty it out or reset it because you want to use a different
class, you would use this method.

Regards,
Bill Karwin

> -----Original Message-----
> From: Stanislav Malyshev [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 08, 2007 9:53 AM
> To: [EMAIL PROTECTED]
> Cc: Zend Framework
> Subject: Re: [fw-general] Zend.php proposal
> 
> > I think static ::get('foo') and ::set('foo', 'bar') methods are
> acceptable
> > compromises, but get() really shouldn't replace getInstance().  It
> 
> I'm OK with this.
> 
> --
> Stanislav Malyshev, Zend Products Engineer
> [EMAIL PROTECTED]  http://www.zend.com/

Reply via email to