/** * @param string $path * @return void */ public function render($path) { $path = (string) $path; if ($path === '') { throw new ViewException('View path cannot be empty.'); } if (DIRECTORY_SEPARATOR !== '/') { $path = str_replace('/', DIRECTORY_SEPARATOR, $path); } if (FileFullPathRecognizer::isFullPath($path)) { $this->file = $path; } else { $this->file = FilePathCombiner::combine($this->getRootPath(), $path); } $this->pushLayout(); try { $loadFileFunction = $this->loadFileFunction; $loadFileFunction(); $this->file = null; if ($this->layoutPath !== null) { $this->render($this->layoutPath); } } finally { $this->popLayout(); } }
/** * @param string $subcommandName * @return string */ private function getConfigPath($subcommandName) { if ($subcommandName === null) { $configPath = Config::getString('hyperframework.cli.command_config_path', ''); if ($configPath === '') { $configPath = 'command.php'; } if (FileFullPathRecognizer::isFullPath($configPath) === false) { $configPath = ConfigFileFullPathBuilder::build($configPath); } return $configPath; } else { return $this->getSubcommandConfigPath($subcommandName); } }
public function testRelativePath() { $this->assertFalse(FileFullPathRecognizer::isFullPath('x')); }