function get_radio_val($input, $methode, $name, $resValue = null) { $value = sfContext::getInstance()->getRequest()->getParameter($name); if ($value !== null) { return $value == $resValue; } elseif (is_object($input) && $methode !== null) { if (method_exist($input, $methode)) { $value = $input->{$methode}(); } } elseif ($input !== null) { return $input; } return $value == $resValue; }
function getVal($input, $methode, $name) { if ($value = sfContext::getInstance()->getRequest()->getParameter($name)) { return $value; } elseif (is_object($input) && !is_null($methode)) { if (method_exist($input, $methode)) { $value = $input->{$methode}(); } else { return ""; } } elseif (!is_null($input)) { $value = $input; } return $value; }
public function _addTorrent(Torrent $torrent = null) { if (!is_null($torrent) && method_exist($torrent, 'getAddParams')) { $parameters = $torrent->getAddParams(); $method = $parameters['type'] == 'magnet' ? self::METHOD_ADD_MAGNET : self::METHOD_ADD_TORRENT; $arguments = array($parameters['href'], array()); try { return $this->client->finalRequest($method, $arguments)->getBody(); } catch (HTTPException $e) { throw new DelugeException($e->getMessage()); } } else { throw new \InvalidArgumentException(sprintf('"%s": Valid Torrent instance expected, "%s" given', 'addTorrent', print_r($torrent, true))); } }
function getVal($input, $methode, $name, $format = null) { $value = sfContext::getInstance()->getRequest()->getParameter($name); if (!is_null($value)) { if ($value == 'Available at') { $value = null; } return $value; } elseif (is_object($input) && !is_null($methode)) { if (method_exist($input, $methode)) { if ($format) { $value = $input->{$methode}($format); } else { $value = $input->{$methode}(); } } else { return ""; } } elseif (!is_null($input)) { $value = $input; } return $value; }
/** * Add a method to the methods list * * @param string $method * @return void * @throws Drake_Trait_LogicException When a method does not exist in the trait * @throws Drake_Trait_LogicException When a method has already been added */ private function _addMethod($method) { if (!method_exist($this, $method)) { throw new Drake_Trait_LogicException("Method '{$method}' does not exist."); } if (array_search($method, $this->_methods)) { throw new Drake_Trait_LogicException("Duplicate method '{$method}'."); } $this->_methods[] = $method; }
/** * LLama a un interface de un módulo activo en la aplicación. * * @param string $str_interface Nombre del interfaz. * @param array optional $arr_args Argumentos para la llamada. * * @return string The current application. * * @access public. */ function callInterface($str_interface, $arr_args = array()) { $ret_val = false; if ($this->hasInterface($str_interface, true)) { list($module, $method) = explode('::', $str_interface); //Validamos que el metodo realmente existe $class_name = 'miguel_' . $this->interfaces[$str_interface]['interface'] . '.class.php'; $method_name = $this->interfaces[$str_interface]['method']; $file_name = $this->interfaces[$str_interface]['module'] . '/model/classes/' . $class_name; //Fichero de definicion incluido if (file_exists(Util::app_Path($file_name))) { include_once $file_name; $obj_data = new $class_name(); //Metodo existe en clase if (method_exist($obj_data, $method)) { $ret_val = call_user_func_array(array(&$obj_data, $method_name), $arr_args); } else { $this->_setError('Method not found in class.', ERROR); } } else { $this->_setError('Class file not found.', ERROR); } } else { $this->_setError('Interface not defined: ' . $str_interface, ERROR); } return $ret_val; }