## Apache Zeta Components Manual :: File Source for gzip.php

## Source for file gzip.php

Documentation is available at gzip.php

1. <?php
2. /**
3. * File containing the ezcMvcGzipResponseFilter class
4. *
5. * Licensed to the Apache Software Foundation (ASF) under one
6. * or more contributor license agreements. See the NOTICE file
7. * distributed with this work for additional information
8. * regarding copyright ownership. The ASF licenses this file
9. * to you under the Apache License, Version 2.0 (the
10. * "License"); you may not use this file except in compliance
11. * with the License. You may obtain a copy of the License at
12. *
13. * http://www.apache.org/licenses/LICENSE-2.0
14. *
15. * Unless required by applicable law or agreed to in writing,
16. * software distributed under the License is distributed on an
17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18. * KIND, either express or implied. See the License for the
19. * specific language governing permissions and limitations
20. * under the License.
21. *
22. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
23. * @version //autogentag//
24. * @filesource
25. * @package MvcTools
26. */
28. /**
29. * Response filter that gzip's the contents.
30. *
31. * @package MvcTools
32. * @version //autogentag//
33. * @mainclass
34. */
35. class ezcMvcGzipResponseFilter implements ezcMvcResponseFilter
36. {
37. /**
38. * This function filters the $response by gzip-encoding it.
39. *
40. * @param ezcMvcResponse $response
41. */
42. public function filterResponse ( ezcMvcResponse $response )
43. {
44. $response->body = gzencode ( $response->body );
45. if ( !$response->content )
46. {
47. $response->content = new ezcMvcResultContent ;
48. }
49. $response->content->encoding = 'gzip';
50. }
52. /**
53. * Should not be called with any options, as this filter doesn't support any.
54. *
55. * @throws ezcMvcFilterHasNoOptionsException if the $options array is not
56. * empty.
57. * @param array $options
58. */
59. public function setOptions ( array $options )
60. {
61. if ( count( $options ) )
62. {
63. throw new ezcMvcFilterHasNoOptionsException ( __CLASS__ );
64. }
65. }
66. }
67. ?>

Documentation generated by phpDocumentor 1.4.3