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


PHP Solar::apiVersion方法代码示例

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


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

示例1: testEncode_dequote

    public function testEncode_dequote()
    {
        $json = $this->_newJson();
        $before = array('parameters' => "Form.serialize('foo')", 'asynchronous' => true, 'onSuccess' => 'function(t) { new Effect.Highlight(el, {"duration":1});}', 'on404' => 'function(t) { alert(\'Error 404: location not found\'); }', 'onFailure' => 'function(t) { alert(\'Ack!\'); }', 'requestHeaders' => array('X-Solar-Version', Solar::apiVersion(), 'X-Foo', 'Bar'));
        $after = $json->encode($before, array('onSuccess', 'on404', 'onFailure', 'parameters'));
        $expect = <<<ENDEXPECT
{"parameters":Form.serialize('foo'),"asynchronous":true,"onSuccess":function(t) { new Effect.Highlight(el, {"duration":1});},"on404":function(t) { alert('Error 404: location not found'); },"onFailure":function(t) { alert('Ack!'); },"requestHeaders":["X-Solar-Version","1.0.0","X-Foo","Bar"]}
ENDEXPECT;
        $this->assertSame($after, trim($expect));
    }
开发者ID:abtris,项目名称:solarphp-quickstart,代码行数:10,代码来源:Json.php

示例2: exec

 /**
  * 
  * Public interface to execute the command.
  * 
  * This method...
  * 
  * - populates and validates the option values
  * - calls _preExec()
  * - calls _exec() with the numeric parameters from the options
  * - calls _postExec()
  * 
  * @param array $argv The command-line arguments from the user.
  * 
  * @return void
  * 
  * @todo Accept a Getopt object in addition to $argv array?
  * 
  */
 public function exec($argv = null)
 {
     // get the command-line arguments
     if ($argv === null) {
         // use the $_SERVER values
         $argv = $this->_request->server['argv'];
         // remove the argument pointing to this command
         array_shift($argv);
     } else {
         $argv = (array) $argv;
     }
     // set options, populate values, and validate parameters
     $this->_getopt->populate($argv);
     if (!$this->_getopt->validate()) {
         // need a better way to throw exceptions with specific error
         // messages
         throw $this->_exception('ERR_INVALID_OPTIONS', array('invalid' => $this->_getopt->getInvalid(), 'options' => $this->_getopt->options));
     }
     // retain the option values, minus the numeric params
     $this->_options = $this->_getopt->values();
     $params = array();
     foreach ($this->_options as $key => $val) {
         if (is_int($key)) {
             $params[] = $val;
             unset($this->_options[$key]);
         }
     }
     // special behavior for -V/--version
     if ($this->_options['version']) {
         $vendor = Solar_Class::vendor($this);
         $this->_out("{$vendor} command-line tool, Solar version ");
         $this->_outln(Solar::apiVersion() . '.');
         return;
     }
     // call pre-exec
     $skip_exec = $this->_preExec();
     // should we skip the main execution?
     if ($skip_exec !== true) {
         // call _exec() with the numeric params from getopt
         call_user_func_array(array($this, '_exec'), $params);
     }
     // call post-exec
     $this->_postExec();
     // done, return terminal to normal colors
     $this->_out("%n");
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:64,代码来源:Command.php


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