/** * get/setPosition() test */ public function testSetPosition() { $r = new Zend_Server_Reflection_Parameter($this->_getParameter()); $this->assertEquals(null, $r->getPosition()); $r->setPosition(3); $this->assertEquals(3, $r->getPosition()); }
/** * Build method signatures * * Builds method signatures using the array of return types and the array of * parameters types * * @param array $return Array of return types * @param string $returnDesc Return value description * @param array $params Array of arguments (each an array of types) * @param array $paramDesc Array of parameter descriptions * @return array */ protected function _buildSignatures($return, $returnDesc, $paramTypes, $paramDesc) { $this->_return = $return; $this->_returnDesc = $returnDesc; $this->_paramDesc = $paramDesc; $this->_sigParams = $paramTypes; $this->_sigParamsDepth = count($paramTypes); $signatureTrees = $this->_buildTree(); $signatures = array(); $endPoints = array(); foreach ($signatureTrees as $root) { $tmp = $root->getEndPoints(); if (empty($tmp)) { $endPoints = array_merge($endPoints, array($root)); } else { $endPoints = array_merge($endPoints, $tmp); } } foreach ($endPoints as $node) { if (!$node instanceof Zend_Server_Reflection_Node) { continue; } $signature = array(); do { array_unshift($signature, $node->getValue()); $node = $node->getParent(); } while ($node instanceof Zend_Server_Reflection_Node); $signatures[] = $signature; } // Build prototypes $params = $this->_reflection->getParameters(); foreach ($signatures as $signature) { $return = new Zend_Server_Reflection_ReturnValue(array_shift($signature), $this->_returnDesc); $tmp = array(); foreach ($signature as $key => $type) { $param = new Zend_Server_Reflection_Parameter($params[$key], $type, isset($this->_paramDesc[$key]) ? $this->_paramDesc[$key] : null); $param->setPosition($key); $tmp[] = $param; } $this->_prototypes[] = new Zend_Server_Reflection_Prototype($return, $tmp); } }