Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

   1  <?php
   2  /**
   3   * Copyright 2012-2017 Horde LLC (http://www.horde.org/)
   4   *
   5   * See the enclosed file LICENSE for license information (LGPL). If you
   6   * did not receive this file, see http://www.horde.org/licenses/lgpl21.
   7   *
   8   * @category  Horde
   9   * @copyright 2012-2017 Horde LLC
  10   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  11   * @package   Imap_Client
  12   */
  13  
  14  /**
  15   * Exception thrown for server error responses.
  16   *
  17   * @author    Michael Slusarz <slusarz@horde.org>
  18   * @category  Horde
  19   * @copyright 2012-2017 Horde LLC
  20   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  21   * @package   Imap_Client
  22   *
  23   * @property-read string $command  The command that caused the BAD/NO error
  24   *                                 status.
  25   * @property-read array $resp_data  The response data array.
  26   * @property-read integer $status  Server error status.
  27   */
  28  class Horde_Imap_Client_Exception_ServerResponse extends Horde_Imap_Client_Exception
  29  {
  30      /**
  31       * Pipeline object.
  32       *
  33       * @var Horde_Imap_Client_Interaction_Pipeline
  34       */
  35      protected $_pipeline;
  36  
  37      /**
  38       * Server response object.
  39       *
  40       * @var Horde_Imap_Client_Interaction_Server
  41       */
  42      protected $_server;
  43  
  44      /**
  45       * Constructor.
  46       *
  47       * @param string|null $msg                                  Error message.
  48       * @param integer $code                                     Error code.
  49       * @param Horde_Imap_Client_Interaction_Server $server      Server ob.
  50       * @param Horde_Imap_Client_Interaction_Pipeline $pipeline  Pipeline ob.
  51       */
  52      public function __construct(
  53          $msg,
  54          $code,
  55          Horde_Imap_Client_Interaction_Server $server,
  56          Horde_Imap_Client_Interaction_Pipeline $pipeline
  57      )
  58      {
  59          $this->details = strval($server->token);
  60  
  61          $this->_pipeline = $pipeline;
  62          $this->_server = $server;
  63  
  64          parent::__construct($msg, $code);
  65      }
  66  
  67      /**
  68       */
  69      public function __get($name)
  70      {
  71          switch ($name) {
  72          case 'command':
  73              return ($this->_server instanceof Horde_Imap_Client_Interaction_Server_Tagged)
  74                  ? $this->_pipeline->getCmd($this->_server->tag)->getCommand()
  75                  : null;
  76  
  77          case 'resp_data':
  78              return $this->_pipeline->data;
  79  
  80          case 'status':
  81              return $this->_server->status;
  82  
  83          default:
  84              return parent::__get($name);
  85          }
  86      }
  87  
  88  }