PHP Class Pop\Mvc\View

Author: Nick Sagona, III ([email protected])
Show file Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$data array Model data
$output string View output string
$templateFile string View template file
$templateString string View template string

Public Methods

Method Description
__construct ( string $template = null, array $data = null ) : View Constructor
__get ( string $name ) : mixed Get method to return the value of data[$name].
__isset ( string $name ) : boolean Return the isset value of data[$name].
__set ( string $name, mixed $value ) : mixed Set method to set the property to the value of data[$name].
__toString ( ) : string Return rendered view as string
__unset ( string $name ) : void Unset data[$name].
factory ( string $template = null, array $data = null ) : View Create a Pop\Mvc\View object
get ( string $key ) : mixed Get model data
getData ( ) : array Get all model data
getTemplate ( ) : string Get view template
getTemplateFile ( ) : string Get view template file
getTemplateString ( ) : string Get view template string
merge ( array $data ) : View Merge new model data
render ( boolean $ret = false ) : mixed Render the view.
set ( string $name, mixed $value ) : View Set model data
setData ( array $data = [] ) : View Set all model data
setTemplate ( string $template ) : View Set view template with auto-detect
setTemplateFile ( string $template ) : View Set view template file
setTemplateString ( string $template ) : View Set view template string

Protected Methods

Method Description
renderTemplateFile ( ) : void Render view template file
renderTemplateString ( ) : void Render view template string

Method Details

__construct() public method

Instantiate the view object.
public __construct ( string $template = null, array $data = null ) : View
$template string
$data array
return View

__get() public method

Get method to return the value of data[$name].
public __get ( string $name ) : mixed
$name string
return mixed

__isset() public method

Return the isset value of data[$name].
public __isset ( string $name ) : boolean
$name string
return boolean

__set() public method

Set method to set the property to the value of data[$name].
public __set ( string $name, mixed $value ) : mixed
$name string
$value mixed
return mixed

__toString() public method

Return rendered view as string
public __toString ( ) : string
return string

__unset() public method

Unset data[$name].
public __unset ( string $name ) : void
$name string
return void

factory() public static method

Create a Pop\Mvc\View object
public static factory ( string $template = null, array $data = null ) : View
$template string
$data array
return View

get() public method

Get model data
public get ( string $key ) : mixed
$key string
return mixed

getData() public method

Get all model data
public getData ( ) : array
return array

getTemplate() public method

Get view template
public getTemplate ( ) : string
return string

getTemplateFile() public method

Get view template file
public getTemplateFile ( ) : string
return string

getTemplateString() public method

Get view template string
public getTemplateString ( ) : string
return string

merge() public method

Merge new model data
public merge ( array $data ) : View
$data array
return View

render() public method

Render the view.
public render ( boolean $ret = false ) : mixed
$ret boolean
return mixed

renderTemplateFile() protected method

Render view template file
protected renderTemplateFile ( ) : void
return void

renderTemplateString() protected method

Render view template string
protected renderTemplateString ( ) : void
return void

set() public method

Set model data
public set ( string $name, mixed $value ) : View
$name string
$value mixed
return View

setData() public method

Set all model data
public setData ( array $data = [] ) : View
$data array
return View

setTemplate() public method

Set view template with auto-detect
public setTemplate ( string $template ) : View
$template string
return View

setTemplateFile() public method

Set view template file
public setTemplateFile ( string $template ) : View
$template string
return View

setTemplateString() public method

Set view template string
public setTemplateString ( string $template ) : View
$template string
return View

Property Details

$data protected property

Model data
protected array $data
return array

$output protected property

View output string
protected string $output
return string

$templateFile protected property

View template file
protected string $templateFile
return string

$templateString protected property

View template string
protected string $templateString
return string