PageRenderTime 53ms CodeModel.GetById 49ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/zend/Zend/Server/Reflection/Prototype.php

http://zoop.googlecode.com/
PHP | 103 lines | 35 code | 9 blank | 59 comment | 4 complexity | 6b8cfb6ea1e97548c959a1eee60803ad 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_Server
 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 */
 20
 21/**
 22 * Zend_Server_Reflection_ReturnValue
 23 */
 24require_once 'Zend/Server/Reflection/ReturnValue.php';
 25
 26/**
 27 * Zend_Server_Reflection_Parameter
 28 */
 29require_once 'Zend/Server/Reflection/Parameter.php';
 30
 31/**
 32 * Method/Function prototypes
 33 *
 34 * Contains accessors for the return value and all method arguments.
 35 *
 36 * @category   Zend
 37 * @package    Zend_Server
 38 * @subpackage Reflection
 39 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 40 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 41 * @version $Id: Prototype.php 20096 2010-01-06 02:05:09Z bkarwin $
 42 */
 43class Zend_Server_Reflection_Prototype
 44{
 45    /**
 46     * Constructor
 47     *
 48     * @param Zend_Server_Reflection_ReturnValue $return
 49     * @param array $params
 50     * @return void
 51     */
 52    public function __construct(Zend_Server_Reflection_ReturnValue $return, $params = null)
 53    {
 54        $this->_return = $return;
 55
 56        if (!is_array($params) && (null !== $params)) {
 57            require_once 'Zend/Server/Reflection/Exception.php';
 58            throw new Zend_Server_Reflection_Exception('Invalid parameters');
 59        }
 60
 61        if (is_array($params)) {
 62            foreach ($params as $param) {
 63                if (!$param instanceof Zend_Server_Reflection_Parameter) {
 64                    require_once 'Zend/Server/Reflection/Exception.php';
 65                    throw new Zend_Server_Reflection_Exception('One or more params are invalid');
 66                }
 67            }
 68        }
 69
 70        $this->_params = $params;
 71    }
 72
 73    /**
 74     * Retrieve return type
 75     *
 76     * @return string
 77     */
 78    public function getReturnType()
 79    {
 80        return $this->_return->getType();
 81    }
 82
 83    /**
 84     * Retrieve the return value object
 85     *
 86     * @access public
 87     * @return Zend_Server_Reflection_ReturnValue
 88     */
 89    public function getReturnValue()
 90    {
 91        return $this->_return;
 92    }
 93
 94    /**
 95     * Retrieve method parameters
 96     *
 97     * @return array Array of {@link Zend_Server_Reflection_Parameter}s
 98     */
 99    public function getParameters()
100    {
101        return $this->_params;
102    }
103}