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

## Source for file request_parser.php

Documentation is available at request_parser.php

1. <?php
2. /**
3. * File containing the ezcMvcRequestParser 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. * The interface that should be implemented by all request parsers.
30. *
31. * A request parser takes the raw request - protocol dependent - and creates an
32. * abstract ezcMvcRequest object of this.
33. *
34. * @property string $prefix The prefix in the URL that should be stripped
35. * from URL properties.
36. *
37. * @package MvcTools
38. * @version //autogentag//
39. */
40. abstract class ezcMvcRequestParser
41. {
42. /**
43. * Contains the request struct
44. *
45. * @var ezcMvcRequest
46. */
47. protected $request ;
49. /**
50. * Holds the properties of this class.
51. *
52. * @var array(string=>mixed)
53. */
54. protected $properties = array();
56. /**
57. * Sets the property $name to $value.
58. *
59. * @throws ezcBasePropertyNotFoundException if the property does not exist.
60. * @throws ezcBaseValueException if a the value for a property is out of
61. * range.
62. * @param string $name
63. * @param mixed $value
64. * @ignore
65. */
66. public function __set( $name, $value )
67. {
68. switch ( $name )
69. {
70. // cases to check for properties
71. case 'prefix':
72. if ( ! is_string ( $value ) )
73. {
74. throw new ezcBaseValueException ( $name, $value, 'string' );
75. }
76. $this-> properties [$name] = $value;
77. break;
79. default:
80. throw new ezcBasePropertyNotFoundException ( $name );
81. }
82. }
84. /**
85. * Returns the value of the property $name.
86. *
87. * @throws ezcBasePropertyNotFoundException if the property does not exist.
88. * @param string $name
89. * @ignore
90. */
91. public function __get( $name )
92. {
93. switch ( $name )
94. {
95. case 'prefix':
96. return $this-> properties [$name];
97. }
98. throw new ezcBasePropertyNotFoundException ( $name );
99. }
101. /**
102. * Returns true if the property $name is set, otherwise false.
103. *
104. * @param string $name
105. * @return bool
106. * @ignore
107. */
108. public function __isset( $name )
109. {
110. switch ( $name )
111. {
112. case 'prefix':
113. return isset( $this-> properties [$name] );
115. default:
116. return false;
117. }
118. }
120. /**
121. * Constructs a new request parser
122. */
123. public function __construct ()
124. {
125. $this-> properties ['prefix'] = '';
126. }
128. /**
129. * Reads the raw request data with what ever means necessary and
130. * constructs an ezcMvcRequest object.
131. *
132. * @return ezcMvcRequest
133. */
134. abstract public function createRequest ();
135. }
136. ?>

Documentation generated by phpDocumentor 1.4.3