本文整理汇总了PHP中call_user_method_array函数的典型用法代码示例。如果您正苦于以下问题:PHP call_user_method_array函数的具体用法?PHP call_user_method_array怎么用?PHP call_user_method_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call_user_method_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureOptions
/**
* Option configurations
*
* @return void
*/
protected function configureOptions()
{
foreach ($this->options as $option) {
call_user_method_array('addOption', $this, $option);
}
return $this;
}
示例2: execute
public function execute($id)
{
if (!isset($this->prepares[$id])) {
throw new Moonlake_Exception_ModelConnector("The given id doesn't represent a valid prepared statement. This mostly means, that the statement is freed befor this call");
}
for ($i = 0; $i < count($this->prepares[$id]['types']); $i++) {
$args[] = func_get_arg($i + 1);
}
$stmt = $this->prepares[$id]['stmt'];
call_user_method_array('bind_param', $stmt, $args);
$stmt->execute() or $this->error($this->prepares[$id]['sql']);
// bind result byref to array
call_user_func_array(array($stmt, "bind_result"), $byref_array_for_fields);
// returns a copy of a value
$copy = create_function('$a', 'return $a;');
$results = array();
while ($mysqli_stmt_object->fetch()) {
// array_map will preserve keys when done here and this way
$result = array_map($copy, $byref_array_for_fields);
$mresult = new Moonlake_Model_Result();
foreach ($result as $key => $val) {
$mresult->{$key} = $val;
}
$results[] = $mresult;
}
// create with this new query
$qid = count($this->queries);
$this->queries[$qid]['sql'] = $sql;
$this->queries[$qid]['rows'] = count($results);
$this->queries[$qid]['seek'] = 0;
$this->queries[$qid]['result'] = $results;
return $results;
}
示例3: __call
public function __call($method, $arguments)
{
if (method_exists($this->pdf, $method)) {
return call_user_method_array($method, $this->pdf, $arguments);
}
throw new Exception("Method not found");
}
示例4: __call
/**
* Invokes HttpMessage object methods
*
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, $args)
{
if (method_exists($this->message, $method)) {
return call_user_method_array($method, $this->message, $args);
}
throw new \BadMethodCallException(sprintf('Method "%s" does not exist for class "%s".', $method, get_class($this)));
}
示例5: smarty_function_view
function smarty_function_view($params, &$smarty)
{
$src = $params["file"];
if ($src != "") {
$smarty->display(view_path . "/" . ltrim($src, "/"));
return;
}
//FIXME: Burası tek bir merkezden kontrol edilmeli.
global $rule;
foreach ($rule as $r) {
if (eregi($r["class"], $params["class"])) {
$class_path = controller_root . "/" . $r["file"];
$class_name = $r["class"];
break;
}
}
$method = $params["method"];
$method_arguments = get_arguments($params);
if (!file_exists($class_path)) {
echo "Module ({$class_name}) Not Found<br/>";
} else {
require_once $class_path;
}
if (!method_exists($class_name, $method)) {
echo "Method ({$method}) Not Found<br/>";
} else {
eval("\$class = new {$class_name}();");
$class->arguments = $smarty->get_template_vars();
call_user_method_array($method, $class, $method_arguments);
}
}
示例6: filter
public function filter($action, $args = array()){
$this->action = ( $action ? $action : "index" );
$this->args = ( $args ? $args : array() );
$this->extension = pathinfo($this->args[count($this->args) - 1], PATHINFO_EXTENSION);
if($this->extension){
$this->args[count($this->args) - 1] = str_replace(".{$this->extension}", '', $this->args[count($this->args) - 1]);
} else {
$this->extension = "html";
}
// Remove empty values from the args array
foreach($this->args as $key=>$arg){
if(empty($arg) || $arg == '') unset($this->args[$key]);
}
if(!method_exists($this, $this->action)){
if($this->defaultToIndex && method_exists($this, 'index')){
array_unshift($this->args, $this->action);
$this->action = 'index';
$this->filter($this->action, $this->args);
return;
}
throw new Exception("Undefined method - {$this->name}/{$this->action}");
}
if($this->beforeFilter() === false) return;
call_user_method_array($this->action, $this, $this->args);
$this->afterFilter();
if($this->autoRender) $this->render();
}
示例7: _call
/**
*/
public final function _call($method, $args)
{
if (method_exists($this->_content, $method)) {
call_user_method_array($method, $this->_content, $args);
} else {
throw $this->_exception_unknown_method();
}
}
示例8: __call
function __call($methodName, $params)
{
$tpl = $this->getTemplateInstance();
if (!method_exists($tpl, $methodName)) {
throw new lmbException('Wrong template method called', array('template class' => get_class($tpl), 'method' => $methodName));
}
return call_user_method_array($methodName, $tpl, $params);
}
示例9: make
/**
* Create a new document, but don't save yet
*
* @return Self
*/
public static function make()
{
$instance = new static();
if (method_exists($instance, 'setup')) {
call_user_method_array('setup', $instance, func_get_args());
}
return $instance;
}
示例10: getChildren
public function getChildren()
{
if (empty($this['children'])) {
return array();
} else {
return call_user_method_array('getCategories', $this['CollectionParent'], $this['children']);
}
}
示例11: log
public function log($message)
{
$message = $message . PHP_EOL;
if ($this->logger) {
call_user_method_array($this->callback, $this->logger, array($message));
} else {
$this->message($message);
}
}
示例12: __call
/**
*
* @param type $method
* @param type $args
* @return type
* @throws Exception
*/
public function __call($method, $args)
{
foreach ($this->_exts as $ext) {
if (method_exists($ext, $method)) {
return call_user_method_array($method, $ext, $args);
}
}
throw new Exception("Este Metodo {$method} nao existe!");
}
示例13: __call
public function __call($method, $args)
{
foreach ($this->_exts as $ext) {
if (method_exists($ext, $method)) {
return call_user_method_array($method, $ext, $args);
}
}
throw new Exception("This Method {$method} doesn't exists");
}
示例14: __call
/**
* Map certain calls to a single method, not usually on this object, e.g. the validation, which
* reside in Fu_DB_Validation
*
* @return mixed
*/
public function __call($m, $a)
{
switch (true) {
case substr($m, 0, 10) == 'validates_':
$validation = substr($m, 10);
return $this->_validation->add($validation, $a);
break;
case $m == 'bind':
if (is_string($a[1]) && method_exists($this, $a[1])) {
$a[1] = array($this, $a[1]);
}
return call_user_method_array('bind', $this->_event, $a);
break;
// associations
// associations
case $m == 'fetch':
return $this->_association->fetch($this, $a[0], (array) $a[1]);
break;
case $m == 'belongs_to':
$options = array('class' => $a[0], 'association_name' => $a[1], 'foreign_key_id' => $a[2] ? $a[2] : $a[1]);
if (is_array($a[3])) {
$options = array_merge($options, $a[3]);
}
return $this->_association->add($m, $options);
break;
case $m == 'has_one':
case $m == 'has_many':
$options = array('class' => $a[0], 'association_name' => $a[1], 'association_id' => $a[2]);
if (is_array($a[3])) {
$options = array_merge($options, $a[3]);
}
return $this->_association->add($m, $options);
break;
/**
* has_and_belongs_to_many & habtm are aliases of many_to_many
*/
/**
* has_and_belongs_to_many & habtm are aliases of many_to_many
*/
case $m == 'has_and_belongs_to_many':
case $m == 'habtm':
case $m == 'many_to_many':
$m = 'many_to_many';
$options = array('class' => $a[0], 'association_name' => $a[1]);
if (is_array($a[2])) {
$options = array_merge($options, $a[2]);
}
return $this->_association->add($m, $options);
break;
// pass any unknown methods calls to the DB handler
// pass any unknown methods calls to the DB handler
default:
throw new Exception("Method not found: {$m}");
break;
}
}
示例15: __call
/**
* We use the __call method here to provide transparent access to render and
* set (as we need to call these either on ourself or our cached template).
*
* @param string $method the method name
* @param array $arguments the array of arguments to pass through
* @return mixed the result of the function
*/
public function __call($method, $arguments)
{
if (!in_array($method, array('render', 'set'))) {
die("Scurvy: '{$method}' is not a valid scurvy method.");
}
if ($this->cache) {
return call_user_method_array($method, $this->cacheTemplate, $arguments);
} else {
return call_user_method_array($method, $this, $arguments);
}
}