• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ApiError类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 public function __construct(&$subject, $config = array())
 {
     parent::__construct($subject, $config = array());
     $easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php';
     if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easysocial', true)) {
         ApiError::raiseError(404, 'Easyblog not installed');
         return;
     }
     // Load Easyblog language & bootstrap files
     $language = JFactory::getLanguage();
     $language->load('com_easyblog');
     require_once JPATH_ROOT . '/components/com_easyblog/constants.php';
     require_once EBLOG_HELPERS . '/helper.php';
     // Set resources & access
     ApiResource::addIncludePath(dirname(__FILE__) . '/easyblog');
     $this->setResourceAccess('latest', 'public', 'get');
     $this->setResourceAccess('category', 'public', 'get');
     $this->setResourceAccess('blog', 'public', 'get');
     $this->setResourceAccess('blog', 'public', 'post');
     $this->setResourceAccess('comments', 'public', 'get');
     $this->setResourceAccess('easyblog_users', 'public', 'get');
     $config = EasyBlogHelper::getConfig();
     if ($config->get('main_allowguestcomment')) {
         $this->setResourceAccess('comments', 'public', 'post');
     }
 }
开发者ID:beingsane,项目名称:com_api-plugins,代码行数:26,代码来源:easyblog.php


示例2: render

 public function render()
 {
     $params = [];
     $errorCode = ApiError::UNKNOWN;
     if ($this->exception instanceof LackParametersException) {
         $errorCode = ApiError::LACK_PARAMETERS;
         $params['lackParameters'] = explode(', ', $this->exception->getMessage());
     } elseif ($this->exception instanceof UnauthenticatedException) {
         $errorCode = ApiError::UNAUTHENTICATED;
     } elseif ($this->exception instanceof UnauthorizedException) {
         $errorCode = ApiError::NOT_AUTHENTICATED;
     }
     $statusCode = $this->response->statusCode();
     $errorMessages = ApiError::messages();
     if (isset($errorMessages[$statusCode])) {
         $errorCode = $statusCode;
     }
     if (Configure::read('debug') > 1 && $errorCode == ApiError::UNKNOWN) {
         $params['debug'] = ['message' => $this->exception->getMessage(), 'trace' => explode("\n", $this->exception->getTraceAsString())];
     }
     $params = ['success' => false, 'code' => $statusCode, 'errorCode' => $errorCode, 'errorMessage' => ApiError::message($errorCode)] + $params;
     $this->response->body(json_encode($params));
     $this->response->type('json');
     $this->response->send();
 }
开发者ID:hiromi2424,项目名称:api,代码行数:25,代码来源:ApiExceptionRenderer.php


