File indexing completed on 2025-01-19 05:21:28

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_Server
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  */
0020 
0021 /**
0022  * Zend_Server_Reflection_ReturnValue
0023  */
0024 // require_once 'Zend/Server/Reflection/ReturnValue.php';
0025 
0026 /**
0027  * Zend_Server_Reflection_Parameter
0028  */
0029 // require_once 'Zend/Server/Reflection/Parameter.php';
0030 
0031 /**
0032  * Method/Function prototypes
0033  *
0034  * Contains accessors for the return value and all method arguments.
0035  *
0036  * @category   Zend
0037  * @package    Zend_Server
0038  * @subpackage Reflection
0039  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0040  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0041  * @version $Id$
0042  */
0043 class Zend_Server_Reflection_Prototype
0044 {
0045     /**
0046      * Constructor
0047      *
0048      * @param Zend_Server_Reflection_ReturnValue $return
0049      * @param array $params
0050      * @return void
0051      */
0052     public function __construct(Zend_Server_Reflection_ReturnValue $return, $params = null)
0053     {
0054         $this->_return = $return;
0055 
0056         if (!is_array($params) && (null !== $params)) {
0057             // require_once 'Zend/Server/Reflection/Exception.php';
0058             throw new Zend_Server_Reflection_Exception('Invalid parameters');
0059         }
0060 
0061         if (is_array($params)) {
0062             foreach ($params as $param) {
0063                 if (!$param instanceof Zend_Server_Reflection_Parameter) {
0064                     // require_once 'Zend/Server/Reflection/Exception.php';
0065                     throw new Zend_Server_Reflection_Exception('One or more params are invalid');
0066                 }
0067             }
0068         }
0069 
0070         $this->_params = $params;
0071     }
0072 
0073     /**
0074      * Retrieve return type
0075      *
0076      * @return string
0077      */
0078     public function getReturnType()
0079     {
0080         return $this->_return->getType();
0081     }
0082 
0083     /**
0084      * Retrieve the return value object
0085      *
0086      * @access public
0087      * @return Zend_Server_Reflection_ReturnValue
0088      */
0089     public function getReturnValue()
0090     {
0091         return $this->_return;
0092     }
0093 
0094     /**
0095      * Retrieve method parameters
0096      *
0097      * @return array Array of {@link Zend_Server_Reflection_Parameter}s
0098      */
0099     public function getParameters()
0100     {
0101         return $this->_params;
0102     }
0103 }