1<?php
2
3declare(strict_types=1);
4
5namespace Sabre\DAV;
6
7/**
8 * Main Exception class.
9 *
10 * This class defines a getHTTPCode method, which should return the appropriate HTTP code for the Exception occurred.
11 * The default for this is 500.
12 *
13 * This class also allows you to generate custom xml data for your exceptions. This will be displayed
14 * in the 'error' element in the failing response.
15 *
16 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
17 * @author Evert Pot (http://evertpot.com/)
18 * @license http://sabre.io/license/ Modified BSD License
19 */
20class Exception extends \Exception
21{
22    /**
23     * Returns the HTTP statuscode for this exception.
24     *
25     * @return int
26     */
27    public function getHTTPCode()
28    {
29        return 500;
30    }
31
32    /**
33     * This method allows the exception to include additional information into the WebDAV error response.
34     */
35    public function serialize(Server $server, \DOMElement $errorNode)
36    {
37    }
38
39    /**
40     * This method allows the exception to return any extra HTTP response headers.
41     *
42     * The headers must be returned as an array.
43     *
44     * @return array
45     */
46    public function getHTTPHeaders(Server $server)
47    {
48        return [];
49    }
50}
51