/** * get file in app folder * * @throws RuntimeException * @return null|File */ protected final function getFile() { if (!isset($this->settings['folder'], $this->settings['extension'])) { throw new RuntimeException('mode invalid: expect `folder` and `extension`'); } $fileList = array(new File('private/src/area/' . $this->request->getArea() . '/app'), new File('private/src/common/app')); $page = implode('/', array_merge(array($this->request->getPage()), $this->request->getInputList())); foreach ($fileList as $file) { if (!$file instanceof File) { continue; } $file->attach($this->settings['folder'])->attach($page . $this->settings['extension']); if ($file->isFile()) { return $file; } } return null; }