/** * Option configurations * * @return void */ protected function configureOptions() { foreach ($this->options as $option) { call_user_method_array('addOption', $this, $option); } return $this; }
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; }
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"); }
/** * 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))); }
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); } }
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(); }
/** */ 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(); } }
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); }
/** * 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; }
public function getChildren() { if (empty($this['children'])) { return array(); } else { return call_user_method_array('getCategories', $this['CollectionParent'], $this['children']); } }
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); } }
/** * * @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!"); }
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"); }
/** * 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; } }
/** * 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); } }
public function __call($name, $arguments) { if (false !== strpos($name, 'make')) { // Attempt to call the method $class = ucfirst(substr($name, 4)); $classPath = __NAMESPACE__ . "\\Entity\\{$class}"; $object = new $classPath(); return call_user_method_array($name, $object, $arguments); } else { throw new GeneratorException(sprintf("Unknown method called! '%s'", (string) $name)); } }
/** * magic funtion __call * implements aop functionality by invoking methods which have a underscore(_) prefix * and weave in aspects before and after method * @param string $pMethod methodname * @param array $pArgs arguments */ public function __call($pMethod = '', $pArgs = array()) { $aspectMethod = '_' . $pMethod; if (!\method_exists($this, $aspectMethod)) { throw new EFrameworkInterceptor(sprintf("aspectized method %s does not exists\n", $aspectMethod)); } $joinPoint = new AOP\JoinPoints\CMethodCall(\get_class($this), $pMethod, $pArgs); AOP\AFramework::weaveIn($this, $joinPoint); $joinPoint->result = call_user_method_array($aspectMethod, $this, $pArgs); AOP\AFramework::weaveOut($this, $joinPoint); return $joinPoint->result; }
public function call($method, $params = []) { $result = []; foreach ($this->services as $key => $service) { if (method_exists($service['provider'], $method)) { $data = call_user_method_array([$service['provider'], $method], $params); if ($data) { $result[] = $data; } } } return $result; }
/** * This is a shortcut function to access the latest TheLib object. * * Usage: * WDev()->message(); */ function WDev() { $obj = TheLibWrap::$object; if (func_num_args()) { $func = func_get_arg(0); $args = func_get_args(); array_shift($args); if (is_callable(array($obj, $func))) { return call_user_method_array($func, $obj, $args); } } return $obj; }
public function executeAction() { if ($this->route->isAuthRequired() && !Authentication::isAuthenticated()) { $loginRoute = Route::findRoute(\Config\App\LOGIN_PAGE_ROUTE, Route::METHOD_GET); $obj = ControllerHandler::instance()->redirectToRoute($loginRoute, $this->request); $action = $loginRoute->getAction(); $parameters = Route::getRouteParameters($this->route, $this->request); return call_user_method_array($action, $obj, $parameters); } $action = $this->route->getAction(); $parameters = Route::getRouteParameters($this->route, $this->request); return call_user_method_array($action, $this, $parameters); }
function pay($type = null, $action = 'form') { $this->init(); if ($type === null) { return $this; } else { $f = 'pay_' . strtolower($type) . '_' . strtolower($action); $pp = func_get_args(); array_shift($pp); array_shift($pp); return method_exists($this, $f) ? @call_user_method_array($f, $this, $pp) : false; } }
/** * Executes a callback (flexible input) * * Accepts arguments: * - "className", "methodName", [ array(arguments) ] * - object, "methodName", [ array(arguments) ] * - array("className", "methodName"), [ array(arguments) ] * - array(object, "methodName"), [ array(arguments) ] * - "functionName" [ array(arguments) ] * * @param mixed $arg1 String (function callback) or array (class and object callbacks) * @param mixed $arg2 String (for objects and classes) or array (for function callbacks) * @param array $arg3 Array for objects and classes */ function call($arg1, $arg2 = false, $arg3 = array()) { switch (func_num_args()) { default: case 3: call_user_method_array(array($arg1, $arg2), $arg3); break; case 2 && is_array($arg2): call_user_func_array($arg1, $arg2); break; case 1 && is_string($arg1): call_user_func($arg1); break; } }
/** * / * @return [type] [description] */ public static function query() { $args = func_get_args(); $db = $args[0]; $method = $args[1]; unset($args[0]); unset($args[1]); $params = array_values($args); $model = new static($db); if (method_exists($model, $method)) { $result = call_user_method_array($method, $model, $params); return $result; } return new Result(array('success' => false, 'message' => "Method {$method} does not exist.")); }
public function __call($method, $args) { $b = NULL; if (method_exists($this->router, $method)) { $router = $this->router; $b = call_user_method_array($method, $router, $args); $this->router = $router; } elseif (method_exists($this->sql_object, $method)) { $sql_object = $this->sql_object; $b = call_user_method_array(array($sql_object, $method), $args); $this->sql_object = $sql_object; } if ($b !== NULL) { return $b; } }
/** * Execute the command. * * @param InputInterface $input * @param OutputInterface $output * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $formatter = $input->getArgument('formatter'); $params = []; // If 'params' option is not empty, parse it into array if (!empty($strParam = $input->getOption('params'))) { $params = explode(',', $strParam); } try { $data = call_user_method_array($formatter, $this->faker, $params); $output->writeln($data); } catch (InvalidArgumentException $e) { $output->writeln("<error>{$e->getMessage()}</error>"); $output->writeln("Visit https://github.com/fzaninotto/Faker for complete lists of valid formatters."); } }
public function runFilters($controller, $action, $params, $filters, $skip) { $count = 0; foreach ($filters as $filter) { $runFilter = true; if (isset($skip[$filter])) { if (isset($skip[$filter]["only"]) && in_array($action, $skip[$filter]["only"]) || isset($skip[$filter]["except"]) && !in_array($action, $skip[$filter]["except"])) { $runFilter = false; } } if ($runFilter) { call_user_method_array($filter, $controller, $params); $count++; } } return $count; }
public function save($reload = false) { $args = count(func_get_args()) > 1 ? array_shift(func_get_args()) : array(); $this->log('[' . $this->_name() . '::save] ', false); try { $saved = call_user_method_array('_save', $this, $args); if ($saved === false) { $this->log('NOT SAVED: There were no changes.'); return $this; } else { $this->log('SAVED: ' . $saved); return $reload ? $this->load($saved) : $this; } } catch (Strategery_Migrations_Exception $e) { $this->log('error - ' . $e->getMessage()); return false; } }
public function __call($methodName, $params) { // what are we doing? $log = usingLog()->startAction(["run redis command", $methodName, "with params:", $params]); // do we have such a redis call? if (!method_exists($this->args[0], $methodName)) { throw new E5xx_ActionFailed(__METHOD__, "no such redis command '{$methodName}'"); } // make the call try { $return = call_user_method_array($methodName, $this->args[0], $params); // all done $log->endAction($return); return $return; } catch (Exception $e) { throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); } }
/** * Выполнение действия вызванного пользователем. * По-умолчанию выводит представление с таким же именем как у действия (псевдонима) * @param string $action */ protected function run($action) { $methodName = "action" . $action; if (method_exists($this, $methodName)) { call_user_method_array($methodName, $this, UrlManager::getParams()); } else { $this->render($action); } }
/** * Processes the initial data set, recursivly in order to achieve a * fully functional api call. * * @return */ private function processSet(ApiRetrievable $set) { // Checks if the next index is available in the set. if (!isset($this->pathComponents[$this->componentIndex])) { // Is finnal query, call request type method. return call_user_method($this->requestType, $set, $this->requestData); } $compVal = $this->pathComponents[$this->componentIndex]; // Check if is actually searchin for an id. if (is_numeric($compVal)) { $contentType = get_class($set); if (get_class($set) == 'ApiDataSet') { $contentType = $set->contentType; } return $this->processSet($contentType::getInstance($compVal)); } // Call the acceptable functions. $funcs = $set::getAvailableReturns(); $usedFunc = null; // Check if a function is being called... foreach ($funcs as $func) { if ($compVal == $func['url_name']) { $usedFunc = $func; } } // Check if the function exists. if ($usedFunc) { $method = $usedFunc['method_name']; $arguments = array(); // Get the arguments from the array. $iterations = 0; // First iteration throuh the component index is moved to the // next argument. $this->componentIndex++; while ($this->componentIndex < count($this->pathComponents) && $iterations++ < $usedFunc['argument_count']) { $arguments[] = $this->pathComponents[$this->componentIndex++]; } $result = call_user_method_array($method, $set, $arguments); // Establish what type of result is being expected. $returnType = isset($userFunc['return_type']) ? $userFunc['return_type'] : ':self'; // Check for ':self' if ($returnType == ':self') { // Check if this is a set or a result. if (get_class($set) == 'ApiDataSet') { $returnType = $set->contentType; } else { $returnType = get_class($set); } } if (isset($usedFunc['return_set']) && !$usedFunc['return_set']) { // Return an instance of the return type not a set. return $this->processSet(new $returnType($result)); } // Turn the result into a new data set. Send this set to be // processed. return $this->processSet(new ApiDataSet($returnType, $result)); } else { return call_user_method($this->requestType, $set, $this->requestData); } }