本文整理匯總了PHP中Zend_Reflection_Class::newInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Reflection_Class::newInstance方法的具體用法?PHP Zend_Reflection_Class::newInstance怎麽用?PHP Zend_Reflection_Class::newInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Reflection_Class
的用法示例。
在下文中一共展示了Zend_Reflection_Class::newInstance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _build
/**
* Construção de Objetos para Elementos Internas
* @param string $name Nome Completo da Classe
* @return mixed Instância da Classe Solicitada
* @throws Zend_Controller_Action_Exception Classe Inválida
*/
private function _build($name, array $params = array())
{
if (!(is_string($name) && class_exists($name))) {
throw new Zend_Controller_Action_Exception('Invalid Class Name');
}
// Construção
$reflect = new Zend_Reflection_Class($name);
// Retorno da Instância
return $reflect->newInstance($params);
}
示例2: _getFormReferencia
/**
* Captura um Formulário de Determinado Tipo
* @param string Nome do Formulário
* @return Local_Form_FormAbstract Elemento Solicitado
*/
protected function _getFormReferencia($tipo)
{
// Filtro de Dados
$filter = new Zend_Filter();
$filter->addFilter(new Zend_Filter_StringToLower())->addFilter(new Zend_Filter_Callback('ucfirst'));
$tipo = $filter->filter($tipo);
// Verificação
if (!in_array($tipo, $this->_references)) {
throw new Zend_Controller_Action_Exception('Invalid Referencia');
}
$classname = 'Application_Form_Referencia_' . $tipo;
$reflect = new Zend_Reflection_Class($classname);
return $reflect->newInstance(array());
}
示例3: _initObject
/**
* Init Object
*
* @param string $class
* @param array $params
* @return object
*/
protected function _initObject($class, array $params = array())
{
$ref = new Zend_Reflection_Class($class);
if (!empty($params)) {
return $ref->newInstanceArgs($params);
} else {
return $ref->newInstance();
}
}