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


PHP Error::setMessage方法代码示例

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


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

示例1: buildMenuElement

 /**
  * This function creates a HTML-block for a menu item.
  *
  * @access public
  * @author k
  * @param MenuElement $parameters['menuElement']
  *        	the menu element
  * @param string $parameters['type']
  *        	the type
  * @see MenuElement::$type
  * @uses Error for error handling
  * @uses ErrorView for error handling
  * @uses MENU_COMMON for the common menu
  * @uses MENU_SIDE for the menu in sidebar
  */
 public static function buildMenuElement($parameters)
 {
     require_once 'HTML/Template/IT.php';
     $tpl = new \HTML_Template_IT(ROOT_FOLDER . 'html');
     $tpl->loadTemplatefile('particle-template.html');
     switch ($parameters['type']) {
         case MENU_COMMON:
             $tpl->setCurrentBlock('item-in-common-menu');
             $tpl->setVariable(array('HREF-OF-ITEM-IN-COMMON-MENU' => null === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL-OF-ITEM-IN-COMMON-MENU' => $parameters['menuElement']->translate(array('property' => 'label'))));
             $tpl->parse('item-in-common-menu');
             // echo ' 38: ', $tpl->get('menu-item');
             return $tpl->get('item-in-common-menu');
             break;
         case MENU_SIDE:
             $tpl->setCurrentBlock('item-in-menu-in-sidebar');
             $tpl->setVariable(array('HREF-OF-ITEM-IN-MENU-IN-SIDEBAR' => null === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL-OF-ITEM-IN-MENU-IN-SIDEBAR' => $parameters['menuElement']->translate(array('property' => 'label'))));
             $tpl->parse('item-in-menu-in-sidebar');
             return $tpl->get('item-in-menu-in-sidebar');
             break;
         default:
             require_once dirname(__FILE__) . '/Error.php';
             $error = new Error();
             $error->setMessage(\pstk\String::translate('errorWhichMenu'));
             require_once dirname(__FILE__) . '/ErrorView.php';
             ErrorView::raiseError($error);
     }
 }
开发者ID:piiskop,项目名称:pstk,代码行数:42,代码来源:MenuElementView.php

示例2: create

 public function create($article)
 {
     $postArgs = array('post_title' => $article->entityName, 'post_type' => DPSFA_Article_Slug, 'post_content' => '', 'post_excerpt' => '', 'post_status' => 'publish');
     $post = wp_insert_post($postArgs);
     if ($post) {
         $date = new \DateTime();
         $article->id = $post;
         $article->date_created = $date->getTimestamp();
         $article->save();
     } else {
         $error = new Error("Error", 400);
         $error->setTitle('Could not create Article');
         $error->setMessage('Wordpress could not create the article');
         $error->setRaw($post);
     }
 }
开发者ID:jerwarren,项目名称:digital-publishing-tools-for-wordpress,代码行数:16,代码来源:dpsfa-cms-wordpress-cpt-article.php

示例3: has_api_credentials

 public function has_api_credentials()
 {
     // Make sure all credentials have been entered
     // If nothign has been entered, return false
     if (empty($this->key) && empty($this->secret) && empty($this->device_token) && empty($this->device_id)) {
         return false;
     } else {
         $missing = array();
         if (empty($this->key)) {
             array_push($missing, "API Key");
         }
         if (empty($this->secret)) {
             array_push($missing, "API Secret");
         }
         if (empty($this->device_token)) {
             array_push($missing, "Device Token");
         }
         if (empty($this->device_id)) {
             array_push($missing, "Device ID");
         }
         if (empty($missing)) {
             return true;
         } else {
             // Throw new error
             $error = new Error("Error", $code);
             $error->setTitle('Missing Credentials');
             $error->setMessage('One of the required API credentials is missing, please fill out: ' . implode(", ", $missing));
             throw $error;
         }
     }
 }
开发者ID:josedesousa-tcc,项目名称:digital-publishing-tools-for-wordpress,代码行数:31,代码来源:dpsfa-settings.php

示例4: refresh_access_token

 /**
  * This method will get the access token.
  *
  * @param {String} $refresh_token - The base-64 encoded refresh token
  * @param {String} $grant_type - The grant type, optional parameters
  * @example $grant_type = 'refresh_token';
  * @param {String} $scope - The scope value, optional parameters
  * @example $scope = 'AdobeID,openid';
  */
 public function refresh_access_token($grant_type = 'refresh_token', $scope = 'AdobeID,openid')
 {
     // set request header:
     // [+] Accept: application/json
     // [+] Content-Type: application/x-www-form-urlencoded
     $headers = array('Accept: application/json', 'Content-Type: Content-Type: application/x-www-form-urlencoded');
     // set request URL
     $url = $this->authentication_endpoint . "/ims/token/v1?grant_type=device&client_id=" . $this->client_id . "&client_secret=" . $this->client_secret . "&scope=openid&device_token=" . $this->device_token . "&device_id=" . $this->device_id;
     // call helper to initiate the cURL request
     $curl = new Curl('POST', $url, $headers);
     // Parse out token
     $data = $curl->getResponseBody();
     if (!empty($data['error'])) {
         // Throw new error
         $error = new Error("Error", 401);
         $error->setRaw(array("headers" => $curl->getResponseHeader(), "body" => $curl->getResponseBody(), "url" => $curl->getRequestUrl(), "entity" => ''));
         $error->setTitle('API Credentials Not Valid');
         $error->setMessage('The API credentials supplied are not valid. The plugin will not allow you to access any of the cloud functions without proper credentials: ' . $data['error']);
         // Return token
         $this->access_token = "";
         $this->refresh_token = "";
         // Save access token
         $settings = new Settings();
         $settings->access_token = "";
         $settings->refresh_token = "";
         $settings->publications = array();
         $settings->permissions = array();
         $settings->save();
         throw $error;
     } else {
         $access_token = isset($data['access_token']) ? $data['access_token'] : null;
         $refresh_token = isset($data['refresh_token']) ? $data['refresh_token'] : null;
         // Save access token
         $settings = new Settings();
         $settings->access_token = $access_token;
         $settings->refresh_token = $refresh_token;
         $settings->save();
         // Return token
         $this->access_token = $access_token;
         $this->refresh_token = $refresh_token;
     }
 }
开发者ID:jerwarren,项目名称:digital-publishing-tools-for-wordpress,代码行数:51,代码来源:dpsfa-adobe.php

示例5: RunTestMethod

 private function RunTestMethod($test_method_name)
 {
     $error_catcher = $this->getErrorCatcherObject();
     $error_catcher->setUp();
     $this->resetErrorsExpectations();
     $test = $this->start_new_test($test_method_name);
     $this->setUp();
     $this->assertPreConditions();
     $exception_generated = false;
     try {
         $this->{$test_method_name}();
     } catch (\Exception $exception) {
         $exception_generated = true;
         if (!$this->exception_expected) {
             $test->setException($exception);
         }
     }
     if ($this->exception_expected && !$exception_generated) {
         $test->setSuccessful(false);
     }
     if ($error_catcher->hasErrors()) {
         if (!$this->error_expected) {
             $test->setErrors($error_catcher->getErrors());
         }
     } else {
         if ($this->error_expected) {
             $test->setSuccessful(false);
             $Error = new Error();
             $Error->setMessage("Error is expected but wasn't generated");
             $test->setErrors(array($Error));
         }
     }
     $this->assertPostConditions();
     $this->tearDown();
     if (!$test->isSuccessful()) {
         $this->onNotSuccessfulTest();
     }
 }
开发者ID:jamm,项目名称:memory,代码行数:38,代码来源:ClassTest.php

示例6: AplExternaError

 /** 
  * Constructor encargado de inicializar el c�digo de error
  * @param	$code	Es el c�digo del error
  * @return   void
  */
 function AplExternaError($code = 0)
 {
     Error::Error($code);
     Error::setMessage($this->tipoError($code));
 }
开发者ID:kractos26,项目名称:orfeo,代码行数:10,代码来源:AplExternaError.php

示例7: CombinaError

 /** 
  * Constructor encargado de inicializar el código de error
  * @param	$code	Es el código del error
  * @return   void
  */
 function CombinaError($code = 0)
 {
     Error::Error($code);
     Error::setMessage($this->tipoError($code));
 }
开发者ID:kractos26,项目名称:orfeo,代码行数:10,代码来源:CombinaError.php

示例8: exec

 /**
  * This method will initialize and execute the HTTPS request.
  */
 public function exec()
 {
     // initialize the cURL
     $this->curl = curl_init();
     // initialize cURL parameters
     curl_setopt_array($this->curl, $this->curl_options);
     // execute cURL request
     $this->curl_response = curl_exec($this->curl);
     // get the response HTTP code
     $this->curl_http_code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);
     // get the response header size
     $this->curl_response_size = curl_getinfo($this->curl, CURLINFO_HEADER_SIZE);
     // call helper to parse & store the response header and body
     $this->formatResponse();
     if (curl_errno($this->curl)) {
         $error = new Error("Error", curl_errno($this->curl));
         $error = new Error("Error", 300);
         $error->setTitle('Unable to send a request to the Adobe API');
         $error->setMessage(curl_error($this->curl));
         throw $error;
     }
     // close cURL request
     curl_close($this->curl);
 }
开发者ID:jerwarren,项目名称:digital-publishing-tools-for-wordpress,代码行数:27,代码来源:dpsfa-curl.php


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