PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/zend/Zend/Reflection/Docblock/Tag/Return.php

http://zoop.googlecode.com/
PHP | 72 lines | 26 code | 6 blank | 40 comment | 4 complexity | 4bb22746528e89cf3091ed9ae171f9fb MD5 | raw file
 1<?php
 2/**
 3 * Zend Framework
 4 *
 5 * LICENSE
 6 *
 7 * This source file is subject to the new BSD license that is bundled
 8 * with this package in the file LICENSE.txt.
 9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category   Zend
16 * @package    Zend_Reflection
17 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license    http://framework.zend.com/license/new-bsd     New BSD License
19 * @version    $Id: Return.php 20096 2010-01-06 02:05:09Z bkarwin $
20 */
21
22/** Zend_Reflection_Docblock_Tag */
23require_once 'Zend/Reflection/Docblock/Tag.php';
24
25/**
26 * @category   Zend
27 * @package    Zend_Reflection
28 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29 * @license    http://framework.zend.com/license/new-bsd     New BSD License
30 */
31class Zend_Reflection_Docblock_Tag_Return extends Zend_Reflection_Docblock_Tag
32{
33    /**
34     * @var string
35     */
36    protected $_type = null;
37
38    /**
39     * Constructor
40     *
41     * @param  string $tagDocblockLine
42     * @return void
43     */
44    public function __construct($tagDocblockLine)
45    {
46        if (!preg_match('#^@(\w+)\s+([\w|\\\]+)(?:\s+(.*))?#', $tagDocblockLine, $matches)) {
47            require_once 'Zend/Reflection/Exception.php';
48            throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid tag');
49        }
50
51        if ($matches[1] != 'return') {
52            require_once 'Zend/Reflection/Exception.php';
53            throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid @return tag');
54        }
55
56        $this->_name = 'return';
57        $this->_type = $matches[2];
58        if (isset($matches[3])) {
59            $this->_description = $matches[3];
60        }
61    }
62
63    /**
64     * Get return variable type
65     *
66     * @return string
67     */
68    public function getType()
69    {
70        return $this->_type;
71    }
72}