| @@ 312-342 (lines=31) @@ | ||
| 309 | * |
|
| 310 | * @return ExpandedProjectionNode|null |
|
| 311 | */ |
|
| 312 | protected function getCurrentExpandedProjectionNode() |
|
| 313 | { |
|
| 314 | $expandedProjectionNode = $this->request->getRootProjectionNode(); |
|
| 315 | if (is_null($expandedProjectionNode)) { |
|
| 316 | return null; |
|
| 317 | } else { |
|
| 318 | $depth = count($this->_segmentNames); |
|
| 319 | // $depth == 1 means serialization of root entry |
|
| 320 | //(the resource identified by resource path) is going on, |
|
| 321 | //so control won't get into the below for loop. |
|
| 322 | //we will directly return the root node, |
|
| 323 | //which is 'ExpandedProjectionNode' |
|
| 324 | // for resource identified by resource path. |
|
| 325 | if ($depth != 0) { |
|
| 326 | for ($i = 1; $i < $depth; $i++) { |
|
| 327 | $expandedProjectionNode |
|
| 328 | = $expandedProjectionNode->findNode($this->_segmentNames[$i]); |
|
| 329 | $this->assert( |
|
| 330 | !is_null($expandedProjectionNode), |
|
| 331 | '!is_null($expandedProjectionNode)' |
|
| 332 | ); |
|
| 333 | $this->assert( |
|
| 334 | $expandedProjectionNode instanceof ExpandedProjectionNode, |
|
| 335 | '$expandedProjectionNode instanceof ExpandedProjectionNode' |
|
| 336 | ); |
|
| 337 | } |
|
| 338 | } |
|
| 339 | } |
|
| 340 | ||
| 341 | return $expandedProjectionNode; |
|
| 342 | } |
|
| 343 | ||
| 344 | /** |
|
| 345 | * Check whether to expand a navigation property or not. |
|
| @@ 891-914 (lines=24) @@ | ||
| 888 | * |
|
| 889 | * @return ExpandedProjectionNode|null |
|
| 890 | */ |
|
| 891 | private function _getCurrentExpandedProjectionNode() |
|
| 892 | { |
|
| 893 | $expandedProjectionNode |
|
| 894 | = $this->request->getRootProjectionNode(); |
|
| 895 | if (!is_null($expandedProjectionNode)) { |
|
| 896 | $depth = count($this->_segmentNames); |
|
| 897 | if ($depth != 0) { |
|
| 898 | for ($i = 1; $i < $depth; $i++) { |
|
| 899 | $expandedProjectionNode |
|
| 900 | = $expandedProjectionNode->findNode($this->_segmentNames[$i]); |
|
| 901 | $this->assert( |
|
| 902 | !is_null($expandedProjectionNode), |
|
| 903 | '!is_null($expandedProjectionNode)' |
|
| 904 | ); |
|
| 905 | $this->assert( |
|
| 906 | $expandedProjectionNode instanceof ExpandedProjectionNode, |
|
| 907 | '$expandedProjectionNode instanceof ExpandedProjectionNode' |
|
| 908 | ); |
|
| 909 | } |
|
| 910 | } |
|
| 911 | } |
|
| 912 | ||
| 913 | return $expandedProjectionNode; |
|
| 914 | } |
|
| 915 | ||
| 916 | /** |
|
| 917 | * Pushes information about the segment whose instance is going to be |
|