private function buildConstructArgs($class, $properties)
{
if ($properties === null) {
return array();
}
if (count($properties) == 0) {
return array();
}
$refMethod = $class->getConstructor();
$params = $refMethod->getParameters();
$args = array();
foreach ($params as $key => $param) {
$param_name = $param->getName();
if (isset($properties[$param_name])) {
$args[$key] = $this->getProperty($properties[$param_name]);
} else {
Verify::isTrue($param->isOptional(), "{$class->getName()}::__construct miss required param: {$param_name}");
//参数没有指定, 除非是可选参数
break;
}
}
return $args;
}