Skip to content

Commit

Permalink
Make protected properties underscore prefixed.
Browse files Browse the repository at this point in the history
This matches the rest of the framework.
  • Loading branch information
markstory committed Aug 14, 2015
1 parent 1ed2a63 commit 3be35e7
Showing 1 changed file with 49 additions and 49 deletions.
98 changes: 49 additions & 49 deletions src/View/ViewBuilder.php
Expand Up @@ -35,77 +35,77 @@ class ViewBuilder
*
* @var string
*/
protected $viewPath;
protected $_viewPath;

/**
* The template file to render.
*
* @var string
*/
protected $template;
protected $_template;

/**
* The plugin name to use.
*
* @var string
*/
protected $plugin;
protected $_plugin;

/**
* The theme name to use.
*
* @var string
*/
protected $theme;
protected $_theme;

/**
* The layout name to render.
*
* @var string
*/
protected $layout;
protected $_layout;

/**
* Whether or not autoLayout should be enabled.
*
* @var bool
*/
protected $autoLayout;
protected $_autoLayout;

/**
* The layout path to build the view with.
*
* @var string
*/
protected $layoutPath;
protected $_layoutPath;

/**
* The view variables to use
*
* @var string
*/
protected $name;
protected $_name;

/**
* The view variables to use
*
* @var string
*/
protected $className;
protected $_className;

/**
* The view variables to use
*
* @var array
*/
protected $options = [];
protected $_options = [];

/**
* The helpers to use
*
* @var array
*/
protected $helpers = [];
protected $_helpers = [];

/**
* Get/set path for view files.
Expand All @@ -116,10 +116,10 @@ class ViewBuilder
public function viewPath($path = null)
{
if ($path === null) {
return $this->viewPath;
return $this->_viewPath;
}

$this->viewPath = $path;
$this->_viewPath = $path;
return $this;
}

Expand All @@ -132,10 +132,10 @@ public function viewPath($path = null)
public function layoutPath($path = null)
{
if ($path === null) {
return $this->layoutPath;
return $this->_layoutPath;
}

$this->layoutPath = $path;
$this->_layoutPath = $path;
return $this;
}

Expand All @@ -150,10 +150,10 @@ public function layoutPath($path = null)
public function autoLayout($autoLayout = null)
{
if ($autoLayout === null) {
return $this->autoLayout;
return $this->_autoLayout;
}

$this->autoLayout = (bool)$autoLayout;
$this->_autoLayout = (bool)$autoLayout;
return $this;
}

Expand All @@ -166,10 +166,10 @@ public function autoLayout($autoLayout = null)
public function plugin($name = null)
{
if ($name === null) {
return $this->plugin;
return $this->_plugin;
}

$this->plugin = $name;
$this->_plugin = $name;
return $this;
}

Expand All @@ -183,12 +183,12 @@ public function plugin($name = null)
public function helpers(array $helpers = null, $merge = true)
{
if ($helpers === null) {
return $this->helpers;
return $this->_helpers;
}
if ($merge) {
$helpers = array_merge($this->helpers, $helpers);
$helpers = array_merge($this->_helpers, $helpers);
}
$this->helpers = $helpers;
$this->_helpers = $helpers;
return $this;
}

Expand All @@ -201,10 +201,10 @@ public function helpers(array $helpers = null, $merge = true)
public function theme($theme = null)
{
if ($theme === null) {
return $this->theme;
return $this->_theme;
}

$this->theme = $theme;
$this->_theme = $theme;
return $this;
}

Expand All @@ -218,10 +218,10 @@ public function theme($theme = null)
public function template($name = null)
{
if ($name === null) {
return $this->template;
return $this->_template;
}

$this->template = $name;
$this->_template = $name;
return $this;
}

Expand All @@ -236,10 +236,10 @@ public function template($name = null)
public function layout($name = null)
{
if ($name === null) {
return $this->layout;
return $this->_layout;
}

$this->layout = $name;
$this->_layout = $name;
return $this;
}

Expand All @@ -253,12 +253,12 @@ public function layout($name = null)
public function options(array $options = null, $merge = true)
{
if ($options === null) {
return $this->options;
return $this->_options;
}
if ($merge) {
$options = array_merge($this->options, $options);
$options = array_merge($this->_options, $options);
}
$this->options = $options;
$this->_options = $options;
return $this;
}

Expand All @@ -271,9 +271,9 @@ public function options(array $options = null, $merge = true)
public function name($name = null)
{
if ($name === null) {
return $this->name;
return $this->_name;
}
$this->name = $name;
$this->_name = $name;
return $this;
}

Expand All @@ -288,9 +288,9 @@ public function name($name = null)
public function className($name = null)
{
if ($name === null) {
return $this->className;
return $this->_className;
}
$this->className = $name;
$this->_className = $name;
return $this;
}

Expand All @@ -306,27 +306,27 @@ public function className($name = null)
*/
public function build($vars = [], Request $request = null, Response $response = null, EventManager $events = null)
{
if ($this->className === 'View') {
$className = App::className($this->className, 'View');
if ($this->_className === 'View') {
$className = App::className($this->_className, 'View');
} else {
$className = App::className($this->className, 'View', 'View');
$className = App::className($this->_className, 'View', 'View');
}
if (!$className) {
throw new Exception\MissingViewException([$this->className]);
throw new Exception\MissingViewException([$this->_className]);
}
$data = [
'name' => $this->name,
'viewPath' => $this->viewPath,
'view' => $this->template,
'plugin' => $this->plugin,
'theme' => $this->theme,
'layout' => $this->layout,
'autoLayout' => $this->autoLayout,
'layoutPath' => $this->layoutPath,
'helpers' => $this->helpers,
'name' => $this->_name,
'viewPath' => $this->_viewPath,
'view' => $this->_template,
'plugin' => $this->_plugin,
'theme' => $this->_theme,
'layout' => $this->_layout,
'autoLayout' => $this->_autoLayout,
'layoutPath' => $this->_layoutPath,
'helpers' => $this->_helpers,
'viewVars' => $vars,
];
$data += $this->options;
$data += $this->_options;
return new $className($request, $response, $events, $data);
}
}

0 comments on commit 3be35e7

Please sign in to comment.