public function create($path, $data = array())
    {
        $path = $this->buildPath($path);

        if(!file_exists($path))
            throw new NotFoundException('Unable to find view ['.$path.']');

        // merge with default data.
        $class = '\Exedra\View\View';

        if(is_string($data))
        {
            // assume data as fully qualified class name
            if($data)
            {
                $class = $data;

                $data = array();
            }
        }
        else
        {
            if(!is_array($data))
                throw new NotFoundException('Argument 2 must be either string or array ['.gettype($data).'] given.');
        }

        $data = array_merge($data, $this->defaultData);

        return new $class($path, $data);
    }
public function create($path, $data = array())
    {
        $path = $this->buildPath($path);

        if(!file_exists($path))
            throw new NotFoundException('Unable to find view ['.$path.']');

        // merge with default data.
        $class = '\Exedra\View\View';

        if(is_string($data))
        {
            // assume data as fully qualified class name
            if($data)
            {
                $class = $data;

                $data = array();
            }
        }
        else
        {
            if(!is_array($data))
                throw new NotFoundException('Argument 2 must be either string or array ['.gettype($data).'] given.');
        }

        $data = array_merge($data, $this->defaultData);

        return new $class($path, $data);
    }
public function create ( $ path , $ data = array ( ) ) { $ path = $ this -> buildPath ( $ path ) ; if ( ! file_exists ( $ path ) ) throw new NotFoundException ( 'Unable to find view [' . $ path . ']' ) ; // merge with default data. $ class = '\Exedra\View\View' ; if ( is_string ( $ data ) ) { // assume data as fully qualified class name if ( $ data ) { $ class = $ data ; $ data = array ( ) ; } } else { if ( ! is_array ( $ data ) ) throw new NotFoundException ( 'Argument 2 must be either string or array [' . gettype ( $ data ) . '] given.' ) ; } $ data = array_merge ( $ data , $ this -> defaultData ) ; return new $ class ( $ path , $ data ) ; }
Create view instance based on given relative path.
@param string $path
@param string|array $data (array to be deprecated)
@return View
@throws NotFoundException
Create view instance based on given relative path .