本文整理汇总了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();
}
}