| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function __invoke(Twig_Environment $env, $location) |
||
| 22 | { |
||
| 23 | $this->globs = $env->getGlobals(); |
||
| 24 | $this->dir = fs::getFolderPath($this->globs['__currentTemplate']); |
||
| 25 | $this->path = fs::appendPath($this->dir, $location); |
||
| 26 | |||
| 27 | if (is_file($this->path)) |
||
| 28 | { |
||
| 29 | $this->path = realpath($this->path); |
||
| 30 | } |
||
| 31 | |||
| 32 | if (strpos($this->path, Service::getWorkingDirectory()) !== 0) |
||
| 33 | { |
||
| 34 | throw new FileNotFoundException(sprintf( |
||
| 35 | "The '%s' file could not be found or is outside the website working directory", |
||
| 36 | $location |
||
| 37 | )); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 |