Completed
Push — 2.0.x ( f85be6...e30486 )
by Andrew
02:32
created
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.
config/kohanaview.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Configuration for the KohanaView module
4
- *
5
- * @author     Andrew Coulton <[email protected]>
6
- * @copyright  2015 inGenerator Ltd
7
- * @license    http://kohanaframework.org/license
8
- */
3
+   * Configuration for the KohanaView module
4
+   *
5
+   * @author     Andrew Coulton <[email protected]>
6
+   * @copyright  2015 inGenerator Ltd
7
+   * @license    http://kohanaframework.org/license
8
+   */
9 9
 return [
10
-    'template_manager' => [
11
-        // Where compiled templates should be stored
12
-        'cache_dir'        => \Kohana::$cache_dir.'/compiled_templates',
10
+	'template_manager' => [
11
+		// Where compiled templates should be stored
12
+		'cache_dir'        => \Kohana::$cache_dir.'/compiled_templates',
13 13
 
14
-        // Whether to recompile all templates on the first use of that template even if it exists
15
-        'recompile_always' => (\Kohana::$environment === \Kohana::DEVELOPMENT),
16
-    ],
14
+		// Whether to recompile all templates on the first use of that template even if it exists
15
+		'recompile_always' => (\Kohana::$environment === \Kohana::DEVELOPMENT),
16
+	],
17 17
 ];
Please login to merge, or discard this patch.
config/dependencies.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,44 +1,44 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * KohanaView dependency container configuration for use with https://github.com/zeelot/kohana-dependencies
4
- *
5
- * @author     Andrew Coulton <[email protected]>
6
- * @copyright  2015 inGenerator Ltd
7
- * @license    http://kohanaframework.org/license
8
- */
3
+	 * KohanaView dependency container configuration for use with https://github.com/zeelot/kohana-dependencies
4
+	 *
5
+	 * @author     Andrew Coulton <[email protected]>
6
+	 * @copyright  2015 inGenerator Ltd
7
+	 * @license    http://kohanaframework.org/license
8
+	 */
9 9
 return [
10
-    'kohanaview' => [
11
-        'renderer' => [
12
-            'html' => [
13
-                '_settings' => [
14
-                    'class'     => '\Ingenerator\KohanaView\Renderer\HTMLRenderer',
15
-                    'arguments' => ['%kohanaview.template.selector%', '%kohanaview.template.manager%'],
16
-                    'shared'    => TRUE,
17
-                ],
18
-            ],
19
-        ],
20
-        'template' => [
21
-            'compiler' => [
22
-                '_settings' => [
23
-                    'class'     => '\Ingenerator\KohanaView\TemplateCompiler',
24
-                    'arguments' => [],
25
-                    'shared'    => TRUE,
26
-                ],
27
-            ],
28
-            'manager'  => [
29
-                '_settings' => [
30
-                    'class'     => '\Ingenerator\KohanaView\TemplateManager\CFSTemplateManager',
31
-                    'arguments' => ['%kohanaview.template.compiler%', '@kohanaview.template_manager@'],
32
-                    'shared'    => TRUE,
33
-                ],
34
-            ],
35
-            'selector' => [
36
-                '_settings' => [
37
-                    'class'     => '\Ingenerator\KohanaView\ViewTemplateSelector',
38
-                    'arguments' => [],
39
-                    'shared'    => TRUE,
40
-                ],
41
-            ],
42
-        ],
43
-    ],
10
+	'kohanaview' => [
11
+		'renderer' => [
12
+			'html' => [
13
+				'_settings' => [
14
+					'class'     => '\Ingenerator\KohanaView\Renderer\HTMLRenderer',
15
+					'arguments' => ['%kohanaview.template.selector%', '%kohanaview.template.manager%'],
16
+					'shared'    => TRUE,
17
+				],
18
+			],
19
+		],
20
+		'template' => [
21
+			'compiler' => [
22
+				'_settings' => [
23
+					'class'     => '\Ingenerator\KohanaView\TemplateCompiler',
24
+					'arguments' => [],
25
+					'shared'    => TRUE,
26
+				],
27
+			],
28
+			'manager'  => [
29
+				'_settings' => [
30
+					'class'     => '\Ingenerator\KohanaView\TemplateManager\CFSTemplateManager',
31
+					'arguments' => ['%kohanaview.template.compiler%', '@kohanaview.template_manager@'],
32
+					'shared'    => TRUE,
33
+				],
34
+			],
35
+			'selector' => [
36
+				'_settings' => [
37
+					'class'     => '\Ingenerator\KohanaView\ViewTemplateSelector',
38
+					'arguments' => [],
39
+					'shared'    => TRUE,
40
+				],
41
+			],
42
+		],
43
+	],
44 44
 ];
Please login to merge, or discard this patch.
classes/Ingenerator/KohanaView/Exception/UndefinedViewVarException.php 1 patch
Indentation   +16 added lines, -16 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
 
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
 class UndefinedViewVarException extends \BadMethodCallException
16 16
 {
17 17
 
18
-    /**
19
-     * @param string $view_class
20
-     * @param string $var_name
21
-     *
22
-     * @return static
23
-     */
24
-    public static function forClassAndVar($view_class, $var_name)
25
-    {
26
-        return new static(
27
-            "$view_class does not define a '$var_name' field"
28
-        );
29
-    }
18
+	/**
19
+	 * @param string $view_class
20
+	 * @param string $var_name
21
+	 *
22
+	 * @return static
23
+	 */
24
+	public static function forClassAndVar($view_class, $var_name)
25
+	{
26
+		return new static(
27
+			"$view_class does not define a '$var_name' field"
28
+		);
29
+	}
30 30
 }
Please login to merge, or discard this patch.
classes/Ingenerator/KohanaView/ViewModel/PageLayoutView.php 1 patch
Indentation   +10 added lines, -10 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\ViewModel;
9 9
 
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 interface PageLayoutView extends ViewModel
22 22
 {
23 23
 
24
-    /**
25
-     * @param string $html
26
-     *
27
-     * @return void
28
-     */
29
-    public function setBodyHTML($html);
24
+	/**
25
+	 * @param string $html
26
+	 *
27
+	 * @return void
28
+	 */
29
+	public function setBodyHTML($html);
30 30
 
31 31
 }
Please login to merge, or discard this patch.
classes/Ingenerator/KohanaView/Exception/UnassignedViewVarException.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,25 +16,25 @@
 block discarded – undo
16 16
 class UnassignedViewVarException extends \BadMethodCallException
17 17
 {
18 18
 
19
-    /**
20
-     * @param string $view_class
21
-     * @param string $var_name
22
-     * @param string $hint
23
-     *
24
-     * @return static
25
-     */
26
-    public static function forVariable($view_class, $var_name, $hint)
27
-    {
28
-        return new static(
29
-            sprintf(
30
-                'Call %s::display(["%s" => "%s"]) before rendering a %s view',
31
-                $view_class,
32
-                $var_name,
33
-                $hint,
34
-                $view_class
35
-            )
36
-        );
37
-    }
19
+	/**
20
+	 * @param string $view_class
21
+	 * @param string $var_name
22
+	 * @param string $hint
23
+	 *
24
+	 * @return static
25
+	 */
26
+	public static function forVariable($view_class, $var_name, $hint)
27
+	{
28
+		return new static(
29
+			sprintf(
30
+				'Call %s::display(["%s" => "%s"]) before rendering a %s view',
31
+				$view_class,
32
+				$var_name,
33
+				$hint,
34
+				$view_class
35
+			)
36
+		);
37
+	}
38 38
 
39 39
 
40 40
 }
Please login to merge, or discard this patch.