import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Abstract.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -39,17 +39,17 @@ abstract class Zend_CodeGenerator_Php_Abstract extends Zend_CodeGenerator_Abstra
|
||||
*
|
||||
*/
|
||||
const LINE_FEED = "\n";
|
||||
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isSourceDirty = true;
|
||||
|
||||
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
protected $_indentation = ' ';
|
||||
|
||||
|
||||
/**
|
||||
* setSourceDirty()
|
||||
*
|
||||
@ -61,7 +61,7 @@ abstract class Zend_CodeGenerator_Php_Abstract extends Zend_CodeGenerator_Abstra
|
||||
$this->_isSourceDirty = ($isSourceDirty) ? true : false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isSourceDirty()
|
||||
*
|
||||
@ -71,7 +71,7 @@ abstract class Zend_CodeGenerator_Php_Abstract extends Zend_CodeGenerator_Abstra
|
||||
{
|
||||
return $this->_isSourceDirty;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setIndentation()
|
||||
*
|
||||
@ -83,7 +83,7 @@ abstract class Zend_CodeGenerator_Php_Abstract extends Zend_CodeGenerator_Abstra
|
||||
$this->_indentation = $indentation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getIndentation()
|
||||
*
|
||||
@ -93,5 +93,5 @@ abstract class Zend_CodeGenerator_Php_Abstract extends Zend_CodeGenerator_Abstra
|
||||
{
|
||||
return $this->_indentation;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Body.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Body.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -33,12 +33,12 @@ require_once 'Zend/CodeGenerator/Abstract.php';
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Body extends Zend_CodeGenerator_Abstract
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_content = null;
|
||||
|
||||
|
||||
/**
|
||||
* setContent()
|
||||
*
|
||||
@ -50,7 +50,7 @@ class Zend_CodeGenerator_Php_Body extends Zend_CodeGenerator_Abstract
|
||||
$this->_content = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getContent()
|
||||
*
|
||||
@ -60,7 +60,7 @@ class Zend_CodeGenerator_Php_Body extends Zend_CodeGenerator_Abstract
|
||||
{
|
||||
return (string) $this->_content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Class.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Class.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -53,37 +53,37 @@ require_once 'Zend/CodeGenerator/Php/Docblock.php';
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var Zend_CodeGenerator_Php_Docblock
|
||||
*/
|
||||
protected $_docblock = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isAbstract = false;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_extendedClass = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var array Array of string names
|
||||
*/
|
||||
protected $_implementedInterfaces = array();
|
||||
|
||||
|
||||
/**
|
||||
* @var array Array of properties
|
||||
*/
|
||||
protected $_properties = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var array Array of methods
|
||||
*/
|
||||
@ -98,26 +98,31 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
public static function fromReflection(Zend_Reflection_Class $reflectionClass)
|
||||
{
|
||||
$class = new self();
|
||||
|
||||
|
||||
$class->setSourceContent($class->getSourceContent());
|
||||
$class->setSourceDirty(false);
|
||||
|
||||
|
||||
if ($reflectionClass->getDocComment() != '') {
|
||||
$class->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionClass->getDocblock()));
|
||||
}
|
||||
|
||||
|
||||
$class->setAbstract($reflectionClass->isAbstract());
|
||||
$class->setName($reflectionClass->getName());
|
||||
|
||||
|
||||
if ($parentClass = $reflectionClass->getParentClass()) {
|
||||
$class->setExtendedClass($parentClass->getName());
|
||||
$interfaces = array_diff($parentClass->getInterfaces(), $reflectionClass->getInterfaces());
|
||||
$interfaces = array_diff($reflectionClass->getInterfaces(), $parentClass->getInterfaces());
|
||||
} else {
|
||||
$interfaces = $reflectionClass->getInterfaces();
|
||||
}
|
||||
|
||||
$class->setImplementedInterfaces($interfaces);
|
||||
|
||||
|
||||
$interfaceNames = array();
|
||||
foreach($interfaces AS $interface) {
|
||||
$interfaceNames[] = $interface->getName();
|
||||
}
|
||||
|
||||
$class->setImplementedInterfaces($interfaceNames);
|
||||
|
||||
$properties = array();
|
||||
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
|
||||
if ($reflectionProperty->getDeclaringClass()->getName() == $class->getName()) {
|
||||
@ -125,7 +130,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
}
|
||||
}
|
||||
$class->setProperties($properties);
|
||||
|
||||
|
||||
$methods = array();
|
||||
foreach ($reflectionClass->getMethods() as $reflectionMethod) {
|
||||
if ($reflectionMethod->getDeclaringClass()->getName() == $class->getName()) {
|
||||
@ -133,33 +138,33 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
}
|
||||
}
|
||||
$class->setMethods($methods);
|
||||
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setDocblock() Set the docblock
|
||||
*
|
||||
* @param Zend_CodeGenerator_Php_Docblock|array|string $docblock
|
||||
* @return Zend_CodeGenerator_Php_File
|
||||
*/
|
||||
public function setDocblock($docblock)
|
||||
public function setDocblock($docblock)
|
||||
{
|
||||
if (is_string($docblock)) {
|
||||
$docblock = array('shortDescription' => $docblock);
|
||||
}
|
||||
|
||||
|
||||
if (is_array($docblock)) {
|
||||
$docblock = new Zend_CodeGenerator_Php_Docblock($docblock);
|
||||
} elseif (!$docblock instanceof Zend_CodeGenerator_Php_Docblock) {
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('setDocblock() is expecting either a string, array or an instance of Zend_CodeGenerator_Php_Docblock');
|
||||
}
|
||||
|
||||
|
||||
$this->_docblock = $docblock;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getDocblock()
|
||||
*
|
||||
@ -169,7 +174,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_docblock;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setName()
|
||||
*
|
||||
@ -181,7 +186,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getName()
|
||||
*
|
||||
@ -203,7 +208,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_isAbstract = ($isAbstract) ? true : false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isAbstract()
|
||||
*
|
||||
@ -213,7 +218,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_isAbstract;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setExtendedClass()
|
||||
*
|
||||
@ -225,7 +230,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_extendedClass = $extendedClass;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getExtendedClass()
|
||||
*
|
||||
@ -235,7 +240,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_extendedClass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setImplementedInterfaces()
|
||||
*
|
||||
@ -247,7 +252,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_implementedInterfaces = $implementedInterfaces;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getImplementedInterfaces
|
||||
*
|
||||
@ -257,7 +262,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_implementedInterfaces;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setProperties()
|
||||
*
|
||||
@ -269,10 +274,10 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
foreach ($properties as $property) {
|
||||
$this->setProperty($property);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setProperty()
|
||||
*
|
||||
@ -290,16 +295,16 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('setProperty() expects either an array of property options or an instance of Zend_CodeGenerator_Php_Property');
|
||||
}
|
||||
|
||||
|
||||
if (isset($this->_properties[$propertyName])) {
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('A property by name ' . $propertyName . ' already exists in this class.');
|
||||
}
|
||||
|
||||
$this->_properties->append($property);
|
||||
|
||||
$this->_properties[$propertyName] = $property;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getProperties()
|
||||
*
|
||||
@ -309,7 +314,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_properties;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getProperty()
|
||||
*
|
||||
@ -325,7 +330,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hasProperty()
|
||||
*
|
||||
@ -336,7 +341,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return isset($this->_properties[$propertyName]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setMethods()
|
||||
*
|
||||
@ -350,7 +355,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setMethod()
|
||||
*
|
||||
@ -368,16 +373,16 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('setMethod() expects either an array of method options or an instance of Zend_CodeGenerator_Php_Method');
|
||||
}
|
||||
|
||||
|
||||
if (isset($this->_methods[$methodName])) {
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('A method by name ' . $methodName . ' already exists in this class.');
|
||||
}
|
||||
|
||||
$this->_methods->append($method);
|
||||
|
||||
$this->_methods[$methodName] = $method;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getMethods()
|
||||
*
|
||||
@ -387,7 +392,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_methods;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getMethod()
|
||||
*
|
||||
@ -403,7 +408,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hasMethod()
|
||||
*
|
||||
@ -414,7 +419,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return isset($this->_methods[$methodName]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isSourceDirty()
|
||||
*
|
||||
@ -425,22 +430,22 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
if (($docblock = $this->getDocblock()) && $docblock->isSourceDirty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->_properties as $property) {
|
||||
if ($property->isSourceDirty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->_methods as $method) {
|
||||
if ($method->isSourceDirty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return parent::isSourceDirty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
@ -451,50 +456,50 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
|
||||
if (!$this->isSourceDirty()) {
|
||||
return $this->getSourceContent();
|
||||
}
|
||||
|
||||
$output = '';
|
||||
|
||||
|
||||
$output = '';
|
||||
|
||||
if (null !== ($docblock = $this->getDocblock())) {
|
||||
$docblock->setIndentation('');
|
||||
$output .= $docblock->generate();
|
||||
}
|
||||
|
||||
|
||||
if ($this->isAbstract()) {
|
||||
$output .= 'abstract ';
|
||||
}
|
||||
|
||||
|
||||
$output .= 'class ' . $this->getName();
|
||||
|
||||
|
||||
if (null !== ($ec = $this->_extendedClass)) {
|
||||
$output .= ' extends ' . $ec;
|
||||
}
|
||||
|
||||
|
||||
$implemented = $this->getImplementedInterfaces();
|
||||
if (!empty($implemented)) {
|
||||
$output .= ' implements ' . implode(', ', $implemented);
|
||||
}
|
||||
|
||||
|
||||
$output .= self::LINE_FEED . '{' . self::LINE_FEED . self::LINE_FEED;
|
||||
|
||||
|
||||
$properties = $this->getProperties();
|
||||
if (!empty($properties)) {
|
||||
foreach ($properties as $property) {
|
||||
$output .= $property->generate() . self::LINE_FEED . self::LINE_FEED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$methods = $this->getMethods();
|
||||
if (!empty($methods)) {
|
||||
foreach ($methods as $method) {
|
||||
$output .= $method->generate() . self::LINE_FEED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$output .= self::LINE_FEED . '}' . self::LINE_FEED;
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _init() - is called at construction time
|
||||
*
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Docblock.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Docblock.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -42,12 +42,12 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
* @var string
|
||||
*/
|
||||
protected $_shortDescription = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_longDescription = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@ -57,7 +57,7 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
* @var string
|
||||
*/
|
||||
protected $_indentation = '';
|
||||
|
||||
|
||||
/**
|
||||
* fromReflection() - Build a docblock generator object from a reflection object
|
||||
*
|
||||
@ -67,20 +67,20 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
public static function fromReflection(Zend_Reflection_Docblock $reflectionDocblock)
|
||||
{
|
||||
$docblock = new self();
|
||||
|
||||
|
||||
$docblock->setSourceContent($reflectionDocblock->getContents());
|
||||
$docblock->setSourceDirty(false);
|
||||
|
||||
|
||||
$docblock->setShortDescription($reflectionDocblock->getShortDescription());
|
||||
$docblock->setLongDescription($reflectionDocblock->getLongDescription());
|
||||
|
||||
|
||||
foreach ($reflectionDocblock->getTags() as $tag) {
|
||||
$docblock->setTag(Zend_CodeGenerator_Php_Docblock_Tag::fromReflection($tag));
|
||||
}
|
||||
|
||||
|
||||
return $docblock;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setShortDescription()
|
||||
*
|
||||
@ -92,7 +92,7 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_shortDescription = $shortDescription;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getShortDescription()
|
||||
*
|
||||
@ -102,7 +102,7 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_shortDescription;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setLongDescription()
|
||||
*
|
||||
@ -114,7 +114,7 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_longDescription = $longDescription;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getLongDescription()
|
||||
*
|
||||
@ -124,7 +124,7 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_longDescription;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setTags()
|
||||
*
|
||||
@ -136,10 +136,10 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
foreach ($tags as $tag) {
|
||||
$this->setTag($tag);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setTag()
|
||||
*
|
||||
@ -157,11 +157,11 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
. 'instance of Zend_CodeGenerator_Php_Docblock_Tag'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$this->_tags[] = $tag;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getTags
|
||||
*
|
||||
@ -171,7 +171,7 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
@ -182,7 +182,7 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
if (!$this->isSourceDirty()) {
|
||||
return $this->_docCommentize($this->getSourceContent());
|
||||
}
|
||||
|
||||
|
||||
$output = '';
|
||||
if (null !== ($sd = $this->getShortDescription())) {
|
||||
$output .= $sd . self::LINE_FEED . self::LINE_FEED;
|
||||
@ -194,10 +194,10 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
foreach ($this->getTags() as $tag) {
|
||||
$output .= $tag->generate() . self::LINE_FEED;
|
||||
}
|
||||
|
||||
|
||||
return $this->_docCommentize(trim($output));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _docCommentize()
|
||||
*
|
||||
@ -216,5 +216,5 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
|
||||
$output .= $indent . ' */' . self::LINE_FEED;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Tag.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Tag.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -68,9 +68,9 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTag)
|
||||
{
|
||||
$tagName = $reflectionTag->getName();
|
||||
|
||||
|
||||
$codeGenDocblockTag = self::factory($tagName);
|
||||
|
||||
|
||||
// transport any properties via accessors and mutators from reflection to codegen object
|
||||
$reflectionClass = new ReflectionClass($reflectionTag);
|
||||
foreach ($reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
|
||||
@ -81,10 +81,10 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $codeGenDocblockTag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setPluginLoader()
|
||||
*
|
||||
@ -95,7 +95,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
self::$_pluginLoader = $pluginLoader;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getPluginLoader()
|
||||
*
|
||||
@ -109,24 +109,24 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
'Zend_CodeGenerator_Php_Docblock_Tag' => dirname(__FILE__) . '/Tag/'))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return self::$_pluginLoader;
|
||||
}
|
||||
|
||||
|
||||
public static function factory($tagName)
|
||||
{
|
||||
$pluginLoader = self::getPluginLoader();
|
||||
|
||||
|
||||
try {
|
||||
$tagClass = $pluginLoader->load($tagName);
|
||||
} catch (Zend_Loader_Exception $exception) {
|
||||
$tagClass = 'Zend_CodeGenerator_Php_Docblock_Tag';
|
||||
}
|
||||
|
||||
|
||||
$tag = new $tagClass(array('name' => $tagName));
|
||||
return $tag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setName()
|
||||
*
|
||||
@ -138,7 +138,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
$this->_name = ltrim($name, '@');
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getName()
|
||||
*
|
||||
@ -148,7 +148,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setDescription()
|
||||
*
|
||||
@ -160,7 +160,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
$this->_description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getDescription()
|
||||
*
|
||||
@ -180,5 +180,5 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
|
||||
{
|
||||
return '@' . $this->_name . ' ' . $this->_description;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: License.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: License.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -31,19 +31,19 @@ require_once 'Zend/CodeGenerator/Php/Docblock/Tag.php';
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Docblock_Tag_License extends Zend_CodeGenerator_Php_Docblock_Tag
|
||||
class Zend_CodeGenerator_Php_Docblock_Tag_License extends Zend_CodeGenerator_Php_Docblock_Tag
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_url = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_description = null;
|
||||
|
||||
|
||||
/**
|
||||
* fromReflection()
|
||||
*
|
||||
@ -53,14 +53,14 @@ class Zend_CodeGenerator_Php_Docblock_Tag_License extends Zend_CodeGenerator_Php
|
||||
public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTagLicense)
|
||||
{
|
||||
$returnTag = new self();
|
||||
|
||||
|
||||
$returnTag->setName('license');
|
||||
$returnTag->setUrl($reflectionTagLicense->getUrl());
|
||||
$returnTag->setDescription($reflectionTagLicense->getDescription());
|
||||
|
||||
|
||||
return $returnTag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setUrl()
|
||||
*
|
||||
@ -72,7 +72,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_License extends Zend_CodeGenerator_Php
|
||||
$this->_url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getUrl()
|
||||
*
|
||||
@ -94,5 +94,5 @@ class Zend_CodeGenerator_Php_Docblock_Tag_License extends Zend_CodeGenerator_Php
|
||||
$output = '@license ' . $this->_url . ' ' . $this->_description . self::LINE_FEED;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Param.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Param.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -33,22 +33,22 @@ require_once 'Zend/CodeGenerator/Php/Docblock/Tag.php';
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_Docblock_Tag
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_datatype = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_paramName = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_description = null;
|
||||
|
||||
|
||||
/**
|
||||
* fromReflection()
|
||||
*
|
||||
@ -63,7 +63,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_D
|
||||
$paramTag->setDatatype($reflectionTagParam->getType()); // @todo rename
|
||||
$paramTag->setParamName($reflectionTagParam->getVariableName());
|
||||
$paramTag->setDescription($reflectionTagParam->getDescription());
|
||||
|
||||
|
||||
return $paramTag;
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_D
|
||||
$this->_datatype = $datatype;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getDatatype
|
||||
*
|
||||
@ -88,7 +88,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_D
|
||||
{
|
||||
return $this->_datatype;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setParamName()
|
||||
*
|
||||
@ -100,7 +100,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_D
|
||||
$this->_paramName = $paramName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getParamName()
|
||||
*
|
||||
@ -110,7 +110,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_D
|
||||
{
|
||||
return $this->_paramName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
@ -118,11 +118,11 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_D
|
||||
*/
|
||||
public function generate()
|
||||
{
|
||||
$output = '@param '
|
||||
$output = '@param '
|
||||
. (($this->_datatype != null) ? $this->_datatype : 'unknown')
|
||||
. (($this->_paramName != null) ? ' $' . $this->_paramName : '')
|
||||
. (($this->_paramName != null) ? ' $' . $this->_paramName : '')
|
||||
. (($this->_description != null) ? ' ' . $this->_description : '');
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Return.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Return.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -31,19 +31,19 @@ require_once 'Zend/CodeGenerator/Php/Docblock/Tag.php';
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Docblock_Tag_Return extends Zend_CodeGenerator_Php_Docblock_Tag
|
||||
class Zend_CodeGenerator_Php_Docblock_Tag_Return extends Zend_CodeGenerator_Php_Docblock_Tag
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_datatype = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_description = null;
|
||||
|
||||
|
||||
/**
|
||||
* fromReflection()
|
||||
*
|
||||
@ -53,14 +53,14 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Return extends Zend_CodeGenerator_Php_
|
||||
public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTagReturn)
|
||||
{
|
||||
$returnTag = new self();
|
||||
|
||||
|
||||
$returnTag->setName('return');
|
||||
$returnTag->setDatatype($reflectionTagReturn->getType()); // @todo rename
|
||||
$returnTag->setDescription($reflectionTagReturn->getDescription());
|
||||
|
||||
|
||||
return $returnTag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setDatatype()
|
||||
*
|
||||
@ -72,7 +72,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Return extends Zend_CodeGenerator_Php_
|
||||
$this->_datatype = $datatype;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getDatatype()
|
||||
*
|
||||
@ -94,5 +94,5 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Return extends Zend_CodeGenerator_Php_
|
||||
$output = '@return ' . $this->_datatype . ' ' . $this->_description;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Exception.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -33,5 +33,5 @@ require_once 'Zend/CodeGenerator/Exception.php';
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Exception extends Zend_CodeGenerator_Exception
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: File.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: File.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -38,12 +38,12 @@ require_once 'Zend/CodeGenerator/Php/Class.php';
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var array Array of Zend_CodeGenerator_Php_File
|
||||
*/
|
||||
protected static $_fileCodeGenerators = array();
|
||||
|
||||
|
||||
/**#@+
|
||||
* @var string
|
||||
*/
|
||||
@ -51,27 +51,27 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
protected static $_markerRequire = '/* Zend_CodeGenerator_Php_File-RequireMarker: {?} */';
|
||||
protected static $_markerClass = '/* Zend_CodeGenerator_Php_File-ClassMarker: {?} */';
|
||||
/**#@-*/
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_filename = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var Zend_CodeGenerator_Php_Docblock
|
||||
*/
|
||||
protected $_docblock = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_requiredFiles = array();
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_classes = array();
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -82,20 +82,20 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
if ($fileName == null) {
|
||||
$fileName = $fileCodeGenerator->getFilename();
|
||||
}
|
||||
|
||||
|
||||
if ($fileName == '') {
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('FileName does not exist.');
|
||||
}
|
||||
|
||||
|
||||
// cannot use realpath since the file might not exist, but we do need to have the index
|
||||
// in the same DIRECTORY_SEPARATOR that realpath would use:
|
||||
$fileName = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $fileName);
|
||||
|
||||
|
||||
self::$_fileCodeGenerators[$fileName] = $fileCodeGenerator;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fromReflectedFilePath() - use this if you intend on generating code generation objects based on the same file.
|
||||
* This will keep previous changes to the file in tact during the same PHP process
|
||||
@ -108,31 +108,31 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
public static function fromReflectedFileName($filePath, $usePreviousCodeGeneratorIfItExists = true, $includeIfNotAlreadyIncluded = true)
|
||||
{
|
||||
$realpath = realpath($filePath);
|
||||
|
||||
|
||||
if ($realpath === false) {
|
||||
if ( ($realpath = Zend_Reflection_file::findRealpathInIncludePath($filePath)) === false) {
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('No file for ' . $realpath . ' was found.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($usePreviousCodeGeneratorIfItExists && isset(self::$_fileCodeGenerators[$realpath])) {
|
||||
return self::$_fileCodeGenerators[$realpath];
|
||||
}
|
||||
|
||||
|
||||
if ($includeIfNotAlreadyIncluded && !in_array($realpath, get_included_files())) {
|
||||
include $realpath;
|
||||
}
|
||||
|
||||
|
||||
$codeGenerator = self::fromReflection(($fileReflector = new Zend_Reflection_File($realpath)));
|
||||
|
||||
|
||||
if (!isset(self::$_fileCodeGenerators[$fileReflector->getFileName()])) {
|
||||
self::$_fileCodeGenerators[$fileReflector->getFileName()] = $codeGenerator;
|
||||
}
|
||||
|
||||
|
||||
return $codeGenerator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fromReflection()
|
||||
*
|
||||
@ -142,22 +142,22 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
public static function fromReflection(Zend_Reflection_File $reflectionFile)
|
||||
{
|
||||
$file = new self();
|
||||
|
||||
|
||||
$file->setSourceContent($reflectionFile->getContents());
|
||||
$file->setSourceDirty(false);
|
||||
|
||||
|
||||
$body = $reflectionFile->getContents();
|
||||
|
||||
|
||||
// @todo this whole area needs to be reworked with respect to how body lines are processed
|
||||
foreach ($reflectionFile->getClasses() as $class) {
|
||||
$file->setClass(Zend_CodeGenerator_Php_Class::fromReflection($class));
|
||||
$classStartLine = $class->getStartLine(true);
|
||||
$classEndLine = $class->getEndLine();
|
||||
|
||||
|
||||
$bodyLines = explode("\n", $body);
|
||||
$bodyReturn = array();
|
||||
for ($lineNum = 1; $lineNum <= count($bodyLines); $lineNum++) {
|
||||
if ($lineNum == $classStartLine) {
|
||||
if ($lineNum == $classStartLine) {
|
||||
$bodyReturn[] = str_replace('?', $class->getName(), self::$_markerClass); //'/* Zend_CodeGenerator_Php_File-ClassMarker: {' . $class->getName() . '} */';
|
||||
$lineNum = $classEndLine;
|
||||
} else {
|
||||
@ -167,15 +167,15 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
$body = implode("\n", $bodyReturn);
|
||||
unset($bodyLines, $bodyReturn, $classStartLine, $classEndLine);
|
||||
}
|
||||
|
||||
|
||||
if (($reflectionFile->getDocComment() != '')) {
|
||||
$docblock = $reflectionFile->getDocblock();
|
||||
$file->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($docblock));
|
||||
|
||||
|
||||
$bodyLines = explode("\n", $body);
|
||||
$bodyReturn = array();
|
||||
for ($lineNum = 1; $lineNum <= count($bodyLines); $lineNum++) {
|
||||
if ($lineNum == $docblock->getStartLine()) {
|
||||
if ($lineNum == $docblock->getStartLine()) {
|
||||
$bodyReturn[] = str_replace('?', $class->getName(), self::$_markerDocblock); //'/* Zend_CodeGenerator_Php_File-ClassMarker: {' . $class->getName() . '} */';
|
||||
$lineNum = $docblock->getEndLine();
|
||||
} else {
|
||||
@ -185,41 +185,41 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
$body = implode("\n", $bodyReturn);
|
||||
unset($bodyLines, $bodyReturn, $classStartLine, $classEndLine);
|
||||
}
|
||||
|
||||
|
||||
$file->setBody($body);
|
||||
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setDocblock() Set the docblock
|
||||
*
|
||||
* @param Zend_CodeGenerator_Php_Docblock|array|string $docblock
|
||||
* @return Zend_CodeGenerator_Php_File
|
||||
*/
|
||||
public function setDocblock($docblock)
|
||||
public function setDocblock($docblock)
|
||||
{
|
||||
if (is_string($docblock)) {
|
||||
$docblock = array('shortDescription' => $docblock);
|
||||
}
|
||||
|
||||
|
||||
if (is_array($docblock)) {
|
||||
$docblock = new Zend_CodeGenerator_Php_Docblock($docblock);
|
||||
} elseif (!$docblock instanceof Zend_CodeGenerator_Php_Docblock) {
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('setDocblock() is expecting either a string, array or an instance of Zend_CodeGenerator_Php_Docblock');
|
||||
}
|
||||
|
||||
|
||||
$this->_docblock = $docblock;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get docblock
|
||||
*
|
||||
* @return Zend_CodeGenerator_Php_Docblock
|
||||
*/
|
||||
public function getDocblock()
|
||||
public function getDocblock()
|
||||
{
|
||||
return $this->_docblock;
|
||||
}
|
||||
@ -235,13 +235,13 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_requiredFiles = $requiredFiles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getRequiredFiles()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRequiredFiles()
|
||||
public function getRequiredFiles()
|
||||
{
|
||||
return $this->_requiredFiles;
|
||||
}
|
||||
@ -252,14 +252,14 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
* @param array $classes
|
||||
* @return Zend_CodeGenerator_Php_File
|
||||
*/
|
||||
public function setClasses(Array $classes)
|
||||
public function setClasses(Array $classes)
|
||||
{
|
||||
foreach ($classes as $class) {
|
||||
$this->setClass($class);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getClass()
|
||||
*
|
||||
@ -272,10 +272,10 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
reset($this->_classes);
|
||||
return current($this->_classes);
|
||||
}
|
||||
|
||||
|
||||
return $this->_classes[$name];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setClass()
|
||||
*
|
||||
@ -293,13 +293,13 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('Expecting either an array or an instance of Zend_CodeGenerator_Php_Class');
|
||||
}
|
||||
|
||||
// @todo check for dup here
|
||||
|
||||
|
||||
// @todo check for dup here
|
||||
|
||||
$this->_classes[$className] = $class;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setFilename()
|
||||
*
|
||||
@ -311,7 +311,7 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_filename = $filename;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getFilename()
|
||||
*
|
||||
@ -321,13 +321,13 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_filename;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getClasses()
|
||||
*
|
||||
* @return array Array of Zend_CodeGenerator_Php_Class
|
||||
*/
|
||||
public function getClasses()
|
||||
public function getClasses()
|
||||
{
|
||||
return $this->_classes;
|
||||
}
|
||||
@ -343,7 +343,7 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_body = $body;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getBody()
|
||||
*
|
||||
@ -353,7 +353,7 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_body;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isSourceDirty()
|
||||
*
|
||||
@ -364,16 +364,16 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
if (($docblock = $this->getDocblock()) && $docblock->isSourceDirty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->_classes as $class) {
|
||||
if ($class->isSourceDirty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return parent::isSourceDirty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
@ -384,21 +384,21 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
if ($this->isSourceDirty() === false) {
|
||||
return $this->_sourceContent;
|
||||
}
|
||||
|
||||
|
||||
$output = '';
|
||||
|
||||
|
||||
// start with the body (if there), or open tag
|
||||
if (preg_match('#(?:\s*)<\?php#', $this->getBody()) == false) {
|
||||
$output = '<?php' . self::LINE_FEED;
|
||||
}
|
||||
|
||||
|
||||
// if there are markers, put the body into the output
|
||||
$body = $this->getBody();
|
||||
if (preg_match('#/\* Zend_CodeGenerator_Php_File-(.*?)Marker:#', $body)) {
|
||||
$output .= $body;
|
||||
$body = '';
|
||||
}
|
||||
|
||||
|
||||
// Add file docblock, if any
|
||||
if (null !== ($docblock = $this->getDocblock())) {
|
||||
$docblock->setIndentation('');
|
||||
@ -409,10 +409,10 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
$output .= $docblock->generate() . self::LINE_FEED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// newline
|
||||
$output .= self::LINE_FEED;
|
||||
|
||||
|
||||
// process required files
|
||||
// @todo marker replacement for required files
|
||||
$requiredFiles = $this->getRequiredFiles();
|
||||
@ -420,10 +420,10 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
foreach ($requiredFiles as $requiredFile) {
|
||||
$output .= 'require_once \'' . $requiredFile . '\';' . self::LINE_FEED;
|
||||
}
|
||||
|
||||
|
||||
$output .= self::LINE_FEED;
|
||||
}
|
||||
|
||||
|
||||
// process classes
|
||||
$classes = $this->getClasses();
|
||||
if (!empty($classes)) {
|
||||
@ -436,22 +436,22 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
$output .= $class->generate() . self::LINE_FEED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!empty($body)) {
|
||||
|
||||
// add an extra space betwee clsses and
|
||||
// add an extra space betwee clsses and
|
||||
if (!empty($classes)) {
|
||||
$output .= self::LINE_FEED;
|
||||
}
|
||||
|
||||
|
||||
$output .= $body;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
public function write()
|
||||
{
|
||||
if ($this->_filename == '' || !is_writable(dirname($this->_filename))) {
|
||||
@ -461,5 +461,5 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
|
||||
file_put_contents($this->_filename, $this->generate());
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Abstract.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -38,7 +38,7 @@ require_once 'Zend/CodeGenerator/Php/Docblock.php';
|
||||
*/
|
||||
abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
|
||||
|
||||
/**#@+
|
||||
* @param const string
|
||||
*/
|
||||
@ -46,32 +46,32 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
const VISIBILITY_PROTECTED = 'protected';
|
||||
const VISIBILITY_PRIVATE = 'private';
|
||||
/**#@-*/
|
||||
|
||||
|
||||
/**
|
||||
* @var Zend_CodeGenerator_Php_Docblock
|
||||
*/
|
||||
protected $_docblock = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isAbstract = false;
|
||||
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isFinal = false;
|
||||
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isStatic = false;
|
||||
|
||||
|
||||
/**
|
||||
* @var const
|
||||
*/
|
||||
protected $_visibility = self::VISIBILITY_PUBLIC;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -83,23 +83,23 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
* @param Zend_CodeGenerator_Php_Docblock|array|string $docblock
|
||||
* @return Zend_CodeGenerator_Php_File
|
||||
*/
|
||||
public function setDocblock($docblock)
|
||||
public function setDocblock($docblock)
|
||||
{
|
||||
if (is_string($docblock)) {
|
||||
$docblock = array('shortDescription' => $docblock);
|
||||
}
|
||||
|
||||
|
||||
if (is_array($docblock)) {
|
||||
$docblock = new Zend_CodeGenerator_Php_Docblock($docblock);
|
||||
} elseif (!$docblock instanceof Zend_CodeGenerator_Php_Docblock) {
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('setDocblock() is expecting either a string, array or an instance of Zend_CodeGenerator_Php_Docblock');
|
||||
}
|
||||
|
||||
|
||||
$this->_docblock = $docblock;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getDocblock()
|
||||
*
|
||||
@ -109,7 +109,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
{
|
||||
return $this->_docblock;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setAbstract()
|
||||
*
|
||||
@ -121,7 +121,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
$this->_isAbstract = ($isAbstract) ? true : false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isAbstract()
|
||||
*
|
||||
@ -131,7 +131,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
{
|
||||
return $this->_isAbstract;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setFinal()
|
||||
*
|
||||
@ -143,7 +143,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
$this->_isFinal = ($isFinal) ? true : false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isFinal()
|
||||
*
|
||||
@ -153,7 +153,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
{
|
||||
return $this->_isFinal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setStatic()
|
||||
*
|
||||
@ -165,7 +165,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
$this->_isStatic = ($isStatic) ? true : false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isStatic()
|
||||
*
|
||||
@ -175,7 +175,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
{
|
||||
return $this->_isStatic;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setVisitibility()
|
||||
*
|
||||
@ -187,7 +187,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
$this->_visibility = $visibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getVisibility()
|
||||
*
|
||||
@ -197,7 +197,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
{
|
||||
return $this->_visibility;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setName()
|
||||
*
|
||||
@ -209,7 +209,7 @@ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator
|
||||
$this->_name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getName()
|
||||
*
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Container.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Container.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -28,19 +28,19 @@
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Member_Container extends ArrayObject
|
||||
{
|
||||
|
||||
|
||||
/**#@+
|
||||
* @param const string
|
||||
*/
|
||||
const TYPE_PROPERTY = 'property';
|
||||
const TYPE_METHOD = 'method';
|
||||
/**#@-*/
|
||||
|
||||
|
||||
/**
|
||||
* @var const|string
|
||||
*/
|
||||
protected $_type = self::TYPE_PROPERTY;
|
||||
|
||||
|
||||
/**
|
||||
* __construct()
|
||||
*
|
||||
@ -51,5 +51,5 @@ class Zend_CodeGenerator_Php_Member_Container extends ArrayObject
|
||||
$this->_type = $type;
|
||||
parent::__construct(array(), self::ARRAY_AS_PROPS);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Method.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Method.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -41,28 +41,28 @@ require_once 'Zend/CodeGenerator/Php/Parameter.php';
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstract
|
||||
class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstract
|
||||
{
|
||||
/**
|
||||
* @var Zend_CodeGenerator_Php_Docblock
|
||||
*/
|
||||
protected $_docblock = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isFinal = false;
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_parameters = array();
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_body = null;
|
||||
|
||||
|
||||
/**
|
||||
* fromReflection()
|
||||
*
|
||||
@ -72,16 +72,16 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
public static function fromReflection(Zend_Reflection_Method $reflectionMethod)
|
||||
{
|
||||
$method = new self();
|
||||
|
||||
|
||||
$method->setSourceContent($reflectionMethod->getContents(false));
|
||||
$method->setSourceDirty(false);
|
||||
|
||||
|
||||
if ($reflectionMethod->getDocComment() != '') {
|
||||
$method->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionMethod->getDocblock()));
|
||||
}
|
||||
|
||||
|
||||
$method->setFinal($reflectionMethod->isFinal());
|
||||
|
||||
|
||||
if ($reflectionMethod->isPrivate()) {
|
||||
$method->setVisibility(self::VISIBILITY_PRIVATE);
|
||||
} elseif ($reflectionMethod->isProtected()) {
|
||||
@ -89,20 +89,20 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
} else {
|
||||
$method->setVisibility(self::VISIBILITY_PUBLIC);
|
||||
}
|
||||
|
||||
|
||||
$method->setStatic($reflectionMethod->isStatic());
|
||||
|
||||
$method->setName($reflectionMethod->getName());
|
||||
|
||||
|
||||
foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
|
||||
$method->setParameter(Zend_CodeGenerator_Php_Parameter::fromReflection($reflectionParameter));
|
||||
}
|
||||
|
||||
|
||||
$method->setBody($reflectionMethod->getBody());
|
||||
|
||||
return $method;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setFinal()
|
||||
*
|
||||
@ -112,7 +112,7 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
{
|
||||
$this->_isFinal = ($isFinal) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setParameters()
|
||||
*
|
||||
@ -126,7 +126,7 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setParameter()
|
||||
*
|
||||
@ -144,11 +144,11 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('setParameter() expects either an array of method options or an instance of Zend_CodeGenerator_Php_Parameter');
|
||||
}
|
||||
|
||||
|
||||
$this->_parameters[$parameterName] = $parameter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getParameters()
|
||||
*
|
||||
@ -170,7 +170,7 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
$this->_body = $body;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getBody()
|
||||
*
|
||||
@ -180,7 +180,7 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
{
|
||||
return $this->_body;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
@ -189,22 +189,22 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
public function generate()
|
||||
{
|
||||
$output = '';
|
||||
|
||||
|
||||
$indent = $this->getIndentation();
|
||||
|
||||
|
||||
if (($docblock = $this->getDocblock()) !== null) {
|
||||
$docblock->setIndentation($indent);
|
||||
$output .= $docblock->generate();
|
||||
}
|
||||
|
||||
|
||||
$output .= $indent;
|
||||
|
||||
|
||||
if ($this->isAbstract()) {
|
||||
$output .= 'abstract ';
|
||||
} else {
|
||||
$output .= (($this->isFinal()) ? 'final ' : '');
|
||||
}
|
||||
|
||||
|
||||
$output .= $this->getVisibility()
|
||||
. (($this->isStatic()) ? ' static' : '')
|
||||
. ' function ' . $this->getName() . '(';
|
||||
@ -214,21 +214,21 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
|
||||
foreach ($parameters as $parameter) {
|
||||
$parameterOuput[] = $parameter->generate();
|
||||
}
|
||||
|
||||
|
||||
$output .= implode(', ', $parameterOuput);
|
||||
}
|
||||
|
||||
|
||||
$output .= ')' . self::LINE_FEED . $indent . '{' . self::LINE_FEED;
|
||||
|
||||
if ($this->_body) {
|
||||
$output .= ' '
|
||||
. str_replace(self::LINE_FEED, self::LINE_FEED . $indent . $indent, trim($this->_body))
|
||||
$output .= ' '
|
||||
. str_replace(self::LINE_FEED, self::LINE_FEED . $indent . $indent, trim($this->_body))
|
||||
. self::LINE_FEED;
|
||||
}
|
||||
|
||||
|
||||
$output .= $indent . '}' . self::LINE_FEED;
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Parameter.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Parameter.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -25,6 +25,11 @@
|
||||
*/
|
||||
require_once 'Zend/CodeGenerator/Php/Abstract.php';
|
||||
|
||||
/**
|
||||
* @see Zend_CodeGenerator_Php_ParameterDefaultValue
|
||||
*/
|
||||
require_once 'Zend/CodeGenerator/Php/Parameter/DefaultValue.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_CodeGenerator
|
||||
@ -37,22 +42,27 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultValue = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_position = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_passedByReference = false;
|
||||
|
||||
/**
|
||||
* fromReflection()
|
||||
*
|
||||
@ -61,10 +71,28 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
*/
|
||||
public static function fromReflection(Zend_Reflection_Parameter $reflectionParameter)
|
||||
{
|
||||
// @todo Research this
|
||||
return new self();
|
||||
$param = new Zend_CodeGenerator_Php_Parameter();
|
||||
$param->setName($reflectionParameter->getName());
|
||||
|
||||
if($reflectionParameter->isArray()) {
|
||||
$param->setType('array');
|
||||
} else {
|
||||
$typeClass = $reflectionParameter->getClass();
|
||||
if($typeClass !== null) {
|
||||
$param->setType($typeClass->getName());
|
||||
}
|
||||
}
|
||||
|
||||
$param->setPosition($reflectionParameter->getPosition());
|
||||
|
||||
if($reflectionParameter->isOptional()) {
|
||||
$param->setDefaultValue($reflectionParameter->getDefaultValue());
|
||||
}
|
||||
$param->setPassedByReference($reflectionParameter->isPassedByReference());
|
||||
|
||||
return $param;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setType()
|
||||
*
|
||||
@ -76,7 +104,7 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getType()
|
||||
*
|
||||
@ -86,7 +114,7 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setName()
|
||||
*
|
||||
@ -98,7 +126,7 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getName()
|
||||
*
|
||||
@ -108,19 +136,34 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setDefaultValue()
|
||||
* Set the default value of the parameter.
|
||||
*
|
||||
* @param string $defaultValue
|
||||
* Certain variables are difficult to expres
|
||||
*
|
||||
* @param null|bool|string|int|float|Zend_CodeGenerator_Php_Parameter_DefaultValue $defaultValue
|
||||
* @return Zend_CodeGenerator_Php_Parameter
|
||||
*/
|
||||
public function setDefaultValue($defaultValue)
|
||||
{
|
||||
$this->_defaultValue = $defaultValue;
|
||||
if($defaultValue === null) {
|
||||
$this->_defaultValue = new Zend_CodeGenerator_Php_Parameter_DefaultValue("null");
|
||||
} else if(is_array($defaultValue)) {
|
||||
$defaultValue = str_replace(array("\r", "\n"), "", var_export($defaultValue, true));
|
||||
$this->_defaultValue = new Zend_CodeGenerator_Php_Parameter_DefaultValue($defaultValue);
|
||||
} else if(is_bool($defaultValue)) {
|
||||
if($defaultValue == true) {
|
||||
$this->_defaultValue = new Zend_CodeGenerator_Php_Parameter_DefaultValue("true");
|
||||
} else {
|
||||
$this->_defaultValue = new Zend_CodeGenerator_Php_Parameter_DefaultValue("false");
|
||||
}
|
||||
} else {
|
||||
$this->_defaultValue = $defaultValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getDefaultValue()
|
||||
*
|
||||
@ -130,7 +173,7 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setPosition()
|
||||
*
|
||||
@ -142,7 +185,7 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
$this->_position = $position;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getPosition()
|
||||
*
|
||||
@ -152,7 +195,25 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
{
|
||||
return $this->_position;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getPassedByReference()
|
||||
{
|
||||
return $this->_passedByReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $passedByReference
|
||||
* @return Zend_CodeGenerator_Php_Parameter
|
||||
*/
|
||||
public function setPassedByReference($passedByReference)
|
||||
{
|
||||
$this->_passedByReference = $passedByReference;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
@ -161,17 +222,23 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
public function generate()
|
||||
{
|
||||
$output = '';
|
||||
|
||||
|
||||
if ($this->_type) {
|
||||
$output .= $this->_type . ' ';
|
||||
$output .= $this->_type . ' ';
|
||||
}
|
||||
|
||||
|
||||
if($this->_passedByReference === true) {
|
||||
$output .= '&';
|
||||
}
|
||||
|
||||
$output .= '$' . $this->_name;
|
||||
|
||||
if ($this->_defaultValue) {
|
||||
|
||||
if ($this->_defaultValue !== null) {
|
||||
$output .= ' = ';
|
||||
if (is_string($this->_defaultValue)) {
|
||||
$output .= '\'' . $this->_defaultValue . '\'';
|
||||
} else if($this->_defaultValue instanceof Zend_CodeGenerator_Php_ParameterDefaultValue) {
|
||||
$output .= (string)$this->_defaultValue;
|
||||
} else {
|
||||
$output .= $this->_defaultValue;
|
||||
}
|
||||
@ -179,5 +246,5 @@ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
}
|
60
libs/Zend/CodeGenerator/Php/Parameter/DefaultValue.php
Normal file
60
libs/Zend/CodeGenerator/Php/Parameter/DefaultValue.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_CodeGenerator
|
||||
* @subpackage Php
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: DefaultValue.php 18010 2009-09-07 21:58:40Z beberlei $
|
||||
*/
|
||||
|
||||
/**
|
||||
* A value-holder object for non-expressable parameter default values, such as null, booleans and empty array()
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_CodeGenerator
|
||||
* @subpackage Php
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Parameter_DefaultValue
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultValue = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $defaultValue
|
||||
* @throws Zend_CodeGenerator_Php_Exception
|
||||
*/
|
||||
public function __construct($defaultValue)
|
||||
{
|
||||
if(!is_string($defaultValue)) {
|
||||
require_once "Zend/CodeGenerator/Php/Exception.php";
|
||||
throw new Zend_CodeGenerator_Php_Exception(
|
||||
"Can only set a string as default value representation, ".
|
||||
"but ".gettype($defaultValue)." was given."
|
||||
);
|
||||
}
|
||||
$this->_defaultValue = $defaultValue;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_defaultValue;
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Property.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Property.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -36,14 +36,14 @@ require_once 'Zend/CodeGenerator/Php/Property/DefaultValue.php';
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abstract
|
||||
class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abstract
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isConst = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -58,21 +58,21 @@ class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abst
|
||||
public static function fromReflection(Zend_Reflection_Property $reflectionProperty)
|
||||
{
|
||||
$property = new self();
|
||||
|
||||
|
||||
$property->setName($reflectionProperty->getName());
|
||||
|
||||
|
||||
$allDefaultProperties = $reflectionProperty->getDeclaringClass()->getDefaultProperties();
|
||||
|
||||
|
||||
$property->setDefaultValue($allDefaultProperties[$reflectionProperty->getName()]);
|
||||
|
||||
|
||||
if ($reflectionProperty->getDocComment() != '') {
|
||||
$property->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionProperty->getDocComment()));
|
||||
}
|
||||
|
||||
|
||||
if ($reflectionProperty->isStatic()) {
|
||||
$property->setStatic(true);
|
||||
}
|
||||
|
||||
|
||||
if ($reflectionProperty->isPrivate()) {
|
||||
$property->setVisibility(self::VISIBILITY_PRIVATE);
|
||||
} elseif ($reflectionProperty->isProtected()) {
|
||||
@ -80,12 +80,12 @@ class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abst
|
||||
} else {
|
||||
$property->setVisibility(self::VISIBILITY_PUBLIC);
|
||||
}
|
||||
|
||||
|
||||
$property->setSourceDirty(false);
|
||||
|
||||
|
||||
return $property;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setConst()
|
||||
*
|
||||
@ -97,7 +97,7 @@ class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abst
|
||||
$this->_isConst = $const;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isConst()
|
||||
*
|
||||
@ -117,16 +117,16 @@ class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abst
|
||||
public function setDefaultValue($defaultValue)
|
||||
{
|
||||
// if it looks like
|
||||
if (is_array($defaultValue)
|
||||
if (is_array($defaultValue)
|
||||
&& array_key_exists('value', $defaultValue)
|
||||
&& array_key_exists('type', $defaultValue)) {
|
||||
$defaultValue = new Zend_CodeGenerator_Php_Property_DefaultValue($defaultValue);
|
||||
}
|
||||
|
||||
|
||||
if (!($defaultValue instanceof Zend_CodeGenerator_Php_Property_DefaultValue)) {
|
||||
$defaultValue = new Zend_CodeGenerator_Php_Property_DefaultValue(array('value' => $defaultValue));
|
||||
}
|
||||
|
||||
|
||||
$this->_defaultValue = $defaultValue;
|
||||
return $this;
|
||||
}
|
||||
@ -140,7 +140,7 @@ class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abst
|
||||
{
|
||||
return $this->_defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
@ -150,30 +150,30 @@ class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abst
|
||||
{
|
||||
$name = $this->getName();
|
||||
$defaultValue = $this->getDefaultValue();
|
||||
|
||||
|
||||
$output = '';
|
||||
|
||||
|
||||
if (($docblock = $this->getDocblock()) !== null) {
|
||||
$docblock->setIndentation(' ');
|
||||
$output .= $docblock->generate();
|
||||
}
|
||||
|
||||
|
||||
if ($this->isConst()) {
|
||||
if ($defaultValue != null && !$defaultValue->isValidConstantType()) {
|
||||
require_once 'Zend/CodeGenerator/Php/Exception.php';
|
||||
throw new Zend_CodeGenerator_Php_Exception('The property ' . $this->_name . ' is said to be '
|
||||
. 'constant but does not have a valid constant value.');
|
||||
}
|
||||
$output .= $this->_indentation . 'const ' . $name . ' = '
|
||||
$output .= $this->_indentation . 'const ' . $name . ' = '
|
||||
. (($defaultValue !== null) ? $defaultValue->generate() : 'null;');
|
||||
} else {
|
||||
$output .= $this->_indentation
|
||||
. $this->getVisibility()
|
||||
. (($this->isStatic()) ? ' static' : '')
|
||||
. $this->getVisibility()
|
||||
. (($this->isStatic()) ? ' static' : '')
|
||||
. ' $' . $name . ' = '
|
||||
. (($defaultValue !== null) ? $defaultValue->generate() : 'null;');
|
||||
}
|
||||
return $output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PHP
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: DefaultValue.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: DefaultValue.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -50,22 +50,22 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
const TYPE_NULL = 'null';
|
||||
const TYPE_OTHER = 'other';
|
||||
/**#@-*/
|
||||
|
||||
|
||||
/**
|
||||
* @var array of reflected constants
|
||||
*/
|
||||
protected static $_constants = array();
|
||||
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_value = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = self::TYPE_AUTO;
|
||||
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
@ -78,11 +78,13 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
*/
|
||||
protected function _init()
|
||||
{
|
||||
$reflect = new ReflectionClass(get_class($this));
|
||||
self::$_constants = $reflect->getConstants();
|
||||
unset($reflect);
|
||||
if(count(self::$_constants) == 0) {
|
||||
$reflect = new ReflectionClass(get_class($this));
|
||||
self::$_constants = $reflect->getConstants();
|
||||
unset($reflect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isValidConstantType()
|
||||
*
|
||||
@ -93,7 +95,7 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
if ($this->_type == self::TYPE_AUTO) {
|
||||
$type = $this->_getAutoDeterminedType($this->_value);
|
||||
}
|
||||
|
||||
|
||||
// valid types for constants
|
||||
$scalarTypes = array(
|
||||
self::TYPE_BOOLEAN,
|
||||
@ -107,10 +109,10 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
self::TYPE_CONSTANT,
|
||||
self::TYPE_NULL
|
||||
);
|
||||
|
||||
|
||||
return in_array($type, $scalarTypes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setValue()
|
||||
*
|
||||
@ -122,7 +124,7 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getValue()
|
||||
*
|
||||
@ -132,7 +134,7 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setType()
|
||||
*
|
||||
@ -144,7 +146,7 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
$this->_type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getType()
|
||||
*
|
||||
@ -154,7 +156,7 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setArrayDepth()
|
||||
*
|
||||
@ -166,7 +168,7 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
$this->_arrayDepth = $arrayDepth;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getArrayDepth()
|
||||
*
|
||||
@ -176,7 +178,7 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
{
|
||||
return $this->_arrayDepth;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _getValidatedType()
|
||||
*
|
||||
@ -188,10 +190,10 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
if (($constName = array_search($type, self::$_constants)) !== false) {
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
||||
return self::TYPE_AUTO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _getAutoDeterminedType()
|
||||
*
|
||||
@ -221,10 +223,8 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
default:
|
||||
return self::TYPE_OTHER;
|
||||
}
|
||||
|
||||
return self::TYPE_OTHER;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate()
|
||||
*
|
||||
@ -233,16 +233,16 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
public function generate()
|
||||
{
|
||||
$type = $this->_type;
|
||||
|
||||
|
||||
if ($type != self::TYPE_AUTO) {
|
||||
$type = $this->_getValidatedType($type);
|
||||
}
|
||||
|
||||
|
||||
$value = $this->_value;
|
||||
|
||||
|
||||
if ($type == self::TYPE_AUTO) {
|
||||
$type = $this->_getAutoDeterminedType($value);
|
||||
|
||||
|
||||
if ($type == self::TYPE_ARRAY) {
|
||||
$rii = new RecursiveIteratorIterator(
|
||||
$it = new RecursiveArrayIterator($value),
|
||||
@ -257,21 +257,27 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
}
|
||||
$value = $rii->getSubIterator()->getArrayCopy();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$output = '';
|
||||
|
||||
|
||||
switch ($type) {
|
||||
case self::TYPE_BOOLEAN:
|
||||
case self::TYPE_BOOL:
|
||||
$output .= ( $value ? 'true' : 'false' );
|
||||
break;
|
||||
case self::TYPE_STRING:
|
||||
$output .= "'" . $value . "'";
|
||||
$output .= "'" . addcslashes($value, "'") . "'";
|
||||
break;
|
||||
case self::TYPE_NULL:
|
||||
$output .= 'null';
|
||||
break;
|
||||
case self::TYPE_NUMBER:
|
||||
case self::TYPE_INTEGER:
|
||||
case self::TYPE_INT:
|
||||
case self::TYPE_FLOAT:
|
||||
case self::TYPE_DOUBLE:
|
||||
case self::TYPE_NULL:
|
||||
case self::TYPE_CONSTANT:
|
||||
$output .= $value;
|
||||
break;
|
||||
@ -292,9 +298,9 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
$outputParts[] = $partV;
|
||||
$noKeyIndex++;
|
||||
} else {
|
||||
$outputParts[] = (is_int($n) ? $n : "'" . $n . "'") . ' => ' . $partV;
|
||||
$outputParts[] = (is_int($n) ? $n : "'" . addcslashes($n, "'") . "'") . ' => ' . $partV;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$output .= implode(',' . PHP_EOL . str_repeat($this->_indentation, $this->_arrayDepth+1), $outputParts);
|
||||
if ($curArrayMultiblock == true) {
|
||||
@ -304,11 +310,14 @@ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Ph
|
||||
break;
|
||||
case self::TYPE_OTHER:
|
||||
default:
|
||||
throw new Exception('I dont know this type');
|
||||
require_once "Zend/CodeGenerator/Php/Exception.php";
|
||||
throw new Zend_CodeGenerator_Php_Exception(
|
||||
"Type '".get_class($value)."' is unknown or cannot be used as property default value."
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$output .= ';';
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user