Source of file AbstractTypeableTag.php
Size: 2,119 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Code/Generator/DocBlock/Tag/AbstractTypeableTag.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Code\Generator\DocBlock\Tag; use Zend\Code\Generator\AbstractGenerator; /** * This abstract class can be used as parent for all tags * that use a type part in their content. * @see http://www.phpdoc.org/docs/latest/for-users/phpdoc/types.html */ abstract class AbstractTypeableTag extends AbstractGenerator { /** * @var string */ protected $description = null; /** * @var array */ protected $types = array(); /** * @param array $types * @param string $description */ public function __construct($types = array(), $description = null) { if (!empty($types)) { $this->setTypes($types); } if (!empty($description)) { $this->setDescription($description); } } /** * @param string $description * @return ReturnTag */ public function setDescription($description) { $this->description = $description; return $this; } /** * @return string */ public function getDescription() { return $this->description; } /** * Array of types or string with types delimited by pipe (|) * e.g. array('int', 'null') or "int|null" * * @param array|string $types * @return ReturnTag */ public function setTypes($types) { if (is_string($types)) { $types = explode('|', $types); } $this->types = $types; return $this; } /** * @return array */ public function getTypes() { return $this->types; } /** * @param string $delimiter * @return string */ public function getTypesAsString($delimiter = '|') { return implode($delimiter, $this->types); } } |