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


PHP checkArgument函数代码示例

本文整理汇总了PHP中checkArgument函数的典型用法代码示例。如果您正苦于以下问题:PHP checkArgument函数的具体用法?PHP checkArgument怎么用?PHP checkArgument使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: toString

 public static function toString($value)
 {
     checkArgument(is_int($value), 'value must be a integer');
     if (array_key_exists($value, self::$_values)) {
         return self::$_values[$value];
     }
     return 'UNKNOWN';
 }
开发者ID:tuttarealstep,项目名称:pokegoapi-php,代码行数:8,代码来源:UseItemGymResponse.php

示例2: PDO

	.Get id
	.Get action
		Set :			Get :			GetLast :	GetAll :
		.Get note 		.Get matiere 	nil 		nil
		.Get date
		.Get matiere
*/
try {
    $inst = Config::getInstance();
    $bdd = new PDO('mysql:host=' . $inst->get('db_host') . ';dbname=' . $inst->get('db_name') . '', $inst->get('db_user'), $inst->get('db_pass'));
} catch (\Exception $e) {
    die('Erreur : ' . $e->getMessage());
}
$bdd->query("SET NAMES 'UTF-8'");
try {
    if (checkArgument()) {
        $user = new User($_GET['id'], $_GET['name'], null, null, null);
        $user->checkIdUser($bdd);
        $note = new Note(null, $_GET['id'], $_GET['matiere'], $_GET['note'], $_GET['date']);
        switch ($_GET['action']) {
            case 'set':
                $disp = $note->setNote($bdd);
                break;
            case 'get':
                $disp = $note->getNote($bdd);
                break;
            case 'getLast':
                $disp = $note->getLast($bdd);
                break;
            case 'getAll':
                $disp = $note->getAll($bdd);
开发者ID:hugo082,项目名称:API_FamillyApp,代码行数:31,代码来源:note.php

示例3: header

<?php

header('Content-Type: application/json; charset=utf-8');
/*
	---- VALUE ----
	.Get name
	.Get id
	.Get action
		Set :			Get :			GetLast :	GetAll :
		.Get note 		.Get matiere 	nil 		nil
		.Get date
		.Get matiere
*/
include 'co_Bdd.php';
try {
    if (checkArgument() && checkUser($_GET['name'], $_GET['id'], $bdd)) {
        switch ($_GET['action']) {
            case 'set':
                $disp = setNote($bdd);
                break;
            case 'get':
                $disp = getNote($bdd);
                break;
            case 'getLast':
                $disp = getLast($bdd);
                break;
            case 'getAll':
                $disp = getAll($bdd);
                break;
            default:
                throw new Exception('ActionNotFound', 04);
开发者ID:hugo082,项目名称:API_FamillyApp,代码行数:31,代码来源:getSetNote.php

示例4: skip_field

 /**
  * Seek past the current field
  * TODO Rewrite this to be safer
  */
 public static function skip_field($fp, $wire_type, &$limit = PHP_INT_MAX)
 {
     checkArgument(get_resource_type($fp) === 'stream', 'fp must be a file resource');
     checkArgument(is_int($wire_type), 'wire_type must be a integer');
     switch ($wire_type) {
         case 0:
             // varint
             $tmp = self::skip_varint($fp, $limit);
             if ($tmp === false) {
                 throw new \Exception('Protobuf::skip_varint returned false');
             }
         case 1:
             // 64bit
             if (fseek($fp, 8, SEEK_CUR) === -1) {
                 throw new Exception('skip(' . self::get_wiretype(1) . '): Error seeking');
             }
             $limit -= 8;
         case 2:
             // length delimited
             $len = self::read_varint($fp, $limit);
             if ($len === false) {
                 throw new \Exception('Protobuf::read_varint returned false');
             }
             if (fseek($fp, $len, SEEK_CUR) === -1) {
                 throw new Exception('skip(' . self::get_wiretype(2) . '): Error seeking');
             }
             $limit -= $len;
             //case 3: // Start group TODO we must keep looping until we find the closing end grou
             //case 4: // End group - We should never skip a end group!
             //	return 0; // Do nothing
         //case 3: // Start group TODO we must keep looping until we find the closing end grou
         //case 4: // End group - We should never skip a end group!
         //	return 0; // Do nothing
         case 5:
             // 32bit
             if (fseek($fp, 4, SEEK_CUR) === -1) {
                 throw new Exception('skip(' . self::get_wiretype(5) . '): Error seeking');
             }
             $limit -= 4;
         default:
             throw new Exception('skip(' . self::get_wiretype($wire_type) . '): Unsupported wire_type');
     }
 }
开发者ID:bramp,项目名称:protoc-gen-php,代码行数:47,代码来源:protocolbuffers.inc.php


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