Completed
Push — 1.0.x ( efc2ab...86a833 )
by Andrew
01:37 queued 10s
created
classes/Kohana/View/Stream/Wrapper.php 1 patch
Braces   +12 added lines, -27 removed lines patch added patch discarded remove patch
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
 		 * If reading the file failed, update our local stat store
85 85
 		 * to reflect the real stat of the file, then return on failure
86 86
 		 */
87
-		if ($this->_data === false)
88
-		{
87
+		if ($this->_data === false) {
89 88
 			$this->_stat = stat($path);
90 89
 			return false;
91 90
 		}
@@ -126,20 +125,16 @@  discard block
 block discarded – undo
126 125
                     '$this->var_$1', $code);
127 126
 
128 127
             // If this block is not the special <?= block return
129
-            if ($matches[1] !== '=')
130
-            {
128
+            if ($matches[1] !== '=') {
131 129
                 return '<?php '. $code . '?>';
132 130
             }
133 131
 
134 132
             // Remove trailing ; characters
135 133
             $var = trim($code, ';');
136 134
 
137
-            if (substr($var, 0, 1) != $this->_raw_output_char)
138
-            {
135
+            if (substr($var, 0, 1) != $this->_raw_output_char) {
139 136
                 return '<?php echo '.$this->_encode_method.'('.$var.'); ?>';
140
-            }
141
-            else
142
-            {
137
+            } else {
143 138
                 // Remove the "turn off escape" character
144 139
                 return '<?php echo '.substr($var, strlen($this->_raw_output_char), strlen($var)-1).'; ?>';
145 140
             }
@@ -194,40 +189,30 @@  discard block
 block discarded – undo
194 189
 	 */
195 190
 	public function stream_seek($offset, $whence)
196 191
 	{
197
-		switch ($whence)
198
-		{
192
+		switch ($whence) {
199 193
 			case SEEK_SET:
200
-				if ($offset < strlen($this->_data) && $offset >= 0)
201
-				{
194
+				if ($offset < strlen($this->_data) && $offset >= 0) {
202 195
 					$this->_pos = $offset;
203 196
 					return true;
204
-				}
205
-				else
206
-				{
197
+				} else {
207 198
 					return false;
208 199
 				}
209 200
 				break;
210 201
 
211 202
 			case SEEK_CUR:
212
-				if ($offset >= 0)
213
-				{
203
+				if ($offset >= 0) {
214 204
 					$this->_pos += $offset;
215 205
 					return true;
216
-				}
217
-				else
218
-				{
206
+				} else {
219 207
 					return false;
220 208
 				}
221 209
 				break;
222 210
 
223 211
 			case SEEK_END:
224
-				if (strlen($this->_data) + $offset >= 0)
225
-				{
212
+				if (strlen($this->_data) + $offset >= 0) {
226 213
 					$this->_pos = strlen($this->_data) + $offset;
227 214
 					return true;
228
-				}
229
-				else
230
-				{
215
+				} else {
231 216
 					return false;
232 217
 				}
233 218
 				break;
@@ -238,7 +223,7 @@  discard block
 block discarded – undo
238 223
 	}
239 224
 
240 225
 	public function stream_set_option($option, $arg1, $arg2)
241
-    {
226
+	{
242 227
         // PHP7.4 requires this be implemented, but we can return FALSE that we don't support any of the options
243 228
         // (blocking mode, buffering, etc)
244 229
         return FALSE;
Please login to merge, or discard this patch.
classes/Kohana/View/Model.php 1 patch
Braces   +23 added lines, -44 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@  discard block
 block discarded – undo
10 10
  * @copyright  (c) 2008-2010 Kohana Team
11 11
  * @license    http://kohanaphp.com/license
12 12
  */
13
-class Kohana_View_Model {
13
+class Kohana_View_Model
14
+{
14 15
 
15 16
 	// View filename
16 17
 	protected $_file;
@@ -28,13 +29,13 @@  discard block
 block discarded – undo
28 29
 	public static function factory($file = NULL, array $data = NULL)
29 30
 	{
30 31
 		// Return a raw view object if no template is specified.
31
-		if ($file === FALSE)
32
-			return new View(FALSE, $data);
32
+		if ($file === FALSE) {
33
+					return new View(FALSE, $data);
34
+		}
33 35
 
34 36
 		$class = 'View_'.strtr($file, '/', '_');
35 37
 
36
-		if ( ! class_exists($class))
37
-		{
38
+		if ( ! class_exists($class)) {
38 39
 			$class = 'View';
39 40
 		}
40 41
 
@@ -52,20 +53,16 @@  discard block
 block discarded – undo
52 53
 	 */
53 54
 	protected function capture($kohana_view_filename)
54 55
 	{
55
-		if ( ! in_array('kohana.view', stream_get_wrappers()))
56
-		{
56
+		if ( ! in_array('kohana.view', stream_get_wrappers())) {
57 57
 			stream_wrapper_register('kohana.view', 'View_Stream_Wrapper');
58 58
 		}
59 59
 
60 60
 		// Capture the view output
61 61
 		ob_start();
62 62
 
63
-		try
64
-		{
63
+		try {
65 64
 			include 'kohana.view://'.$kohana_view_filename;
66
-		}
67
-		catch (Exception $e)
68
-		{
65
+		} catch (Exception $e) {
69 66
 			// Delete the output buffer
70 67
 			ob_end_clean();
71 68
 
@@ -90,20 +87,17 @@  discard block
 block discarded – undo
90 87
 	 */
91 88
 	public function __construct($file = NULL, array $data = NULL)
92 89
 	{
93
-		if ($file === NULL)
94
-		{
90
+		if ($file === NULL) {
95 91
 			$foo = explode('_', get_class($this));
96 92
 			array_shift($foo);
97 93
 			$file = strtolower(implode('/', $foo));
98 94
 		}
99 95
 		
100
-		if ($file !== FALSE)
101
-		{
96
+		if ($file !== FALSE) {
102 97
 			$this->set_filename($file);
103 98
 		}
104 99
 
105
-		if ($data !== NULL)
106
-		{
100
+		if ($data !== NULL) {
107 101
 			// Add the values to the current data
108 102
 			$this->set($data);
109 103
 		}
@@ -123,16 +117,11 @@  discard block
 block discarded – undo
123 117
 	 */
124 118
 	public function __get($key)
125 119
 	{
126
-		if (method_exists($this, $key))
127
-		{
120
+		if (method_exists($this, $key)) {
128 121
 			return $this->$key();
129
-		}
130
-		elseif (property_exists($this, $key))
131
-		{
122
+		} elseif (property_exists($this, $key)) {
132 123
 			return $this->$key;
133
-		}
134
-		else
135
-		{
124
+		} else {
136 125
 			throw new Kohana_Exception('View variable is not set: :var',
137 126
 				array(':var' => $key));
138 127
 		}
@@ -161,12 +150,9 @@  discard block
 block discarded – undo
161 150
 	 */
162 151
 	public function __toString()
163 152
 	{
164
-		try
165
-		{
153
+		try {
166 154
 			return $this->render();
167
-		}
168
-		catch (Exception $e)
169
-		{
155
+		} catch (Exception $e) {
170 156
 			// Display the exception message
171 157
 			Kohana_Exception::handler($e);
172 158
 
@@ -185,8 +171,7 @@  discard block
 block discarded – undo
185 171
 	 */
186 172
 	public function set_filename($file)
187 173
 	{
188
-		if (($path = Kohana::find_file('views', $file)) === FALSE)
189
-		{
174
+		if (($path = Kohana::find_file('views', $file)) === FALSE) {
190 175
 			throw new Kohana_View_Exception('The requested view :file could not be found', array(
191 176
 				':file' => $file,
192 177
 			));
@@ -216,15 +201,11 @@  discard block
 block discarded – undo
216 201
 	 */
217 202
 	public function set($key, $value = NULL)
218 203
 	{
219
-		if (is_array($key))
220
-		{
221
-			foreach ($key as $name => $value)
222
-			{
204
+		if (is_array($key)) {
205
+			foreach ($key as $name => $value) {
223 206
 				$this->{$name} = $value;
224 207
 			}
225
-		}
226
-		else
227
-		{
208
+		} else {
228 209
 			$this->{$key} = $value;
229 210
 		}
230 211
 
@@ -267,13 +248,11 @@  discard block
 block discarded – undo
267 248
 	 */
268 249
 	public function render($file = NULL)
269 250
 	{
270
-		if ($file !== NULL)
271
-		{
251
+		if ($file !== NULL) {
272 252
 			$this->set_filename($file);
273 253
 		}
274 254
 
275
-		if (empty($this->_file))
276
-		{
255
+		if (empty($this->_file)) {
277 256
 			throw new Kohana_View_Exception('You must set the file to use within your view before rendering');
278 257
 		}
279 258
 
Please login to merge, or discard this patch.
classes/ViewFactory.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,4 +14,6 @@
 block discarded – undo
14 14
  * The ViewFactory creates view classes, to allow stubbing of views for testing and easier extension in applications.
15 15
  *
16 16
  */
17
-class ViewFactory extends Ingenerator\ViewFactory{}
18 17
\ No newline at end of file
18
+class ViewFactory extends Ingenerator\ViewFactory
19
+{
20
+}
19 21
\ No newline at end of file
Please login to merge, or discard this patch.
classes/View/Stream/Wrapper.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,5 @@
 block discarded – undo
1 1
 <?php defined('SYSPATH') or die('No direct script access.');
2 2
 
3
-class View_Stream_Wrapper extends Kohana_View_Stream_Wrapper {}
3
+class View_Stream_Wrapper extends Kohana_View_Stream_Wrapper
4
+{
5
+}
Please login to merge, or discard this patch.
classes/View/Model.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,5 @@
 block discarded – undo
1 1
 <?php defined('SYSPATH') or die('No direct script access.');
2 2
 
3
-class View_Model extends Kohana_View_Model {}
3
+class View_Model extends Kohana_View_Model
4
+{
5
+}
Please login to merge, or discard this patch.
classes/Ingenerator/ViewFactory.php 1 patch
Braces   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @package Ingenerator
18 18
  */
19
-class ViewFactory {
19
+class ViewFactory
20
+{
20 21
 
21 22
 	/**
22 23
 	 * Create and return a view of the specified type
@@ -30,15 +31,13 @@  discard block
 block discarded – undo
30 31
 	public function create($class, $data = array())
31 32
 	{
32 33
 		// Check the view class exists
33
-		if ( ! class_exists($class))
34
-		{
34
+		if ( ! class_exists($class)) {
35 35
 			throw new \View_Exception("View class $class does not exist");
36 36
 		}
37 37
 
38 38
 		// Temporary fix to map template names for namespaced classes
39 39
 		//@todo: Refactor the existing factory methods and classes to support namespaces
40
-		if ('\\View\\' === substr($class, 0, 6))
41
-		{
40
+		if ('\\View\\' === substr($class, 0, 6)) {
42 41
 			// Strip the \View\ prefix
43 42
 			$template = substr($class, 6);
44 43
 
@@ -47,9 +46,7 @@  discard block
 block discarded – undo
47 46
 
48 47
 			// Lowercase the View file name
49 48
 			$template = strtolower($template);
50
-		}
51
-		else
52
-		{
49
+		} else {
53 50
 			$template = NULL;
54 51
 		}
55 52
 
Please login to merge, or discard this patch.
classes/Ingenerator/View/Layout.php 1 patch
Braces   +8 added lines, -17 removed lines patch added patch discarded remove patch
@@ -47,11 +47,9 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function var_page()
49 49
     {
50
-        if ( is_string($this->template))
51
-        {
50
+        if ( is_string($this->template)) {
52 51
             $class = 'View_Template_'.$this->template;
53
-            if ( ! class_exists($class))
54
-            {
52
+            if ( ! class_exists($class)) {
55 53
                 $class = 'View';
56 54
             }
57 55
             $this->template = new $class();
@@ -109,8 +107,7 @@  discard block
 block discarded – undo
109 107
         $this->post_render();
110 108
 
111 109
         // Render the template if required
112
-        if ($this->use_template())
113
-        {
110
+        if ($this->use_template()) {
114 111
             $template = $this->var_page();
115 112
             $template->set('var_body', $body);
116 113
             return $template->render();
@@ -138,27 +135,21 @@  discard block
 block discarded – undo
138 135
     public function use_template($use_template = null)
139 136
     {
140 137
         // If we're being called as a setter
141
-        if ($use_template !== null)
142
-        {
138
+        if ($use_template !== null) {
143 139
             $this->_use_template = $use_template;
144 140
             return $this;
145 141
         }
146 142
 
147 143
         // If an explicit value was set
148
-        if ($this->_use_template !== null)
149
-        {
144
+        if ($this->_use_template !== null) {
150 145
             return $this->_use_template;
151 146
         }
152 147
 
153 148
         // Guess based on is_ajax
154
-        if (Request::current())
155
-        {
156
-            if (Request::current()->is_ajax())
157
-            {
149
+        if (Request::current()) {
150
+            if (Request::current()->is_ajax()) {
158 151
                 return false;
159
-            }
160
-            else
161
-            {
152
+            } else {
162 153
                 return true;
163 154
             }
164 155
         }
Please login to merge, or discard this patch.