本文整理汇总了PHP中ReflectionParameter::setPosition方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionParameter::setPosition方法的具体用法?PHP ReflectionParameter::setPosition怎么用?PHP ReflectionParameter::setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionParameter
的用法示例。
在下文中一共展示了ReflectionParameter::setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildSignatures
/**
* 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 Node) {
continue;
}
$signature = array();
do {
array_unshift($signature, $node->getValue());
$node = $node->getParent();
} while ($node instanceof Node);
$signatures[] = $signature;
}
// Build prototypes
$params = $this->reflection->getParameters();
foreach ($signatures as $signature) {
$return = new ReflectionReturnValue(array_shift($signature), $this->returnDesc);
$tmp = array();
foreach ($signature as $key => $type) {
$param = new ReflectionParameter($params[$key], $type, isset($this->paramDesc[$key]) ? $this->paramDesc[$key] : null);
$param->setPosition($key);
$tmp[] = $param;
}
$this->prototypes[] = new Prototype($return, $tmp);
}
}