示例3: __construct

 public function __construct($reason = null, $fieldPath = null, $trigger = null, $errorString = null, $ApiErrorType = null)
 {
     parent::__construct();
     $this->reason = $reason;
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:antonsmolin,项目名称:google-ads-api-namespaced,代码行数:9,代码来源:SelectorError.php


示例4: invoke

 public final function invoke()
 {
     $method_name = $this->plugin->get('request_method');
     if (in_array($method_name, $this->allowed_methods) && method_exists($this, $method_name) && is_callable(array($this, $method_name))) {
         $this->{$method_name}();
     } else {
         ApiError::raiseError(404, JText::_('COM_API_PLUGIN_METHOD_NOT_FOUND'));
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:9,代码来源:resource.php


示例5: __construct

 public function __construct($reason = null, $rateName = null, $rateScope = null, $retryAfterSeconds = null, $fieldPath = null, $trigger = null, $errorString = null, $ApiErrorType = null)
 {
     parent::__construct();
     $this->reason = $reason;
     $this->rateName = $rateName;
     $this->rateScope = $rateScope;
     $this->retryAfterSeconds = $retryAfterSeconds;
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:nediam,项目名称:adwords-lib,代码行数:12,代码来源:RateExceededError.php


示例6: __construct

 public function __construct($reason = null, $functionString = null, $operatorName = null, $operandIndex = null, $operandValue = null, $fieldPath = null, $trigger = null, $errorString = null, $ApiErrorType = null)
 {
     parent::__construct();
     $this->reason = $reason;
     $this->functionString = $functionString;
     $this->operatorName = $operatorName;
     $this->operandIndex = $operandIndex;
     $this->operandValue = $operandValue;
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:nediam,项目名称:adwords-lib,代码行数:13,代码来源:AdCustomizerError.php


示例7: __construct

 public function __construct($reason = null, $enclosingId = null, $limit = null, $accountLimitType = null, $existingCount = null, $fieldPath = null, $trigger = null, $errorString = null, $ApiErrorType = null)
 {
     parent::__construct();
     $this->reason = $reason;
     $this->enclosingId = $enclosingId;
     $this->limit = $limit;
     $this->accountLimitType = $accountLimitType;
     $this->existingCount = $existingCount;
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:anton-github,项目名称:google-adwords-api-light,代码行数:13,代码来源:EntityCountLimitExceeded.php


示例8: __construct

 public function __construct($key = null, $externalPolicyName = null, $externalPolicyUrl = null, $externalPolicyDescription = null, $isExemptable = null, $violatingParts = null, $fieldPath = null, $trigger = null, $errorString = null, $ApiErrorType = null)
 {
     parent::__construct();
     $this->key = $key;
     $this->externalPolicyName = $externalPolicyName;
     $this->externalPolicyUrl = $externalPolicyUrl;
     $this->externalPolicyDescription = $externalPolicyDescription;
     $this->isExemptable = $isExemptable;
     $this->violatingParts = $violatingParts;
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:nediam,项目名称:adwords-lib,代码行数:14,代码来源:PolicyViolationError.php


示例9: __construct

 public function __construct(&$subject, $config = array())
 {
     parent::__construct($subject, $config = array());
     $easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php';
     if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easyblog', true)) {
         ApiError::raiseError(404, 'Easyblog not installed');
         return;
     }
     //load helper file
     require_once JPATH_SITE . '/plugins/api/easyblog/helper/simpleschema.php';
     // Load Easyblog language & bootstrap files
     $language = JFactory::getLanguage();
     $language->load('com_easyblog');
     $xml = JFactory::getXML(JPATH_ADMINISTRATOR . '/components/com_easyblog/easyblog.xml');
     $version = (string) $xml->version;
     if ($version < 5) {
         require_once JPATH_ROOT . '/components/com_easyblog/constants.php';
         require_once JPATH_ROOT . '/components/com_easyblog/helpers/helper.php';
         ApiResource::addIncludePath(dirname(__FILE__) . '/easyblog4');
     } else {
         ApiResource::addIncludePath(dirname(__FILE__) . '/easyblog5');
         require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/constants.php';
         //require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/includes/gettable/gettable.php' ;
         require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes' . '/date/date.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes' . '/string/string.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes' . '/adsense/adsense.php';
     }
     // Set resources & access
     $this->setResourceAccess('latest', 'public', 'get');
     $this->setResourceAccess('category', 'public', 'get');
     $this->setResourceAccess('blog', 'public', 'get');
     $this->setResourceAccess('blog', 'public', 'post');
     $this->setResourceAccess('comments', 'public', 'get');
     $this->setResourceAccess('easyblog_users', 'public', 'get');
     $config = EasyBlogHelper::getConfig();
     if ($config->get('main_allowguestcomment')) {
         $this->setResourceAccess('comments', 'public', 'post');
     }
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:40,代码来源:easyblog.php


示例10: __construct

 public function __construct($reason = NULL, $adGroupId = NULL, $fieldPath = NULL, $trigger = NULL, $errorString = NULL, $ApiErrorType = NULL)
 {
     if (get_parent_class('AdGroupServiceError')) {
         parent::__construct();
     }
     $this->reason = $reason;
     $this->adGroupId = $adGroupId;
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:sambavade,项目名称:google-api-adwords-php,代码行数:12,代码来源:MutateJobService.php


示例11: __construct

 public function __construct($reason = NULL, $fieldPath = NULL, $trigger = NULL, $errorString = NULL, $ApiErrorType = NULL)
 {
     if (get_parent_class('AdUnitHierarchyError')) {
         parent::__construct();
     }
     $this->reason = $reason;
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:11,代码来源:PublisherQueryLanguageService.php


示例12: addError

 public function addError(ApiError $error)
 {
     $this->errors[] = $error->asArray();
     return $this;
 }
开发者ID:logbon72,项目名称:pebble-movies-server,代码行数:5,代码来源:Response.php


示例13: encode

 /**
  * Determines the method with which to encode the output based on the requested content type
  * @return string
  */
 public function encode()
 {
     $document = JFactory::getDocument();
     $document->setMimeEncoding($this->format);
     $format_name = $this->content_types[$this->format];
     $method = 'to' . ucfirst($format_name);
     if (!method_exists($this, $method)) {
         ApiError::raiseError(406, JText::_('COM_API_PLUGIN_NO_ENCODER'));
     }
     if (!is_callable(array($this, $method))) {
         ApiError::raiseError(404, JText::_('COM_API_PLUGIN_NO_ENCODER'));
     }
     return $this->{$method}();
 }
开发者ID:yalive,项目名称:com_api,代码行数:18,代码来源:plugin.php


示例14: defined

<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_webgallery
 *
 * @copyright   Copyright (C) 2012 Asikart. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      Generated by AKHelper - http://asikart.com
 */
// no direct access
defined('_JEXEC') or die;
$view = JRequest::getVar('view');
JRequest::setVar('view', 'api', 'method', true);
JRequest::setVar('format', 'json', 'method', true);
// Replace JDocumentHTML to JSON
JFactory::$document = JDocument::getInstance('json');
include_once dirname(__FILE__) . '/controllerapi.class.php';
include_once dirname(__FILE__) . '/viewapi.class.php';
include_once dirname(__FILE__) . '/errorapi.class.php';
// Replace API Error Handler
ApiError::attachHandler();
// Init API Server
include_once dirname(__FILE__) . '/../core.php';
AKHelper::_('api.initServer');
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:25,代码来源:api.init.php


示例15: __construct

 public function __construct($fieldPath = NULL, $trigger = NULL, $errorString = NULL, $ApiErrorType = NULL)
 {
     parent::__construct();
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:venkyanthony,项目名称:google-api-dfp-php,代码行数:8,代码来源:CreativeWrapperService.php


示例16: failure

 /**
  * レスポンスを失敗状態にします。
  * エラーコード、HTTPステータスを指定できます。
  *
  * @param string $errorCode
  * @param mixed $httpStatus
  * @return void
  * @see ApiError
  */
 public function failure($errorCode, $httpStatus = 500)
 {
     $this->setResponse(['success' => false, 'code' => $httpStatus, 'errorCode' => $errorCode, 'errorMessage' => ApiError::message($errorCode)]);
 }
开发者ID:hiromi2424,项目名称:api,代码行数:13,代码来源:ApiComponent.php


示例17: failure

 /**
  * test failure() method
  *
  * @test
  */
 public function failure()
 {
     $this->generateComponent();
     $this->Api->failure(ApiError::VALIDATION_ERROR);
     $this->assertSame(['success' => false, 'code' => 500, 'errorCode' => ApiError::VALIDATION_ERROR, 'errorMessage' => ApiError::message(ApiError::VALIDATION_ERROR)], $this->Api->getResponse());
     $this->generateComponent();
     $this->Api->failure(ApiError::VALIDATION_ERROR, 501);
     $this->assertSame(501, $this->Api->getResponse()['code']);
 }
开发者ID:hiromi2424,项目名称:api,代码行数:14,代码来源:ApiComponentTest.php


示例18: __construct

 public function __construct($fieldPath = NULL, $trigger = NULL, $errorString = NULL, $ApiErrorType = NULL)
 {
     if (get_parent_class('UniqueError')) {
         parent::__construct();
     }
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:10,代码来源:CustomFieldService.php


示例19: handleSession

 public function handleSession()
 {
     $class = JRequest::getVar('class');
     // get session key and detete user
     // =================================================================
     $s = JFactory::getSession();
     $key = JRequest::getVar('session_key');
     $db = JFactory::getDbo();
     $q = $db->getQuery(true);
     $q->select('userid')->from('#__session')->where("session_id='{$key}'");
     $db->setQuery($q, 0, 1);
     $uid = $db->loadResult();
     // if user has loged in, set it in session.
     // =================================================================
     if ($uid) {
         $user = JFactory::getUser($uid);
         $s->set('user', $user);
     }
     // Detect is login?
     // =================================================================
     $user = JFactory::getUser();
     if ($user->guest && $class != 'user') {
         ApiError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
     }
 }
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:25,代码来源:viewapi.class.php


示例20: __construct

 public function __construct($key = NULL, $externalPolicyName = NULL, $externalPolicyUrl = NULL, $externalPolicyDescription = NULL, $isExemptable = NULL, $violatingParts = NULL, $fieldPath = NULL, $trigger = NULL, $errorString = NULL, $ApiErrorType = NULL)
 {
     if (get_parent_class('PolicyViolationError')) {
         parent::__construct();
     }
     $this->key = $key;
     $this->externalPolicyName = $externalPolicyName;
     $this->externalPolicyUrl = $externalPolicyUrl;
     $this->externalPolicyDescription = $externalPolicyDescription;
     $this->isExemptable = $isExemptable;
     $this->violatingParts = $violatingParts;
     $this->fieldPath = $fieldPath;
     $this->trigger = $trigger;
     $this->errorString = $errorString;
     $this->ApiErrorType = $ApiErrorType;
 }
开发者ID:fertandil87,项目名称:adwords-php-client,代码行数:16,代码来源:AdGroupAdService.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ApiException类代码示例发布时间:2022-05-23
下一篇:
PHP ApiBase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap