1 | <?php |
||
8 | class SegmentStack |
||
9 | { |
||
10 | /** |
||
11 | * Collection of segment names. |
||
12 | * |
||
13 | * @var string[] |
||
14 | */ |
||
15 | private $segmentNames; |
||
16 | |||
17 | /** |
||
18 | * Collection of segment ResourceSetWrapper instances. |
||
19 | * |
||
20 | * @var ResourceSetWrapper[] |
||
21 | */ |
||
22 | private $segmentResourceSetWrappers; |
||
23 | |||
24 | /** |
||
25 | * Description of the OData request that a client has submitted. |
||
26 | * |
||
27 | * @var RequestDescription |
||
28 | */ |
||
29 | private $request; |
||
30 | |||
31 | private $mismatch = "Mismatch between size of names array and wrappers array"; |
||
32 | |||
33 | public function __construct(RequestDescription $request = null) |
||
40 | |||
41 | |||
42 | /** |
||
43 | * Pushes information about the segment whose instance is going to be |
||
44 | * retrieved from the IDSQP implementation |
||
45 | * Note: Calls to this method should be balanced with calls to popSegment. |
||
46 | * |
||
47 | * @param string $segmentName Name of segment to push |
||
48 | * @param ResourceSetWrapper &$resourceSetWrapper The resource set wrapper |
||
49 | * to push |
||
50 | * |
||
51 | * @return bool true if the segment was push, false otherwise |
||
52 | */ |
||
53 | public function pushSegment($segmentName, ResourceSetWrapper &$resourceSetWrapper) |
||
69 | |||
70 | /** |
||
71 | * Pops segment information from the 'Segment Stack' |
||
72 | * Note: Calls to this method should be balanced with previous calls |
||
73 | * to _pushSegment. |
||
74 | * |
||
75 | * @param bool $needPop Is a pop required. Only true if last push |
||
76 | * was successful |
||
77 | * |
||
78 | * @throws InvalidOperationException If found un-balanced call |
||
79 | * with _pushSegment |
||
80 | */ |
||
81 | public function popSegment($needPop) |
||
96 | |||
97 | /** |
||
98 | * Retrieve stored segment names |
||
99 | * |
||
100 | * @return \string[] |
||
101 | */ |
||
102 | public function getSegmentNames() |
||
106 | |||
107 | /** |
||
108 | * Retrieve stored segment wrappers |
||
109 | * |
||
110 | * @return ResourceSetWrapper[] |
||
111 | */ |
||
112 | public function getSegmentWrappers() |
||
116 | |||
117 | /** |
||
118 | * Gets reference to the request submitted by client. |
||
119 | * |
||
120 | * @return RequestDescription |
||
121 | */ |
||
122 | public function getRequest() |
||
127 | |||
128 | /** |
||
129 | * Sets reference to the request submitted by client. |
||
130 | * @param RequestDescription $request |
||
131 | * |
||
132 | */ |
||
133 | public function setRequest(RequestDescription $request) |
||
137 | } |
||
138 |