1<?php
2
3namespace Sabre\HTTP;
4
5/**
6 * Response Decorator
7 *
8 * This helper class allows you to easily create decorators for the Response
9 * object.
10 *
11 * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
12 * @author Evert Pot (http://evertpot.com/)
13 * @license http://sabre.io/license/ Modified BSD License
14 */
15class ResponseDecorator implements ResponseInterface {
16
17    use MessageDecoratorTrait;
18
19    /**
20     * Constructor.
21     *
22     * @param ResponseInterface $inner
23     */
24    function __construct(ResponseInterface $inner) {
25
26        $this->inner = $inner;
27
28    }
29
30    /**
31     * Returns the current HTTP status code.
32     *
33     * @return int
34     */
35    function getStatus() {
36
37        return $this->inner->getStatus();
38
39    }
40
41
42    /**
43     * Returns the human-readable status string.
44     *
45     * In the case of a 200, this may for example be 'OK'.
46     *
47     * @return string
48     */
49    function getStatusText() {
50
51        return $this->inner->getStatusText();
52
53    }
54    /**
55     * Sets the HTTP status code.
56     *
57     * This can be either the full HTTP status code with human readable string,
58     * for example: "403 I can't let you do that, Dave".
59     *
60     * Or just the code, in which case the appropriate default message will be
61     * added.
62     *
63     * @param string|int $status
64     * @return void
65     */
66    function setStatus($status) {
67
68        $this->inner->setStatus($status);
69
70    }
71
72    /**
73     * Serializes the request object as a string.
74     *
75     * This is useful for debugging purposes.
76     *
77     * @return string
78     */
79    function __toString() {
80
81        return $this->inner->__toString();
82
83    }
84}
85