The base class from which all CodeGenerator classes inherit provides the minimal functionality necessary. It's API is as follows:
<?php
abstract class Zend_CodeGenerator_Abstract
{
final public function __construct(Array $options = array())
public function setOptions(Array $options)
public function setSourceContent($sourceContent)
public function getSourceContent()
protected function _init()
protected function _prepare()
abstract public function generate();
final public function __toString()
}
The constructor first calls _init() (which is left
empty for the concrete extending class to implement), then
passes the $options parameter to
setOptions(), and finally calls
_prepare() (again, to be implemented by an
extending class).
Like most classes in Zend Framework, setOptions()
compares an option key to existing setters in the class, and
passes the value on to that method if found.
__toString() is marked as final, and proxies to
generate().
setSourceContent() and
getSourceContent() are intended to either set the
default content for the code being generated, or to replace said
content once all generation tasks are complete.
Zend_CodeGenerator_Php_Abstract extends
Zend_CodeGenerator_Abstract, and adds some
properties for tracking whether content has changed as well as
the amount of indentation that should appear before generated
content. Its API is as follows:
<?php
abstract class Zend_CodeGenerator_Php_Abstract
extends Zend_CodeGenerator_Abstract
{
public function setSourceDirty($isSourceDirty = true)
public function isSourceDirty()
public function setIndentation($indentation)
public function getIndentation()
}
Zend_CodeGenerator_Php_Member_Abstract is a base
class for generating class members -- properties and methods --
and provides accessors and mutators for establishing visibility;
whether or not the member is abstract, static, or final; and the
name of the member. Its API is as follows:
<?php
abstract class Zend_CodeGenerator_Php_Member_Abstract
extends Zend_CodeGenerator_Php_Abstract
{
public function setAbstract($isAbstract)
public function isAbstract()
public function setStatic($isStatic)
public function isStatic()
public function setVisibility($visibility)
public function getVisibility()
public function setName($name)
public function getName()
}




