当前位置: 首页>>代码示例>>PHP>>正文


PHP Ethna::raiseError方法代码示例

本文整理汇总了PHP中Ethna::raiseError方法的典型用法代码示例。如果您正苦于以下问题:PHP Ethna::raiseError方法的具体用法?PHP Ethna::raiseError怎么用?PHP Ethna::raiseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ethna的用法示例。


在下文中一共展示了Ethna::raiseError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:36,代码来源:Ethna_Plugin_Handle_AddAction.php

示例2: 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;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:35,代码来源:Ethna_Plugin_Handle_InfoPlugin.php

示例3: 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;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:38,代码来源:Ethna_Plugin_Handle_I18n.php

示例4: _perform

 /**
  *  @access protected
  */
 function _perform($target)
 {
     $r =& $this->_getopt(array('basedir='));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // table_name
     $table_name = array_shift($arg_list);
     if ($table_name == null) {
         return Ethna::raiseError('table name isn\'t set.', 'usage');
     }
     // basedir
     if (isset($opt_list['basedir'])) {
         $basedir = realpath(end($opt_list['basedir']));
     } else {
         $basedir = getcwd();
     }
     $r =& Ethna_Generator::generate($target, $basedir, $table_name);
     if (Ethna::isError($r)) {
         printf("error occurred while generating skelton. please see also following error message(s)\n\n");
         return $r;
     }
     return true;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:28,代码来源:Ethna_Plugin_Handle_AddAppObject.php

示例5: 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;
 }
开发者ID:hiroki-ta,项目名称:my.project,代码行数:34,代码来源:Help.php

示例6: 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;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:35,代码来源:Ethna_Plugin_Handle_AddView.php

示例7: 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;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:35,代码来源:Ethna_Plugin_Handle_AddProject.php

示例8: 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;
 }
开发者ID:ethna,项目名称:ethna-cli,代码行数:33,代码来源:AddEntryPoint.php

示例9: 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;
 }
开发者ID:hiroki-ta,项目名称:my.project,代码行数:38,代码来源:CreatePlugin.php

示例10: 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;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:35,代码来源:Ethna_Plugin_Handle_AddTest.php

示例11: switch

 /**
  *  エントリポイントのスケルトンを生成する
  *
  *  @access public
  *  @param  string  $skelton    スケルトンファイル名
  *  @param  int     $gateway    ゲートウェイ
  *  @return true|Ethna_Error    true:成功 Ethna_Error:失敗
  */
 function &generate($action_name, $skelton = null, $gateway = GATEWAY_WWW)
 {
     $true = true;
     // entity
     switch ($gateway) {
         case GATEWAY_WWW:
             $entity = sprintf("%s/%s.%s", $this->ctl->getDirectory('www'), $action_name, $this->ctl->getExt('php'));
             break;
         case GATEWAY_CLI:
             $entity = sprintf("%s/%s.%s", $this->ctl->getDirectory('bin'), $action_name, $this->ctl->getExt('php'));
             break;
         default:
             $ret = Ethna::raiseError('add-entry-point accepts only GATEWAY_WWW or GATEWAY_CLI.');
             return $ret;
     }
     // skelton
     if ($skelton === null) {
         switch ($gateway) {
             case GATEWAY_WWW:
                 $skelton = 'skel.entry_www.php';
                 break;
             case GATEWAY_CLI:
                 $skelton = 'skel.entry_cli.php';
                 break;
         }
     }
     if (file_exists($entity)) {
         printf("file [%s] already exists -> skip\n", $entity);
         return $true;
     }
     // macro
     $macro = array();
     $macro['project_id'] = $this->ctl->getAppId();
     $macro['action_name'] = $action_name;
     $macro['dir_app'] = $this->ctl->getDirectory('app');
     // user macro
     $user_macro = $this->_getUserMacro();
     $macro = array_merge($macro, $user_macro);
     // generate
     $ret = $this->_generateFile($skelton, $entity, $macro);
     if ($ret) {
         printf("action script(s) successfully created [%s]\n", $entity);
     } else {
         printf("[warning] file creation failed [%s]\n", $entity);
         return $true;
         // XXX: error handling
     }
     // chmod
     if ($gateway === GATEWAY_CLI) {
         // is needed?
         //$ret = Ethna_Util::chmod($entity, 0777);
     }
     return $true;
 }
