Completed
Pull Request — 2.0.x (#6)
by Andrew
02:53
created
Ingenerator/KohanaView/Exception/UnspecifiedTemplateNameException.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @author     Andrew Coulton <[email protected]>
4
- * @copyright  2015 inGenerator Ltd
5
- * @license    http://kohanaframework.org/license
6
- */
3
+	 * @author     Andrew Coulton <[email protected]>
4
+	 * @copyright  2015 inGenerator Ltd
5
+	 * @license    http://kohanaframework.org/license
6
+	 */
7 7
 
8 8
 namespace Ingenerator\KohanaView\Exception;
9 9
 
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
 class UnspecifiedTemplateNameException extends \UnexpectedValueException
17 17
 {
18 18
 
19
-    /**
20
-     * @param string $view_class
21
-     *
22
-     * @return static
23
-     */
24
-    public static function forEmptyValue($view_class)
25
-    {
26
-        return new static(
27
-            $view_class.'::getTemplateName() must return a template name, empty value returned'
28
-        );
29
-    }
19
+	/**
20
+	 * @param string $view_class
21
+	 *
22
+	 * @return static
23
+	 */
24
+	public static function forEmptyValue($view_class)
25
+	{
26
+		return new static(
27
+			$view_class.'::getTemplateName() must return a template name, empty value returned'
28
+		);
29
+	}
30 30
 
31
-    /**
32
-     * @param string $view_class
33
-     * @param string $template
34
-     *
35
-     * @return static
36
-     */
37
-    public static function forNonStringValue($view_class, $template)
38
-    {
39
-        return new static(
40
-            sprintf(
41
-                '%s::getTemplateName() must return a string template name, %s value returned',
42
-                $view_class,
43
-                is_object($template) ? get_class($template) : gettype($template)
44
-            )
45
-        );
46
-    }
31
+	/**
32
+	 * @param string $view_class
33
+	 * @param string $template
34
+	 *
35
+	 * @return static
36
+	 */
37
+	public static function forNonStringValue($view_class, $template)
38
+	{
39
+		return new static(
40
+			sprintf(
41
+				'%s::getTemplateName() must return a string template name, %s value returned',
42
+				$view_class,
43
+				is_object($template) ? get_class($template) : gettype($template)
44
+			)
45
+		);
46
+	}
47 47
 
48 48
 }
Please login to merge, or discard this patch.
classes/Ingenerator/KohanaView/TemplateCompiler.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -33,83 +33,83 @@
 block discarded – undo
33 33
 class TemplateCompiler
34 34
 {
35 35
 
36
-    /**
37
-     * @var array
38
-     */
39
-    protected $options = [
40
-        'raw_output_prefix' => '!',
41
-        'escape_method'     => 'HTML::chars',
42
-    ];
36
+	/**
37
+	 * @var array
38
+	 */
39
+	protected $options = [
40
+		'raw_output_prefix' => '!',
41
+		'escape_method'     => 'HTML::chars',
42
+	];
43 43
 
44
-    /**
45
-     * @param array $options
46
-     */
47
-    public function __construct(array $options = [])
48
-    {
49
-        $this->options = array_merge($this->options, $options);
50
-    }
44
+	/**
45
+	 * @param array $options
46
+	 */
47
+	public function __construct(array $options = [])
48
+	{
49
+		$this->options = array_merge($this->options, $options);
50
+	}
51 51
 
52
-    /**
53
-     * Compile a string containing a PHP template, automatically escaping variables that are echoed in PHP short tags,
54
-     * and return the compiled PHP string.
55
-     *
56
-     * @param string $source
57
-     *
58
-     * @return string
59
-     * @throws \InvalidArgumentException if the template is empty or invalid
60
-     */
61
-    public function compile($source)
62
-    {
63
-        if ( ! $source) {
64
-            throw InvalidTemplateContentException::forEmptyTemplate();
65
-        }
52
+	/**
53
+	 * Compile a string containing a PHP template, automatically escaping variables that are echoed in PHP short tags,
54
+	 * and return the compiled PHP string.
55
+	 *
56
+	 * @param string $source
57
+	 *
58
+	 * @return string
59
+	 * @throws \InvalidArgumentException if the template is empty or invalid
60
+	 */
61
+	public function compile($source)
62
+	{
63
+		if ( ! $source) {
64
+			throw InvalidTemplateContentException::forEmptyTemplate();
65
+		}
66 66
 
67
-        return preg_replace_callback('/<\?=(.+?)(;|\?>)/s', [$this, 'compilePhpShortTag'], $source);
68
-    }
67
+		return preg_replace_callback('/<\?=(.+?)(;|\?>)/s', [$this, 'compilePhpShortTag'], $source);
68
+	}
69 69
 
70
-    /**
71
-     * @param string[] $matches
72
-     *
73
-     * @return string
74
-     */
75
-    protected function compilePhpShortTag($matches)
76
-    {
77
-        $var               = trim($matches[1]);
78
-        $terminator        = $matches[2];
79
-        $escape_method     = $this->options['escape_method'];
80
-        $raw_output_prefix = $this->options['raw_output_prefix'];
70
+	/**
71
+	 * @param string[] $matches
72
+	 *
73
+	 * @return string
74
+	 */
75
+	protected function compilePhpShortTag($matches)
76
+	{
77
+		$var               = trim($matches[1]);
78
+		$terminator        = $matches[2];
79
+		$escape_method     = $this->options['escape_method'];
80
+		$raw_output_prefix = $this->options['raw_output_prefix'];
81 81
 
82
-        if ($this->startsWith($var, $raw_output_prefix)) {
83
-            // Remove prefix and echo unescaped
84
-            $compiled = '<?='.trim(substr($var, strlen($raw_output_prefix))).';';
85
-        } elseif ($this->startsWith($var, '//')) {
86
-            // Echo an empty string to prevent the comment causing a parse error
87
-            $compiled = "<?='';$var;";
82
+		if ($this->startsWith($var, $raw_output_prefix)) {
83
+			// Remove prefix and echo unescaped
84
+			$compiled = '<?='.trim(substr($var, strlen($raw_output_prefix))).';';
85
+		} elseif ($this->startsWith($var, '//')) {
86
+			// Echo an empty string to prevent the comment causing a parse error
87
+			$compiled = "<?='';$var;";
88 88
 
89
-        } elseif ($this->startsWith($var, $escape_method)) {
90
-            throw InvalidTemplateContentException::containsImplicitDoubleEscape($escape_method, $matches[0]);
89
+		} elseif ($this->startsWith($var, $escape_method)) {
90
+			throw InvalidTemplateContentException::containsImplicitDoubleEscape($escape_method, $matches[0]);
91 91
 
92
-        } else {
93
-            // Escape the value before echoing
94
-            $compiled = "<?={$escape_method}($var);";
95
-        }
92
+		} else {
93
+			// Escape the value before echoing
94
+			$compiled = "<?={$escape_method}($var);";
95
+		}
96 96
 
97
-        if ($terminator === '?>') {
98
-            $compiled .= '?>';
99
-        }
97
+		if ($terminator === '?>') {
98
+			$compiled .= '?>';
99
+		}
100 100
 
101
-        return $compiled;
102
-    }
101
+		return $compiled;
102
+	}
103 103
 
104
-    /**
105
-     * @param string $string
106
-     * @param string $prefix
107
-     *
108
-     * @return bool
109
-     */
110
-    protected function startsWith($string, $prefix)
111
-    {
112
-        return (strncmp($string, $prefix, strlen($prefix)) === 0);
113
-    }
104
+	/**
105
+	 * @param string $string
106
+	 * @param string $prefix
107
+	 *
108
+	 * @return bool
109
+	 */
110
+	protected function startsWith($string, $prefix)
111
+	{
112
+		return (strncmp($string, $prefix, strlen($prefix)) === 0);
113
+	}
114 114
 
115 115
 }
Please login to merge, or discard this patch.
classes/Ingenerator/KohanaView/TemplateManager/CFSTemplateManager.php 1 patch
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -24,117 +24,117 @@
 block discarded – undo
24 24
  */
25 25
 class CFSTemplateManager implements TemplateManager
26 26
 {
27
-    /**
28
-     * @var string
29
-     */
30
-    protected $cache_dir;
31
-
32
-    /**
33
-     * @var CFSWrapper
34
-     */
35
-    protected $cascading_files;
36
-
37
-    /**
38
-     * @var array
39
-     */
40
-    protected $compiled_paths = [];
41
-
42
-    /**
43
-     * @var TemplateCompiler
44
-     */
45
-    protected $compiler;
46
-
47
-    /**
48
-     * @var boolean
49
-     */
50
-    protected $recompile_always;
51
-
52
-    /**
53
-     * Valid options:
54
-     * * cache_dir => the path where compiled templates will be cached
55
-     * * recompile_always => whether to recompile each template on every execution,
56
-     *
57
-     * @param TemplateCompiler $compiler
58
-     * @param array            $options
59
-     * @param CFSWrapper       $cascading_files
60
-     */
61
-    public function __construct(TemplateCompiler $compiler, array $options, CFSWrapper $cascading_files = NULL)
62
-    {
63
-        $this->cascading_files  = $cascading_files ?: new CFSWrapper;
64
-        $this->compiler         = $compiler;
65
-        $this->cache_dir        = rtrim($options['cache_dir'], '/');
66
-        $this->recompile_always = \Arr::get($options, 'recompile_always', FALSE);
67
-    }
68
-
69
-    /**
70
-     * {@inheritdoc}
71
-     */
72
-    public function getPath($template_name)
73
-    {
74
-        $compiled_path = $this->cache_dir.'/'.$template_name.'.php';
75
-
76
-        if ($this->isCompileRequired($compiled_path)) {
77
-            $source   = $this->requireSourceFileContent($template_name);
78
-            $compiled = $this->compiler->compile($source);
79
-            $this->writeFile($compiled_path, $compiled);
80
-            $this->compiled_paths[$compiled_path] = TRUE;
81
-        }
82
-
83
-        return $compiled_path;
84
-    }
85
-
86
-    /**
87
-     * @param string $compiled_path
88
-     *
89
-     * @return bool
90
-     */
91
-    protected function isCompileRequired($compiled_path)
92
-    {
93
-        if ($this->recompile_always AND ! isset($this->compiled_paths[$compiled_path])) {
94
-            return TRUE;
95
-        }
96
-
97
-        return ! file_exists($compiled_path);
98
-    }
99
-
100
-    /**
101
-     * @param string $template_name
102
-     *
103
-     * @return string
104
-     */
105
-    protected function requireSourceFileContent($template_name)
106
-    {
107
-        if ( ! $source_file = $this->cascading_files->find_file('views', $template_name)) {
108
-            throw TemplateNotFoundException::forSourcePath('views/'.$template_name);
109
-        }
110
-
111
-        return file_get_contents($source_file);
112
-    }
113
-
114
-    /**
115
-     * @param string $compiled_path
116
-     * @param string $compiled
117
-     */
118
-    protected function writeFile($compiled_path, $compiled)
119
-    {
120
-        $this->ensureWriteableDirectory(dirname($compiled_path));
121
-        file_put_contents($compiled_path, $compiled);
122
-    }
123
-
124
-    /**
125
-     * @param string $path
126
-     */
127
-    protected function ensureWriteableDirectory($path)
128
-    {
129
-        if (is_dir($path)) {
130
-            if ( ! is_writeable($path)) {
131
-                throw TemplateCacheException::pathNotWriteable($path);
132
-            }
133
-        } else {
134
-            if ( ! mkdir($path, 0777, TRUE)) {
135
-                throw TemplateCacheException::cannotCreateDirectory($path);
136
-            }
137
-        }
138
-    }
27
+	/**
28
+	 * @var string
29
+	 */
30
+	protected $cache_dir;
31
+
32
+	/**
33
+	 * @var CFSWrapper
34
+	 */
35
+	protected $cascading_files;
36
+
37
+	/**
38
+	 * @var array
39
+	 */
40
+	protected $compiled_paths = [];
41
+
42
+	/**
43
+	 * @var TemplateCompiler
44
+	 */
45
+	protected $compiler;
46
+
47
+	/**
48
+	 * @var boolean
49
+	 */
50
+	protected $recompile_always;
51
+
52
+	/**
53
+	 * Valid options:
54
+	 * * cache_dir => the path where compiled templates will be cached
55
+	 * * recompile_always => whether to recompile each template on every execution,
56
+	 *
57
+	 * @param TemplateCompiler $compiler
58
+	 * @param array            $options
59
+	 * @param CFSWrapper       $cascading_files
60
+	 */
61
+	public function __construct(TemplateCompiler $compiler, array $options, CFSWrapper $cascading_files = NULL)
62
+	{
63
+		$this->cascading_files  = $cascading_files ?: new CFSWrapper;
64
+		$this->compiler         = $compiler;
65
+		$this->cache_dir        = rtrim($options['cache_dir'], '/');
66
+		$this->recompile_always = \Arr::get($options, 'recompile_always', FALSE);
67
+	}
68
+
69
+	/**
70
+	 * {@inheritdoc}
71
+	 */
72
+	public function getPath($template_name)
73
+	{
74
+		$compiled_path = $this->cache_dir.'/'.$template_name.'.php';
75
+
76
+		if ($this->isCompileRequired($compiled_path)) {
77
+			$source   = $this->requireSourceFileContent($template_name);
78
+			$compiled = $this->compiler->compile($source);
79
+			$this->writeFile($compiled_path, $compiled);
80
+			$this->compiled_paths[$compiled_path] = TRUE;
81
+		}
82
+
83
+		return $compiled_path;
84
+	}
85
+
86
+	/**
87
+	 * @param string $compiled_path
88
+	 *
89
+	 * @return bool
90
+	 */
91
+	protected function isCompileRequired($compiled_path)
92
+	{
93
+		if ($this->recompile_always AND ! isset($this->compiled_paths[$compiled_path])) {
94
+			return TRUE;
95
+		}
96
+
97
+		return ! file_exists($compiled_path);
98
+	}
99
+
100
+	/**
101
+	 * @param string $template_name
102
+	 *
103
+	 * @return string
104
+	 */
105
+	protected function requireSourceFileContent($template_name)
106
+	{
107
+		if ( ! $source_file = $this->cascading_files->find_file('views', $template_name)) {
108
+			throw TemplateNotFoundException::forSourcePath('views/'.$template_name);
109
+		}
110
+
111
+		return file_get_contents($source_file);
112
+	}
113
+
114
+	/**
115
+	 * @param string $compiled_path
116
+	 * @param string $compiled
117
+	 */
118
+	protected function writeFile($compiled_path, $compiled)
119
+	{
120
+		$this->ensureWriteableDirectory(dirname($compiled_path));
121
+		file_put_contents($compiled_path, $compiled);
122
+	}
123
+
124
+	/**
125
+	 * @param string $path
126
+	 */
127
+	protected function ensureWriteableDirectory($path)
128
+	{
129
+		if (is_dir($path)) {
130
+			if ( ! is_writeable($path)) {
131
+				throw TemplateCacheException::pathNotWriteable($path);
132
+			}
133
+		} else {
134
+			if ( ! mkdir($path, 0777, TRUE)) {
135
+				throw TemplateCacheException::cannotCreateDirectory($path);
136
+			}
137
+		}
138
+	}
139 139
 
140 140
 }
Please login to merge, or discard this patch.
classes/Ingenerator/KohanaView/ViewModel/AbstractViewModel.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -40,89 +40,89 @@
 block discarded – undo
40 40
  */
41 41
 abstract class AbstractViewModel implements ViewModel
42 42
 {
43
-    /**
44
-     * @var array The actual view data
45
-     */
46
-    protected $variables = [];
43
+	/**
44
+	 * @var array The actual view data
45
+	 */
46
+	protected $variables = [];
47 47
 
48
-    /**
49
-     * @var string[] The names of the valid set of fields that must be passed to the display() method
50
-     */
51
-    protected $expect_var_names = [];
48
+	/**
49
+	 * @var string[] The names of the valid set of fields that must be passed to the display() method
50
+	 */
51
+	protected $expect_var_names = [];
52 52
 
53
-    public function __construct()
54
-    {
55
-        // Assign the expect_var_names to ensure that we don't accidentally start requiring compiled fields
56
-        $this->expect_var_names = array_keys($this->variables);
57
-    }
53
+	public function __construct()
54
+	{
55
+		// Assign the expect_var_names to ensure that we don't accidentally start requiring compiled fields
56
+		$this->expect_var_names = array_keys($this->variables);
57
+	}
58 58
 
59
-    /**
60
-     * Get field values
61
-     *
62
-     * @param string $name
63
-     *
64
-     * @return mixed
65
-     */
66
-    public function __get($name)
67
-    {
68
-        if (array_key_exists($name, $this->variables)) {
69
-            return $this->variables[$name];
70
-        } elseif (method_exists($this, 'var_'.$name)) {
71
-            $method = 'var_'.$name;
59
+	/**
60
+	 * Get field values
61
+	 *
62
+	 * @param string $name
63
+	 *
64
+	 * @return mixed
65
+	 */
66
+	public function __get($name)
67
+	{
68
+		if (array_key_exists($name, $this->variables)) {
69
+			return $this->variables[$name];
70
+		} elseif (method_exists($this, 'var_'.$name)) {
71
+			$method = 'var_'.$name;
72 72
 
73
-            return $this->$method();
74
-        } else {
75
-            throw UndefinedViewVarException::forClassAndVar(static::class, $name);
76
-        }
77
-    }
73
+			return $this->$method();
74
+		} else {
75
+			throw UndefinedViewVarException::forClassAndVar(static::class, $name);
76
+		}
77
+	}
78 78
 
79
-    /**
80
-     * @param string $name
81
-     * @param mixed  $value
82
-     *
83
-     * @throws \BadMethodCallException values cannot be assigned except with the display method
84
-     */
85
-    public function __set($name, $value)
86
-    {
87
-        throw InvalidViewVarAssignmentException::forReadOnlyVar(static::class, $name);
88
-    }
79
+	/**
80
+	 * @param string $name
81
+	 * @param mixed  $value
82
+	 *
83
+	 * @throws \BadMethodCallException values cannot be assigned except with the display method
84
+	 */
85
+	public function __set($name, $value)
86
+	{
87
+		throw InvalidViewVarAssignmentException::forReadOnlyVar(static::class, $name);
88
+	}
89 89
 
90
-    /**
91
-     * Set the data to be rendered in the view - note this does not actually render the view.
92
-     *
93
-     * @param array $variables
94
-     */
95
-    public function display(array $variables)
96
-    {
97
-        if ($errors = $this->validateDisplayVariables($variables)) {
98
-            throw InvalidDisplayVariablesException::passedToDisplay(static::class, $errors);
99
-        }
90
+	/**
91
+	 * Set the data to be rendered in the view - note this does not actually render the view.
92
+	 *
93
+	 * @param array $variables
94
+	 */
95
+	public function display(array $variables)
96
+	{
97
+		if ($errors = $this->validateDisplayVariables($variables)) {
98
+			throw InvalidDisplayVariablesException::passedToDisplay(static::class, $errors);
99
+		}
100 100
 
101
-        $this->variables = $variables;
102
-    }
101
+		$this->variables = $variables;
102
+	}
103 103
 
104
-    /**
105
-     * @param array $variables
106
-     *
107
-     * @return string[] of errors
108
-     */
109
-    protected function validateDisplayVariables(array $variables)
110
-    {
111
-        $errors             = [];
112
-        $provided_variables = array_keys($variables);
113
-        foreach (array_diff($provided_variables, $this->expect_var_names) as $unexpected_var) {
114
-            if (method_exists($this, 'var_'.$unexpected_var)) {
115
-                $errors[] = "'$unexpected_var' conflicts with ::var_$unexpected_var()";
116
-            } else {
117
-                $errors[] = "'$unexpected_var' is not expected";
118
-            }
119
-        }
104
+	/**
105
+	 * @param array $variables
106
+	 *
107
+	 * @return string[] of errors
108
+	 */
109
+	protected function validateDisplayVariables(array $variables)
110
+	{
111
+		$errors             = [];
112
+		$provided_variables = array_keys($variables);
113
+		foreach (array_diff($provided_variables, $this->expect_var_names) as $unexpected_var) {
114
+			if (method_exists($this, 'var_'.$unexpected_var)) {
115
+				$errors[] = "'$unexpected_var' conflicts with ::var_$unexpected_var()";
116
+			} else {
117
+				$errors[] = "'$unexpected_var' is not expected";
118
+			}
119
+		}
120 120
 
121
-        foreach (array_diff($this->expect_var_names, $provided_variables) as $missing_var) {
122
-            $errors[] = "'$missing_var' is missing";
123
-        }
121
+		foreach (array_diff($this->expect_var_names, $provided_variables) as $missing_var) {
122
+			$errors[] = "'$missing_var' is missing";
123
+		}
124 124
 
125
-        return $errors;
126
-    }
125
+		return $errors;
126
+	}
127 127
 
128 128
 }
Please login to merge, or discard this patch.
Ingenerator/KohanaView/ViewModel/PageLayout/StaticPageContentView.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,21 +12,21 @@
 block discarded – undo
12 12
 
13 13
 class StaticPageContentView extends AbstractPageContentView implements TemplateSpecifyingViewModel
14 14
 {
15
-    protected $variables = [
16
-        'page_path' => NULL,
17
-    ];
15
+	protected $variables = [
16
+		'page_path' => NULL,
17
+	];
18 18
 
19
-    /**
20
-     * {@inheritdoc}
21
-     */
22
-    public function getTemplateName()
23
-    {
24
-        if ( ! $this->variables['page_path']) {
25
-            throw UnassignedViewVarException::forVariable(static::class, 'page_path', 'name/of/view');
26
-        }
19
+	/**
20
+	 * {@inheritdoc}
21
+	 */
22
+	public function getTemplateName()
23
+	{
24
+		if ( ! $this->variables['page_path']) {
25
+			throw UnassignedViewVarException::forVariable(static::class, 'page_path', 'name/of/view');
26
+		}
27 27
 
28
-        return $this->variables['page_path'];
29
-    }
28
+		return $this->variables['page_path'];
29
+	}
30 30
 
31 31
 
32 32
 }
Please login to merge, or discard this patch.
classes/Ingenerator/KohanaView/ViewTemplateSelector.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -22,55 +22,55 @@
 block discarded – undo
22 22
 class ViewTemplateSelector
23 23
 {
24 24
 
25
-    /**
26
-     * @param ViewModel $view
27
-     *
28
-     * @return string
29
-     */
30
-    public function getTemplateName(ViewModel $view)
31
-    {
32
-        if ($view instanceof TemplateSpecifyingViewModel) {
33
-            return $this->validateSpecifiedTemplateName($view);
34
-        } else {
35
-            return $this->calculateTemplateFromClassName($view);
36
-        }
37
-    }
25
+	/**
26
+	 * @param ViewModel $view
27
+	 *
28
+	 * @return string
29
+	 */
30
+	public function getTemplateName(ViewModel $view)
31
+	{
32
+		if ($view instanceof TemplateSpecifyingViewModel) {
33
+			return $this->validateSpecifiedTemplateName($view);
34
+		} else {
35
+			return $this->calculateTemplateFromClassName($view);
36
+		}
37
+	}
38 38
 
39
-    /**
40
-     * @param TemplateSpecifyingViewModel $view
41
-     *
42
-     * @return mixed
43
-     * @throws \UnexpectedValueException if no template is provided
44
-     */
45
-    protected function validateSpecifiedTemplateName(TemplateSpecifyingViewModel $view)
46
-    {
47
-        $template   = $view->getTemplateName();
48
-        $view_class = get_class($view);
49
-        if ( ! $template) {
50
-            throw UnspecifiedTemplateNameException::forEmptyValue($view_class);
51
-        }
39
+	/**
40
+	 * @param TemplateSpecifyingViewModel $view
41
+	 *
42
+	 * @return mixed
43
+	 * @throws \UnexpectedValueException if no template is provided
44
+	 */
45
+	protected function validateSpecifiedTemplateName(TemplateSpecifyingViewModel $view)
46
+	{
47
+		$template   = $view->getTemplateName();
48
+		$view_class = get_class($view);
49
+		if ( ! $template) {
50
+			throw UnspecifiedTemplateNameException::forEmptyValue($view_class);
51
+		}
52 52
 
53
-        if ( ! is_string($template)) {
54
-            throw UnspecifiedTemplateNameException::forNonStringValue($view_class, $template);
55
-        }
53
+		if ( ! is_string($template)) {
54
+			throw UnspecifiedTemplateNameException::forNonStringValue($view_class, $template);
55
+		}
56 56
 
57
-        return $template;
58
-    }
57
+		return $template;
58
+	}
59 59
 
60
-    /**
61
-     * @param ViewModel $view
62
-     *
63
-     * @return string
64
-     */
65
-    protected function calculateTemplateFromClassName(ViewModel $view)
66
-    {
67
-        $template = get_class($view);
68
-        $template = preg_replace('/\\\\|_/', '/', $template);
69
-        $template = preg_replace('#(^view/?(model)?/)|(?<!/)(view/?(model)?$)#i', '', $template);
70
-        $template = preg_replace('/([a-z])([A-Z])/', '\1_\2', $template);
71
-        $template = strtolower($template);
60
+	/**
61
+	 * @param ViewModel $view
62
+	 *
63
+	 * @return string
64
+	 */
65
+	protected function calculateTemplateFromClassName(ViewModel $view)
66
+	{
67
+		$template = get_class($view);
68
+		$template = preg_replace('/\\\\|_/', '/', $template);
69
+		$template = preg_replace('#(^view/?(model)?/)|(?<!/)(view/?(model)?$)#i', '', $template);
70
+		$template = preg_replace('/([a-z])([A-Z])/', '\1_\2', $template);
71
+		$template = strtolower($template);
72 72
 
73
-        return $template;
74
-    }
73
+		return $template;
74
+	}
75 75
 
76 76
 }
Please login to merge, or discard this patch.