本文整理汇总了PHP中Ethna::isError方法的典型用法代码示例。如果您正苦于以下问题:PHP Ethna::isError方法的具体用法?PHP Ethna::isError怎么用?PHP Ethna::isError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ethna
的用法示例。
在下文中一共展示了Ethna::isError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform
/**
* add action entry point
*
* @access public
*/
function perform()
{
$r = $this->_getopt(array('basedir=', 'skelfile=', 'gateway='));
if (Ethna::isError($r)) {
return $r;
}
list($opt_list, $arg_list) = $r;
// action_name
$action_name = array_shift($arg_list);
if ($action_name == null) {
return Ethna::raiseError('action name isn\'t set.', 'usage');
}
$r = Ethna_Controller::checkActionName($action_name);
if (Ethna::isError($r)) {
return $r;
}
// add entry point
$ret = $this->_perform('EntryPoint', $action_name, $opt_list);
if (Ethna::isError($ret) || $ret === false) {
return $ret;
}
// add action (no effects if already exists.)
$ret = $this->_perform('Action', $action_name, $opt_list);
if (Ethna::isError($ret) || $ret === false) {
return $ret;
}
return true;
}
示例2: CommitTransaction
/**
* commitTransaction
* トランザクションを終了し、全ての変更をコミットする
*
* @return 成功時:true 失敗時:false
*/
public function CommitTransaction()
{
if (Ethna::isError($this->db->commit())) {
return false;
}
return true;
}
示例3: perform
/**
* @access public
*/
function perform()
{
$r = $this->_getopt(array('basedir=', 'type=', 'plugin-package'));
if (Ethna::isError($r)) {
return $r;
}
list($opt_list, $arg_list) = $r;
// plugin name
$plugin_name = array_shift($arg_list);
if (empty($plugin_name)) {
return Ethna::raiseError('Please specify plugin Name.', 'usage');
}
// plugin types
$type = end($opt_list['type']);
$types = explode(',', $type);
if (empty($type)) {
$types = array('v', 'f', 'sm');
// Validator, Filter, Smarty modifier.
}
// basedir
if (isset($opt_list['basedir'])) {
$basedir = realpath(end($opt_list['basedir']));
} else {
$basedir = getcwd();
}
// no-ini file flag.
$forpackage = isset($opt_list['plugin-package']) ? true : false;
$r = Ethna_Generator::generate('CreatePlugin', NULL, $basedir, $types, $forpackage, $plugin_name);
if (Ethna::isError($r)) {
printf("error occurred while generating plugin skelton. please see also error messages given above\n\n");
return $r;
}
printf("\nplugin skelton for [%s] is successfully generated.\n\n", $plugin_name);
return true;
}
示例4: perform
/**
* @access public
*/
function perform()
{
$args =& $this->_parseArgList();
if (Ethna::isError($args)) {
return $args;
}
$pear =& new Ethna_PearWrapper();
if (isset($args['pearopt'])) {
$pear->setPearOpt($args['pearopt']);
}
if (isset($args['type']) && isset($args['name'])) {
$target = isset($args['target']) ? $args['target'] : null;
$channel = isset($args['channel']) ? $args['channel'] : null;
$basedir = isset($args['basedir']) ? realpath($args['basedir']) : getcwd();
if ($target == 'master') {
$pkg_name = sprintf('Ethna_Plugin_%s_%s', $args['type'], $args['name']);
} else {
$pkg_name = sprintf('App_Plugin_%s_%s', $args['type'], $args['name']);
}
$r =& $pear->init($target, $basedir, $channel);
if (Ethna::isError($r)) {
return $r;
}
$r =& $pear->doInfo($pkg_name);
if (Ethna::isError($r)) {
return $r;
}
} else {
return Ethna::raiseError('invalid arguments', 'usage');
}
return true;
}
示例5: perform
/**
* @access public
*/
function perform()
{
$args =& $this->_parseArgList();
if (Ethna::isError($args)) {
return $args;
}
$pear =& new Ethna_PearWrapper();
if (isset($args['pearopt'])) {
$pear->setPearOpt($args['pearopt']);
}
$target = isset($args['target']) ? $args['target'] : null;
$channel = isset($args['channel']) ? $args['channel'] : null;
$basedir = isset($args['basedir']) ? realpath($args['basedir']) : getcwd();
$r =& $pear->init($target, $basedir, $channel);
if (Ethna::isError($r)) {
return $r;
}
$r =& $pear->doClearCache();
if (Ethna::isError($r)) {
return $r;
}
$r =& $pear->doChannelUpdate();
if (Ethna::isError($r)) {
return $r;
}
return true;
}
示例6: list
/**
* コマンドの実装部分
*
* テストケースファイル生成を行う
*
* @access protected
* @return mixed 実行結果: TRUE: 成功
* Ethna_Error: エラー
*/
function &perform()
{
// get args.
$r = $this->_getopt(array('basedir=', 'skelfile='));
if (Ethna::isError($r)) {
return $r;
}
list($optlist, $arglist) = $r;
$num = count($arglist);
if ($num < 1 || $num > 3) {
return Ethna::raiseError("Invalid Arguments.", 'usage');
}
if (isset($optlist['skelfile'])) {
$skelfile = end($optlist['skelfile']);
} else {
$skelfile = null;
}
$baseDir = isset($optlist['basedir']) ? $optlist['basedir'] : getcwd();
$name = $arglist[0];
$r =& Ethna_Generator::generate('Test', $baseDir, $skelfile, $name);
if (Ethna::isError($r)) {
return $r;
}
$true = true;
return $true;
}
示例7: func_get_args
/**
* スケルトンを削除する
*
* @access public
* @param string $type 生成する対象
* @param string $app_dir アプリケーションのディレクトリ
* (nullのときはアプリケーションを特定しない)
* @param mixed residue プラグインのremove()にそのまま渡す
* @static
*/
function &remove()
{
$arg_list = func_get_args();
$type = array_shift($arg_list);
$app_dir = array_shift($arg_list);
if ($app_dir === null) {
$ctl =& Ethna_Handle::getEthnaController();
} else {
$ctl =& Ethna_Handle::getAppController($app_dir);
}
if (Ethna::isError($ctl)) {
return $ctl;
}
$plugin_manager =& $ctl->getPlugin();
if (Ethna::isError($plugin_manager)) {
return $plugin_manager;
}
$generator =& $plugin_manager->getPlugin('Generator', $type);
if (Ethna::isError($generator)) {
return $generator;
}
// 引数はプラグイン依存とする
$ret = call_user_func_array(array(&$generator, 'remove'), $arg_list);
return $ret;
}
示例8: preforward
function preforward()
{
$item_manager = $this->backend->getManager('Item');
$filter = array('price' => new Ethna_AppSearchObject(0, OBJECT_CONDITION_GE));
$order = array('price' => OBJECT_SORT_DESC);
$offset = 0;
$count = 10;
$object_list_result = $item_manager->getObjectList('Item', $filter, $order, $offset, $count);
if (Ethna::isError($object_list_result)) {
$this->ae->addObject(null, $object_list_result);
return;
}
$item_list = array();
foreach ($object_list_result[1] as $item_object) {
if ($item_object->get('type') == ITEM_TYPE_BEER) {
$type_name = 'ビール';
} else {
if ($item_object->get('type') == ITEM_TYPE_SNACK) {
$type_name = 'お菓子';
}
}
$item_tmp = $item_object->getNameObject();
$item_tmp['type_name'] = $type_name;
$item_list[] = $item_tmp;
}
$this->af->setApp('item_list', $item_list);
$this->session->start();
// omajinai
$user_object = $this->backend->getObject('User', 'id', $this->session->get('id'));
if ($user_object->isValid()) {
$this->af->setApp('user', $user_object->getNameObject());
}
}
示例9: perform
/**
* generate message catalog.
*
* @access public
*/
function perform()
{
$r = $this->_getopt(array('basedir=', 'locale=', 'gettext'));
if (Ethna::isError($r)) {
return $r;
}
list($opt_list, $arg_list) = $r;
// basedir
if (isset($opt_list['basedir'])) {
$basedir = realpath(end($opt_list['basedir']));
} else {
$basedir = getcwd();
}
// locale
if (isset($opt_list['locale'])) {
$locale = end($opt_list['locale']);
if (!preg_match('/^[A-Za-z_]+$/', $locale)) {
return Ethna::raiseError("You specified locale, but invalid : {$locale}", 'usage');
}
} else {
$locale = 'ja_JP';
// default locale.
}
// use gettext ?
$use_gettext = isset($opt_list['gettext']) ? true : false;
// generate message catalog.
$ret =& Ethna_Generator::generate('I18n', $basedir, $locale, $use_gettext, $arg_list);
if (Ethna::isError($ret)) {
printf("error occurred while generating skelton. please see also following error message(s)\n\n");
return $ret;
}
return $ret;
}
示例10: _validateArgList
/**
* check arguments
*
* @access private
*/
function _validateArgList()
{
$arg_list = array();
if (count($this->arg_list) < 1) {
return Ethna::raiseError('too few argments', 'usage');
} else {
if (count($this->arg_list) > 2) {
return Ethna::raiseError('too many argments', 'usage');
} else {
if (count($this->arg_list) == 1) {
$arg_list[] = $this->arg_list[0];
$arg_list[] = getcwd();
} else {
$arg_list = $this->arg_list;
}
}
}
$r = Ethna_Controller::checkAppId($arg_list[0]);
if (Ethna::isError($r)) {
return $r;
}
if (is_dir($arg_list[1]) == false) {
return Ethna::raiseError("no such directory [{$arg_list[1]}]");
}
return $arg_list;
}
示例11: perform
/**
* show help
*
* @access public
*/
function perform()
{
$r = $this->_getopt();
if (Ethna::isError($r)) {
return $r;
}
list($opt_list, $arg_list) = $r;
// action_name
$handle_name = array_shift($arg_list);
if (!strlen($handle_name)) {
$handler_list = $this->eh->getHandlerList();
printf("usage: ethna [option] [command] [args...]\n\n");
printf("available options are as follows:\n\n");
printf(" -v, --version show version and exit\n");
printf("\navailable commands are as follows:\n\n");
foreach ($handler_list as $handler) {
printf(" %s\n", $handler->getId());
}
return true;
}
// getHandler
$handler = $this->eh->getHandler($handle_name);
if (Ethna::isError($handler) || $handler === false) {
// command not found
return Ethna::raiseError('command not found.', 'usage');
}
echo $handler->getDescription();
return true;
}
示例12: perform
/**
* add project:)
*
* @access public
*/
function perform()
{
$r = $this->_getopt(array('basedir='));
if (Ethna::isError($r)) {
return $r;
}
list($opt_list, $arg_list) = $r;
// app_id
$app_id = array_shift($arg_list);
if ($app_id == null) {
return Ethna::raiseError('project id isn\'t set.', 'usage');
}
$r = Ethna_Controller::checkAppId($app_id);
if (Ethna::isError($r)) {
return $r;
}
// basedir
if (isset($opt_list['basedir'])) {
$basedir = realpath(end($opt_list['basedir']));
} else {
$basedir = getcwd();
}
$r = Ethna_Generator::generate('Project', null, $app_id, $basedir);
if (Ethna::isError($r)) {
printf("error occurred while generating skelton. please see also error messages given above\n\n");
return $r;
}
printf("\nproject skelton for [%s] is successfully generated at [%s]\n\n", $app_id, $basedir);
return true;
}
示例13: realpath
/**
* @access protected
*/
function &_perform($target, $target_name, $opt_list)
{
// basedir
if (isset($opt_list['basedir'])) {
$basedir = realpath(end($opt_list['basedir']));
} else {
$basedir = getcwd();
}
// skelfile
if (isset($opt_list['skelfile'])) {
$skelfile = end($opt_list['skelfile']);
} else {
$skelfile = null;
}
// gateway
if (isset($opt_list['gateway'])) {
$gateway = 'GATEWAY_' . strtoupper(end($opt_list['gateway']));
if (defined($gateway)) {
$gateway = constant($gateway);
} else {
return Ethna::raiseError('unknown gateway', 'usage');
}
} else {
$gateway = GATEWAY_WWW;
}
$r =& Ethna_Generator::generate($target, $basedir, $target_name, $skelfile, $gateway);
if (Ethna::isError($r)) {
printf("error occurred while generating skelton. please see also following error message(s)\n\n");
return $r;
}
$true = true;
return $true;
}
示例14: perform
/**
* add view
*
* @access public
*/
function perform()
{
$r =& $this->_getopt(array('basedir=', 'skelfile=', 'template'));
if (Ethna::isError($r)) {
return $r;
}
list($opt_list, $arg_list) = $r;
// view_name
$view_name = array_shift($arg_list);
if ($view_name == null) {
return Ethna::raiseError('view name isn\'t set.', 'usage');
}
$r =& Ethna_Controller::checkViewName($view_name);
if (Ethna::isError($r)) {
return $r;
}
// add view
$ret =& $this->_perform('View', $view_name, $opt_list);
if (Ethna::isError($ret) || $ret === false) {
return $ret;
}
// add template
if (isset($opt_list['template'])) {
$ret =& $this->_perform('Template', $view_name, $opt_list);
if (Ethna::isError($ret) || $ret === false) {
return $ret;
}
}
return true;
}
示例15: test_cmd_option
function test_cmd_option()
{
// unrecognized option
$r = $this->proj->runCmd('add-template', array('-k'));
$this->assertTrue(Ethna::isError($r));
$this->assertEqual('unrecognized option -k', $r->getMessage());
// skel requires an argument
$r = $this->proj->runCmd('add-template', array('-s'));
$this->assertTrue(Ethna::isError($r));
$this->assertEqual('option -s requires an argument', $r->getMessage());
$r = $this->proj->runCmd('add-template', array('--skelfile'));
$this->assertTrue(Ethna::isError($r));
$this->assertEqual('option --skelfile requires an argument', $r->getMessage());
// locale requires an argument
$r = $this->proj->runCmd('add-template', array('-l'));
$this->assertTrue(Ethna::isError($r));
$this->assertEqual('option -l requires an argument', $r->getMessage());
$r = $this->proj->runCmd('add-template', array('--locale'));
$this->assertTrue(Ethna::isError($r));
$this->assertEqual('option --locale requires an argument', $r->getMessage());
// template name isn't set
$r = $this->proj->runCmd('add-template', array());
$this->assertTrue(Ethna::isError($r));
$this->assertEqual('template name isn\'t set.', $r->getMessage());
// invalid locale
$r = $this->proj->runCmd('add-template', array('-l', 'invalid::locale', 'test'));
$this->assertTrue(Ethna::isError($r));
$this->assertEqual('You specified locale, but invalid : invalid::locale', $r->getMessage());
// normal command exexute
$r = $this->proj->runCmd('add-template', array('-l', 'ja_JP', 'test'));
$this->assertFalse(Ethna::isError($r));
}