[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/horde/framework/Horde/Exception/ -> Wrapped.php (source)

   1  <?php
   2  /**
   3   * Horde exception class that can wrap and set its details from PEAR_Error,
   4   * Exception, and other objects with similar interfaces.
   5   *
   6   * Copyright 2008-2014 Horde LLC (http://www.horde.org/)
   7   *
   8   * See the enclosed file COPYING for license information (LGPL). If you
   9   * did not receive this file, see http://www.horde.org/licenses/lgpl21.
  10   *
  11   * @category Horde
  12   * @package  Exception
  13   */
  14  class Horde_Exception_Wrapped extends Horde_Exception
  15  {
  16      /**
  17       * Exception constructor.
  18       *
  19       * @param mixed $message The exception message, a PEAR_Error
  20       *                       object, or an Exception object.
  21       * @param int   $code    A numeric error code.
  22       */
  23      public function __construct($message = null, $code = 0)
  24      {
  25          $previous = null;
  26          if (is_object($message) &&
  27              method_exists($message, 'getMessage')) {
  28              if (empty($code) &&
  29                  method_exists($message, 'getCode')) {
  30                  $code = (int)$message->getCode();
  31              }
  32              if ($message instanceof Exception) {
  33                  $previous = $message;
  34              }
  35              if (method_exists($message, 'getUserinfo') &&
  36                  $details = $message->getUserinfo()) {
  37                  $this->details = $details;
  38              } elseif (!empty($message->details)) {
  39                  $this->details = $message->details;
  40              }
  41              $message = (string)$message->getMessage();
  42          }
  43  
  44          parent::__construct($message, $code, $previous);
  45      }
  46  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1