File indexing completed on 2024-06-23 05:55:36

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Reflection
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 /** Zend_Reflection_Docblock_Tag */
0023 // require_once 'Zend/Reflection/Docblock/Tag.php';
0024 
0025 /**
0026  * @category   Zend
0027  * @package    Zend_Reflection
0028  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0029  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0030  */
0031 class Zend_Reflection_Docblock_Tag_Return extends Zend_Reflection_Docblock_Tag
0032 {
0033     /**
0034      * @var string
0035      */
0036     protected $_type = null;
0037 
0038     /**
0039      * Constructor
0040      *
0041      * @param  string $tagDocblockLine
0042      * @return \Zend_Reflection_Docblock_Tag_Return
0043      */
0044     public function __construct($tagDocblockLine)
0045     {
0046         if (!preg_match('#^@(\w+)\s+([^\s]+)(?:\s+(.*))?#', $tagDocblockLine, $matches)) {
0047             // require_once 'Zend/Reflection/Exception.php';
0048             throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid tag');
0049         }
0050 
0051         if ($matches[1] != 'return') {
0052             // require_once 'Zend/Reflection/Exception.php';
0053             throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid @return tag');
0054         }
0055 
0056         $this->_name = 'return';
0057         $this->_type = $matches[2];
0058         if (isset($matches[3])) {
0059             $this->_description = $matches[3];
0060         }
0061     }
0062 
0063     /**
0064      * Get return variable type
0065      *
0066      * @return string
0067      */
0068     public function getType()
0069     {
0070         return $this->_type;
0071     }
0072 }