| Conditions | 6 |
| Paths | 6 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function needsExpansion($documentPath) |
||
| 26 | { |
||
| 27 | $request = $this->getRequestStack()->getMasterRequest(); |
||
| 28 | |||
| 29 | if (is_null($request)) { |
||
| 30 | return false; |
||
| 31 | } |
||
| 32 | if (!$request->headers->has('x-ez-embed-value')) { |
||
| 33 | return false; |
||
| 34 | } |
||
| 35 | |||
| 36 | $documentPath = strtolower($documentPath); |
||
| 37 | foreach (explode(',', $request->headers->get('x-ez-embed-value')) as $requestedPath) { |
||
| 38 | $requestedPath = strtolower($requestedPath); |
||
| 39 | if ($requestedPath === $documentPath) { |
||
| 40 | return true; |
||
| 41 | } |
||
| 42 | if (substr($requestedPath, 0, strlen($documentPath)) === $documentPath) { |
||
| 43 | return true; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | return false; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |