Completed
Branch scrutinizer (4d54e2)
by Fabio
15:49
created
framework/3rdParty/TextHighlighter/Text/Highlighter/Renderer.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,6 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @access public
70 70
      *
71
-     * @param  array $options  Rendering options. Renderer-specific.
72 71
      */
73 72
     function reset()
74 73
     {
@@ -130,6 +129,7 @@  discard block
 block discarded – undo
130 129
      * Set current language
131 130
      *
132 131
      * @abstract
132
+     * @param string $lang
133 133
      * @return void
134 134
      * @access public
135 135
      *
Please login to merge, or discard this patch.
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -35,109 +35,109 @@
 block discarded – undo
35 35
 
36 36
 class Text_Highlighter_Renderer
37 37
 {
38
-    /**
39
-     * Renderer options
40
-     *
41
-     * @var array
42
-     * @access protected
43
-     */
44
-    public $_options = array();
38
+	/**
39
+	 * Renderer options
40
+	 *
41
+	 * @var array
42
+	 * @access protected
43
+	 */
44
+	public $_options = array();
45 45
 
46
-    /**
47
-     * Current language
48
-     *
49
-     * @var string
50
-     * @access protected
51
-     */
52
-    public $_language = '';
46
+	/**
47
+	 * Current language
48
+	 *
49
+	 * @var string
50
+	 * @access protected
51
+	 */
52
+	public $_language = '';
53 53
 
54
-    /**
55
-     * Constructor
56
-     *
57
-     * @access public
58
-     *
59
-     * @param  array $options  Rendering options. Renderer-specific.
60
-     */
61
-    function __construct($options = array())
62
-    {
63
-        $this->_options = $options;
64
-    }
54
+	/**
55
+	 * Constructor
56
+	 *
57
+	 * @access public
58
+	 *
59
+	 * @param  array $options  Rendering options. Renderer-specific.
60
+	 */
61
+	function __construct($options = array())
62
+	{
63
+		$this->_options = $options;
64
+	}
65 65
 
66
-    /**
67
-     * Resets renderer state
68
-     *
69
-     * @access public
70
-     *
71
-     * @param  array $options  Rendering options. Renderer-specific.
72
-     */
73
-    function reset()
74
-    {
75
-        return;
76
-    }
66
+	/**
67
+	 * Resets renderer state
68
+	 *
69
+	 * @access public
70
+	 *
71
+	 * @param  array $options  Rendering options. Renderer-specific.
72
+	 */
73
+	function reset()
74
+	{
75
+		return;
76
+	}
77 77
 
78
-    /**
79
-     * Preprocesses code
80
-     *
81
-     * @access public
82
-     *
83
-     * @param  string $str Code to preprocess
84
-     * @return string Preprocessed code
85
-     */
86
-    function preprocess($str)
87
-    {
88
-        return $str;
89
-    }
78
+	/**
79
+	 * Preprocesses code
80
+	 *
81
+	 * @access public
82
+	 *
83
+	 * @param  string $str Code to preprocess
84
+	 * @return string Preprocessed code
85
+	 */
86
+	function preprocess($str)
87
+	{
88
+		return $str;
89
+	}
90 90
 
91
-    /**
92
-     * Accepts next token
93
-     *
94
-     * @abstract
95
-     * @access public
96
-     *
97
-     * @param  string $class   Token class
98
-     * @param  string $content Token content
99
-     */
100
-    function acceptToken($class, $content)
101
-    {
102
-        return;
103
-    }
91
+	/**
92
+	 * Accepts next token
93
+	 *
94
+	 * @abstract
95
+	 * @access public
96
+	 *
97
+	 * @param  string $class   Token class
98
+	 * @param  string $content Token content
99
+	 */
100
+	function acceptToken($class, $content)
101
+	{
102
+		return;
103
+	}
104 104
 
105
-    /**
106
-     * Signals that no more tokens are available
107
-     *
108
-     * @access public
109
-     *
110
-     */
111
-    function finalize()
112
-    {
113
-        return;
114
-    }
105
+	/**
106
+	 * Signals that no more tokens are available
107
+	 *
108
+	 * @access public
109
+	 *
110
+	 */
111
+	function finalize()
112
+	{
113
+		return;
114
+	}
115 115
 
116
-    /**
117
-     * Get generated output
118
-     *
119
-     * @abstract
120
-     * @return mixed Renderer-specific
121
-     * @access public
122
-     *
123
-     */
124
-    function getOutput()
125
-    {
126
-        return;
127
-    }
116
+	/**
117
+	 * Get generated output
118
+	 *
119
+	 * @abstract
120
+	 * @return mixed Renderer-specific
121
+	 * @access public
122
+	 *
123
+	 */
124
+	function getOutput()
125
+	{
126
+		return;
127
+	}
128 128
 
129
-    /**
130
-     * Set current language
131
-     *
132
-     * @abstract
133
-     * @return void
134
-     * @access public
135
-     *
136
-     */
137
-    function setCurrentLanguage($lang)
138
-    {
139
-        $this->_language = $lang;
140
-    }
129
+	/**
130
+	 * Set current language
131
+	 *
132
+	 * @abstract
133
+	 * @return void
134
+	 * @access public
135
+	 *
136
+	 */
137
+	function setCurrentLanguage($lang)
138
+	{
139
+		$this->_language = $lang;
140
+	}
141 141
 
142 142
 }
143 143
 
Please login to merge, or discard this patch.
framework/3rdParty/WsdlGen/WsdlMessage.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,6 @@
 block discarded – undo
59 59
 
60 60
 	/**
61 61
 	 * Return the message as a DOM element
62
-	 * @param 		DOMDocument		$wsdl		The wsdl document the messages will be children of
63 62
 	 */
64 63
 	public function getMessageElement(DOMDocument $dom)
65 64
 	{
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WsdlMessage file.
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the BSD License.
7
- *
8
- * Copyright(c) 2005 by Marcus Nyeholt. All rights reserved.
9
- *
10
- * To contact the author write to {@link mailto:[email protected] Marcus Nyeholt}
11
- * This file is part of the PRADO framework from {@link http://www.xisc.com}
12
- *
13
- * @author Marcus Nyeholt		<[email protected]>
14
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
15
- * @package System.Web.Services.SOAP
16
- */
3
+	 * WsdlMessage file.
4
+	 *
5
+	 * This program is free software; you can redistribute it and/or modify
6
+	 * it under the terms of the BSD License.
7
+	 *
8
+	 * Copyright(c) 2005 by Marcus Nyeholt. All rights reserved.
9
+	 *
10
+	 * To contact the author write to {@link mailto:[email protected] Marcus Nyeholt}
11
+	 * This file is part of the PRADO framework from {@link http://www.xisc.com}
12
+	 *
13
+	 * @author Marcus Nyeholt		<[email protected]>
14
+	 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
15
+	 * @package System.Web.Services.SOAP
16
+	 */
17 17
 
18 18
 /**
19 19
  * Represents a WSDL message. This is bound to the portTypes
Please login to merge, or discard this patch.
framework/Collections/TPagedDataSource.php 3 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -63,6 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 	/**
65 65
 	 * @param mixed original data source
66
+	 * @param Traversable $value
66 67
 	 */
67 68
 	public function setDataSource($value)
68 69
 	{
@@ -88,6 +89,7 @@  discard block
 block discarded – undo
88 89
 
89 90
 	/**
90 91
 	 * @param integer number of items in each page
92
+	 * @param integer $value
91 93
 	 */
92 94
 	public function setPageSize($value)
93 95
 	{
@@ -107,6 +109,7 @@  discard block
 block discarded – undo
107 109
 
108 110
 	/**
109 111
 	 * @param integer current page index
112
+	 * @param integer $value
110 113
 	 */
111 114
 	public function setCurrentPageIndex($value)
112 115
 	{
@@ -125,6 +128,7 @@  discard block
 block discarded – undo
125 128
 
126 129
 	/**
127 130
 	 * @param boolean whether to allow paging
131
+	 * @param boolean $value
128 132
 	 */
129 133
 	public function setAllowPaging($value)
130 134
 	{
@@ -141,6 +145,7 @@  discard block
 block discarded – undo
141 145
 
142 146
 	/**
143 147
 	 * @param boolean whether to allow custom paging
148
+	 * @param boolean $value
144 149
 	 */
145 150
 	public function setAllowCustomPaging($value)
146 151
 	{
@@ -157,6 +162,7 @@  discard block
 block discarded – undo
157 162
 
158 163
 	/**
159 164
 	 * @param integer user-assigned number of items in data source
165
+	 * @param integer $value
160 166
 	 */
161 167
 	public function setVirtualItemCount($value)
162 168
 	{
@@ -290,6 +296,8 @@  discard block
 block discarded – undo
290 296
 	 * @param TList the data to be iterated through
291 297
 	 * @param integer start index
292 298
 	 * @param integer number of items to be iterated through
299
+	 * @param integer $startIndex
300
+	 * @param integer $count
293 301
 	 */
294 302
 	public function __construct(TList $list,$startIndex,$count)
295 303
 	{
@@ -374,6 +382,8 @@  discard block
 block discarded – undo
374 382
 	/**
375 383
 	 * Constructor.
376 384
 	 * @param array the data to be iterated through
385
+	 * @param integer $startIndex
386
+	 * @param integer $count
377 387
 	 */
378 388
 	public function __construct(TMap $map,$startIndex,$count)
379 389
 	{
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -26,32 +26,32 @@  discard block
 block discarded – undo
26 26
  * @package System.Collections
27 27
  * @since 3.0
28 28
  */
29
-class TPagedDataSource extends TComponent implements IteratorAggregate,Countable
29
+class TPagedDataSource extends TComponent implements IteratorAggregate, Countable
30 30
 {
31 31
 	/**
32 32
 	 * @var mixed original data source
33 33
 	 */
34
-	private $_dataSource=null;
34
+	private $_dataSource = null;
35 35
 	/**
36 36
 	 * @var integer number of items in each page
37 37
 	 */
38
-	private $_pageSize=10;
38
+	private $_pageSize = 10;
39 39
 	/**
40 40
 	 * @var integer current page index
41 41
 	 */
42
-	private $_currentPageIndex=0;
42
+	private $_currentPageIndex = 0;
43 43
 	/**
44 44
 	 * @var boolean whether to allow paging
45 45
 	 */
46
-	private $_allowPaging=false;
46
+	private $_allowPaging = false;
47 47
 	/**
48 48
 	 * @var boolean whether to allow custom paging
49 49
 	 */
50
-	private $_allowCustomPaging=false;
50
+	private $_allowCustomPaging = false;
51 51
 	/**
52 52
 	 * @var integer user-assigned number of items in data source
53 53
 	 */
54
-	private $_virtualCount=0;
54
+	private $_virtualCount = 0;
55 55
 
56 56
 	/**
57 57
 	 * @return mixed original data source. Defaults to null.
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function setDataSource($value)
68 68
 	{
69
-		if(!($value instanceof TMap) && !($value instanceof TList))
69
+		if (!($value instanceof TMap) && !($value instanceof TList))
70 70
 		{
71
-			if(is_array($value))
72
-				$value=new TMap($value);
73
-			else if($value instanceof Traversable)
74
-				$value=new TList($value);
75
-			else if($value!==null)
71
+			if (is_array($value))
72
+				$value = new TMap($value);
73
+			else if ($value instanceof Traversable)
74
+				$value = new TList($value);
75
+			else if ($value !== null)
76 76
 				throw new TInvalidDataTypeException('pageddatasource_datasource_invalid');
77 77
 		}
78
-		$this->_dataSource=$value;
78
+		$this->_dataSource = $value;
79 79
 	}
80 80
 
81 81
 	/**
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function setPageSize($value)
93 93
 	{
94
-		if(($value=TPropertyValue::ensureInteger($value))>0)
95
-			$this->_pageSize=$value;
94
+		if (($value = TPropertyValue::ensureInteger($value)) > 0)
95
+			$this->_pageSize = $value;
96 96
 		else
97 97
 			throw new TInvalidDataValueException('pageddatasource_pagesize_invalid');
98 98
 	}
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function setCurrentPageIndex($value)
112 112
 	{
113
-		if(($value=TPropertyValue::ensureInteger($value))<0)
114
-			$value=0;
115
-		$this->_currentPageIndex=$value;
113
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
114
+			$value = 0;
115
+		$this->_currentPageIndex = $value;
116 116
 	}
117 117
 
118 118
 	/**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function setAllowPaging($value)
130 130
 	{
131
-		$this->_allowPaging=TPropertyValue::ensureBoolean($value);
131
+		$this->_allowPaging = TPropertyValue::ensureBoolean($value);
132 132
 	}
133 133
 
134 134
 	/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function setAllowCustomPaging($value)
146 146
 	{
147
-		$this->_allowCustomPaging=TPropertyValue::ensureBoolean($value);
147
+		$this->_allowCustomPaging = TPropertyValue::ensureBoolean($value);
148 148
 	}
149 149
 
150 150
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function setVirtualItemCount($value)
162 162
 	{
163
-		if(($value=TPropertyValue::ensureInteger($value))>=0)
164
-			$this->_virtualCount=$value;
163
+		if (($value = TPropertyValue::ensureInteger($value)) >= 0)
164
+			$this->_virtualCount = $value;
165 165
 		else
166 166
 			throw new TInvalidDataValueException('pageddatasource_virtualitemcount_invalid');
167 167
 	}
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function getCount()
173 173
 	{
174
-		if($this->_dataSource===null)
174
+		if ($this->_dataSource === null)
175 175
 			return 0;
176
-		if(!$this->_allowPaging)
176
+		if (!$this->_allowPaging)
177 177
 			return $this->getDataSourceCount();
178
-		if(!$this->_allowCustomPaging && $this->getIsLastPage())
179
-			return $this->getDataSourceCount()-$this->getFirstIndexInPage();
178
+		if (!$this->_allowCustomPaging && $this->getIsLastPage())
179
+			return $this->getDataSourceCount() - $this->getFirstIndexInPage();
180 180
 		return $this->_pageSize;
181 181
 	}
182 182
 
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function getPageCount()
197 197
 	{
198
-		if($this->_dataSource===null)
198
+		if ($this->_dataSource === null)
199 199
 			return 0;
200
-		$count=$this->getDataSourceCount();
201
-		if(!$this->_allowPaging || $count<=0)
200
+		$count = $this->getDataSourceCount();
201
+		if (!$this->_allowPaging || $count <= 0)
202 202
 			return 1;
203
-		return (int)(($count+$this->_pageSize-1)/$this->_pageSize);
203
+		return (int) (($count + $this->_pageSize - 1) / $this->_pageSize);
204 204
 	}
205 205
 
206 206
 	/**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function getIsFirstPage()
210 210
 	{
211
-		if($this->_allowPaging)
212
-			return $this->_currentPageIndex===0;
211
+		if ($this->_allowPaging)
212
+			return $this->_currentPageIndex === 0;
213 213
 		else
214 214
 			return true;
215 215
 	}
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function getIsLastPage()
221 221
 	{
222
-		if($this->_allowPaging)
223
-			return $this->_currentPageIndex===$this->getPageCount()-1;
222
+		if ($this->_allowPaging)
223
+			return $this->_currentPageIndex === $this->getPageCount() - 1;
224 224
 		else
225 225
 			return true;
226 226
 	}
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function getFirstIndexInPage()
233 233
 	{
234
-		if($this->_dataSource!==null && $this->_allowPaging && !$this->_allowCustomPaging)
235
-			return $this->_currentPageIndex*$this->_pageSize;
234
+		if ($this->_dataSource !== null && $this->_allowPaging && !$this->_allowCustomPaging)
235
+			return $this->_currentPageIndex * $this->_pageSize;
236 236
 		else
237 237
 			return 0;
238 238
 	}
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	public function getDataSourceCount()
244 244
 	{
245
-		if($this->_dataSource===null)
245
+		if ($this->_dataSource === null)
246 246
 			return 0;
247
-		else if($this->_allowCustomPaging)
247
+		else if ($this->_allowCustomPaging)
248 248
 			return $this->_virtualCount;
249 249
 		else
250 250
 			return $this->_dataSource->getCount();
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	public function getIterator()
257 257
 	{
258
-		if($this->_dataSource instanceof TList)
259
-			return new TPagedListIterator($this->_dataSource,$this->getFirstIndexInPage(),$this->getCount());
260
-		else if($this->_dataSource instanceof TMap)
261
-			return new TPagedMapIterator($this->_dataSource,$this->getFirstIndexInPage(),$this->getCount());
258
+		if ($this->_dataSource instanceof TList)
259
+			return new TPagedListIterator($this->_dataSource, $this->getFirstIndexInPage(), $this->getCount());
260
+		else if ($this->_dataSource instanceof TMap)
261
+			return new TPagedMapIterator($this->_dataSource, $this->getFirstIndexInPage(), $this->getCount());
262 262
 		else
263 263
 			return null;
264 264
 	}
@@ -291,15 +291,15 @@  discard block
 block discarded – undo
291 291
 	 * @param integer start index
292 292
 	 * @param integer number of items to be iterated through
293 293
 	 */
294
-	public function __construct(TList $list,$startIndex,$count)
294
+	public function __construct(TList $list, $startIndex, $count)
295 295
 	{
296
-		$this->_list=$list;
297
-		$this->_index=0;
298
-		$this->_startIndex=$startIndex;
299
-		if($startIndex+$count>$list->getCount())
300
-			$this->_count=$list->getCount()-$startIndex;
296
+		$this->_list = $list;
297
+		$this->_index = 0;
298
+		$this->_startIndex = $startIndex;
299
+		if ($startIndex + $count > $list->getCount())
300
+			$this->_count = $list->getCount() - $startIndex;
301 301
 		else
302
-			$this->_count=$count;
302
+			$this->_count = $count;
303 303
 	}
304 304
 
305 305
 	/**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 */
309 309
 	public function rewind()
310 310
 	{
311
-		$this->_index=0;
311
+		$this->_index = 0;
312 312
 	}
313 313
 
314 314
 	/**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	public function current()
330 330
 	{
331
-		return $this->_list->itemAt($this->_startIndex+$this->_index);
331
+		return $this->_list->itemAt($this->_startIndex + $this->_index);
332 332
 	}
333 333
 
334 334
 	/**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	public function valid()
349 349
 	{
350
-		return $this->_index<$this->_count;
350
+		return $this->_index < $this->_count;
351 351
 	}
352 352
 }
353 353
 
@@ -375,16 +375,16 @@  discard block
 block discarded – undo
375 375
 	 * Constructor.
376 376
 	 * @param array the data to be iterated through
377 377
 	 */
378
-	public function __construct(TMap $map,$startIndex,$count)
378
+	public function __construct(TMap $map, $startIndex, $count)
379 379
 	{
380
-		$this->_map=$map;
381
-		$this->_index=0;
382
-		$this->_startIndex=$startIndex;
383
-		if($startIndex+$count>$map->getCount())
384
-			$this->_count=$map->getCount()-$startIndex;
380
+		$this->_map = $map;
381
+		$this->_index = 0;
382
+		$this->_startIndex = $startIndex;
383
+		if ($startIndex + $count > $map->getCount())
384
+			$this->_count = $map->getCount() - $startIndex;
385 385
 		else
386
-			$this->_count=$count;
387
-		$this->_iterator=$map->getIterator();
386
+			$this->_count = $count;
387
+		$this->_iterator = $map->getIterator();
388 388
 	}
389 389
 
390 390
 	/**
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 	public function rewind()
395 395
 	{
396 396
 		$this->_iterator->rewind();
397
-		for($i=0;$i<$this->_startIndex;++$i)
397
+		for ($i = 0; $i < $this->_startIndex; ++$i)
398 398
 			$this->_iterator->next();
399
-		$this->_index=0;
399
+		$this->_index = 0;
400 400
 	}
401 401
 
402 402
 	/**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 */
437 437
 	public function valid()
438 438
 	{
439
-		return $this->_index<$this->_count;
439
+		return $this->_index < $this->_count;
440 440
 	}
441 441
 }
442 442
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -394,8 +394,9 @@
 block discarded – undo
394 394
 	public function rewind()
395 395
 	{
396 396
 		$this->_iterator->rewind();
397
-		for($i=0;$i<$this->_startIndex;++$i)
398
-			$this->_iterator->next();
397
+		for($i=0;$i<$this->_startIndex;++$i) {
398
+					$this->_iterator->next();
399
+		}
399 400
 		$this->_index=0;
400 401
 	}
401 402
 
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -208,6 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * @param string active record class name.
209 209
 	 * @param array row data
210 210
 	 * @param array foreign key column names
211
+	 * @param string $type
211 212
 	 * @return TActiveRecord
212 213
 	 */
213 214
 	protected function createFkObject($type,$row,$foreignKeys)
@@ -227,6 +228,7 @@  discard block
 block discarded – undo
227 228
 	 * @param TTableInfo association table info
228 229
 	 * @param array field names
229 230
 	 * @param array field values
231
+	 * @param TActiveRecordCriteria $criteria
230 232
 	 */
231 233
 	public function createCommand($criteria, $foreignKeys,$indexValues,$sourceKeys)
232 234
 	{
@@ -341,6 +343,10 @@  discard block
 block discarded – undo
341 343
 		return $this->getCommandBuilder()->onExecuteCommand($command, $command->execute()) > 0;
342 344
 	}
343 345
 
346
+	/**
347
+	 * @param TActiveRecord $obj
348
+	 * @param TDbCommandBuilder $builder
349
+	 */
344 350
 	private function updateAssociationTable($obj,$fkObjects, $builder)
345 351
 	{
346 352
 		$source = $this->getSourceRecordValues($obj);
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,10 +90,10 @@
 block discarded – undo
90 90
 	private $_association_columns=array();
91 91
 
92 92
 	/**
93
-	* Get the foreign key index values from the results and make calls to the
94
-	* database to find the corresponding foreign objects using association table.
95
-	* @param array original results.
96
-	*/
93
+	 * Get the foreign key index values from the results and make calls to the
94
+	 * database to find the corresponding foreign objects using association table.
95
+	 * @param array original results.
96
+	 */
97 97
 	protected function collectForeignObjects(&$results)
98 98
 	{
99 99
 		list($sourceKeys, $foreignKeys) = $this->getRelationForeignKeys();
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	private $_association;
88 88
 	private $_sourceTable;
89 89
 	private $_foreignTable;
90
-	private $_association_columns=array();
90
+	private $_association_columns = array();
91 91
 
92 92
 	/**
93 93
 	* Get the foreign key index values from the results and make calls to the
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		list($sourceKeys, $foreignKeys) = $this->getRelationForeignKeys();
100 100
 		$properties = array_values($sourceKeys);
101 101
 		$indexValues = $this->getIndexValues($properties, $results);
102
-		$this->fetchForeignObjects($results, $foreignKeys,$indexValues,$sourceKeys);
102
+		$this->fetchForeignObjects($results, $foreignKeys, $indexValues, $sourceKeys);
103 103
 	}
104 104
 
105 105
 	/**
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	protected function getAssociationTable()
121 121
 	{
122
-		if($this->_association===null)
122
+		if ($this->_association === null)
123 123
 		{
124 124
 			$gateway = $this->getSourceRecord()->getRecordGateway();
125 125
 			$conn = $this->getSourceRecord()->getDbConnection();
126 126
 			//table name may include the fk column name separated with a dot.
127 127
 			$table = explode('.', $this->getContext()->getAssociationTable());
128
-			if(count($table)>1)
128
+			if (count($table) > 1)
129 129
 			{
130 130
 				$columns = preg_replace('/^\((.*)\)/', '\1', $table[1]);
131
-				$this->_association_columns = preg_split('/\s*[, ]\*/',$columns);
131
+				$this->_association_columns = preg_split('/\s*[, ]\*/', $columns);
132 132
 			}
133 133
 			$this->_association = $gateway->getTableInfo($conn, $table[0]);
134 134
 		}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	protected function getSourceTable()
142 142
 	{
143
-		if($this->_sourceTable===null)
143
+		if ($this->_sourceTable === null)
144 144
 		{
145 145
 			$gateway = $this->getSourceRecord()->getRecordGateway();
146 146
 			$this->_sourceTable = $gateway->getRecordTableInfo($this->getSourceRecord());
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	protected function getForeignTable()
155 155
 	{
156
-		if($this->_foreignTable===null)
156
+		if ($this->_foreignTable === null)
157 157
 		{
158 158
 			$gateway = $this->getSourceRecord()->getRecordGateway();
159 159
 			$fkObject = $this->getContext()->getForeignRecordFinder();
@@ -185,20 +185,20 @@  discard block
 block discarded – undo
185 185
 	 * @param array field names
186 186
 	 * @param array foreign key index values.
187 187
 	 */
188
-	protected function fetchForeignObjects(&$results,$foreignKeys,$indexValues,$sourceKeys)
188
+	protected function fetchForeignObjects(&$results, $foreignKeys, $indexValues, $sourceKeys)
189 189
 	{
190 190
 		$criteria = $this->getCriteria();
191 191
 		$finder = $this->getContext()->getForeignRecordFinder();
192 192
 		$type = get_class($finder);
193
-		$command = $this->createCommand($criteria, $foreignKeys,$indexValues,$sourceKeys);
193
+		$command = $this->createCommand($criteria, $foreignKeys, $indexValues, $sourceKeys);
194 194
 		$srcProps = array_keys($sourceKeys);
195
-		$collections=array();
196
-		foreach($this->getCommandBuilder()->onExecuteCommand($command, $command->query()) as $row)
195
+		$collections = array();
196
+		foreach ($this->getCommandBuilder()->onExecuteCommand($command, $command->query()) as $row)
197 197
 		{
198 198
 			$hash = $this->getObjectHash($row, $srcProps);
199
-			foreach($srcProps as $column)
199
+			foreach ($srcProps as $column)
200 200
 				unset($row[$column]);
201
-			$obj = $this->createFkObject($type,$row,$foreignKeys);
201
+			$obj = $this->createFkObject($type, $row, $foreignKeys);
202 202
 			$collections[$hash][] = $obj;
203 203
 		}
204 204
 		$this->setResultCollection($results, $collections, array_values($sourceKeys));
@@ -210,13 +210,13 @@  discard block
 block discarded – undo
210 210
 	 * @param array foreign key column names
211 211
 	 * @return TActiveRecord
212 212
 	 */
213
-	protected function createFkObject($type,$row,$foreignKeys)
213
+	protected function createFkObject($type, $row, $foreignKeys)
214 214
 	{
215 215
 		$obj = TActiveRecord::createRecord($type, $row);
216
-		if(count($this->_association_columns) > 0)
216
+		if (count($this->_association_columns) > 0)
217 217
 		{
218
-			$i=0;
219
-			foreach($foreignKeys as $ref=>$fk)
218
+			$i = 0;
219
+			foreach ($foreignKeys as $ref=>$fk)
220 220
 				$obj->setColumnValue($ref, $row[$this->_association_columns[$i++]]);
221 221
 		}
222 222
 		return $obj;
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
 	 * @param array field names
229 229
 	 * @param array field values
230 230
 	 */
231
-	public function createCommand($criteria, $foreignKeys,$indexValues,$sourceKeys)
231
+	public function createCommand($criteria, $foreignKeys, $indexValues, $sourceKeys)
232 232
 	{
233
-		$innerJoin = $this->getAssociationJoin($foreignKeys,$indexValues,$sourceKeys);
233
+		$innerJoin = $this->getAssociationJoin($foreignKeys, $indexValues, $sourceKeys);
234 234
 		$fkTable = $this->getForeignTable()->getTableFullName();
235 235
 		$srcColumns = $this->getSourceColumns($sourceKeys);
236
-		if(($where=$criteria->getCondition())===null)
237
-			$where='1=1';
236
+		if (($where = $criteria->getCondition()) === null)
237
+			$where = '1=1';
238 238
 		$sql = "SELECT {$fkTable}.*, {$srcColumns} FROM {$fkTable} {$innerJoin} WHERE {$where}";
239 239
 
240 240
 		$parameters = $criteria->getParameters()->toArray();
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		$offset = $criteria->getOffset();
244 244
 
245 245
 		$builder = $this->getForeignCommandBuilder()->getBuilder();
246
-		$command = $builder->applyCriterias($sql,$parameters,$ordering,$limit,$offset);
246
+		$command = $builder->applyCriterias($sql, $parameters, $ordering, $limit, $offset);
247 247
 		$this->getCommandBuilder()->onCreateCommand($command, $criteria);
248 248
 		return $command;
249 249
 	}
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	protected function getSourceColumns($sourceKeys)
256 256
 	{
257
-		$columns=array();
257
+		$columns = array();
258 258
 		$table = $this->getAssociationTable();
259 259
 		$tableName = $table->getTableFullName();
260
-		$columnNames = array_merge(array_keys($sourceKeys),$this->_association_columns);
261
-		foreach($columnNames as $name)
262
-			$columns[] = $tableName.'.'.$table->getColumn($name)->getColumnName();
260
+		$columnNames = array_merge(array_keys($sourceKeys), $this->_association_columns);
261
+		foreach ($columnNames as $name)
262
+			$columns[] = $tableName . '.' . $table->getColumn($name)->getColumnName();
263 263
 		return implode(', ', $columns);
264 264
 	}
265 265
 
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 	 * @param array source table column names.
271 271
 	 * @return string inner join condition for M-N relationship via association table.
272 272
 	 */
273
-	protected function getAssociationJoin($foreignKeys,$indexValues,$sourceKeys)
273
+	protected function getAssociationJoin($foreignKeys, $indexValues, $sourceKeys)
274 274
 	{
275
-		$refInfo= $this->getAssociationTable();
275
+		$refInfo = $this->getAssociationTable();
276 276
 		$fkInfo = $this->getForeignTable();
277 277
 
278 278
 		$refTable = $refInfo->getTableFullName();
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 
281 281
 		$joins = array();
282 282
 		$hasAssociationColumns = count($this->_association_columns) > 0;
283
-		$i=0;
284
-		foreach($foreignKeys as $ref=>$fk)
283
+		$i = 0;
284
+		foreach ($foreignKeys as $ref=>$fk)
285 285
 		{
286
-			if($hasAssociationColumns)
286
+			if ($hasAssociationColumns)
287 287
 				$refField = $refInfo->getColumn($this->_association_columns[$i++])->getColumnName();
288 288
 			else
289 289
 				$refField = $refInfo->getColumn($ref)->getColumnName();
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			$joins[] = "{$fkTable}.{$fkField} = {$refTable}.{$refField}";
292 292
 		}
293 293
 		$joinCondition = implode(' AND ', $joins);
294
-		$index = $this->getCommandBuilder()->getIndexKeyCondition($refInfo,array_keys($sourceKeys), $indexValues);
294
+		$index = $this->getCommandBuilder()->getIndexKeyCondition($refInfo, array_keys($sourceKeys), $indexValues);
295 295
 		return "INNER JOIN {$refTable} ON ({$joinCondition}) AND {$index}";
296 296
 	}
297 297
 
@@ -303,12 +303,12 @@  discard block
 block discarded – undo
303 303
 	{
304 304
 		$obj = $this->getContext()->getSourceRecord();
305 305
 		$fkObjects = &$obj->{$this->getContext()->getProperty()};
306
-		$success=true;
307
-		if(($total = count($fkObjects))> 0)
306
+		$success = true;
307
+		if (($total = count($fkObjects)) > 0)
308 308
 		{
309 309
 			$source = $this->getSourceRecord();
310 310
 			$builder = $this->getAssociationTableCommandBuilder();
311
-			for($i=0;$i<$total;$i++)
311
+			for ($i = 0; $i < $total; $i++)
312 312
 				$success = $fkObjects[$i]->save() && $success;
313 313
 			return $this->updateAssociationTable($obj, $fkObjects, $builder) && $success;
314 314
 		}
@@ -324,33 +324,33 @@  discard block
 block discarded – undo
324 324
 		return $this->getAssociationTable()->createCommandBuilder($conn);
325 325
 	}
326 326
 
327
-	private function hasAssociationData($builder,$data)
327
+	private function hasAssociationData($builder, $data)
328 328
 	{
329
-		$condition=array();
329
+		$condition = array();
330 330
 		$table = $this->getAssociationTable();
331
-		foreach($data as $name=>$value)
332
-			$condition[] = $table->getColumn($name)->getColumnName().' = ?';
333
-		$command = $builder->createCountCommand(implode(' AND ', $condition),array_values($data));
331
+		foreach ($data as $name=>$value)
332
+			$condition[] = $table->getColumn($name)->getColumnName() . ' = ?';
333
+		$command = $builder->createCountCommand(implode(' AND ', $condition), array_values($data));
334 334
 		$result = $this->getCommandBuilder()->onExecuteCommand($command, intval($command->queryScalar()));
335 335
 		return intval($result) > 0;
336 336
 	}
337 337
 
338
-	private function addAssociationData($builder,$data)
338
+	private function addAssociationData($builder, $data)
339 339
 	{
340 340
 		$command = $builder->createInsertCommand($data);
341 341
 		return $this->getCommandBuilder()->onExecuteCommand($command, $command->execute()) > 0;
342 342
 	}
343 343
 
344
-	private function updateAssociationTable($obj,$fkObjects, $builder)
344
+	private function updateAssociationTable($obj, $fkObjects, $builder)
345 345
 	{
346 346
 		$source = $this->getSourceRecordValues($obj);
347 347
 		$foreignKeys = $this->findForeignKeys($this->getAssociationTable(), $fkObjects[0]);
348
-		$success=true;
349
-		foreach($fkObjects as $fkObject)
348
+		$success = true;
349
+		foreach ($fkObjects as $fkObject)
350 350
 		{
351
-			$data = array_merge($source, $this->getForeignObjectValues($foreignKeys,$fkObject));
352
-			if(!$this->hasAssociationData($builder,$data))
353
-				$success = $this->addAssociationData($builder,$data) && $success;
351
+			$data = array_merge($source, $this->getForeignObjectValues($foreignKeys, $fkObject));
352
+			if (!$this->hasAssociationData($builder, $data))
353
+				$success = $this->addAssociationData($builder, $data) && $success;
354 354
 		}
355 355
 		return $success;
356 356
 	}
@@ -360,16 +360,16 @@  discard block
 block discarded – undo
360 360
 		$sourceKeys = $this->findForeignKeys($this->getAssociationTable(), $obj);
361 361
 		$indexValues = $this->getIndexValues(array_values($sourceKeys), $obj);
362 362
 		$data = array();
363
-		$i=0;
364
-		foreach($sourceKeys as $name=>$srcKey)
363
+		$i = 0;
364
+		foreach ($sourceKeys as $name=>$srcKey)
365 365
 			$data[$name] = $indexValues[0][$i++];
366 366
 		return $data;
367 367
 	}
368 368
 
369
-	private function getForeignObjectValues($foreignKeys,$fkObject)
369
+	private function getForeignObjectValues($foreignKeys, $fkObject)
370 370
 	{
371
-		$data=array();
372
-		foreach($foreignKeys as $name=>$fKey)
371
+		$data = array();
372
+		foreach ($foreignKeys as $name=>$fKey)
373 373
 			$data[$name] = $fkObject->getColumnValue($fKey);
374 374
 		return $data;
375 375
 	}
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -196,8 +196,9 @@  discard block
 block discarded – undo
196 196
 		foreach($this->getCommandBuilder()->onExecuteCommand($command, $command->query()) as $row)
197 197
 		{
198 198
 			$hash = $this->getObjectHash($row, $srcProps);
199
-			foreach($srcProps as $column)
200
-				unset($row[$column]);
199
+			foreach($srcProps as $column) {
200
+							unset($row[$column]);
201
+			}
201 202
 			$obj = $this->createFkObject($type,$row,$foreignKeys);
202 203
 			$collections[$hash][] = $obj;
203 204
 		}
@@ -216,8 +217,9 @@  discard block
 block discarded – undo
216 217
 		if(count($this->_association_columns) > 0)
217 218
 		{
218 219
 			$i=0;
219
-			foreach($foreignKeys as $ref=>$fk)
220
-				$obj->setColumnValue($ref, $row[$this->_association_columns[$i++]]);
220
+			foreach($foreignKeys as $ref=>$fk) {
221
+							$obj->setColumnValue($ref, $row[$this->_association_columns[$i++]]);
222
+			}
221 223
 		}
222 224
 		return $obj;
223 225
 	}
@@ -258,8 +260,9 @@  discard block
 block discarded – undo
258 260
 		$table = $this->getAssociationTable();
259 261
 		$tableName = $table->getTableFullName();
260 262
 		$columnNames = array_merge(array_keys($sourceKeys),$this->_association_columns);
261
-		foreach($columnNames as $name)
262
-			$columns[] = $tableName.'.'.$table->getColumn($name)->getColumnName();
263
+		foreach($columnNames as $name) {
264
+					$columns[] = $tableName.'.'.$table->getColumn($name)->getColumnName();
265
+		}
263 266
 		return implode(', ', $columns);
264 267
 	}
265 268
 
@@ -308,8 +311,9 @@  discard block
 block discarded – undo
308 311
 		{
309 312
 			$source = $this->getSourceRecord();
310 313
 			$builder = $this->getAssociationTableCommandBuilder();
311
-			for($i=0;$i<$total;$i++)
312
-				$success = $fkObjects[$i]->save() && $success;
314
+			for($i=0;$i<$total;$i++) {
315
+							$success = $fkObjects[$i]->save() && $success;
316
+			}
313 317
 			return $this->updateAssociationTable($obj, $fkObjects, $builder) && $success;
314 318
 		}
315 319
 		return $success;
@@ -328,8 +332,9 @@  discard block
 block discarded – undo
328 332
 	{
329 333
 		$condition=array();
330 334
 		$table = $this->getAssociationTable();
331
-		foreach($data as $name=>$value)
332
-			$condition[] = $table->getColumn($name)->getColumnName().' = ?';
335
+		foreach($data as $name=>$value) {
336
+					$condition[] = $table->getColumn($name)->getColumnName().' = ?';
337
+		}
333 338
 		$command = $builder->createCountCommand(implode(' AND ', $condition),array_values($data));
334 339
 		$result = $this->getCommandBuilder()->onExecuteCommand($command, intval($command->queryScalar()));
335 340
 		return intval($result) > 0;
@@ -361,16 +366,18 @@  discard block
 block discarded – undo
361 366
 		$indexValues = $this->getIndexValues(array_values($sourceKeys), $obj);
362 367
 		$data = array();
363 368
 		$i=0;
364
-		foreach($sourceKeys as $name=>$srcKey)
365
-			$data[$name] = $indexValues[0][$i++];
369
+		foreach($sourceKeys as $name=>$srcKey) {
370
+					$data[$name] = $indexValues[0][$i++];
371
+		}
366 372
 		return $data;
367 373
 	}
368 374
 
369 375
 	private function getForeignObjectValues($foreignKeys,$fkObject)
370 376
 	{
371 377
 		$data=array();
372
-		foreach($foreignKeys as $name=>$fKey)
373
-			$data[$name] = $fkObject->getColumnValue($fKey);
378
+		foreach($foreignKeys as $name=>$fKey) {
379
+					$data[$name] = $fkObject->getColumnValue($fKey);
380
+		}
374 381
 		return $data;
375 382
 	}
376 383
 }
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php 4 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,6 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	/**
94 94
 	 * Fetch results for current relationship.
95
+	 * @param TActiveRecord $obj
95 96
 	 * @return boolean always true.
96 97
 	 */
97 98
 	public function fetchResultsInto($obj)
@@ -104,7 +105,6 @@  discard block
 block discarded – undo
104 105
 	 * Returns foreign keys in $fromRecord with source column names as key
105 106
 	 * and foreign column names in the corresponding $matchesRecord as value.
106 107
 	 * The method returns the first matching foreign key between these 2 records.
107
-	 * @param TActiveRecord $fromRecord
108 108
 	 * @param TActiveRecord $matchesRecord
109 109
 	 * @return array foreign keys with source column names as key and foreign column names as value.
110 110
 	 */
@@ -212,6 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @param array source property names
213 213
 	 * @param array foreign objects
214 214
 	 * @param array foreign object field names.
215
+	 * @param TActiveRecord[] $fkObjects
215 216
 	 */
216 217
 	protected function populateResult(&$results,$properties,&$fkObjects,$fields)
217 218
 	{
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -71,21 +71,21 @@  discard block
 block discarded – undo
71 71
 	 * @param array method arguments
72 72
 	 * @return mixed TActiveRecord or array of TActiveRecord results depending on the method called.
73 73
 	 */
74
-	public function __call($method,$args)
74
+	public function __call($method, $args)
75 75
 	{
76
-		static $stack=array();
76
+		static $stack = array();
77 77
 
78
-		$results = call_user_func_array(array($this->getSourceRecord(),$method),$args);
78
+		$results = call_user_func_array(array($this->getSourceRecord(), $method), $args);
79 79
 		$validArray = is_array($results) && count($results) > 0;
80
-		if($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord)
80
+		if ($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord)
81 81
 		{
82 82
 			$this->collectForeignObjects($results);
83
-			while($obj = array_pop($stack))
83
+			while ($obj = array_pop($stack))
84 84
 				$obj->collectForeignObjects($results);
85 85
 		}
86
-		else if($results instanceof TActiveRecordRelation)
86
+		else if ($results instanceof TActiveRecordRelation)
87 87
 			$stack[] = $this; //call it later
88
-		else if($results === null || !$validArray)
88
+		else if ($results === null || !$validArray)
89 89
 			$stack = array();
90 90
 		return $results;
91 91
 	}
@@ -108,24 +108,24 @@  discard block
 block discarded – undo
108 108
 	 * @param TActiveRecord $matchesRecord
109 109
 	 * @return array foreign keys with source column names as key and foreign column names as value.
110 110
 	 */
111
-	protected function findForeignKeys($from, $matchesRecord, $loose=false)
111
+	protected function findForeignKeys($from, $matchesRecord, $loose = false)
112 112
 	{
113 113
 		$gateway = $matchesRecord->getRecordGateway();
114 114
 		$recordTableInfo = $gateway->getRecordTableInfo($matchesRecord);
115 115
 		$matchingTableName = strtolower($recordTableInfo->getTableName());
116 116
 		$matchingFullTableName = strtolower($recordTableInfo->getTableFullName());
117
-		$tableInfo=$from;
118
-		if($from instanceof TActiveRecord)
117
+		$tableInfo = $from;
118
+		if ($from instanceof TActiveRecord)
119 119
 			$tableInfo = $gateway->getRecordTableInfo($from);
120 120
 		//find first non-empty FK
121
-		foreach($tableInfo->getForeignKeys() as $fkeys)
121
+		foreach ($tableInfo->getForeignKeys() as $fkeys)
122 122
 		{
123 123
 			$fkTable = strtolower($fkeys['table']);
124
-			if($fkTable===$matchingTableName || $fkTable===$matchingFullTableName)
124
+			if ($fkTable === $matchingTableName || $fkTable === $matchingFullTableName)
125 125
 			{
126 126
 				$hasFkField = !$loose && $this->getContext()->hasFkField();
127 127
 				$key = $hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys'];
128
-				if(!empty($key))
128
+				if (!empty($key))
129 129
 					return $key;
130 130
 			}
131 131
 		}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 		$matching = array();
153 153
 		preg_match_all('/\s*(\S+\.)?([\w-]+)\s*/', $this->getContext()->getFkField(), $matching);
154 154
 		$fields = array();
155
-		foreach($fkeys as $fkName => $field)
155
+		foreach ($fkeys as $fkName => $field)
156 156
 		{
157
-			if(in_array($fkName, $matching[2]))
157
+			if (in_array($fkName, $matching[2]))
158 158
 				$fields[$fkName] = $field;
159 159
 		}
160 160
 		return $fields;
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function getObjectHash($obj, $properties)
169 169
 	{
170
-		$ids=array();
171
-		foreach($properties as $property)
172
-			$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
170
+		$ids = array();
171
+		foreach ($properties as $property)
172
+			$ids[] = is_object($obj) ? (string) $obj->getColumnValue($property) : (string) $obj[$property];
173 173
 		return serialize($ids);
174 174
 	}
175 175
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	protected function getIndexValues($keys, $results)
195 195
 	{
196
-		if(!is_array($results) && !$results instanceof ArrayAccess)
196
+		if (!is_array($results) && !$results instanceof ArrayAccess)
197 197
 			$results = array($results);
198
-		$values=array();
199
-		foreach($results as $result)
198
+		$values = array();
199
+		foreach ($results as $result)
200 200
 		{
201 201
 			$value = array();
202
-			foreach($keys as $name)
202
+			foreach ($keys as $name)
203 203
 				$value[] = $result->getColumnValue($name);
204 204
 			$values[] = $value;
205 205
 		}
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	 * @param array foreign objects
214 214
 	 * @param array foreign object field names.
215 215
 	 */
216
-	protected function populateResult(&$results,$properties,&$fkObjects,$fields)
216
+	protected function populateResult(&$results, $properties, &$fkObjects, $fields)
217 217
 	{
218
-		$collections=array();
219
-		foreach($fkObjects as $fkObject)
220
-			$collections[$this->getObjectHash($fkObject, $fields)][]=$fkObject;
218
+		$collections = array();
219
+		foreach ($fkObjects as $fkObject)
220
+			$collections[$this->getObjectHash($fkObject, $fields)][] = $fkObject;
221 221
 		$this->setResultCollection($results, $collections, $properties);
222 222
 	}
223 223
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	protected function setResultCollection(&$results, &$collections, $properties)
231 231
 	{
232
-		if(is_array($results) || $results instanceof ArrayAccess)
232
+		if (is_array($results) || $results instanceof ArrayAccess)
233 233
 		{
234
-			for($i=0,$k=count($results);$i<$k;$i++)
234
+			for ($i = 0, $k = count($results); $i < $k; $i++)
235 235
 				$this->setObjectProperty($results[$i], $properties, $collections);
236 236
 		}
237 237
 		else
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	{
249 249
 		$hash = $this->getObjectHash($source, $properties);
250 250
 		$prop = $this->getContext()->getProperty();
251
-		$source->$prop=isset($collections[$hash]) ? $collections[$hash] : array();
251
+		$source->$prop = isset($collections[$hash]) ? $collections[$hash] : array();
252 252
 	}
253 253
 }
254 254
 
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TActiveRecordRelation class file.
4
- *
5
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @version $Id$
10
- * @package System.Data.ActiveRecord.Relations
11
- */
3
+	 * TActiveRecordRelation class file.
4
+	 *
5
+	 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @version $Id$
10
+	 * @package System.Data.ActiveRecord.Relations
11
+	 */
12 12
 
13 13
 /**
14 14
  * Load active record relationship context.
Please login to merge, or discard this patch.
Braces   +17 added lines, -14 removed lines patch added patch discarded remove patch
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 		if($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord)
81 81
 		{
82 82
 			$this->collectForeignObjects($results);
83
-			while($obj = array_pop($stack))
84
-				$obj->collectForeignObjects($results);
85
-		}
86
-		else if($results instanceof TActiveRecordRelation)
83
+			while($obj = array_pop($stack)) {
84
+							$obj->collectForeignObjects($results);
85
+			}
86
+		} else if($results instanceof TActiveRecordRelation)
87 87
 			$stack[] = $this; //call it later
88 88
 		else if($results === null || !$validArray)
89 89
 			$stack = array();
@@ -168,8 +168,9 @@  discard block
 block discarded – undo
168 168
 	protected function getObjectHash($obj, $properties)
169 169
 	{
170 170
 		$ids=array();
171
-		foreach($properties as $property)
172
-			$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
171
+		foreach($properties as $property) {
172
+					$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
173
+		}
173 174
 		return serialize($ids);
174 175
 	}
175 176
 
@@ -199,8 +200,9 @@  discard block
 block discarded – undo
199 200
 		foreach($results as $result)
200 201
 		{
201 202
 			$value = array();
202
-			foreach($keys as $name)
203
-				$value[] = $result->getColumnValue($name);
203
+			foreach($keys as $name) {
204
+							$value[] = $result->getColumnValue($name);
205
+			}
204 206
 			$values[] = $value;
205 207
 		}
206 208
 		return $values;
@@ -216,8 +218,9 @@  discard block
 block discarded – undo
216 218
 	protected function populateResult(&$results,$properties,&$fkObjects,$fields)
217 219
 	{
218 220
 		$collections=array();
219
-		foreach($fkObjects as $fkObject)
220
-			$collections[$this->getObjectHash($fkObject, $fields)][]=$fkObject;
221
+		foreach($fkObjects as $fkObject) {
222
+					$collections[$this->getObjectHash($fkObject, $fields)][]=$fkObject;
223
+		}
221 224
 		$this->setResultCollection($results, $collections, $properties);
222 225
 	}
223 226
 
@@ -231,10 +234,10 @@  discard block
 block discarded – undo
231 234
 	{
232 235
 		if(is_array($results) || $results instanceof ArrayAccess)
233 236
 		{
234
-			for($i=0,$k=count($results);$i<$k;$i++)
235
-				$this->setObjectProperty($results[$i], $properties, $collections);
236
-		}
237
-		else
237
+			for($i=0,$k=count($results);$i<$k;$i++) {
238
+							$this->setObjectProperty($results[$i], $properties, $collections);
239
+			}
240
+		} else
238 241
 			$this->setObjectProperty($results, $properties, $collections);
239 242
 	}
240 243
 
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php 3 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,9 @@  discard block
 block discarded – undo
30 30
 	private $_relation; //data from an entry of TActiveRecord::$RELATION
31 31
 	private $_fkeys;
32 32
 
33
+	/**
34
+	 * @param TActiveRecord $record
35
+	 */
33 36
 	public function __construct($record, $property=null, $relation=null)
34 37
 	{
35 38
 		$this->_record=$record;
@@ -163,6 +166,7 @@  discard block
 block discarded – undo
163 166
 	 * An instance of TActiveRecordHasOne, TActiveRecordBelongsTo, TActiveRecordHasMany,
164 167
 	 * or TActiveRecordHasManyAssocation will be returned.
165 168
 	 * @param TActiveRecordCriteria search criteria
169
+	 * @param TSqlCriteria $criteria
166 170
 	 * @return TActiveRecordRelation record relationship handler instnace.
167 171
 	 * @throws TActiveRecordException if property is not defined or missing.
168 172
 	 */
@@ -195,7 +199,7 @@  discard block
 block discarded – undo
195 199
 	}
196 200
 
197 201
 	/**
198
-	 * @return TActiveRecordRelationCommand
202
+	 * @return boolean
199 203
 	 */
200 204
 	public function updateAssociatedRecords($updateBelongsTo=false)
201 205
 	{
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TActiveRecordRelationContext class.
4
- *
5
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @version $Id$
10
- * @package System.Data.ActiveRecord.Relations
11
- */
3
+	 * TActiveRecordRelationContext class.
4
+	 *
5
+	 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @version $Id$
10
+	 * @package System.Data.ActiveRecord.Relations
11
+	 */
12 12
 
13 13
 /**
14 14
  * TActiveRecordRelationContext holds information regarding record relationships
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	private $_relation; //data from an entry of TActiveRecord::$RELATION
31 31
 	private $_fkeys;
32 32
 
33
-	public function __construct($record, $property=null, $relation=null)
33
+	public function __construct($record, $property = null, $relation = null)
34 34
 	{
35
-		$this->_record=$record;
36
-		$this->_property=$property;
37
-		$this->_relation=$relation;
35
+		$this->_record = $record;
36
+		$this->_property = $property;
37
+		$this->_relation = $relation;
38 38
 	}
39 39
 
40 40
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function hasRecordRelation()
45 45
 	{
46
-		return $this->_relation!==null;
46
+		return $this->_relation !== null;
47 47
 	}
48 48
 
49 49
 	public function getPropertyValue()
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function getRelationForeignKeys()
77 77
 	{
78
-		if($this->_fkeys===null)
79
-			$this->_fkeys=$this->getRelationHandler()->getRelationForeignKeys();
78
+		if ($this->_fkeys === null)
79
+			$this->_fkeys = $this->getRelationHandler()->getRelationForeignKeys();
80 80
 		return $this->_fkeys;
81 81
 	}
82 82
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function getCondition()
113 113
 	{
114
-		return isset($this->_relation[3])?$this->_relation[3]:null;
114
+		return isset($this->_relation[3]) ? $this->_relation[3] : null;
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function getParameters()
122 122
 	{
123
-		return isset($this->_relation[4])?$this->_relation[4]:array();
123
+		return isset($this->_relation[4]) ? $this->_relation[4] : array();
124 124
 	}
125 125
 
126 126
 	/**
@@ -166,16 +166,16 @@  discard block
 block discarded – undo
166 166
 	 * @return TActiveRecordRelation record relationship handler instnace.
167 167
 	 * @throws TActiveRecordException if property is not defined or missing.
168 168
 	 */
169
-	public function getRelationHandler($criteria=null)
169
+	public function getRelationHandler($criteria = null)
170 170
 	{
171
-		if(!$this->hasRecordRelation())
171
+		if (!$this->hasRecordRelation())
172 172
 		{
173 173
 			throw new TActiveRecordException('ar_undefined_relation_prop',
174 174
 				$this->_property, get_class($this->_record), 'RELATIONS');
175 175
 		}
176
-		if($criteria===null)
176
+		if ($criteria === null)
177 177
 			$criteria = new TActiveRecordCriteria($this->getCondition(), $this->getParameters());
178
-		switch($this->getRelationType())
178
+		switch ($this->getRelationType())
179 179
 		{
180 180
 			case TActiveRecord::HAS_MANY:
181 181
 				Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordHasMany');
@@ -197,19 +197,19 @@  discard block
 block discarded – undo
197 197
 	/**
198 198
 	 * @return TActiveRecordRelationCommand
199 199
 	 */
200
-	public function updateAssociatedRecords($updateBelongsTo=false)
200
+	public function updateAssociatedRecords($updateBelongsTo = false)
201 201
 	{
202
-		$success=true;
203
-		foreach($this->_record->getRecordRelations() as $data)
202
+		$success = true;
203
+		foreach ($this->_record->getRecordRelations() as $data)
204 204
 		{
205 205
 			list($property, $relation) = $data;
206
-			$belongsTo = $relation[0]==TActiveRecord::BELONGS_TO;
207
-			if(($updateBelongsTo && $belongsTo) || (!$updateBelongsTo && !$belongsTo))
206
+			$belongsTo = $relation[0] == TActiveRecord::BELONGS_TO;
207
+			if (($updateBelongsTo && $belongsTo) || (!$updateBelongsTo && !$belongsTo))
208 208
 			{
209 209
 				$obj = $this->getSourceRecord();
210
-				if(!$this->isEmptyFkObject($obj->getColumnValue($property)))
210
+				if (!$this->isEmptyFkObject($obj->getColumnValue($property)))
211 211
 				{
212
-					$context = new TActiveRecordRelationContext($this->getSourceRecord(),$property,$relation);
212
+					$context = new TActiveRecordRelationContext($this->getSourceRecord(), $property, $relation);
213 213
 					$success = $context->getRelationHandler()->updateAssociatedRecords() && $success;
214 214
 				}
215 215
 			}
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 
220 220
 	protected function isEmptyFkObject($obj)
221 221
 	{
222
-		if(is_object($obj))
222
+		if (is_object($obj))
223 223
 			return $obj instanceof TList ? $obj->count() === 0 : false;
224
-		else if(is_array($obj))
225
-			return count($obj)===0;
224
+		else if (is_array($obj))
225
+			return count($obj) === 0;
226 226
 		else
227 227
 			return empty($obj);
228 228
 	}
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -46,6 +46,10 @@  discard block
 block discarded – undo
46 46
 		}
47 47
 	}
48 48
 
49
+	/**
50
+	 * @param TScaffoldEditView $parent
51
+	 * @param TActiveRecord $record
52
+	 */
49 53
 	public function createScaffoldInput($parent, $item, $column, $record)
50 54
 	{
51 55
 		$this->_parent=$parent;
@@ -62,6 +66,11 @@  discard block
 block discarded – undo
62 66
 		$label->setForControl(self::DEFAULT_ID);
63 67
 	}
64 68
 
69
+	/**
70
+	 * @param TScaffoldEditView $parent
71
+	 * @param TDbTableColumn $column
72
+	 * @param TActiveRecord $record
73
+	 */
65 74
 	public function loadScaffoldInput($parent, $item, $column, $record)
66 75
 	{
67 76
 		$this->_parent=$parent;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,51 +21,51 @@  discard block
 block discarded – undo
21 21
 	{
22 22
 		$record->getDbConnection()->setActive(true); //must be connected before retrieving driver name!
23 23
 		$driver = $record->getDbConnection()->getDriverName();
24
-		switch(strtolower($driver))
24
+		switch (strtolower($driver))
25 25
 		{
26 26
 			case 'sqlite': //sqlite 3
27 27
 			case 'sqlite2': //sqlite 2
28
-				require_once(dirname(__FILE__).'/TSqliteScaffoldInput.php');
28
+				require_once(dirname(__FILE__) . '/TSqliteScaffoldInput.php');
29 29
 				return new TSqliteScaffoldInput($conn);
30 30
 			case 'mysqli':
31 31
 			case 'mysql':
32
-				require_once(dirname(__FILE__).'/TMysqlScaffoldInput.php');
32
+				require_once(dirname(__FILE__) . '/TMysqlScaffoldInput.php');
33 33
 				return new TMysqlScaffoldInput($conn);
34 34
 			case 'pgsql':
35
-				require_once(dirname(__FILE__).'/TPgsqlScaffoldInput.php');
35
+				require_once(dirname(__FILE__) . '/TPgsqlScaffoldInput.php');
36 36
 				return new TPgsqlScaffoldInput($conn);
37 37
 			case 'mssql':
38
-				require_once(dirname(__FILE__).'/TMssqlScaffoldInput.php');
38
+				require_once(dirname(__FILE__) . '/TMssqlScaffoldInput.php');
39 39
 				return new TMssqlScaffoldInput($conn);
40 40
 			case 'ibm':
41
-				require_once(dirname(__FILE__).'/TIbmScaffoldInput.php');
41
+				require_once(dirname(__FILE__) . '/TIbmScaffoldInput.php');
42 42
 				return new TIbmScaffoldInput($conn);
43 43
 			default:
44 44
 				throw new TConfigurationException(
45
-					'scaffold_invalid_database_driver',$driver);
45
+					'scaffold_invalid_database_driver', $driver);
46 46
 		}
47 47
 	}
48 48
 
49 49
 	public function createScaffoldInput($parent, $item, $column, $record)
50 50
 	{
51
-		$this->_parent=$parent;
51
+		$this->_parent = $parent;
52 52
 		$item->setCustomData($column->getColumnId());
53 53
 		$this->createControl($item->_input, $column, $record);
54
-		if($item->_input->findControl(self::DEFAULT_ID))
54
+		if ($item->_input->findControl(self::DEFAULT_ID))
55 55
 			$this->createControlLabel($item->_label, $column, $record);
56 56
 	}
57 57
 
58 58
 	protected function createControlLabel($label, $column, $record)
59 59
 	{
60
-		$fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())).':';
60
+		$fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())) . ':';
61 61
 		$label->setText($fieldname);
62 62
 		$label->setForControl(self::DEFAULT_ID);
63 63
 	}
64 64
 
65 65
 	public function loadScaffoldInput($parent, $item, $column, $record)
66 66
 	{
67
-		$this->_parent=$parent;
68
-		if($this->getIsEnabled($column, $record))
67
+		$this->_parent = $parent;
68
+		if ($this->getIsEnabled($column, $record))
69 69
 		{
70 70
 			$prop = $column->getColumnId();
71 71
 			$record->setColumnValue($prop, $this->getControlValue($item->_input, $column, $record));
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	protected function getRecordPropertyValue($column, $record)
82 82
 	{
83 83
 		$value = $record->getColumnValue($column->getColumnId());
84
-		if($column->getDefaultValue()!==TDbTableColumn::UNDEFINED_VALUE && $value===null)
84
+		if ($column->getDefaultValue() !== TDbTableColumn::UNDEFINED_VALUE && $value === null)
85 85
 			return $column->getDefaultValue();
86 86
 		else
87 87
 			return $value;
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputCommon.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@
 block discarded – undo
47 47
 		return $control;
48 48
 	}
49 49
 
50
+	/**
51
+	 * @return string
52
+	 */
50 53
 	protected function getDefaultControlValue($container,$column, $record)
51 54
 	{
52 55
 		$control = $container->findControl(self::DEFAULT_ID);
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	protected function setNotNullProperty($container, $control, $column, $record)
22 22
 	{
23 23
 		$this->setDefaultProperty($container, $control, $column, $record);
24
-		if(!$column->getAllowNull() && !$column->hasSequence())
24
+		if (!$column->getAllowNull() && !$column->hasSequence())
25 25
 			$this->createRequiredValidator($container, $column, $record);
26 26
 	}
27 27
 
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 		$control = new TTextBox();
42 42
 		$control->setText($value);
43 43
 		$control->setCssClass('default-textbox scaffold_input');
44
-		if(($len=$column->getColumnSize())!==null)
44
+		if (($len = $column->getColumnSize()) !== null)
45 45
 			$control->setMaxLength($len);
46 46
 		$this->setNotNullProperty($container, $control, $column, $record);
47 47
 		return $control;
48 48
 	}
49 49
 
50
-	protected function getDefaultControlValue($container,$column, $record)
50
+	protected function getDefaultControlValue($container, $column, $record)
51 51
 	{
52 52
 		$control = $container->findControl(self::DEFAULT_ID);
53
-		if($control instanceof TCheckBox)
53
+		if ($control instanceof TCheckBox)
54 54
 			return $control->getChecked();
55
-		else if($control instanceof TControl)
55
+		else if ($control instanceof TControl)
56 56
 			return $control->getText();
57 57
 	}
58 58
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 		$control = new TDropDownList();
74 74
 		$years = array();
75 75
 		$current = intval(@date('Y'));
76
-		$from = $current-10; $to=$current+10;
77
-		for($i = $from; $i <= $to; $i++)
76
+		$from = $current - 10; $to = $current + 10;
77
+		for ($i = $from; $i <= $to; $i++)
78 78
 			$years[$i] = $i;
79 79
 		$control->setDataSource($years);
80 80
 		$control->setSelectedValue(empty($value) ? $current : $value);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 		$val = $this->createTypeValidator($container, $column, $record);
99 99
 		$val->setDataType(TValidationDataType::Float);
100 100
 		$val->setErrorMessage('Please entery a decimal number.');
101
-		if(($max= $column->getMaxiumNumericConstraint())!==null)
101
+		if (($max = $column->getMaxiumNumericConstraint()) !== null)
102 102
 		{
103
-			$val = $this->createRangeValidator($container,$column,$record);
103
+			$val = $this->createRangeValidator($container, $column, $record);
104 104
 			$val->setDataType(TValidationDataType::Float);
105 105
 			$val->setMaxValue($max);
106 106
 			$val->setStrictComparison(true);
107
-			$val->setErrorMessage('Please entery a decimal number strictly less than '.$max.'.');
107
+			$val->setErrorMessage('Please entery a decimal number strictly less than ' . $max . '.');
108 108
 		}
109 109
 		return $control;
110 110
 	}
@@ -149,22 +149,22 @@  discard block
 block discarded – undo
149 149
 	protected function createTimeControl($container, $column, $record)
150 150
 	{
151 151
 		$value = $this->getRecordPropertyValue($column, $record);
152
-		$hours=array();
153
-		for($i=0;$i<24;$i++) $hours[] = str_pad($i,2,'0',STR_PAD_LEFT);
154
-		$mins=array();
155
-		for($i=0;$i<60;$i++) $mins[] = str_pad($i,2,'0',STR_PAD_LEFT);
152
+		$hours = array();
153
+		for ($i = 0; $i < 24; $i++) $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT);
154
+		$mins = array();
155
+		for ($i = 0; $i < 60; $i++) $mins[] = str_pad($i, 2, '0', STR_PAD_LEFT);
156 156
 		$hour = intval(@date('H'));
157 157
 		$min = intval(@date('i'));
158 158
 		$sec = intval(@date('s'));
159
-		if(!empty($value))
159
+		if (!empty($value))
160 160
 		{
161
-			$match=array();
162
-			if(preg_match('/(\d+):(\d+):?(\d+)?/', $value, $match))
161
+			$match = array();
162
+			if (preg_match('/(\d+):(\d+):?(\d+)?/', $value, $match))
163 163
 			{
164 164
 				$hour = $match[1];
165 165
 				$min = $match[2];
166
-				if(isset($match[3]))
167
-					$sec=$match[3];
166
+				if (isset($match[3]))
167
+					$sec = $match[3];
168 168
 			}
169 169
 		}
170 170
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		$scontrol->setSelectedValue(intval($sec));
192 192
 		$container->Controls[] = $scontrol;
193 193
 
194
-		return array($hcontrol,$mcontrol,$scontrol);
194
+		return array($hcontrol, $mcontrol, $scontrol);
195 195
 	}
196 196
 
197 197
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 		$control->setFromYear(1900);
203 203
 		$control->setInputMode(TDatePickerInputMode::DropDownList);
204 204
 		$control->setDateFormat('yyyy-MM-dd');
205
-		if(!empty($value))
206
-			$control->setDate(substr($value,0,10));
205
+		if (!empty($value))
206
+			$control->setDate(substr($value, 0, 10));
207 207
 		$control->setCssClass('date-dropdown');
208 208
 		$this->setNotNullProperty($container, $control, $column, $record);
209 209
 		return $control;
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
 		$control = $this->createDateControl($container, $column, $record);
216 216
 		$container->Controls[] = ' @ ';
217 217
 		$time = $this->createTimeControl($container, $column, $record);
218
-		if(!empty($value))
218
+		if (!empty($value))
219 219
 		{
220
-			$match=array();
221
-			if(preg_match('/(\d+):(\d+):?(\d+)?/', substr($value, 11), $match))
220
+			$match = array();
221
+			if (preg_match('/(\d+):(\d+):?(\d+)?/', substr($value, 11), $match))
222 222
 			{
223 223
 				$time[0]->setSelectedValue(intval($match[1]));
224 224
 				$time[1]->setSelectedValue(intval($match[2]));
225
-				if(isset($match[3]))
225
+				if (isset($match[3]))
226 226
 					$time[2]->setSelectedValue(intval($match[3]));
227 227
 			}
228 228
 		}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		$values = $column->getDbTypeValues();
256 256
 		$control->setDataSource($values);
257 257
 		$control->dataBind();
258
-		$control->setSelectedIndices($this->getMatchingIndices($values,$selectedValues));
258
+		$control->setSelectedIndices($this->getMatchingIndices($values, $selectedValues));
259 259
 		$control->setID(self::DEFAULT_ID);
260 260
 		$control->setCssClass('set-checkboxes');
261 261
 		$this->setNotNullProperty($container, $control, $column, $record);
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 
265 265
 	protected function getMatchingIndices($checks, $values)
266 266
 	{
267
-		$index=array();
268
-		for($i=0, $k=count($checks); $i<$k; $i++)
267
+		$index = array();
268
+		for ($i = 0, $k = count($checks); $i < $k; $i++)
269 269
 		{
270
-			if(in_array($checks[$i], $values))
270
+			if (in_array($checks[$i], $values))
271 271
 				$index[] = $i;
272 272
 		}
273 273
 		return $index;
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 		$values = $column->getDbTypeValues();
282 282
 		$control->setDataSource($values);
283 283
 		$control->dataBind();
284
-		$index = $this->getMatchingIndices($values,$selectedValues);
285
-		if(count($index) > 0)
284
+		$index = $this->getMatchingIndices($values, $selectedValues);
285
+		if (count($index) > 0)
286 286
 			$control->setSelectedIndex($index[0]);
287 287
 		$control->setID(self::DEFAULT_ID);
288 288
 		$control->setCssClass('enum-radio-buttons');
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 
293 293
 	protected function getSetValue($container, $column, $record)
294 294
 	{
295
-		$value=array();
296
-		foreach($container->findControl(self::DEFAULT_ID)->getItems() as $item)
295
+		$value = array();
296
+		foreach ($container->findControl(self::DEFAULT_ID)->getItems() as $item)
297 297
 		{
298
-			if($item->getSelected())
298
+			if ($item->getSelected())
299 299
 				$value[] = $item->getText();
300 300
 		}
301 301
 		return implode(',', $value);
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,8 +74,9 @@  discard block
 block discarded – undo
74 74
 		$years = array();
75 75
 		$current = intval(@date('Y'));
76 76
 		$from = $current-10; $to=$current+10;
77
-		for($i = $from; $i <= $to; $i++)
78
-			$years[$i] = $i;
77
+		for($i = $from; $i <= $to; $i++) {
78
+					$years[$i] = $i;
79
+		}
79 80
 		$control->setDataSource($years);
80 81
 		$control->setSelectedValue(empty($value) ? $current : $value);
81 82
 		$control->setCssClass('year-dropdown');
@@ -150,9 +151,13 @@  discard block
 block discarded – undo
150 151
 	{
151 152
 		$value = $this->getRecordPropertyValue($column, $record);
152 153
 		$hours=array();
153
-		for($i=0;$i<24;$i++) $hours[] = str_pad($i,2,'0',STR_PAD_LEFT);
154
+		for($i=0;$i<24;$i++) {
155
+			$hours[] = str_pad($i,2,'0',STR_PAD_LEFT);
156
+		}
154 157
 		$mins=array();
155
-		for($i=0;$i<60;$i++) $mins[] = str_pad($i,2,'0',STR_PAD_LEFT);
158
+		for($i=0;$i<60;$i++) {
159
+			$mins[] = str_pad($i,2,'0',STR_PAD_LEFT);
160
+		}
156 161
 		$hour = intval(@date('H'));
157 162
 		$min = intval(@date('i'));
158 163
 		$sec = intval(@date('s'));
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	private $_record;
37 37
 
38 38
 	/**
39
-	 * @return TDbMetaData table/view information
39
+	 * @return TDbTableInfo table/view information
40 40
 	 */
41 41
 	protected function getTableInfo()
42 42
 	{
@@ -84,6 +84,7 @@  discard block
 block discarded – undo
84 84
 	/**
85 85
 	 * Name of the Active Record class to be viewed or scaffolded.
86 86
 	 * @param string Active Record class name.
87
+	 * @param string $value
87 88
 	 */
88 89
 	public function setRecordClass($value)
89 90
 	{
@@ -183,6 +184,7 @@  discard block
 block discarded – undo
183 184
 
184 185
 	/**
185 186
 	 * @param boolean enable default stylesheet, default is true.
187
+	 * @param boolean $value
186 188
 	 */
187 189
 	public function setEnableDefaultStyle($value)
188 190
 	{
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	protected function getRecordPropertyValues($record)
53 53
 	{
54 54
 		$data = array();
55
-		foreach($this->getTableInfo()->getColumns() as $name=>$column)
55
+		foreach ($this->getTableInfo()->getColumns() as $name=>$column)
56 56
 			$data[] = $record->getColumnValue($name);
57 57
 		return $data;
58 58
 	}
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	protected function getRecordPkValues($record)
65 65
 	{
66
-		$data=array();
67
-		foreach($this->getTableInfo()->getColumns() as $name=>$column)
66
+		$data = array();
67
+		foreach ($this->getTableInfo()->getColumns() as $name=>$column)
68 68
 		{
69
-			if($column->getIsPrimaryKey())
69
+			if ($column->getIsPrimaryKey())
70 70
 				$data[] = $record->getColumnValue($name);
71 71
 		}
72 72
 		return $data;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function clearRecordObject()
108 108
 	{
109
-		$this->_record=null;
109
+		$this->_record = null;
110 110
 	}
111 111
 
112 112
 	/**
@@ -115,26 +115,26 @@  discard block
 block discarded – undo
115 115
 	 * @param array primary key value
116 116
 	 * @return TActiveRecord record instance
117 117
 	 */
118
-	protected function getRecordObject($pk=null)
118
+	protected function getRecordObject($pk = null)
119 119
 	{
120
-		if($this->_record===null)
120
+		if ($this->_record === null)
121 121
 		{
122
-			if($pk!==null)
122
+			if ($pk !== null)
123 123
 			{
124
-				$this->_record=$this->getRecordFinder()->findByPk($pk);
125
-				if($this->_record===null)
124
+				$this->_record = $this->getRecordFinder()->findByPk($pk);
125
+				if ($this->_record === null)
126 126
 					throw new TConfigurationException('scaffold_invalid_record_pk',
127 127
 						$this->getRecordClass(), $pk);
128 128
 			}
129 129
 			else
130 130
 			{
131 131
 				$class = $this->getRecordClass();
132
-				if($class!==null)
133
-					$this->_record=Prado::createComponent($class);
132
+				if ($class !== null)
133
+					$this->_record = Prado::createComponent($class);
134 134
 				else
135 135
 				{
136 136
 					throw new TConfigurationException('scaffold_invalid_record_class',
137
-						$this->getRecordClass(),$this->getID());
137
+						$this->getRecordClass(), $this->getID());
138 138
 				}
139 139
 			}
140 140
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	protected function setRecordObject(TActiveRecord $value)
148 148
 	{
149
-		$this->_record=$value;
149
+		$this->_record = $value;
150 150
 	}
151 151
 
152 152
 	/**
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 	public function onPreRender($param)
196 196
 	{
197 197
 		parent::onPreRender($param);
198
-		if($this->getEnableDefaultStyle())
198
+		if ($this->getEnableDefaultStyle())
199 199
 		{
200
-			$url = $this->publishAsset($this->getDefaultStyle().'.css');
201
-			$this->getPage()->getClientScript()->registerStyleSheetFile($url,$url);
200
+			$url = $this->publishAsset($this->getDefaultStyle() . '.css');
201
+			$this->getPage()->getClientScript()->registerStyleSheetFile($url, $url);
202 202
 		}
203 203
 	}
204 204
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 	protected function getRecordPropertyValues($record)
53 53
 	{
54 54
 		$data = array();
55
-		foreach($this->getTableInfo()->getColumns() as $name=>$column)
56
-			$data[] = $record->getColumnValue($name);
55
+		foreach($this->getTableInfo()->getColumns() as $name=>$column) {
56
+					$data[] = $record->getColumnValue($name);
57
+		}
57 58
 		return $data;
58 59
 	}
59 60
 
@@ -125,8 +126,7 @@  discard block
 block discarded – undo
125 126
 				if($this->_record===null)
126 127
 					throw new TConfigurationException('scaffold_invalid_record_pk',
127 128
 						$this->getRecordClass(), $pk);
128
-			}
129
-			else
129
+			} else
130 130
 			{
131 131
 				$class = $this->getRecordClass();
132 132
 				if($class!==null)
Please login to merge, or discard this patch.