[ Index ] |
PHP Cross Reference of phpBB-3.3.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Zend Framework (http://framework.zend.com/) 4 * 5 * @link http://github.com/zendframework/zf2 for the canonical source repository 6 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) 7 * @license http://framework.zend.com/license/new-bsd New BSD License 8 */ 9 10 namespace Zend\Code\Generator\DocBlock\Tag; 11 12 use Zend\Code\Generator\AbstractGenerator; 13 14 use function explode; 15 use function implode; 16 use function is_string; 17 18 /** 19 * This abstract class can be used as parent for all tags 20 * that use a type part in their content. 21 * 22 * @see http://www.phpdoc.org/docs/latest/for-users/phpdoc/types.html 23 */ 24 abstract class AbstractTypeableTag extends AbstractGenerator 25 { 26 /** 27 * @var string 28 */ 29 protected $description; 30 31 /** 32 * @var array 33 */ 34 protected $types = []; 35 36 /** 37 * @param string|string[] $types 38 * @param string $description 39 */ 40 public function __construct($types = [], $description = null) 41 { 42 if (! empty($types)) { 43 $this->setTypes($types); 44 } 45 46 if (! empty($description)) { 47 $this->setDescription($description); 48 } 49 } 50 51 /** 52 * @param string $description 53 * @return AbstractTypeableTag 54 */ 55 public function setDescription($description) 56 { 57 $this->description = $description; 58 return $this; 59 } 60 61 /** 62 * @return string 63 */ 64 public function getDescription() 65 { 66 return $this->description; 67 } 68 69 /** 70 * Array of types or string with types delimited by pipe (|) 71 * e.g. array('int', 'null') or "int|null" 72 * 73 * @param array|string $types 74 * @return AbstractTypeableTag 75 */ 76 public function setTypes($types) 77 { 78 if (is_string($types)) { 79 $types = explode('|', $types); 80 } 81 $this->types = $types; 82 return $this; 83 } 84 85 /** 86 * @return array 87 */ 88 public function getTypes() 89 { 90 return $this->types; 91 } 92 93 /** 94 * @param string $delimiter 95 * @return string 96 */ 97 public function getTypesAsString($delimiter = '|') 98 { 99 return implode($delimiter, $this->types); 100 } 101 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Nov 4 14:26:03 2023 | Cross-referenced by PHPXref 0.7.1 |