github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/php/ApiException.mustache (about)

     1  <?php
     2  /**
     3   * ApiException
     4   * PHP version 5
     5   *
     6   * @category Class
     7   * @package  {{invokerPackage}}
     8   * @author   OpenAPI Generator team
     9   * @link     https://openapi-generator.tech
    10   */
    11  
    12  {{>partial_header}}
    13  /**
    14   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
    15   * https://openapi-generator.tech
    16   * Do not edit the class manually.
    17   */
    18  
    19  namespace {{invokerPackage}};
    20  
    21  use \Exception;
    22  
    23  /**
    24   * ApiException Class Doc Comment
    25   *
    26   * @category Class
    27   * @package  {{invokerPackage}}
    28   * @author   OpenAPI Generator team
    29   * @link     https://openapi-generator.tech
    30   */
    31  class ApiException extends Exception
    32  {
    33  
    34      /**
    35       * The HTTP body of the server response either as Json or string.
    36       *
    37       * @var mixed
    38       */
    39      protected $responseBody;
    40  
    41      /**
    42       * The HTTP header of the server response.
    43       *
    44       * @var string[]|null
    45       */
    46      protected $responseHeaders;
    47  
    48      /**
    49       * The deserialized response object
    50       *
    51       * @var $responseObject;
    52       */
    53      protected $responseObject;
    54  
    55      /**
    56       * Constructor
    57       *
    58       * @param string        $message         Error message
    59       * @param int           $code            HTTP status code
    60       * @param string[]|null $responseHeaders HTTP response header
    61       * @param mixed         $responseBody    HTTP decoded body of the server response either as \stdClass or string
    62       */
    63      public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
    64      {
    65          parent::__construct($message, $code);
    66          $this->responseHeaders = $responseHeaders;
    67          $this->responseBody = $responseBody;
    68      }
    69  
    70      /**
    71       * Gets the HTTP response header
    72       *
    73       * @return string[]|null HTTP response header
    74       */
    75      public function getResponseHeaders()
    76      {
    77          return $this->responseHeaders;
    78      }
    79  
    80      /**
    81       * Gets the HTTP body of the server response either as Json or string
    82       *
    83       * @return mixed HTTP body of the server response either as \stdClass or string
    84       */
    85      public function getResponseBody()
    86      {
    87          return $this->responseBody;
    88      }
    89  
    90      /**
    91       * Sets the deseralized response object (during deserialization)
    92       *
    93       * @param mixed $obj Deserialized response object
    94       *
    95       * @return void
    96       */
    97      public function setResponseObject($obj)
    98      {
    99          $this->responseObject = $obj;
   100      }
   101  
   102      /**
   103       * Gets the deseralized response object (during deserialization)
   104       *
   105       * @return mixed the deserialized response object
   106       */
   107      public function getResponseObject()
   108      {
   109          return $this->responseObject;
   110      }
   111  }