/**
  * @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 int $statusCode
  * @param string $statusReasonPhrase
  * @param object $error
  * @param string $outputFormat
  * @return void
  */
 public function render($statusCode, $statusReasonPhrase, $error, $outputFormat = null)
 {
     $rootPath = Config::getString('hyperframework.web.error_view.root_path', '');
     if ($rootPath === '') {
         $rootPath = Config::getString('hyperframework.web.view.root_path', '');
         if ($rootPath === '') {
             $rootPath = 'views' . DIRECTORY_SEPARATOR . '_error';
         } else {
             $rootPath = FilePathCombiner::combine($rootPath, '_error');
         }
     }
     $files = [ViewPathBuilder::build($statusCode, $outputFormat), ViewPathBuilder::build('default', $outputFormat)];
     $rootPath = FileFullPathBuilder::build($rootPath);
     $path = null;
     foreach ($files as $file) {
         $file = FilePathCombiner::combine($rootPath, $file);
         if (file_exists($file)) {
             $path = $file;
             break;
         }
     }
     if ($path === null) {
         Response::setHeader('Content-Type: text/plain; charset=utf-8');
         echo $statusCode;
         if ((string) $statusReasonPhrase !== '') {
             echo ' ', $statusReasonPhrase;
         }
     } else {
         $view = ViewFactory::createView(['status_code' => $statusCode, 'status_reason_pharse' => $statusReasonPhrase, 'error' => $error]);
         $view->render($path);
     }
 }
 public function testAppendEmpty()
 {
     $path = 'file';
     $path = FilePathCombiner::combine($path, null);
     $this->assertSame('file', $path);
 }