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


PHP Set::enum方法代码示例

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


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

示例1: testEnum

 /**
  * testEnum method
  *
  * @return void
  */
 public function testEnum()
 {
     $result = Set::enum(1, 'one, two');
     $this->assertEquals('two', $result);
     $result = Set::enum(2, 'one, two');
     $this->assertNull($result);
     $set = array('one', 'two');
     $result = Set::enum(0, $set);
     $this->assertEquals('one', $result);
     $result = Set::enum(1, $set);
     $this->assertEquals('two', $result);
     $result = Set::enum(1, array('one', 'two'));
     $this->assertEquals('two', $result);
     $result = Set::enum(2, array('one', 'two'));
     $this->assertNull($result);
     $result = Set::enum('first', array('first' => 'one', 'second' => 'two'));
     $this->assertEquals('one', $result);
     $result = Set::enum('third', array('first' => 'one', 'second' => 'two'));
     $this->assertNull($result);
     $result = Set::enum('no', array('no' => 0, 'yes' => 1));
     $this->assertEquals(0, $result);
     $result = Set::enum('not sure', array('no' => 0, 'yes' => 1));
     $this->assertNull($result);
     $result = Set::enum(0);
     $this->assertEquals('no', $result);
     $result = Set::enum(1);
     $this->assertEquals('yes', $result);
     $result = Set::enum(2);
     $this->assertNull($result);
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:35,代码来源:SetTest.php

示例2: testEnum

 /**
  * testEnum method
  *
  * @access public
  * @return void
  */
 function testEnum()
 {
     $result = Set::enum(1, 'one, two');
     $this->assertIdentical($result, 'two');
     $result = Set::enum(2, 'one, two');
     $this->assertNull($result);
     $result = Set::enum(1, array('one', 'two'));
     $this->assertIdentical($result, 'two');
     $result = Set::enum(2, array('one', 'two'));
     $this->assertNull($result);
     $result = Set::enum('first', array('first' => 'one', 'second' => 'two'));
     $this->assertIdentical($result, 'one');
     $result = Set::enum('third', array('first' => 'one', 'second' => 'two'));
     $this->assertNull($result);
     $result = Set::enum('no', array('no' => 0, 'yes' => 1));
     $this->assertIdentical($result, 0);
     $result = Set::enum('not sure', array('no' => 0, 'yes' => 1));
     $this->assertNull($result);
 }
开发者ID:laiello,项目名称:fredistrano,代码行数:25,代码来源:set.test.php

示例3: getReturnedMessage

 public function getReturnedMessage($code)
 {
     return empty($code) ? '' : Set::enum($code, $this->returned_messages);
 }
开发者ID:ClasseraQwaider,项目名称:ClassEraAPI,代码行数:4,代码来源:AppController.php

示例4: _modifyChecks_r

 function _modifyChecks_r(&$array)
 {
     static $condEnum = array('logical' => array('not' => CHECK_CONDITION_LOGICAL_NOT, 'and' => CHECK_CONDITION_LOGICAL_AND, 'or' => CHECK_CONDITION_LOGICAL_OR, 'atleast' => CHECK_CONDITION_LOGICAL_AT_LEAST, 'atmost' => CHECK_CONDITION_LOGICAL_AT_MOST), 'registry' => array('exist' => CHECK_CONDITION_REGISTRY_EXISTS, 'equals' => CHECK_CONDITION_REGISTRY_EQUALS), 'file' => array('exists' => CHECK_CONDITION_FILE_EXISTS, 'sizeequals' => CHECK_CONDITION_FILE_SIZE_EQUALS, 'versionsmallerthan' => CHECK_CONDITION_FILE_VERSION_SMALLER_THAN, 'versionlessorequal' => CHECK_CONDITION_FILE_VERSION_LESS_THAN_OR_EQUAL_TO, 'versionequalto' => CHECK_CONDITION_FILE_VERSION_EQUAL_TO, 'versiongreaterthan' => CHECK_CONDITION_FILE_VERSION_GREATER_THAN, 'versiongreaterorequal' => CHECK_CONDITION_FILE_VERSION_GREATER_THAN_OR_EQUAL_TO), 'execute' => array('exitcodesmallerthan' => CHECK_CONDITION_EXECUTE_EXIT_CODE_SMALLER_THAN, 'exitcodelessorequal' => CHECK_CONDITION_EXECUTE_EXIT_CODE_LESS_THAN_OR_EQUAL_TO, 'exitcodeequalto' => CHECK_CONDITION_EXECUTE_EXIT_CODE_EQUAL_TO, 'exitcodegreaterthan' => CHECK_CONDITION_EXECUTE_EXIT_CODE_GREATER_THAN, 'exitcodegreaterorequal' => CHECK_CONDITION_EXECUTE_EXIT_CODE_GREATER_THAN_OR_EQUAL_TO), 'uninstall' => array('exists' => CHECK_CONDITION_UNINSTALL_EXISTS));
     $array['condition'] = Set::enum(strtolower($array['condition']), $condEnum[strtolower($array['type'])]);
     $array['type'] = constant('CHECK_TYPE_' . strtoupper($array['type']));
     if (isset($array['Childcheck']) && $array['type'] == CHECK_TYPE_LOGICAL) {
         $this->_arrayify($array['Childcheck']);
         for ($i = 0; $i < count($array['Childcheck']); $i++) {
             $this->_modifyChecks_r($array['Childcheck'][$i]);
         }
     }
 }
开发者ID:maverick2041,项目名称:wpkgexpress,代码行数:12,代码来源:import.functions.php


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