public function createView(ExpressViewRenderer $renderer, $resource)
	{
		$resource = (string)$resource;
		
		if(!is_file($resource))
		{
			throw new \RuntimeException(sprintf('Express view not found: "%s"', $resource));
		}
		
		$key = $this->createKey($resource);
		$typeName = $this->createTypeName($resource);
		
		if(class_exists($typeName, false))
		{
			return $typeName;
		}
		
		$file = $this->cachePath . '/' . $key . '.php';

		if(!is_file($file) || filemtime($file) < filemtime($resource))
		{
			$time = microtime(true);
			
			try
			{
				$code = $this->parseView($renderer, file_get_contents($resource), $resource)->generateCode($key);
			}
			catch(\Exception $e)
			{
				throw new \RuntimeException(sprintf('Unable to parse express view "%s"', $resource), 0, $e);
			}
			
			Filesystem::writeFile($file, $code);
			
			$diff = sprintf('%.2f', microtime(true) - $time);
			
			if($this->logger)
			{
				$this->logger->info('Compiled express view {view}, time spent {time} seconds', ['view' => $resource, 'time' => $diff]);
			}
		}
		
		require_once $file;
		
		if(!class_exists($typeName, false))
		{
			throw new \RuntimeException(sprintf('Unable to load compiled express view "%s"', $resource));
		}
		
		return $typeName;
	}
public function createView(ExpressViewRenderer $renderer, $resource)
	{
		$resource = (string)$resource;
		
		if(!is_file($resource))
		{
			throw new \RuntimeException(sprintf('Express view not found: "%s"', $resource));
		}
		
		$key = $this->createKey($resource);
		$typeName = $this->createTypeName($resource);
		
		if(class_exists($typeName, false))
		{
			return $typeName;
		}
		
		$file = $this->cachePath . '/' . $key . '.php';

		if(!is_file($file) || filemtime($file) < filemtime($resource))
		{
			$time = microtime(true);
			
			try
			{
				$code = $this->parseView($renderer, file_get_contents($resource), $resource)->generateCode($key);
			}
			catch(\Exception $e)
			{
				throw new \RuntimeException(sprintf('Unable to parse express view "%s"', $resource), 0, $e);
			}
			
			Filesystem::writeFile($file, $code);
			
			$diff = sprintf('%.2f', microtime(true) - $time);
			
			if($this->logger)
			{
				$this->logger->info('Compiled express view {view}, time spent {time} seconds', ['view' => $resource, 'time' => $diff]);
			}
		}
		
		require_once $file;
		
		if(!class_exists($typeName, false))
		{
			throw new \RuntimeException(sprintf('Unable to load compiled express view "%s"', $resource));
		}
		
		return $typeName;
	}
public function createView ( ExpressViewRenderer $ renderer , $ resource ) { $ resource = ( string ) $ resource ; if ( ! is_file ( $ resource ) ) { throw new \ RuntimeException ( sprintf ( 'Express view not found: "%s"' , $ resource ) ) ; } $ key = $ this -> createKey ( $ resource ) ; $ typeName = $ this -> createTypeName ( $ resource ) ; if ( class_exists ( $ typeName , false ) ) { return $ typeName ; } $ file = $ this -> cachePath . '/' . $ key . '.php' ; if ( ! is_file ( $ file ) || filemtime ( $ file ) < filemtime ( $ resource ) ) { $ time = microtime ( true ) ; try { $ code = $ this -> parseView ( $ renderer , file_get_contents ( $ resource ) , $ resource ) -> generateCode ( $ key ) ; } catch ( \ Exception $ e ) { throw new \ RuntimeException ( sprintf ( 'Unable to parse express view "%s"' , $ resource ) , 0 , $ e ) ; } Filesystem :: writeFile ( $ file , $ code ) ; $ diff = sprintf ( '%.2f' , microtime ( true ) - $ time ) ; if ( $ this -> logger ) { $ this -> logger -> info ( 'Compiled express view {view}, time spent {time} seconds' , [ 'view' => $ resource , 'time' => $ diff ] ) ; } } require_once $ file ; if ( ! class_exists ( $ typeName , false ) ) { throw new \ RuntimeException ( sprintf ( 'Unable to load compiled express view "%s"' , $ resource ) ) ; } return $ typeName ; }
Create an express view from the given XML view, will utilize the cache directory
to dump and load a template compiled into plain PHP code.

@param ExpressViewRenderer $renderer
@param string $resource The resource to be compiled into a view.
@return string The fully-qualified name of the compiled view.

@throws \RuntimeException When the given resource could not be found.
Create an express view from the given XML view will utilize the cache directory to dump and load a template compiled into plain PHP code .