开发者ID:riaf,项目名称:pastit,代码行数:62,代码来源:EntryPoint.php

示例12: resolveActionName

 public function resolveActionName(Request $request, string $default_action_name)
 {
     $action_name = (new Ethna_RequestWrapper($request))->getActionName($default_action_name);
     list($action_class_name, , ) = $this->getClassNames($action_name);
     if (is_null($action_class_name)) {
         $this->logger->end();
         $r = Ethna::raiseError("undefined action [%s]", E_APP_UNDEFINED_ACTION, $action_name);
         throw new \Exception($r->getMessage());
     }
     return $action_name;
 }
开发者ID:dqneo,项目名称:ethnam,代码行数:11,代码来源:ActionResolver.php

示例13: getUserByToken

 public function getUserByToken($token)
 {
     $ret = $this->db->getRow(sprintf('SELECT * FROM %s WHERE token = ?', $this->_table), $token);
     if (!$ret) {
         return Ethna::raiseError("user not found");
     }
     if (Ethna::isError($ret)) {
         return $ret;
     }
     return $ret;
 }
开发者ID:riaf,项目名称:pastit,代码行数:11,代码来源:Pastit_UserManager.php

示例14: generate

 /**
  *  アクションのスケルトンを生成する
  *
  *  @access public
  *  @param  string  $action_name    アクション名
  *  @param  string  $skelton        スケルトンファイル名
  *  @param  int     $gateway        ゲートウェイ
  *  @return true|Ethna_Error        true:成功 Ethna_Error:失敗
  */
 function generate($action_name, $skelton = null, $gateway = GATEWAY_WWW)
 {
     $action_dir = $this->ctl->getActiondir($gateway);
     $action_class = $this->ctl->getDefaultActionClass($action_name, $gateway);
     $action_form = $this->ctl->getDefaultFormClass($action_name, $gateway);
     $action_path = $this->ctl->getDefaultActionPath($action_name);
     // entity
     $entity = $action_dir . $action_path;
     Ethna_Util::mkdir(dirname($entity), 0755);
     // skelton
     if ($skelton === null) {
         switch ($gateway) {
             case GATEWAY_WWW:
                 $skelton = "skel.action.php";
                 break;
             case GATEWAY_CLI:
                 $skelton = "skel.action_cli.php";
                 break;
             case GATEWAY_XMLRPC:
                 $skelton = "skel.action_xmlrpc.php";
                 break;
             default:
                 $err = Ethna::raiseError('unknown gateway.');
                 return $err;
         }
     }
     // macro
     $macro = array();
     $macro['project_id'] = $this->ctl->getAppId();
     $macro['action_name'] = $action_name;
     $macro['action_class'] = $action_class;
     $macro['action_form'] = $action_form;
     $macro['action_path'] = $action_path;
     // user macro
     $user_macro = $this->_getUserMacro();
     $macro = array_merge($macro, $user_macro);
     // generate
     if (file_exists($entity)) {
         printf("file [%s] already exists -> skip\n", $entity);
     } else {
         if ($this->_generateFile($skelton, $entity, $macro) == false) {
             printf("[warning] file creation failed [%s]\n", $entity);
         } else {
             printf("action script(s) successfully created [%s]\n", $entity);
         }
     }
     $true = true;
     return $true;
 }
开发者ID:hiroki-ta,项目名称:my.project,代码行数:58,代码来源:Action.php

示例15: createObject

 /**
  * 連想配列をもとに AppObject を生成し add() します。
  * 
  * @author Seiya Konno <seiya@uniba.jp>
  * @access protected
  * @param array $array
  * @param bool $add
  */
 function createObject($array = array(), $add = true)
 {
     if (is_null($this->name)) {
         return Ethna::raiseError('AppManager::$name が設定されていません。');
     }
     $this->backend->log(LOG_DEBUG, var_export($array, true));
     $appObject = $this->backend->getObject($this->name);
     foreach ($array as $key => $value) {
         $appObject->set($key, $value);
     }
     if ($add) {
         $result = $appObject->add();
         return Ethna::isError($result) ? $result : $appObject;
     }
     return $appObject;
 }
开发者ID:nulltask,项目名称:Aether,代码行数:24,代码来源:Aether_AppManager.php


注:本文中的Ethna::raiseError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。