Completed
Push — intl ( 51e284 )
by Fabio
06:51
created
framework/Web/UI/WebControls/assets/captcha.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
 	$font=dirname(__FILE__).DIRECTORY_SEPARATOR.'verase.ttf';
101 101
 
102 102
 	if(function_exists('imagefilter'))
103
-    	imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR);
103
+		imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR);
104 104
 
105 105
 	$hasShadow=($theme&THEME_SHADOWED_TEXT);
106
-    for($i=0;$i<$length;$i++)
106
+	for($i=0;$i<$length;$i++)
107 107
 	{
108
-        $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220));
109
-        $size=rand($fontWidth-10,$fontWidth);
110
-        $angle=rand(-30,30);
111
-        $x=$padding+$i*$fontWidth;
112
-        $y=rand($fontHeight-15,$fontHeight-10);
113
-        imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]);
114
-        if($hasShadow)
115
-        	imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]);
116
-        imagecolordeallocate($image,$color);
117
-    }
108
+		$color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220));
109
+		$size=rand($fontWidth-10,$fontWidth);
110
+		$angle=rand(-30,30);
111
+		$x=$padding+$i*$fontWidth;
112
+		$y=rand($fontHeight-15,$fontHeight-10);
113
+		imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]);
114
+		if($hasShadow)
115
+			imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]);
116
+		imagecolordeallocate($image,$color);
117
+	}
118 118
 
119 119
 	header('Content-Type: image/png');
120 120
 	imagepng($image);
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 			{
159 159
 				$color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220));
160 160
 				imagesetpixel($image,$x,$y,$color);
161
-	            imagecolordeallocate($image,$color);
162
-	        }
161
+				imagecolordeallocate($image,$color);
162
+			}
163 163
 		}
164 164
 	}
165 165
 }
Please login to merge, or discard this patch.
Spacing   +98 added lines, -99 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 
12 12
 namespace Prado\Web\UI\WebControls\assets;
13 13
 
14
-define('THEME_OPAQUE_BACKGROUND',0x0001);
15
-define('THEME_NOISY_BACKGROUND',0x0002);
16
-define('THEME_HAS_GRID',0x0004);
17
-define('THEME_HAS_SCRIBBLE',0x0008);
18
-define('THEME_MORPH_BACKGROUND',0x0010);
19
-define('THEME_SHADOWED_TEXT',0x0020);
14
+define('THEME_OPAQUE_BACKGROUND', 0x0001);
15
+define('THEME_NOISY_BACKGROUND', 0x0002);
16
+define('THEME_HAS_GRID', 0x0004);
17
+define('THEME_HAS_SCRIBBLE', 0x0008);
18
+define('THEME_MORPH_BACKGROUND', 0x0010);
19
+define('THEME_SHADOWED_TEXT', 0x0020);
20 20
 
21 21
 require_once(dirname(__FILE__).'/captcha_key.php');
22 22
 
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 if(isset($_GET['options']))
27 27
 {
28 28
 	$str=base64_decode($_GET['options']);
29
-	if(strlen($str)>32)
29
+	if(strlen($str) > 32)
30 30
 	{
31
-		$hash=substr($str,0,32);
32
-		$str=substr($str,32);
31
+		$hash=substr($str, 0, 32);
32
+		$str=substr($str, 32);
33 33
 		if(md5($privateKey.$str)===$hash)
34 34
 		{
35 35
 			$options=unserialize($str);
@@ -39,83 +39,82 @@  discard block
 block discarded – undo
39 39
 			$alphabet=$options['alphabet'];
40 40
 			$fontSize=$options['fontSize'];
41 41
 			$theme=$options['theme'];
42
-			if(($randomSeed=$options['randomSeed'])>0)
42
+			if(($randomSeed=$options['randomSeed']) > 0)
43 43
 				srand($randomSeed);
44 44
 			else
45
-				srand((int)(microtime()*1000000));
46
-			$token=generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive);
45
+				srand((int) (microtime() * 1000000));
46
+			$token=generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive);
47 47
 		}
48 48
 	}
49 49
 }
50 50
 
51
-displayToken($token,$fontSize,$theme);
51
+displayToken($token, $fontSize, $theme);
52 52
 
53
-function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive)
53
+function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive)
54 54
 {
55
-	$token=substr(hash2string(md5($publicKey.$privateKey),$alphabet).hash2string(md5($privateKey.$publicKey),$alphabet),0,$tokenLength);
56
-	return $caseSensitive?$token:strtoupper($token);
55
+	$token=substr(hash2string(md5($publicKey.$privateKey), $alphabet).hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength);
56
+	return $caseSensitive ? $token : strtoupper($token);
57 57
 }
58 58
 
59
-function hash2string($hex,$alphabet)
59
+function hash2string($hex, $alphabet)
60 60
 {
61
-	if(strlen($alphabet)<2)
61
+	if(strlen($alphabet) < 2)
62 62
 		$alphabet='234578adefhijmnrtABDEFGHJLMNRT';
63 63
 	$hexLength=strlen($hex);
64 64
 	$base=strlen($alphabet);
65 65
 	$result='';
66
-	for($i=0;$i<$hexLength;$i+=6)
66
+	for($i=0; $i < $hexLength; $i+=6)
67 67
 	{
68
-		$number=hexdec(substr($hex,$i,6));
68
+		$number=hexdec(substr($hex, $i, 6));
69 69
 		while($number)
70 70
 		{
71
-			$result.=$alphabet[$number%$base];
72
-			$number=floor($number/$base);
71
+			$result.=$alphabet[$number % $base];
72
+			$number=floor($number / $base);
73 73
 		}
74 74
 	}
75 75
 	return $result;
76 76
 }
77 77
 
78
-function displayToken($token,$fontSize,$theme)
78
+function displayToken($token, $fontSize, $theme)
79 79
 {
80
-	if(($fontSize=(int)$fontSize)<22)
80
+	if(($fontSize=(int) $fontSize) < 22)
81 81
 		$fontSize=22;
82
-	if($fontSize>100)
82
+	if($fontSize > 100)
83 83
 		$fontSize=100;
84 84
 	$length=strlen($token);
85 85
 	$padding=10;
86 86
 	$fontWidth=$fontSize;
87
-	$fontHeight=floor($fontWidth*1.5);
88
-	$width=$fontWidth*$length+$padding*2;
87
+	$fontHeight=floor($fontWidth * 1.5);
88
+	$width=$fontWidth * $length + $padding * 2;
89 89
 	$height=$fontHeight;
90
-	$image=imagecreatetruecolor($width,$height);
90
+	$image=imagecreatetruecolor($width, $height);
91 91
 
92
-	addBackground
93
-	(
92
+	addBackground(
94 93
 		$image, $width, $height,
95
-		$theme&THEME_OPAQUE_BACKGROUND,
96
-		$theme&THEME_NOISY_BACKGROUND,
97
-		$theme&THEME_HAS_GRID,
98
-		$theme&THEME_HAS_SCRIBBLE,
99
-		$theme&THEME_MORPH_BACKGROUND
94
+		$theme & THEME_OPAQUE_BACKGROUND,
95
+		$theme & THEME_NOISY_BACKGROUND,
96
+		$theme & THEME_HAS_GRID,
97
+		$theme & THEME_HAS_SCRIBBLE,
98
+		$theme & THEME_MORPH_BACKGROUND
100 99
 	);
101 100
 
102 101
 	$font=dirname(__FILE__).DIRECTORY_SEPARATOR.'verase.ttf';
103 102
 
104 103
 	if(function_exists('imagefilter'))
105
-    	imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR);
104
+    	imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);
106 105
 
107
-	$hasShadow=($theme&THEME_SHADOWED_TEXT);
108
-    for($i=0;$i<$length;$i++)
106
+	$hasShadow=($theme & THEME_SHADOWED_TEXT);
107
+    for($i=0; $i < $length; $i++)
109 108
 	{
110
-        $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220));
111
-        $size=rand($fontWidth-10,$fontWidth);
112
-        $angle=rand(-30,30);
113
-        $x=$padding+$i*$fontWidth;
114
-        $y=rand($fontHeight-15,$fontHeight-10);
115
-        imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]);
109
+        $color=imagecolorallocate($image, rand(150, 220), rand(150, 220), rand(150, 220));
110
+        $size=rand($fontWidth - 10, $fontWidth);
111
+        $angle=rand(-30, 30);
112
+        $x=$padding + $i * $fontWidth;
113
+        $y=rand($fontHeight - 15, $fontHeight - 10);
114
+        imagettftext($image, $size, $angle, $x, $y, $color, $font, $token[$i]);
116 115
         if($hasShadow)
117
-        	imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]);
118
-        imagecolordeallocate($image,$color);
116
+        	imagettftext($image, $size, $angle, $x + 2, $y + 2, $color, $font, $token[$i]);
117
+        imagecolordeallocate($image, $color);
119 118
     }
120 119
 
121 120
 	header('Content-Type: image/png');
@@ -123,103 +122,103 @@  discard block
 block discarded – undo
123 122
 	imagedestroy($image);
124 123
 }
125 124
 
126
-function addBackground($image,$width,$height,$opaque,$noisy,$hasGrid,$hasScribble,$morph)
125
+function addBackground($image, $width, $height, $opaque, $noisy, $hasGrid, $hasScribble, $morph)
127 126
 {
128
-	$background=imagecreatetruecolor($width*2,$height*2);
129
-	$white=imagecolorallocate($background,255,255,255);
130
-	imagefill($background,0,0,$white);
127
+	$background=imagecreatetruecolor($width * 2, $height * 2);
128
+	$white=imagecolorallocate($background, 255, 255, 255);
129
+	imagefill($background, 0, 0, $white);
131 130
 
132 131
 	if($opaque)
133
-		imagefill($background,0,0,imagecolorallocate($background,100,100,100));
132
+		imagefill($background, 0, 0, imagecolorallocate($background, 100, 100, 100));
134 133
 
135 134
 	if($noisy)
136
-		addNoise($background,$width*2,$height*2);
135
+		addNoise($background, $width * 2, $height * 2);
137 136
 
138 137
 	if($hasGrid)
139
-		addGrid($background,$width*2,$height*2);
138
+		addGrid($background, $width * 2, $height * 2);
140 139
 
141 140
 	if($hasScribble)
142
-		addScribble($background,$width*2,$height*2);
141
+		addScribble($background, $width * 2, $height * 2);
143 142
 
144 143
 	if($morph)
145
-		morphImage($background,$width*2,$height*2);
144
+		morphImage($background, $width * 2, $height * 2);
146 145
 
147
-	imagecopy($image,$background,0,0,30,30,$width,$height);
146
+	imagecopy($image, $background, 0, 0, 30, 30, $width, $height);
148 147
 
149 148
 	if(!$opaque)
150
-		imagecolortransparent($image,$white);
149
+		imagecolortransparent($image, $white);
151 150
 }
152 151
 
153
-function addNoise($image,$width,$height)
152
+function addNoise($image, $width, $height)
154 153
 {
155
-	for($x=0;$x<$width;++$x)
154
+	for($x=0; $x < $width; ++$x)
156 155
 	{
157
-		for($y=0;$y<$height;++$y)
156
+		for($y=0; $y < $height; ++$y)
158 157
 		{
159
-			if(rand(0,100)<25)
158
+			if(rand(0, 100) < 25)
160 159
 			{
161
-				$color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220));
162
-				imagesetpixel($image,$x,$y,$color);
163
-	            imagecolordeallocate($image,$color);
160
+				$color=imagecolorallocate($image, rand(150, 220), rand(150, 220), rand(150, 220));
161
+				imagesetpixel($image, $x, $y, $color);
162
+	            imagecolordeallocate($image, $color);
164 163
 	        }
165 164
 		}
166 165
 	}
167 166
 }
168 167
 
169
-function addGrid($image,$width,$height)
168
+function addGrid($image, $width, $height)
170 169
 {
171
-	for($i=0;$i<$width;$i+=rand(15,25))
170
+	for($i=0; $i < $width; $i+=rand(15, 25))
172 171
 	{
173
-		imagesetthickness($image,rand(2,6));
174
-		$color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180));
175
-		imageline($image,$i+rand(-10,20),0,$i+rand(-10,20),$height,$color);
176
-		imagecolordeallocate($image,$color);
172
+		imagesetthickness($image, rand(2, 6));
173
+		$color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180));
174
+		imageline($image, $i + rand(-10, 20), 0, $i + rand(-10, 20), $height, $color);
175
+		imagecolordeallocate($image, $color);
177 176
 	}
178
-	for($i=0;$i<$height;$i+=rand(15,25))
177
+	for($i=0; $i < $height; $i+=rand(15, 25))
179 178
 	{
180
-		imagesetthickness($image,rand(2,6));
181
-		$color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180));
182
-		imageline($image,0,$i+rand(-10,20),$width,$i+rand(-10,20),$color);
183
-		imagecolordeallocate($image,$color);
179
+		imagesetthickness($image, rand(2, 6));
180
+		$color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180));
181
+		imageline($image, 0, $i + rand(-10, 20), $width, $i + rand(-10, 20), $color);
182
+		imagecolordeallocate($image, $color);
184 183
 	}
185 184
 }
186 185
 
187
-function addScribble($image,$width,$height)
186
+function addScribble($image, $width, $height)
188 187
 {
189
-	for($i=0;$i<8;$i++)
188
+	for($i=0; $i < 8; $i++)
190 189
 	{
191
-		$color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180));
190
+		$color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180));
192 191
 		$points=array();
193
-		for($j=1;$j<rand(5,10);$j++)
192
+		for($j=1; $j < rand(5, 10); $j++)
194 193
 		{
195
-			$points[]=rand(2*(20*($i+1)),2*(50*($i+1)));
196
-			$points[]=rand(30,$height+30);
194
+			$points[]=rand(2 * (20 * ($i + 1)), 2 * (50 * ($i + 1)));
195
+			$points[]=rand(30, $height + 30);
197 196
 		}
198
-		imagesetthickness($image,rand(2,6));
199
-		imagepolygon($image,$points,intval(sizeof($points)/2),$color);
200
-		imagecolordeallocate($image,$color);
197
+		imagesetthickness($image, rand(2, 6));
198
+		imagepolygon($image, $points, intval(sizeof($points) / 2), $color);
199
+		imagecolordeallocate($image, $color);
201 200
 	}
202 201
 }
203 202
 
204
-function morphImage($image,$width,$height)
203
+function morphImage($image, $width, $height)
205 204
 {
206
-	$tempImage=imagecreatetruecolor($width,$height);
207
-	$chunk=rand(1,5);
208
-	for($x=$y=0;$x<$width;$x+=$chunk)
205
+	$tempImage=imagecreatetruecolor($width, $height);
206
+	$chunk=rand(1, 5);
207
+	for($x=$y=0; $x < $width; $x+=$chunk)
209 208
 	{
210
-		$chunk=rand(1,5);
211
-		$y+=rand(-1,1);
212
-		if($y>=$height)	$y=$height-5;
213
-		if($y<0) $y=5;
214
-		imagecopy($tempImage,$image,$x,0,$x,$y,$chunk,$height);
209
+		$chunk=rand(1, 5);
210
+		$y+=rand(-1, 1);
211
+		if($y >= $height)	$y=$height - 5;
212
+		if($y < 0) $y=5;
213
+		imagecopy($tempImage, $image, $x, 0, $x, $y, $chunk, $height);
215 214
 	}
216
-	for($x=$y=0;$y<$height;$y+=$chunk)
215
+	for($x=$y=0; $y < $height; $y+=$chunk)
217 216
 	{
218
-		$chunk=rand(1,5);
219
-		$x+=rand(-1,1);
220
-		if($x>=$width)	$x=$width-5;
221
-		if($x<0) $x=5;
222
-		imagecopy($image,$tempImage,$x,$y,0,$y,$width,$chunk);
217
+		$chunk=rand(1, 5);
218
+		$x+=rand(-1, 1);
219
+		if($x >= $width)	$x=$width - 5;
220
+		if($x < 0) $x=5;
221
+		imagecopy($image, $tempImage, $x, $y, 0, $y, $width, $chunk);
223 222
 	}
224 223
 }
225 224
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTabPanel.php 3 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	}
82 82
 
83 83
 	/**
84
-     * Returns the index of the active tab view.
85
-     * Note, this property may not return the correct index.
86
-     * To ensure the correctness, call {@link getActiveView()} first.
84
+	 * Returns the index of the active tab view.
85
+	 * Note, this property may not return the correct index.
86
+	 * To ensure the correctness, call {@link getActiveView()} first.
87 87
 	 * @return integer the zero-based index of the active tab view. If -1, it means no active tab view. Default is 0 (the first view is active).
88 88
 	 */
89 89
 	public function getActiveViewIndex()
@@ -100,24 +100,24 @@  discard block
 block discarded – undo
100 100
 		$this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0);
101 101
 	}
102 102
 
103
-    /**
104
-     * Returns the ID of the active tab view.
105
-     * Note, this property may not return the correct ID.
106
-     * To ensure the correctness, call {@link getActiveView()} first.
107
-     * @return string The ID of the active tab view. Defaults to '', meaning not set.
108
-     */
109
-    public function getActiveViewID()
110
-    {
103
+	/**
104
+	 * Returns the ID of the active tab view.
105
+	 * Note, this property may not return the correct ID.
106
+	 * To ensure the correctness, call {@link getActiveView()} first.
107
+	 * @return string The ID of the active tab view. Defaults to '', meaning not set.
108
+	 */
109
+	public function getActiveViewID()
110
+	{
111 111
 		return $this->getViewState('ActiveViewID','');
112
-    }
112
+	}
113 113
 
114
-    /**
115
-     * @param string The ID of the active tab view.
116
-     */
117
-    public function setActiveViewID($value)
118
-    {
114
+	/**
115
+	 * @param string The ID of the active tab view.
116
+	 */
117
+	public function setActiveViewID($value)
118
+	{
119 119
 		$this->setViewState('ActiveViewID',$value,'');
120
-    }
120
+	}
121 121
 
122 122
 	/**
123 123
 	 * Returns the currently active view.
@@ -172,63 +172,63 @@  discard block
 block discarded – undo
172 172
 			throw new TInvalidOperationException('tabpanel_view_inexistent');
173 173
 	}
174 174
 
175
-    /**
176
-     * @return bool status of automatic tab switch on hover
177
-     */
178
-    public function getAutoSwitch()
179
-    {
180
-        return TPropertyValue::ensureBoolean($this->getViewState('AutoSwitch'));
181
-    }
182
-
183
-    /**
184
-     * @param bool whether to enable automatic tab switch on hover
185
-     */
186
-    public function setAutoSwitch($value)
187
-    {
188
-        $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value));
189
-    }
190
-
191
-
192
-    /**
193
-     * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
194
-     */
195
-    public function getCssUrl()
196
-    {
197
-        return $this->getViewState('CssUrl','default');
198
-    }
199
-
200
-    /**
201
-     * @param string URL for the CSS file including all relevant CSS class definitions.
202
-     */
203
-    public function setCssUrl($value)
204
-    {
205
-        $this->setViewState('CssUrl',TPropertyValue::ensureString($value),'');
206
-    }
207
-
208
-    /**
209
-     * @return string CSS class for the whole tab control div. Defaults to 'tab-panel'.
210
-     */
211
-    public function getCssClass()
212
-    {
213
-    	$cssClass=parent::getCssClass();
214
-    	return $cssClass===''?'tab-panel':$cssClass;
215
-    }
216
-
217
-    /**
218
-     * @return string CSS class for the currently displayed view div. Defaults to 'tab-view'.
219
-     */
220
-    public function getViewCssClass()
221
-    {
222
-        return $this->getViewStyle()->getCssClass();
223
-    }
224
-
225
-    /**
226
-     * @param string CSS class for the currently displayed view div.
227
-     */
228
-    public function setViewCssClass($value)
229
-    {
230
-        $this->getViewStyle()->setCssClass($value);
231
-    }
175
+	/**
176
+	 * @return bool status of automatic tab switch on hover
177
+	 */
178
+	public function getAutoSwitch()
179
+	{
180
+		return TPropertyValue::ensureBoolean($this->getViewState('AutoSwitch'));
181
+	}
182
+
183
+	/**
184
+	 * @param bool whether to enable automatic tab switch on hover
185
+	 */
186
+	public function setAutoSwitch($value)
187
+	{
188
+		$this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value));
189
+	}
190
+
191
+
192
+	/**
193
+	 * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
194
+	 */
195
+	public function getCssUrl()
196
+	{
197
+		return $this->getViewState('CssUrl','default');
198
+	}
199
+
200
+	/**
201
+	 * @param string URL for the CSS file including all relevant CSS class definitions.
202
+	 */
203
+	public function setCssUrl($value)
204
+	{
205
+		$this->setViewState('CssUrl',TPropertyValue::ensureString($value),'');
206
+	}
207
+
208
+	/**
209
+	 * @return string CSS class for the whole tab control div. Defaults to 'tab-panel'.
210
+	 */
211
+	public function getCssClass()
212
+	{
213
+		$cssClass=parent::getCssClass();
214
+		return $cssClass===''?'tab-panel':$cssClass;
215
+	}
216
+
217
+	/**
218
+	 * @return string CSS class for the currently displayed view div. Defaults to 'tab-view'.
219
+	 */
220
+	public function getViewCssClass()
221
+	{
222
+		return $this->getViewStyle()->getCssClass();
223
+	}
224
+
225
+	/**
226
+	 * @param string CSS class for the currently displayed view div.
227
+	 */
228
+	public function setViewCssClass($value)
229
+	{
230
+		$this->getViewStyle()->setCssClass($value);
231
+	}
232 232
 
233 233
 	/**
234 234
 	 * @return TStyle the style for all the view div
@@ -244,21 +244,21 @@  discard block
 block discarded – undo
244 244
 		return $style;
245 245
 	}
246 246
 
247
-    /**
248
-     * @return string CSS class for non-active tabs. Defaults to 'tab-normal'.
249
-     */
250
-    public function getTabCssClass()
251
-    {
252
-        return $this->getTabStyle()->getCssClass();
253
-    }
247
+	/**
248
+	 * @return string CSS class for non-active tabs. Defaults to 'tab-normal'.
249
+	 */
250
+	public function getTabCssClass()
251
+	{
252
+		return $this->getTabStyle()->getCssClass();
253
+	}
254 254
 
255
-    /**
256
-     * @param string CSS class for non-active tabs.
257
-     */
258
-    public function setTabCssClass($value)
259
-    {
260
-        $this->getTabStyle()->setCssClass($value);
261
-    }
255
+	/**
256
+	 * @param string CSS class for non-active tabs.
257
+	 */
258
+	public function setTabCssClass($value)
259
+	{
260
+		$this->getTabStyle()->setCssClass($value);
261
+	}
262 262
 
263 263
 	/**
264 264
 	 * @return TStyle the style for all the inactive tab div
@@ -274,21 +274,21 @@  discard block
 block discarded – undo
274 274
 		return $style;
275 275
 	}
276 276
 
277
-    /**
278
-     * @return string CSS class for the active tab. Defaults to 'tab-active'.
279
-     */
280
-    public function getActiveTabCssClass()
281
-    {
282
-        return $this->getActiveTabStyle()->getCssClass();
283
-    }
284
-
285
-    /**
286
-     * @param string CSS class for the active tab.
287
-     */
288
-    public function setActiveTabCssClass($value)
289
-    {
290
-        $this->getActiveTabStyle()->setCssClass($value);
291
-    }
277
+	/**
278
+	 * @return string CSS class for the active tab. Defaults to 'tab-active'.
279
+	 */
280
+	public function getActiveTabCssClass()
281
+	{
282
+		return $this->getActiveTabStyle()->getCssClass();
283
+	}
284
+
285
+	/**
286
+	 * @param string CSS class for the active tab.
287
+	 */
288
+	public function setActiveTabCssClass($value)
289
+	{
290
+		$this->getActiveTabStyle()->setCssClass($value);
291
+	}
292 292
 
293 293
 	/**
294 294
 	 * @return TStyle the style for the active tab div
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -136,15 +136,13 @@  discard block
 block discarded – undo
136 136
 				$activeView=$views->itemAt($index);
137 137
 			else
138 138
 				throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id);
139
-		}
140
-		else if(($index=$this->getActiveViewIndex())>=0)
139
+		} else if(($index=$this->getActiveViewIndex())>=0)
141 140
 		{
142 141
 			if($index<$views->getCount())
143 142
 				$activeView=$views->itemAt($index);
144 143
 			else
145 144
 				throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index);
146
-		}
147
-		else
145
+		} else
148 146
 		{
149 147
 			foreach($views as $index=>$view)
150 148
 			{
@@ -320,8 +318,7 @@  discard block
 block discarded – undo
320 318
 				$this->setActiveViewIndex($index);
321 319
 				$this->setActiveViewID($view->getID(false));
322 320
 				$view->setActive(true);
323
-			}
324
-			else
321
+			} else
325 322
 				$v->setActive(false);
326 323
 		}
327 324
 	}
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getActiveViewIndex()
96 96
 	{
97
-		return $this->getViewState('ActiveViewIndex',0);
97
+		return $this->getViewState('ActiveViewIndex', 0);
98 98
 	}
99 99
 
100 100
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function setActiveViewIndex($value)
105 105
 	{
106
-		$this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0);
106
+		$this->setViewState('ActiveViewIndex', TPropertyValue::ensureInteger($value), 0);
107 107
 	}
108 108
 
109 109
     /**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function getActiveViewID()
116 116
     {
117
-		return $this->getViewState('ActiveViewID','');
117
+		return $this->getViewState('ActiveViewID', '');
118 118
     }
119 119
 
120 120
     /**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function setActiveViewID($value)
124 124
     {
125
-		$this->setViewState('ActiveViewID',$value,'');
125
+		$this->setViewState('ActiveViewID', $value, '');
126 126
     }
127 127
 
128 128
 	/**
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
138 138
 		$views=$this->getViews();
139 139
 		if(($id=$this->getActiveViewID())!=='')
140 140
 		{
141
-			if(($index=$views->findIndexByID($id))>=0)
141
+			if(($index=$views->findIndexByID($id)) >= 0)
142 142
 				$activeView=$views->itemAt($index);
143 143
 			else
144
-				throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id);
144
+				throw new TInvalidDataValueException('tabpanel_activeviewid_invalid', $id);
145 145
 		}
146
-		else if(($index=$this->getActiveViewIndex())>=0)
146
+		else if(($index=$this->getActiveViewIndex()) >= 0)
147 147
 		{
148
-			if($index<$views->getCount())
148
+			if($index < $views->getCount())
149 149
 				$activeView=$views->itemAt($index);
150 150
 			else
151
-				throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index);
151
+				throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid', $index);
152 152
 		}
153 153
 		else
154 154
 		{
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 */
173 173
 	public function setActiveView($view)
174 174
 	{
175
-		if($this->getViews()->indexOf($view)>=0)
175
+		if($this->getViews()->indexOf($view) >= 0)
176 176
 			$this->activateView($view);
177 177
 		else
178 178
 			throw new TInvalidOperationException('tabpanel_view_inexistent');
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function setAutoSwitch($value)
193 193
     {
194
-        $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value));
194
+        $this->setViewState('AutoSwitch', TPropertyValue::ensureBoolean($value));
195 195
     }
196 196
 
197 197
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function getCssUrl()
202 202
     {
203
-        return $this->getViewState('CssUrl','default');
203
+        return $this->getViewState('CssUrl', 'default');
204 204
     }
205 205
 
206 206
     /**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      */
209 209
     public function setCssUrl($value)
210 210
     {
211
-        $this->setViewState('CssUrl',TPropertyValue::ensureString($value),'');
211
+        $this->setViewState('CssUrl', TPropertyValue::ensureString($value), '');
212 212
     }
213 213
 
214 214
     /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     public function getCssClass()
218 218
     {
219 219
     	$cssClass=parent::getCssClass();
220
-    	return $cssClass===''?'tab-panel':$cssClass;
220
+    	return $cssClass==='' ? 'tab-panel' : $cssClass;
221 221
     }
222 222
 
223 223
     /**
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function getViewStyle()
243 243
 	{
244
-		if(($style=$this->getViewState('ViewStyle',null))===null)
244
+		if(($style=$this->getViewState('ViewStyle', null))===null)
245 245
 		{
246 246
 			$style=new TStyle;
247 247
 			$style->setCssClass('tab-view');
248
-			$this->setViewState('ViewStyle',$style,null);
248
+			$this->setViewState('ViewStyle', $style, null);
249 249
 		}
250 250
 		return $style;
251 251
 	}
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function getTabStyle()
273 273
 	{
274
-		if(($style=$this->getViewState('TabStyle',null))===null)
274
+		if(($style=$this->getViewState('TabStyle', null))===null)
275 275
 		{
276 276
 			$style=new TStyle;
277 277
 			$style->setCssClass('tab-normal');
278
-			$this->setViewState('TabStyle',$style,null);
278
+			$this->setViewState('TabStyle', $style, null);
279 279
 		}
280 280
 		return $style;
281 281
 	}
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function getActiveTabStyle()
303 303
 	{
304
-		if(($style=$this->getViewState('ActiveTabStyle',null))===null)
304
+		if(($style=$this->getViewState('ActiveTabStyle', null))===null)
305 305
 		{
306 306
 			$style=new TStyle;
307 307
 			$style->setCssClass('tab-active');
308
-			$this->setViewState('ActiveTabStyle',$style,null);
308
+			$this->setViewState('ActiveTabStyle', $style, null);
309 309
 		}
310 310
 		return $style;
311 311
 	}
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	 * @param array the input data collection
340 340
 	 * @return boolean whether the data of the control has been changed
341 341
 	 */
342
-	public function loadPostData($key,$values)
342
+	public function loadPostData($key, $values)
343 343
 	{
344 344
 		if(($index=$values[$this->getClientID().'_1'])!==null)
345 345
 		{
346
-			$index=(int)$index;
346
+			$index=(int) $index;
347 347
 			$currentIndex=$this->getActiveViewIndex();
348 348
 			if($currentIndex!==$index)
349 349
 			{
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	protected function addAttributesToRender($writer)
385 385
 	{
386
-		$writer->addAttribute('id',$this->getClientID());
386
+		$writer->addAttribute('id', $this->getClientID());
387 387
 		$this->setCssClass($this->getCssClass());
388 388
 		parent::addAttributesToRender($writer);
389 389
 	}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	public function onPreRender($param)
397 397
 	{
398 398
 		parent::onPreRender($param);
399
-		$this->getActiveView();  // determine the active view
399
+		$this->getActiveView(); // determine the active view
400 400
 		$this->registerStyleSheet();
401 401
 
402 402
 		$page=$this->getPage();
@@ -411,17 +411,17 @@  discard block
 block discarded – undo
411 411
 	 */
412 412
 	protected function registerStyleSheet()
413 413
 	{
414
-		$url = $this->getCssUrl();
414
+		$url=$this->getCssUrl();
415 415
 
416
-		if($url === '') {
416
+		if($url==='') {
417 417
 			return;
418 418
 		}
419 419
 
420
-		if($url === 'default') {
421
-			$url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css');
420
+		if($url==='default') {
421
+			$url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css');
422 422
 		}
423 423
 
424
-		if($url !== '') {
424
+		if($url!=='') {
425 425
 			$this->getPage()->getClientScript()->registerStyleSheetFile($url, $url);
426 426
 		}
427 427
 	}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$code="new $className($options);";
440 440
 		$cs->registerEndScript("prado:$id", $code);
441 441
 		// ensure an item is always active and visible
442
-		$index = $this->getActiveViewIndex();
442
+		$index=$this->getActiveViewIndex();
443 443
 		if(!$this->getViews()->itemAt($index)->Visible)
444 444
 			$index=0;
445 445
 		$cs->registerHiddenField($id.'_1', $index);
@@ -460,19 +460,19 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	protected function getClientOptions()
462 462
 	{
463
-		$options['ID'] = $this->getClientID();
464
-		$options['ActiveCssClass'] = $this->getActiveTabCssClass();
465
-		$options['NormalCssClass'] = $this->getTabCssClass();
466
-		$viewIDs = array();
467
-		$viewVis = array();
463
+		$options['ID']=$this->getClientID();
464
+		$options['ActiveCssClass']=$this->getActiveTabCssClass();
465
+		$options['NormalCssClass']=$this->getTabCssClass();
466
+		$viewIDs=array();
467
+		$viewVis=array();
468 468
 		foreach($this->getViews() as $view)
469 469
 		{
470
-			$viewIDs[] = $view->getClientID();
471
-			$viewVis[] = $view->getVisible();
470
+			$viewIDs[]=$view->getClientID();
471
+			$viewVis[]=$view->getVisible();
472 472
 		}
473
-		$options['Views'] = $viewIDs;
474
-		$options['ViewsVis'] = $viewVis;
475
-		$options['AutoSwitch'] = $this->getAutoSwitch();
473
+		$options['Views']=$viewIDs;
474
+		$options['ViewsVis']=$viewVis;
475
+		$options['AutoSwitch']=$this->getAutoSwitch();
476 476
 
477 477
 		return $options;
478 478
 	}
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	public function renderContents($writer)
508 508
 	{
509 509
 		$views=$this->getViews();
510
-		if($views->getCount()>0)
510
+		if($views->getCount() > 0)
511 511
 		{
512 512
 			$writer->writeLine();
513 513
 			// render tab bar
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveDatePicker.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
 
33 33
 	/**
34 34
 	 * @return boolean a value indicating whether an automatic postback to the server
35
-     * will occur whenever the user modifies the text in the TActiveDatePicker control and
36
-     * then tabs out of the component. Defaults to true.
35
+	 * will occur whenever the user modifies the text in the TActiveDatePicker control and
36
+	 * then tabs out of the component. Defaults to true.
37 37
 	 */
38 38
 	public function getAutoPostBack()
39 39
 	{
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function getAutoPostBack()
48 48
 	{
49
-		return $this->getViewState('AutoPostBack',true);
49
+		return $this->getViewState('AutoPostBack', true);
50 50
 	}
51 51
 
52 52
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function setAutoPostBack($value)
59 59
 	{
60
-		$this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true);
60
+		$this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true);
61 61
 	}
62 62
 
63 63
 	/**
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	protected function getDatePickerOptions()
68 68
 	{
69
-		$options = parent::getDatePickerOptions();
69
+		$options=parent::getDatePickerOptions();
70 70
 		$options['CausesValidation']=$this->getCausesValidation();
71 71
 		$options['ValidationGroup']=$this->getValidationGroup();
72
-		$options['EventTarget'] = $this->getUniqueID();
73
-		$options['ShowCalendar'] = $this->getShowCalendar();
74
-		$options['AutoPostBack'] = $this->getAutoPostBack();
72
+		$options['EventTarget']=$this->getUniqueID();
73
+		$options['ShowCalendar']=$this->getShowCalendar();
74
+		$options['AutoPostBack']=$this->getAutoPostBack();
75 75
 		return $options;
76 76
 	}
77 77
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	/**
90 90
 	 * @return TBaseActiveCallbackControl standard callback control options.
91 91
 	 */
92
-	public function getActiveControl(){
92
+	public function getActiveControl() {
93 93
 		return $this->getAdapter()->getBaseActiveControl();
94 94
 	}
95 95
 
@@ -97,21 +97,21 @@  discard block
 block discarded – undo
97 97
 	 * Client-side Text property can only be updated after the OnLoad stage.
98 98
 	 * @param string text content for the textbox
99 99
 	 */
100
-	public function setText($value){
101
-		if(parent::getText() === $value)
100
+	public function setText($value) {
101
+		if(parent::getText()===$value)
102 102
 			return;
103 103
 
104 104
 		parent::setText($value);
105
-		if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){
105
+		if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) {
106 106
 			$cb=$this->getPage()->getCallbackClient();
107 107
 			$cb->setValue($this, $value);
108
-			if ($this->getInputMode()==TDatePickerInputMode::DropDownList)
108
+			if($this->getInputMode()==TDatePickerInputMode::DropDownList)
109 109
 			{
110
-				$s = new TDateTimeStamp;
111
-				$date = $s->getDate($this->getTimeStampFromText());
110
+				$s=new TDateTimeStamp;
111
+				$date=$s->getDate($this->getTimeStampFromText());
112 112
 				$id=$this->getClientID();
113 113
 				$cb->select($id.TControl::CLIENT_ID_SEPARATOR.'day', 'Value', $date['mday'], 'select');
114
-				$cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon']-1, 'select');
114
+				$cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon'] - 1, 'select');
115 115
 				$cb->select($id.TControl::CLIENT_ID_SEPARATOR.'year', 'Value', $date['year'], 'select');
116 116
 
117 117
 			}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * This method is mainly used by framework and control developers.
125 125
 	 * @param TCallbackEventParameter the event parameter
126 126
 	 */
127
- 	public function raiseCallbackEvent($param){
127
+ 	public function raiseCallbackEvent($param) {
128 128
 		$this->onCallback($param);
129 129
 	}
130 130
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * handler can be invoked.
136 136
 	 * @param TCallbackEventParameter event parameter to be passed to the event handlers
137 137
 	 */
138
-	public function onCallback($param){
138
+	public function onCallback($param) {
139 139
 		$this->raiseEvent('OnCallback', $this, $param);
140 140
 	}
141 141
 
@@ -145,22 +145,22 @@  discard block
 block discarded – undo
145 145
 
146 146
 	protected function registerCalendarClientScriptPre()
147 147
 	{
148
-		$cs = $this->getPage()->getClientScript();
148
+		$cs=$this->getPage()->getClientScript();
149 149
 		$cs->registerPradoScript("activedatepicker");
150 150
 	}
151 151
 
152 152
 	protected function renderClientControlScript($writer)
153 153
 	{
154
-		$cs = $this->getPage()->getClientScript();
154
+		$cs=$this->getPage()->getClientScript();
155 155
 		if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
156 156
 		{
157
-			$spacer = $this->getAssetUrl('spacer.gif');
158
-			$code = "Prado.WebUI.TDatePicker.spacer = '$spacer';";
157
+			$spacer=$this->getAssetUrl('spacer.gif');
158
+			$code="Prado.WebUI.TDatePicker.spacer = '$spacer';";
159 159
 			$cs->registerEndScript('TDatePicker.spacer', $code);
160 160
 		}
161 161
 
162
-		$options = TJavaScript::encode($this->getDatePickerOptions());
163
-		$code = "new Prado.WebUI.TActiveDatePicker($options);";
162
+		$options=TJavaScript::encode($this->getDatePickerOptions());
163
+		$code="new Prado.WebUI.TActiveDatePicker($options);";
164 164
 		$cs->registerEndScript("prado:".$this->getClientID(), $code);
165 165
 	}
166 166
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveHiddenField.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
  */
23 23
 class TActiveHiddenField extends THiddenField implements ICallbackEventHandler, IActiveControl
24 24
 {
25
-    /**
25
+	/**
26 26
 	 * Creates a new callback control, sets the adapter to
27 27
 	 * TActiveControlAdapter. If you override this class, be sure to set the
28 28
 	 * adapter appropriately by, for example, by calling this constructor.
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function setValue($value)
57 57
 	{
58
-		if(parent::getValue() === $value)
58
+		if(parent::getValue()===$value)
59 59
 			return;
60 60
 
61 61
 		parent::setValue($value);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	protected function addAttributesToRender($writer)
112 112
 	{
113 113
 		parent::addAttributesToRender($writer);
114
-		$writer->addAttribute('id',$this->getClientID());
114
+		$writer->addAttribute('id', $this->getClientID());
115 115
 		$this->getActiveControl()->registerCallbackClientScript(
116 116
 			$this->getClientClassName(), $this->getPostBackOptions());
117 117
 	}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActivePanel.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@
 block discarded – undo
60 60
 	 * @param THtmlWriter the writer used for the rendering purpose
61 61
 	 */
62 62
 	protected function addAttributesToRender($writer) {
63
-	    $writer->addAttribute('id',$this->getClientID());
64
-	    parent::addAttributesToRender($writer);
63
+		$writer->addAttribute('id',$this->getClientID());
64
+		parent::addAttributesToRender($writer);
65 65
 	}
66 66
 
67 67
 	/**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param THtmlWriter the writer used for the rendering purpose
65 65
 	 */
66 66
 	protected function addAttributesToRender($writer) {
67
-	    $writer->addAttribute('id',$this->getClientID());
67
+	    $writer->addAttribute('id', $this->getClientID());
68 68
 	    parent::addAttributesToRender($writer);
69 69
 	}
70 70
 
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 		{
82 82
 			parent::render($writer);
83 83
 			if($this->getActiveControl()->canUpdateClientSide())
84
-				$this->getPage()->getCallbackClient()->replaceContent($this,$writer);
84
+				$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
85 85
 		}
86 86
 		else
87 87
 		{
88
-			$this->getPage()->getAdapter()->registerControlToRender($this,$writer);
89
-			if ($this->getHasControls())
88
+			$this->getPage()->getAdapter()->registerControlToRender($this, $writer);
89
+			if($this->getHasControls())
90 90
 			{
91 91
 				// If we update a TActivePanel on callback,
92 92
 				// We shouldn't update all childs, because the whole content will be replaced by
93 93
 				// the parent
94
-				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
94
+				foreach($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
95 95
 				{
96 96
 						$control->getActiveControl()->setEnableUpdate(false);
97 97
 				}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@
 block discarded – undo
82 82
 			parent::render($writer);
83 83
 			if($this->getActiveControl()->canUpdateClientSide())
84 84
 				$this->getPage()->getCallbackClient()->replaceContent($this,$writer);
85
-		}
86
-		else
85
+		} else
87 86
 		{
88 87
 			$this->getPage()->getAdapter()->registerControlToRender($this,$writer);
89 88
 			if ($this->getHasControls())
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveCheckBoxList.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 			&& $this->getPage()->getClientSupportsJavaScript())
117 117
 		{
118 118
 		  $this->getActiveControl()->registerCallbackClientScript(
119
-		    $this->getClientClassName(), $this->getPostBackOptions());
119
+			$this->getClientClassName(), $this->getPostBackOptions());
120 120
 		}
121 121
 	}
122 122
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
 
88 88
 	/**
89 89
 	 * Creates a control used for repetition (used as a template).
90
-	 * @return TControl the control to be repeated
90
+	 * @return TActiveCheckBoxListItem the control to be repeated
91 91
 	 */
92 92
 	protected function createRepeatedControl()
93 93
 	{
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * updated later.
73 73
 	 *@return boolean always true
74 74
 	 */
75
-	protected function getSpanNeeded ()
75
+	protected function getSpanNeeded()
76 76
 	{
77 77
 	  return true;
78 78
 	}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	protected function createRepeatedControl()
93 93
 	{
94
-		$control = new TActiveCheckBoxListItem;
94
+		$control=new TActiveCheckBoxListItem;
95 95
 		$control->getAdapter()->setBaseActiveControl($this->getActiveControl());
96 96
 		return $control;
97 97
 	}
Please login to merge, or discard this patch.
framework/Web/UI/TTemplateControl.php 4 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -238,90 +238,90 @@
 block discarded – undo
238 238
 		parent::initRecursive($namingContainer);
239 239
 	}
240 240
         
241
-        /**
242
-         * Function to update view controls with data in a given AR object.
243
-         * View controls and AR object need to have the same name in IDs and Attrs respectively.
244
-         * @param TActiveRecord $arObj
245
-         * @param Boolean $throwExceptions Wheter or not to throw exceptions
246
-         * @author Daniel Sampedro <[email protected]>
247
-         */
248
-        public function tryToUpdateView($arObj, $throwExceptions = false)
249
-        {
250
-                $objAttrs = get_class_vars(get_class($arObj));
251
-                foreach (array_keys($objAttrs) as $key)
252
-                {
253
-                        try
254
-                        {
255
-                                if ($key != "RELATIONS")
256
-                                {
257
-                                        $control = $this->{$key};
258
-                                        if ($control instanceof TTextBox)
259
-                                                $control->Text = $arObj->{$key};
260
-                                        elseif ($control instanceof TCheckBox)
261
-                                                $control->Checked = (boolean) $arObj->{$key};
262
-                                        elseif ($control instanceof TDatePicker)
263
-                                                $control->Date = $arObj->{$key};
264
-                                }
265
-                                else
266
-                                {
267
-                                        foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
268
-                                        {
269
-                                                $relControl = $this->{$relKey};
270
-                                                switch ($relValues[0])
271
-                                                {
272
-                                                        case TActiveRecord::BELONGS_TO:
273
-                                                        case TActiveRecord::HAS_ONE:
274
-                                                                $relControl->Text = $arObj->{$relKey};
275
-                                                                break;
276
-                                                        case TActiveRecord::HAS_MANY:
277
-                                                                if ($relControl instanceof TListControl)
278
-                                                                {
279
-                                                                        $relControl->DataSource = $arObj->{$relKey};
280
-                                                                        $relControl->dataBind();
281
-                                                                }
282
-                                                                break;
283
-                                                }
284
-                                        }
285
-                                        break;
286
-                                }
287
-                        } 
288
-                        catch (Exception $ex)
289
-                        {
290
-                                if ($throwExceptions)
291
-                                        throw $ex;
292
-                        }
293
-                }
294
-        }
241
+		/**
242
+		 * Function to update view controls with data in a given AR object.
243
+		 * View controls and AR object need to have the same name in IDs and Attrs respectively.
244
+		 * @param TActiveRecord $arObj
245
+		 * @param Boolean $throwExceptions Wheter or not to throw exceptions
246
+		 * @author Daniel Sampedro <[email protected]>
247
+		 */
248
+		public function tryToUpdateView($arObj, $throwExceptions = false)
249
+		{
250
+				$objAttrs = get_class_vars(get_class($arObj));
251
+				foreach (array_keys($objAttrs) as $key)
252
+				{
253
+						try
254
+						{
255
+								if ($key != "RELATIONS")
256
+								{
257
+										$control = $this->{$key};
258
+										if ($control instanceof TTextBox)
259
+												$control->Text = $arObj->{$key};
260
+										elseif ($control instanceof TCheckBox)
261
+												$control->Checked = (boolean) $arObj->{$key};
262
+										elseif ($control instanceof TDatePicker)
263
+												$control->Date = $arObj->{$key};
264
+								}
265
+								else
266
+								{
267
+										foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
268
+										{
269
+												$relControl = $this->{$relKey};
270
+												switch ($relValues[0])
271
+												{
272
+														case TActiveRecord::BELONGS_TO:
273
+														case TActiveRecord::HAS_ONE:
274
+																$relControl->Text = $arObj->{$relKey};
275
+																break;
276
+														case TActiveRecord::HAS_MANY:
277
+																if ($relControl instanceof TListControl)
278
+																{
279
+																		$relControl->DataSource = $arObj->{$relKey};
280
+																		$relControl->dataBind();
281
+																}
282
+																break;
283
+												}
284
+										}
285
+										break;
286
+								}
287
+						} 
288
+						catch (Exception $ex)
289
+						{
290
+								if ($throwExceptions)
291
+										throw $ex;
292
+						}
293
+				}
294
+		}
295 295
 
296
-        /**
297
-         * Function to try to update an AR object with data in view controls.
298
-         * @param TActiveRecord $arObj
299
-         * @param Boolean $throwExceptions Wheter or not to throw exceptions
300
-         * @author Daniel Sampedro <[email protected]>
301
-         */
302
-        public function tryToUpdateAR($arObj, $throwExceptions = false)
303
-        {
304
-                $objAttrs = get_class_vars(get_class($arObj));
305
-                foreach (array_keys($objAttrs) as $key)
306
-                {
307
-                        try
308
-                        {
309
-                                if ($key == "RELATIONS")
310
-                                        break;
311
-                                $control = $this->{$key};
312
-                                if ($control instanceof TTextBox)
313
-                                        $arObj->{$key} = $control->Text;
314
-                                elseif ($control instanceof TCheckBox)
315
-                                        $arObj->{$key} = $control->Checked;
316
-                                elseif ($control instanceof TDatePicker)
317
-                                        $arObj->{$key} = $control->Date;
318
-                        } 
319
-                        catch (Exception $ex)
320
-                        {
321
-                                if ($throwExceptions)
322
-                                        throw $ex;
323
-                        }
324
-                }
325
-        }
296
+		/**
297
+		 * Function to try to update an AR object with data in view controls.
298
+		 * @param TActiveRecord $arObj
299
+		 * @param Boolean $throwExceptions Wheter or not to throw exceptions
300
+		 * @author Daniel Sampedro <[email protected]>
301
+		 */
302
+		public function tryToUpdateAR($arObj, $throwExceptions = false)
303
+		{
304
+				$objAttrs = get_class_vars(get_class($arObj));
305
+				foreach (array_keys($objAttrs) as $key)
306
+				{
307
+						try
308
+						{
309
+								if ($key == "RELATIONS")
310
+										break;
311
+								$control = $this->{$key};
312
+								if ($control instanceof TTextBox)
313
+										$arObj->{$key} = $control->Text;
314
+								elseif ($control instanceof TCheckBox)
315
+										$arObj->{$key} = $control->Checked;
316
+								elseif ($control instanceof TDatePicker)
317
+										$arObj->{$key} = $control->Date;
318
+						} 
319
+						catch (Exception $ex)
320
+						{
321
+								if ($throwExceptions)
322
+										throw $ex;
323
+						}
324
+				}
325
+		}
326 326
 }
327 327
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@  discard block
 block discarded – undo
69 69
 			if(!isset(self::$_template[$class]))
70 70
 				self::$_template[$class]=$this->loadTemplate();
71 71
 			return self::$_template[$class];
72
-		}
73
-		else
72
+		} else
74 73
 			return $this->_localTemplate;
75 74
 	}
76 75
 
@@ -205,8 +204,7 @@  discard block
 block discarded – undo
205 204
 			$controls=$placeholder->getParent()->getControls();
206 205
 			$loc=$controls->remove($placeholder);
207 206
 			$controls->insertAt($loc,$content);
208
-		}
209
-		else
207
+		} else
210 208
 			throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id);
211 209
 	}
212 210
 
@@ -232,8 +230,7 @@  discard block
 block discarded – undo
232 230
 			$master->ensureChildControls();
233 231
 			foreach($this->_contents as $id=>$content)
234 232
 				$master->injectContent($id,$content);
235
-		}
236
-		else if(!empty($this->_contents))
233
+		} else if(!empty($this->_contents))
237 234
 			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
238 235
 		parent::initRecursive($namingContainer);
239 236
 	}
@@ -261,8 +258,7 @@  discard block
 block discarded – undo
261 258
                                                 $control->Checked = (boolean) $arObj->{$key};
262 259
                                         elseif ($control instanceof TDatePicker)
263 260
                                                 $control->Date = $arObj->{$key};
264
-                                }
265
-                                else
261
+                                } else
266 262
                                 {
267 263
                                         foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
268 264
                                         {
@@ -284,8 +280,7 @@  discard block
 block discarded – undo
284 280
                                         }
285 281
                                         break;
286 282
                                 }
287
-                        } 
288
-                        catch (Exception $ex)
283
+                        } catch (Exception $ex)
289 284
                         {
290 285
                                 if ($throwExceptions)
291 286
                                         throw $ex;
@@ -315,8 +310,7 @@  discard block
 block discarded – undo
315 310
                                         $arObj->{$key} = $control->Checked;
316 311
                                 elseif ($control instanceof TDatePicker)
317 312
                                         $arObj->{$key} = $control->Date;
318
-                        } 
319
-                        catch (Exception $ex)
313
+                        } catch (Exception $ex)
320 314
                         {
321 315
                                 if ($throwExceptions)
322 316
                                         throw $ex;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -146,6 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * Registers a content control.
147 147
 	 * @param string ID of the content
148 148
 	 * @param TContent
149
+	 * @param string $id
149 150
 	 */
150 151
 	public function registerContent($id,TContent $object)
151 152
 	{
@@ -160,6 +161,7 @@  discard block
 block discarded – undo
160 161
 	 * This method should only be used by framework and control developers.
161 162
 	 * @param string placeholder ID
162 163
 	 * @param TContentPlaceHolder placeholder control
164
+	 * @param string $id
163 165
 	 */
164 166
 	public function registerContentPlaceHolder($id,TContentPlaceHolder $object)
165 167
 	{
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	protected function loadTemplate()
119 119
 	{
120
-		Prado::trace("Loading template ".get_class($this),'\Prado\Web\UI\TTemplateControl');
120
+		Prado::trace("Loading template ".get_class($this), '\Prado\Web\UI\TTemplateControl');
121 121
 		$template=$this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this));
122 122
 		return $template;
123 123
 	}
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 			foreach($tpl->getDirective() as $name=>$value)
135 135
 			{
136 136
 				if(is_string($value))
137
-					$this->setSubProperty($name,$value);
137
+					$this->setSubProperty($name, $value);
138 138
 				else
139
-					throw new TConfigurationException('templatecontrol_directive_invalid',get_class($this),$name);
139
+					throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name);
140 140
 			}
141 141
 			$tpl->instantiateIn($this);
142 142
 		}
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 * @param string ID of the content
148 148
 	 * @param TContent
149 149
 	 */
150
-	public function registerContent($id,TContent $object)
150
+	public function registerContent($id, TContent $object)
151 151
 	{
152 152
 		if(isset($this->_contents[$id]))
153
-			throw new TConfigurationException('templatecontrol_contentid_duplicated',$id);
153
+			throw new TConfigurationException('templatecontrol_contentid_duplicated', $id);
154 154
 		else
155 155
 			$this->_contents[$id]=$object;
156 156
 	}
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 	 * @param string placeholder ID
162 162
 	 * @param TContentPlaceHolder placeholder control
163 163
 	 */
164
-	public function registerContentPlaceHolder($id,TContentPlaceHolder $object)
164
+	public function registerContentPlaceHolder($id, TContentPlaceHolder $object)
165 165
 	{
166 166
 		if(isset($this->_placeholders[$id]))
167
-			throw new TConfigurationException('templatecontrol_placeholderid_duplicated',$id);
167
+			throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id);
168 168
 		else
169 169
 			$this->_placeholders[$id]=$object;
170 170
 	}
@@ -199,17 +199,17 @@  discard block
 block discarded – undo
199 199
 	 * @param string ID of the content control
200 200
 	 * @param TContent the content to be injected
201 201
 	 */
202
-	public function injectContent($id,$content)
202
+	public function injectContent($id, $content)
203 203
 	{
204 204
 		if(isset($this->_placeholders[$id]))
205 205
 		{
206 206
 			$placeholder=$this->_placeholders[$id];
207 207
 			$controls=$placeholder->getParent()->getControls();
208 208
 			$loc=$controls->remove($placeholder);
209
-			$controls->insertAt($loc,$content);
209
+			$controls->insertAt($loc, $content);
210 210
 		}
211 211
 		else
212
-			throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id);
212
+			throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id);
213 213
 	}
214 214
 
215 215
 	/**
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 			$this->getControls()->add($master);
234 234
 			$master->ensureChildControls();
235 235
 			foreach($this->_contents as $id=>$content)
236
-				$master->injectContent($id,$content);
236
+				$master->injectContent($id, $content);
237 237
 		}
238 238
 		else if(!empty($this->_contents))
239
-			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
239
+			throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this));
240 240
 		parent::initRecursive($namingContainer);
241 241
 	}
242 242
         
@@ -247,38 +247,38 @@  discard block
 block discarded – undo
247 247
          * @param Boolean $throwExceptions Wheter or not to throw exceptions
248 248
          * @author Daniel Sampedro <[email protected]>
249 249
          */
250
-        public function tryToUpdateView($arObj, $throwExceptions = false)
250
+        public function tryToUpdateView($arObj, $throwExceptions=false)
251 251
         {
252
-                $objAttrs = get_class_vars(get_class($arObj));
253
-                foreach (array_keys($objAttrs) as $key)
252
+                $objAttrs=get_class_vars(get_class($arObj));
253
+                foreach(array_keys($objAttrs) as $key)
254 254
                 {
255 255
                         try
256 256
                         {
257
-                                if ($key != "RELATIONS")
257
+                                if($key!="RELATIONS")
258 258
                                 {
259
-                                        $control = $this->{$key};
260
-                                        if ($control instanceof TTextBox)
261
-                                                $control->Text = $arObj->{$key};
262
-                                        elseif ($control instanceof TCheckBox)
263
-                                                $control->Checked = (boolean) $arObj->{$key};
264
-                                        elseif ($control instanceof TDatePicker)
265
-                                                $control->Date = $arObj->{$key};
259
+                                        $control=$this->{$key};
260
+                                        if($control instanceof TTextBox)
261
+                                                $control->Text=$arObj->{$key};
262
+                                        elseif($control instanceof TCheckBox)
263
+                                                $control->Checked=(boolean) $arObj->{$key};
264
+                                        elseif($control instanceof TDatePicker)
265
+                                                $control->Date=$arObj->{$key};
266 266
                                 }
267 267
                                 else
268 268
                                 {
269
-                                        foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
269
+                                        foreach($objAttrs["RELATIONS"] as $relKey => $relValues)
270 270
                                         {
271
-                                                $relControl = $this->{$relKey};
272
-                                                switch ($relValues[0])
271
+                                                $relControl=$this->{$relKey};
272
+                                                switch($relValues[0])
273 273
                                                 {
274 274
                                                         case TActiveRecord::BELONGS_TO:
275 275
                                                         case TActiveRecord::HAS_ONE:
276
-                                                                $relControl->Text = $arObj->{$relKey};
276
+                                                                $relControl->Text=$arObj->{$relKey};
277 277
                                                                 break;
278 278
                                                         case TActiveRecord::HAS_MANY:
279
-                                                                if ($relControl instanceof TListControl)
279
+                                                                if($relControl instanceof TListControl)
280 280
                                                                 {
281
-                                                                        $relControl->DataSource = $arObj->{$relKey};
281
+                                                                        $relControl->DataSource=$arObj->{$relKey};
282 282
                                                                         $relControl->dataBind();
283 283
                                                                 }
284 284
                                                                 break;
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
                                         break;
288 288
                                 }
289 289
                         } 
290
-                        catch (Exception $ex)
290
+                        catch(Exception $ex)
291 291
                         {
292
-                                if ($throwExceptions)
292
+                                if($throwExceptions)
293 293
                                         throw $ex;
294 294
                         }
295 295
                 }
@@ -301,26 +301,26 @@  discard block
 block discarded – undo
301 301
          * @param Boolean $throwExceptions Wheter or not to throw exceptions
302 302
          * @author Daniel Sampedro <[email protected]>
303 303
          */
304
-        public function tryToUpdateAR($arObj, $throwExceptions = false)
304
+        public function tryToUpdateAR($arObj, $throwExceptions=false)
305 305
         {
306
-                $objAttrs = get_class_vars(get_class($arObj));
307
-                foreach (array_keys($objAttrs) as $key)
306
+                $objAttrs=get_class_vars(get_class($arObj));
307
+                foreach(array_keys($objAttrs) as $key)
308 308
                 {
309 309
                         try
310 310
                         {
311
-                                if ($key == "RELATIONS")
311
+                                if($key=="RELATIONS")
312 312
                                         break;
313
-                                $control = $this->{$key};
314
-                                if ($control instanceof TTextBox)
315
-                                        $arObj->{$key} = $control->Text;
316
-                                elseif ($control instanceof TCheckBox)
317
-                                        $arObj->{$key} = $control->Checked;
318
-                                elseif ($control instanceof TDatePicker)
319
-                                        $arObj->{$key} = $control->Date;
313
+                                $control=$this->{$key};
314
+                                if($control instanceof TTextBox)
315
+                                        $arObj->{$key}=$control->Text;
316
+                                elseif($control instanceof TCheckBox)
317
+                                        $arObj->{$key}=$control->Checked;
318
+                                elseif($control instanceof TDatePicker)
319
+                                        $arObj->{$key}=$control->Date;
320 320
                         } 
321
-                        catch (Exception $ex)
321
+                        catch(Exception $ex)
322 322
                         {
323
-                                if ($throwExceptions)
323
+                                if($throwExceptions)
324 324
                                         throw $ex;
325 325
                         }
326 326
                 }
Please login to merge, or discard this patch.
framework/TApplication.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -602,7 +602,7 @@
 block discarded – undo
602 602
 
603 603
  	/**
604 604
  	 * @param string the application configuration type. 'xml' and 'php' are valid values
605
-	 */
605
+ 	 */
606 606
 	public function setConfigurationType($value)
607 607
 	{
608 608
 		$this->_configType = $value;
Please login to merge, or discard this patch.
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -325,6 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * to determine the application configuration file,
326 326
 	 * application root path and the runtime path.
327 327
 	 * @param string the application root path or the application configuration file
328
+	 * @param string $basePath
328 329
 	 * @see setBasePath
329 330
 	 * @see setRuntimePath
330 331
 	 * @see setConfigurationFile
@@ -423,6 +424,7 @@  discard block
 block discarded – undo
423 424
 	 * A global value is one that is persistent across users sessions and requests.
424 425
 	 * @param string the name of the value to be returned
425 426
 	 * @param mixed the default value. If $key is not found, $defaultValue will be returned
427
+	 * @param integer $defaultValue
426 428
 	 * @return mixed the global value corresponding to $key
427 429
 	 */
428 430
 	public function getGlobalState($key,$defaultValue=null)
@@ -439,6 +441,7 @@  discard block
 block discarded – undo
439 441
 	 * @param mixed the global value to be set
440 442
 	 * @param mixed the default value. If $key is not found, $defaultValue will be returned
441 443
 	 * @param boolean wheter to force an immediate GlobalState save. defaults to false
444
+	 * @param string $key
442 445
 	 */
443 446
 	public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false)
444 447
 	{
@@ -553,6 +556,7 @@  discard block
 block discarded – undo
553 556
 
554 557
 	/**
555 558
 	 * @param string the directory containing the application configuration file
559
+	 * @param string $value
556 560
 	 */
557 561
 	public function setBasePath($value)
558 562
 	{
@@ -569,6 +573,7 @@  discard block
 block discarded – undo
569 573
 
570 574
 	/**
571 575
 	 * @param string the application configuration file (absolute path)
576
+	 * @param string $value
572 577
 	 */
573 578
 	public function setConfigurationFile($value)
574 579
 	{
@@ -585,6 +590,7 @@  discard block
 block discarded – undo
585 590
 
586 591
  	/**
587 592
  	 * @param string the application configuration type. 'xml' and 'php' are valid values
593
+ 	 * @param string $value
588 594
 	 */
589 595
 	public function setConfigurationType($value)
590 596
 	{
@@ -640,6 +646,7 @@  discard block
 block discarded – undo
640 646
 
641 647
 	/**
642 648
 	 * @param string the directory storing cache data and application-level persistent data. (absolute path)
649
+	 * @param string $value
643 650
 	 */
644 651
 	public function setRuntimePath($value)
645 652
 	{
@@ -1071,6 +1078,7 @@  discard block
 block discarded – undo
1071 1078
 	 * The service instance will be created. Its properties will be initialized
1072 1079
 	 * and the configurations will be applied, if any.
1073 1080
 	 * @param string service ID
1081
+	 * @param string $serviceID
1074 1082
 	 */
1075 1083
 	public function startService($serviceID)
1076 1084
 	{
@@ -1109,6 +1117,7 @@  discard block
 block discarded – undo
1109 1117
 	 * This method is invoked when an exception is raised during the lifecycles
1110 1118
 	 * of the application.
1111 1119
 	 * @param mixed event parameter
1120
+	 * @param \Exception $param
1112 1121
 	 */
1113 1122
 	public function onError($param)
1114 1123
 	{
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -340,8 +340,7 @@  discard block
 block discarded – undo
340 340
 		{
341 341
 			$configFile=$basePath;
342 342
 			$basePath=dirname($configFile);
343
-		}
344
-		else
343
+		} else
345 344
 			$configFile=null;
346 345
 
347 346
 		// determine runtime path
@@ -361,8 +360,7 @@  discard block
 block discarded – undo
361 360
 			}
362 361
 			$this->setBasePath($basePath);
363 362
 			$this->setRuntimePath($runtimePath);
364
-		}
365
-		else
363
+		} else
366 364
 			throw new TConfigurationException('application_runtimepath_invalid',$runtimePath);
367 365
 
368 366
 	}
@@ -391,8 +389,7 @@  discard block
 block discarded – undo
391 389
 				$this->$method();
392 390
 				$this->_step++;
393 391
 			}
394
-		}
395
-		catch(\Exception $e)
392
+		} catch(\Exception $e)
396 393
 		{
397 394
 			$this->onError($e);
398 395
 		}
@@ -993,8 +990,7 @@  discard block
 block discarded – undo
993 990
 				foreach($parameter[1] as $name=>$value)
994 991
 					$component->setSubProperty($name,$value);
995 992
 				$this->_parameters->add($id,$component);
996
-			}
997
-			else
993
+			} else
998 994
 				$this->_parameters->add($id,$parameter);
999 995
 		}
1000 996
 
@@ -1053,8 +1049,7 @@  discard block
 block discarded – undo
1053 1049
 				$config->loadFromFile($this->_configFile);
1054 1050
 				if($this->_cacheFile!==null)
1055 1051
 					file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
1056
-			}
1057
-			else
1052
+			} else
1058 1053
 				$config=unserialize(file_get_contents($this->_cacheFile));
1059 1054
 
1060 1055
 			$this->applyConfiguration($config,false);
@@ -1099,8 +1094,7 @@  discard block
 block discarded – undo
1099 1094
 			}
1100 1095
 
1101 1096
 			$service->init($configElement);
1102
-		}
1103
-		else
1097
+		} else
1104 1098
 			throw new THttpException(500,'application_service_unknown',$serviceID);
1105 1099
 	}
1106 1100
 
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	/**
117 117
 	 * Configuration file type, application.xml and config.xml
118 118
 	 */
119
-	const CONFIG_TYPE_XML = 'xml';
119
+	const CONFIG_TYPE_XML='xml';
120 120
 	/**
121 121
 	 * Application configuration file name
122 122
 	 */
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	/**
129 129
 	 * Configuration file type, application.php and config.php
130 130
 	 */
131
-	const CONFIG_TYPE_PHP = 'php';
131
+	const CONFIG_TYPE_PHP='php';
132 132
 	/**
133 133
 	 * Runtime directory name
134 134
 	 */
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	/**
282 282
 	 * @var string Customizable page service ID
283 283
 	 */
284
-	private $_pageServiceID = self::PAGE_SERVICE_ID;
284
+	private $_pageServiceID=self::PAGE_SERVICE_ID;
285 285
 
286 286
 	/**
287 287
 	 * Constructor.
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 * @param boolean whether to cache application configuration. Defaults to true.
302 302
 	 * @throws TConfigurationException if configuration file cannot be read or the runtime path is invalid.
303 303
 	 */
304
-	public function __construct($basePath='protected',$cacheConfig=true, $configType=self::CONFIG_TYPE_XML)
304
+	public function __construct($basePath='protected', $cacheConfig=true, $configType=self::CONFIG_TYPE_XML)
305 305
 	{
306 306
 		// register application as a singleton
307 307
 		Prado::setApplication($this);
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 		// generates unique ID by hashing the runtime path
315 315
 		$this->_uniqueID=md5($this->_runtimePath);
316 316
 		$this->_parameters=new \Prado\Collections\TMap;
317
-		$this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null));
317
+		$this->_services=array($this->getPageServiceID()=>array('TPageService', array(), null));
318 318
 
319
-		Prado::setPathOfAlias('Application',$this->_basePath);
319
+		Prado::setPathOfAlias('Application', $this->_basePath);
320 320
 	}
321 321
 
322 322
 	/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	{
334 334
 		// determine configuration path and file
335 335
 		if(empty($basePath) || ($basePath=realpath($basePath))===false)
336
-			throw new TConfigurationException('application_basepath_invalid',$basePath);
336
+			throw new TConfigurationException('application_basepath_invalid', $basePath);
337 337
 		if(is_dir($basePath) && is_file($basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName()))
338 338
 			$configFile=$basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName();
339 339
 		else if(is_file($basePath))
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				if(!is_dir($runtimePath))
355 355
 				{
356 356
 					if(@mkdir($runtimePath)===false)
357
-						throw new TConfigurationException('application_runtimepath_failed',$runtimePath);
357
+						throw new TConfigurationException('application_runtimepath_failed', $runtimePath);
358 358
 					@chmod($runtimePath, PRADO_CHMOD); //make it deletable
359 359
 				}
360 360
 				$this->setConfigurationFile($configFile);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			$this->setRuntimePath($runtimePath);
364 364
 		}
365 365
 		else
366
-			throw new TConfigurationException('application_runtimepath_invalid',$runtimePath);
366
+			throw new TConfigurationException('application_runtimepath_invalid', $runtimePath);
367 367
 
368 368
 	}
369 369
 
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
 			$n=count(self::$_steps);
381 381
 			$this->_step=0;
382 382
 			$this->_requestCompleted=false;
383
-			while($this->_step<$n)
383
+			while($this->_step < $n)
384 384
 			{
385 385
 				if($this->_mode===self::STATE_OFF)
386
-					throw new THttpException(503,'application_unavailable');
386
+					throw new THttpException(503, 'application_unavailable');
387 387
 				if($this->_requestCompleted)
388 388
 					break;
389 389
 				$method=self::$_steps[$this->_step];
390
-				Prado::trace("Executing $method()",'Prado\TApplication');
390
+				Prado::trace("Executing $method()", 'Prado\TApplication');
391 391
 				$this->$method();
392 392
 				$this->_step++;
393 393
 			}
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
 	 * @param mixed the default value. If $key is not found, $defaultValue will be returned
426 426
 	 * @return mixed the global value corresponding to $key
427 427
 	 */
428
-	public function getGlobalState($key,$defaultValue=null)
428
+	public function getGlobalState($key, $defaultValue=null)
429 429
 	{
430
-		return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue;
430
+		return isset($this->_globals[$key]) ? $this->_globals[$key] : $defaultValue;
431 431
 	}
432 432
 
433 433
 	/**
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @param mixed the default value. If $key is not found, $defaultValue will be returned
441 441
 	 * @param boolean wheter to force an immediate GlobalState save. defaults to false
442 442
 	 */
443
-	public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false)
443
+	public function setGlobalState($key, $value, $defaultValue=null, $forceSave=false)
444 444
 	{
445 445
 		$this->_stateChanged=true;
446 446
 		if($value===$defaultValue)
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 */
541 541
 	public function setMode($value)
542 542
 	{
543
-		$this->_mode=TPropertyValue::ensureEnum($value,'\Prado\TApplicationMode');
543
+		$this->_mode=TPropertyValue::ensureEnum($value, '\Prado\TApplicationMode');
544 544
 	}
545 545
 
546 546
 	/**
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 	 */
589 589
 	public function setConfigurationType($value)
590 590
 	{
591
-		$this->_configType = $value;
591
+		$this->_configType=$value;
592 592
 	}
593 593
 
594 594
 	/**
@@ -601,10 +601,10 @@  discard block
 block discarded – undo
601 601
 			switch($this->_configType)
602 602
 			{
603 603
 				case TApplication::CONFIG_TYPE_PHP:
604
-					$this->_configFileExt = TApplication::CONFIG_FILE_EXT_PHP;
604
+					$this->_configFileExt=TApplication::CONFIG_FILE_EXT_PHP;
605 605
 					break;
606 606
 				default:
607
-					$this->_configFileExt = TApplication::CONFIG_FILE_EXT_XML;
607
+					$this->_configFileExt=TApplication::CONFIG_FILE_EXT_XML;
608 608
 			}
609 609
 		}
610 610
 		return $this->_configFileExt;
@@ -616,15 +616,15 @@  discard block
 block discarded – undo
616 616
 	public function getConfigurationFileName()
617 617
 	{
618 618
 		static $fileName;
619
-		if($fileName == null)
619
+		if($fileName==null)
620 620
 		{
621 621
 			switch($this->_configType)
622 622
 			{
623 623
 				case TApplication::CONFIG_TYPE_PHP:
624
-					$fileName = TApplication::CONFIG_FILE_PHP;
624
+					$fileName=TApplication::CONFIG_FILE_PHP;
625 625
 					break;
626 626
 				default:
627
-					$fileName = TApplication::CONFIG_FILE_XML;
627
+					$fileName=TApplication::CONFIG_FILE_XML;
628 628
 			}
629 629
 		}
630 630
 		return $fileName;
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 	public function setModule($id, IModule $module=null)
676 676
 	{
677 677
 		if(isset($this->_modules[$id]))
678
-			throw new TConfigurationException('application_moduleid_duplicated',$id);
678
+			throw new TConfigurationException('application_moduleid_duplicated', $id);
679 679
 		else
680 680
 			$this->_modules[$id]=$module;
681 681
 	}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 		// force loading of a lazy module
692 692
 		if($this->_modules[$id]===null)
693 693
 		{
694
-			$module = $this->internalLoadModule($id, true);
694
+			$module=$this->internalLoadModule($id, true);
695 695
 			$module[0]->init($module[1]);
696 696
 		}
697 697
 
@@ -940,37 +940,37 @@  discard block
 block discarded – undo
940 940
 		list($moduleClass, $initProperties, $configElement)=$this->_lazyModules[$id];
941 941
 		if(isset($initProperties['lazy']) && $initProperties['lazy'] && !$force)
942 942
 		{
943
-			Prado::trace("Postponed loading of lazy module $id ({$moduleClass})",'\Prado\TApplication');
943
+			Prado::trace("Postponed loading of lazy module $id ({$moduleClass})", '\Prado\TApplication');
944 944
 			$this->setModule($id, null);
945 945
 			return null;
946 946
 		}
947 947
 
948
-		Prado::trace("Loading module $id ({$moduleClass})",'\Prado\TApplication');
948
+		Prado::trace("Loading module $id ({$moduleClass})", '\Prado\TApplication');
949 949
 		$module=Prado::createComponent($moduleClass);
950 950
 		foreach($initProperties as $name=>$value)
951 951
 		{
952 952
 			if($name==='lazy') continue;
953
-			$module->setSubProperty($name,$value);
953
+			$module->setSubProperty($name, $value);
954 954
 		}
955
-		$this->setModule($id,$module);
955
+		$this->setModule($id, $module);
956 956
 		// keep the key to avoid reuse of the old module id
957 957
 		$this->_lazyModules[$id]=null;
958 958
 
959
-		return array($module,$configElement);
959
+		return array($module, $configElement);
960 960
 	}
961 961
 	/**
962 962
 	 * Applies an application configuration.
963 963
 	 * @param TApplicationConfiguration the configuration
964 964
 	 * @param boolean whether the configuration is specified within a service.
965 965
 	 */
966
-	public function applyConfiguration($config,$withinService=false)
966
+	public function applyConfiguration($config, $withinService=false)
967 967
 	{
968 968
 		if($config->getIsEmpty())
969 969
 			return;
970 970
 
971 971
 		// set path aliases and using namespaces
972 972
 		foreach($config->getAliases() as $alias=>$path)
973
-			Prado::setPathOfAlias($alias,$path);
973
+			Prado::setPathOfAlias($alias, $path);
974 974
 		foreach($config->getUsings() as $using)
975 975
 			Prado::using($using);
976 976
 
@@ -978,11 +978,11 @@  discard block
 block discarded – undo
978 978
 		if(!$withinService)
979 979
 		{
980 980
 			foreach($config->getProperties() as $name=>$value)
981
-				$this->setSubProperty($name,$value);
981
+				$this->setSubProperty($name, $value);
982 982
 		}
983 983
 
984 984
 		if(empty($this->_services))
985
-			$this->_services=array($this->getPageServiceID()=>array('Prado\Web\Services\TPageService',array(),null));
985
+			$this->_services=array($this->getPageServiceID()=>array('Prado\Web\Services\TPageService', array(), null));
986 986
 
987 987
 		// load parameters
988 988
 		foreach($config->getParameters() as $id=>$parameter)
@@ -991,11 +991,11 @@  discard block
 block discarded – undo
991 991
 			{
992 992
 				$component=Prado::createComponent($parameter[0]);
993 993
 				foreach($parameter[1] as $name=>$value)
994
-					$component->setSubProperty($name,$value);
995
-				$this->_parameters->add($id,$component);
994
+					$component->setSubProperty($name, $value);
995
+				$this->_parameters->add($id, $component);
996 996
 			}
997 997
 			else
998
-				$this->_parameters->add($id,$parameter);
998
+				$this->_parameters->add($id, $parameter);
999 999
 		}
1000 1000
 
1001 1001
 		// load and init modules specified in app config
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			if(!is_string($id))
1006 1006
 				$id='_module'.count($this->_lazyModules);
1007 1007
 			$this->_lazyModules[$id]=$moduleConfig;
1008
-			if($module = $this->internalLoadModule($id))
1008
+			if($module=$this->internalLoadModule($id))
1009 1009
 				$modules[]=$module;
1010 1010
 		}
1011 1011
 		foreach($modules as $module)
@@ -1022,12 +1022,12 @@  discard block
 block discarded – undo
1022 1022
 				$condition=$this->evaluateExpression($condition);
1023 1023
 			if($condition)
1024 1024
 			{
1025
-				if(($path=Prado::getPathOfNamespace($filePath,$this->getConfigurationFileExt()))===null || !is_file($path))
1026
-					throw new TConfigurationException('application_includefile_invalid',$filePath);
1025
+				if(($path=Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt()))===null || !is_file($path))
1026
+					throw new TConfigurationException('application_includefile_invalid', $filePath);
1027 1027
 				$cn=$this->getApplicationConfigurationClass();
1028 1028
 				$c=new $cn;
1029 1029
 				$c->loadFromFile($path);
1030
-				$this->applyConfiguration($c,$withinService);
1030
+				$this->applyConfiguration($c, $withinService);
1031 1031
 			}
1032 1032
 		}
1033 1033
 	}
@@ -1043,21 +1043,21 @@  discard block
 block discarded – undo
1043 1043
 	 */
1044 1044
 	protected function initApplication()
1045 1045
 	{
1046
-		Prado::trace('Initializing application','Prado\TApplication');
1046
+		Prado::trace('Initializing application', 'Prado\TApplication');
1047 1047
 
1048 1048
 		if($this->_configFile!==null)
1049 1049
 		{
1050
-			if($this->_cacheFile===null || @filemtime($this->_cacheFile)<filemtime($this->_configFile))
1050
+			if($this->_cacheFile===null || @filemtime($this->_cacheFile) < filemtime($this->_configFile))
1051 1051
 			{
1052 1052
 				$config=new TApplicationConfiguration;
1053 1053
 				$config->loadFromFile($this->_configFile);
1054 1054
 				if($this->_cacheFile!==null)
1055
-					file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
1055
+					file_put_contents($this->_cacheFile, serialize($config), LOCK_EX);
1056 1056
 			}
1057 1057
 			else
1058 1058
 				$config=unserialize(file_get_contents($this->_cacheFile));
1059 1059
 
1060
-			$this->applyConfiguration($config,false);
1060
+			$this->applyConfiguration($config, false);
1061 1061
 		}
1062 1062
 
1063 1063
 		if(($serviceID=$this->getRequest()->resolveRequest(array_keys($this->_services)))===null)
@@ -1076,32 +1076,32 @@  discard block
 block discarded – undo
1076 1076
 	{
1077 1077
 		if(isset($this->_services[$serviceID]))
1078 1078
 		{
1079
-			list($serviceClass,$initProperties,$configElement)=$this->_services[$serviceID];
1079
+			list($serviceClass, $initProperties, $configElement)=$this->_services[$serviceID];
1080 1080
 			$service=Prado::createComponent($serviceClass);
1081 1081
 			if(!($service instanceof IService))
1082
-				throw new THttpException(500,'application_service_invalid',$serviceClass);
1082
+				throw new THttpException(500, 'application_service_invalid', $serviceClass);
1083 1083
 			if(!$service->getEnabled())
1084
-				throw new THttpException(500,'application_service_unavailable',$serviceClass);
1084
+				throw new THttpException(500, 'application_service_unavailable', $serviceClass);
1085 1085
 			$service->setID($serviceID);
1086 1086
 			$this->setService($service);
1087 1087
 
1088 1088
 			foreach($initProperties as $name=>$value)
1089
-				$service->setSubProperty($name,$value);
1089
+				$service->setSubProperty($name, $value);
1090 1090
 
1091 1091
 			if($configElement!==null)
1092 1092
 			{
1093 1093
 				$config=new TApplicationConfiguration;
1094 1094
 				if($this->getConfigurationType()==self::CONFIG_TYPE_PHP)
1095
-					$config->loadFromPhp($configElement,$this->getBasePath());
1095
+					$config->loadFromPhp($configElement, $this->getBasePath());
1096 1096
 				else
1097
-					$config->loadFromXml($configElement,$this->getBasePath());
1098
-				$this->applyConfiguration($config,true);
1097
+					$config->loadFromXml($configElement, $this->getBasePath());
1098
+				$this->applyConfiguration($config, true);
1099 1099
 			}
1100 1100
 
1101 1101
 			$service->init($configElement);
1102 1102
 		}
1103 1103
 		else
1104
-			throw new THttpException(500,'application_service_unknown',$serviceID);
1104
+			throw new THttpException(500, 'application_service_unknown', $serviceID);
1105 1105
 	}
1106 1106
 
1107 1107
 	/**
@@ -1112,9 +1112,9 @@  discard block
 block discarded – undo
1112 1112
 	 */
1113 1113
 	public function onError($param)
1114 1114
 	{
1115
-		Prado::log($param->getMessage(),TLogger::ERROR,'Prado\TApplication');
1116
-		$this->raiseEvent('OnError',$this,$param);
1117
-		$this->getErrorHandler()->handleError($this,$param);
1115
+		Prado::log($param->getMessage(), TLogger::ERROR, 'Prado\TApplication');
1116
+		$this->raiseEvent('OnError', $this, $param);
1117
+		$this->getErrorHandler()->handleError($this, $param);
1118 1118
 	}
1119 1119
 
1120 1120
 	/**
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 	 */
1127 1127
 	public function onBeginRequest()
1128 1128
 	{
1129
-		$this->raiseEvent('OnBeginRequest',$this,null);
1129
+		$this->raiseEvent('OnBeginRequest', $this, null);
1130 1130
 	}
1131 1131
 
1132 1132
 	/**
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 	 */
1136 1136
 	public function onAuthentication()
1137 1137
 	{
1138
-		$this->raiseEvent('OnAuthentication',$this,null);
1138
+		$this->raiseEvent('OnAuthentication', $this, null);
1139 1139
 	}
1140 1140
 
1141 1141
 	/**
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 	 */
1145 1145
 	public function onAuthenticationComplete()
1146 1146
 	{
1147
-		$this->raiseEvent('OnAuthenticationComplete',$this,null);
1147
+		$this->raiseEvent('OnAuthenticationComplete', $this, null);
1148 1148
 	}
1149 1149
 
1150 1150
 	/**
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 	 */
1154 1154
 	public function onAuthorization()
1155 1155
 	{
1156
-		$this->raiseEvent('OnAuthorization',$this,null);
1156
+		$this->raiseEvent('OnAuthorization', $this, null);
1157 1157
 	}
1158 1158
 
1159 1159
 	/**
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 	 */
1163 1163
 	public function onAuthorizationComplete()
1164 1164
 	{
1165
-		$this->raiseEvent('OnAuthorizationComplete',$this,null);
1165
+		$this->raiseEvent('OnAuthorizationComplete', $this, null);
1166 1166
 	}
1167 1167
 
1168 1168
 	/**
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 	public function onLoadState()
1173 1173
 	{
1174 1174
 		$this->loadGlobals();
1175
-		$this->raiseEvent('OnLoadState',$this,null);
1175
+		$this->raiseEvent('OnLoadState', $this, null);
1176 1176
 	}
1177 1177
 
1178 1178
 	/**
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 	 */
1182 1182
 	public function onLoadStateComplete()
1183 1183
 	{
1184
-		$this->raiseEvent('OnLoadStateComplete',$this,null);
1184
+		$this->raiseEvent('OnLoadStateComplete', $this, null);
1185 1185
 	}
1186 1186
 
1187 1187
 	/**
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 	 */
1191 1191
 	public function onPreRunService()
1192 1192
 	{
1193
-		$this->raiseEvent('OnPreRunService',$this,null);
1193
+		$this->raiseEvent('OnPreRunService', $this, null);
1194 1194
 	}
1195 1195
 
1196 1196
 	/**
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 	 */
1209 1209
 	public function onSaveState()
1210 1210
 	{
1211
-		$this->raiseEvent('OnSaveState',$this,null);
1211
+		$this->raiseEvent('OnSaveState', $this, null);
1212 1212
 		$this->saveGlobals();
1213 1213
 	}
1214 1214
 
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 	 */
1219 1219
 	public function onSaveStateComplete()
1220 1220
 	{
1221
-		$this->raiseEvent('OnSaveStateComplete',$this,null);
1221
+		$this->raiseEvent('OnSaveStateComplete', $this, null);
1222 1222
 	}
1223 1223
 
1224 1224
 	/**
@@ -1227,14 +1227,14 @@  discard block
 block discarded – undo
1227 1227
 	 */
1228 1228
 	public function onPreFlushOutput()
1229 1229
 	{
1230
-		$this->raiseEvent('OnPreFlushOutput',$this,null);
1230
+		$this->raiseEvent('OnPreFlushOutput', $this, null);
1231 1231
 	}
1232 1232
 
1233 1233
 	/**
1234 1234
 	 * Flushes output to client side.
1235 1235
 	 * @param boolean whether to continue buffering after flush if buffering was active
1236 1236
 	 */
1237
-	public function flushOutput($continueBuffering = true)
1237
+	public function flushOutput($continueBuffering=true)
1238 1238
 	{
1239 1239
 		$this->getResponse()->flush($continueBuffering);
1240 1240
 	}
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 	public function onEndRequest()
1247 1247
 	{
1248 1248
 		$this->flushOutput(false); // flush all remaining content in the buffer
1249
-		$this->saveGlobals();  // save global state
1250
-		$this->raiseEvent('OnEndRequest',$this,null);
1249
+		$this->saveGlobals(); // save global state
1250
+		$this->raiseEvent('OnEndRequest', $this, null);
1251 1251
 	}
1252 1252
 }
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php 3 patches
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   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 	*/
97 97
 	protected function collectForeignObjects(&$results)
98 98
 	{
99
-		list($sourceKeys, $foreignKeys) = $this->getRelationForeignKeys();
100
-		$properties = array_values($sourceKeys);
101
-		$indexValues = $this->getIndexValues($properties, $results);
102
-		$this->fetchForeignObjects($results, $foreignKeys,$indexValues,$sourceKeys);
99
+		list($sourceKeys, $foreignKeys)=$this->getRelationForeignKeys();
100
+		$properties=array_values($sourceKeys);
101
+		$indexValues=$this->getIndexValues($properties, $results);
102
+		$this->fetchForeignObjects($results, $foreignKeys, $indexValues, $sourceKeys);
103 103
 	}
104 104
 
105 105
 	/**
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function getRelationForeignKeys()
109 109
 	{
110
-		$association = $this->getAssociationTable();
111
-		$sourceKeys = $this->findForeignKeys($association, $this->getSourceRecord(), true);
112
-		$fkObject = $this->getContext()->getForeignRecordFinder();
113
-		$foreignKeys = $this->findForeignKeys($association, $fkObject);
110
+		$association=$this->getAssociationTable();
111
+		$sourceKeys=$this->findForeignKeys($association, $this->getSourceRecord(), true);
112
+		$fkObject=$this->getContext()->getForeignRecordFinder();
113
+		$foreignKeys=$this->findForeignKeys($association, $fkObject);
114 114
 		return array($sourceKeys, $foreignKeys);
115 115
 	}
116 116
 
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
 	{
122 122
 		if($this->_association===null)
123 123
 		{
124
-			$gateway = $this->getSourceRecord()->getRecordGateway();
125
-			$conn = $this->getSourceRecord()->getDbConnection();
124
+			$gateway=$this->getSourceRecord()->getRecordGateway();
125
+			$conn=$this->getSourceRecord()->getDbConnection();
126 126
 			//table name may include the fk column name separated with a dot.
127
-			$table = explode('.', $this->getContext()->getAssociationTable());
128
-			if(count($table)>1)
127
+			$table=explode('.', $this->getContext()->getAssociationTable());
128
+			if(count($table) > 1)
129 129
 			{
130
-				$columns = preg_replace('/^\((.*)\)/', '\1', $table[1]);
131
-				$this->_association_columns = preg_split('/\s*[, ]\*/',$columns);
130
+				$columns=preg_replace('/^\((.*)\)/', '\1', $table[1]);
131
+				$this->_association_columns=preg_split('/\s*[, ]\*/', $columns);
132 132
 			}
133
-			$this->_association = $gateway->getTableInfo($conn, $table[0]);
133
+			$this->_association=$gateway->getTableInfo($conn, $table[0]);
134 134
 		}
135 135
 		return $this->_association;
136 136
 	}
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	{
143 143
 		if($this->_sourceTable===null)
144 144
 		{
145
-			$gateway = $this->getSourceRecord()->getRecordGateway();
146
-			$this->_sourceTable = $gateway->getRecordTableInfo($this->getSourceRecord());
145
+			$gateway=$this->getSourceRecord()->getRecordGateway();
146
+			$this->_sourceTable=$gateway->getRecordTableInfo($this->getSourceRecord());
147 147
 		}
148 148
 		return $this->_sourceTable;
149 149
 	}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	{
156 156
 		if($this->_foreignTable===null)
157 157
 		{
158
-			$gateway = $this->getSourceRecord()->getRecordGateway();
159
-			$fkObject = $this->getContext()->getForeignRecordFinder();
160
-			$this->_foreignTable = $gateway->getRecordTableInfo($fkObject);
158
+			$gateway=$this->getSourceRecord()->getRecordGateway();
159
+			$fkObject=$this->getContext()->getForeignRecordFinder();
160
+			$this->_foreignTable=$gateway->getRecordTableInfo($fkObject);
161 161
 		}
162 162
 		return $this->_foreignTable;
163 163
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function getForeignCommandBuilder()
177 177
 	{
178
-		$obj = $this->getContext()->getForeignRecordFinder();
178
+		$obj=$this->getContext()->getForeignRecordFinder();
179 179
 		return $this->getSourceRecord()->getRecordGateway()->getCommand($obj);
180 180
 	}
181 181
 
@@ -185,21 +185,21 @@  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
-		$criteria = $this->getCriteria();
191
-		$finder = $this->getContext()->getForeignRecordFinder();
192
-		$type = get_class($finder);
193
-		$command = $this->createCommand($criteria, $foreignKeys,$indexValues,$sourceKeys);
194
-		$srcProps = array_keys($sourceKeys);
190
+		$criteria=$this->getCriteria();
191
+		$finder=$this->getContext()->getForeignRecordFinder();
192
+		$type=get_class($finder);
193
+		$command=$this->createCommand($criteria, $foreignKeys, $indexValues, $sourceKeys);
194
+		$srcProps=array_keys($sourceKeys);
195 195
 		$collections=array();
196 196
 		foreach($this->getCommandBuilder()->onExecuteCommand($command, $command->query()) as $row)
197 197
 		{
198
-			$hash = $this->getObjectHash($row, $srcProps);
198
+			$hash=$this->getObjectHash($row, $srcProps);
199 199
 			foreach($srcProps as $column)
200 200
 				unset($row[$column]);
201
-			$obj = $this->createFkObject($type,$row,$foreignKeys);
202
-			$collections[$hash][] = $obj;
201
+			$obj=$this->createFkObject($type, $row, $foreignKeys);
202
+			$collections[$hash][]=$obj;
203 203
 		}
204 204
 		$this->setResultCollection($results, $collections, array_values($sourceKeys));
205 205
 	}
@@ -210,9 +210,9 @@  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
-		$obj = TActiveRecord::createRecord($type, $row);
215
+		$obj=TActiveRecord::createRecord($type, $row);
216 216
 		if(count($this->_association_columns) > 0)
217 217
 		{
218 218
 			$i=0;
@@ -228,22 +228,22 @@  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);
234
-		$fkTable = $this->getForeignTable()->getTableFullName();
235
-		$srcColumns = $this->getSourceColumns($sourceKeys);
233
+		$innerJoin=$this->getAssociationJoin($foreignKeys, $indexValues, $sourceKeys);
234
+		$fkTable=$this->getForeignTable()->getTableFullName();
235
+		$srcColumns=$this->getSourceColumns($sourceKeys);
236 236
 		if(($where=$criteria->getCondition())===null)
237 237
 			$where='1=1';
238
-		$sql = "SELECT {$fkTable}.*, {$srcColumns} FROM {$fkTable} {$innerJoin} WHERE {$where}";
238
+		$sql="SELECT {$fkTable}.*, {$srcColumns} FROM {$fkTable} {$innerJoin} WHERE {$where}";
239 239
 
240
-		$parameters = $criteria->getParameters()->toArray();
241
-		$ordering = $criteria->getOrdersBy();
242
-		$limit = $criteria->getLimit();
243
-		$offset = $criteria->getOffset();
240
+		$parameters=$criteria->getParameters()->toArray();
241
+		$ordering=$criteria->getOrdersBy();
242
+		$limit=$criteria->getLimit();
243
+		$offset=$criteria->getOffset();
244 244
 
245
-		$builder = $this->getForeignCommandBuilder()->getBuilder();
246
-		$command = $builder->applyCriterias($sql,$parameters,$ordering,$limit,$offset);
245
+		$builder=$this->getForeignCommandBuilder()->getBuilder();
246
+		$command=$builder->applyCriterias($sql, $parameters, $ordering, $limit, $offset);
247 247
 		$this->getCommandBuilder()->onCreateCommand($command, $criteria);
248 248
 		return $command;
249 249
 	}
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 	protected function getSourceColumns($sourceKeys)
256 256
 	{
257 257
 		$columns=array();
258
-		$table = $this->getAssociationTable();
259
-		$tableName = $table->getTableFullName();
260
-		$columnNames = array_merge(array_keys($sourceKeys),$this->_association_columns);
258
+		$table=$this->getAssociationTable();
259
+		$tableName=$table->getTableFullName();
260
+		$columnNames=array_merge(array_keys($sourceKeys), $this->_association_columns);
261 261
 		foreach($columnNames as $name)
262
-			$columns[] = $tableName.'.'.$table->getColumn($name)->getColumnName();
262
+			$columns[]=$tableName.'.'.$table->getColumn($name)->getColumnName();
263 263
 		return implode(', ', $columns);
264 264
 	}
265 265
 
@@ -270,28 +270,28 @@  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();
276
-		$fkInfo = $this->getForeignTable();
275
+		$refInfo=$this->getAssociationTable();
276
+		$fkInfo=$this->getForeignTable();
277 277
 
278
-		$refTable = $refInfo->getTableFullName();
279
-		$fkTable = $fkInfo->getTableFullName();
278
+		$refTable=$refInfo->getTableFullName();
279
+		$fkTable=$fkInfo->getTableFullName();
280 280
 
281
-		$joins = array();
282
-		$hasAssociationColumns = count($this->_association_columns) > 0;
281
+		$joins=array();
282
+		$hasAssociationColumns=count($this->_association_columns) > 0;
283 283
 		$i=0;
284 284
 		foreach($foreignKeys as $ref=>$fk)
285 285
 		{
286 286
 			if($hasAssociationColumns)
287
-				$refField = $refInfo->getColumn($this->_association_columns[$i++])->getColumnName();
287
+				$refField=$refInfo->getColumn($this->_association_columns[$i++])->getColumnName();
288 288
 			else
289
-				$refField = $refInfo->getColumn($ref)->getColumnName();
290
-			$fkField = $fkInfo->getColumn($fk)->getColumnName();
291
-			$joins[] = "{$fkTable}.{$fkField} = {$refTable}.{$refField}";
289
+				$refField=$refInfo->getColumn($ref)->getColumnName();
290
+			$fkField=$fkInfo->getColumn($fk)->getColumnName();
291
+			$joins[]="{$fkTable}.{$fkField} = {$refTable}.{$refField}";
292 292
 		}
293
-		$joinCondition = implode(' AND ', $joins);
294
-		$index = $this->getCommandBuilder()->getIndexKeyCondition($refInfo,array_keys($sourceKeys), $indexValues);
293
+		$joinCondition=implode(' AND ', $joins);
294
+		$index=$this->getCommandBuilder()->getIndexKeyCondition($refInfo, array_keys($sourceKeys), $indexValues);
295 295
 		return "INNER JOIN {$refTable} ON ({$joinCondition}) AND {$index}";
296 296
 	}
297 297
 
@@ -301,15 +301,15 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function updateAssociatedRecords()
303 303
 	{
304
-		$obj = $this->getContext()->getSourceRecord();
305
-		$fkObjects = &$obj->{$this->getContext()->getProperty()};
304
+		$obj=$this->getContext()->getSourceRecord();
305
+		$fkObjects=&$obj->{$this->getContext()->getProperty()};
306 306
 		$success=true;
307
-		if(($total = count($fkObjects))> 0)
307
+		if(($total=count($fkObjects)) > 0)
308 308
 		{
309
-			$source = $this->getSourceRecord();
310
-			$builder = $this->getAssociationTableCommandBuilder();
311
-			for($i=0;$i<$total;$i++)
312
-				$success = $fkObjects[$i]->save() && $success;
309
+			$source=$this->getSourceRecord();
310
+			$builder=$this->getAssociationTableCommandBuilder();
311
+			for($i=0; $i < $total; $i++)
312
+				$success=$fkObjects[$i]->save() && $success;
313 313
 			return $this->updateAssociationTable($obj, $fkObjects, $builder) && $success;
314 314
 		}
315 315
 		return $success;
@@ -320,57 +320,57 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	protected function getAssociationTableCommandBuilder()
322 322
 	{
323
-		$conn = $this->getContext()->getSourceRecord()->getDbConnection();
323
+		$conn=$this->getContext()->getSourceRecord()->getDbConnection();
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 329
 		$condition=array();
330
-		$table = $this->getAssociationTable();
330
+		$table=$this->getAssociationTable();
331 331
 		foreach($data as $name=>$value)
332
-			$condition[] = $table->getColumn($name)->getColumnName().' = ?';
333
-		$command = $builder->createCountCommand(implode(' AND ', $condition),array_values($data));
334
-		$result = $this->getCommandBuilder()->onExecuteCommand($command, intval($command->queryScalar()));
332
+			$condition[]=$table->getColumn($name)->getColumnName().' = ?';
333
+		$command=$builder->createCountCommand(implode(' AND ', $condition), array_values($data));
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
-		$command = $builder->createInsertCommand($data);
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
-		$source = $this->getSourceRecordValues($obj);
347
-		$foreignKeys = $this->findForeignKeys($this->getAssociationTable(), $fkObjects[0]);
346
+		$source=$this->getSourceRecordValues($obj);
347
+		$foreignKeys=$this->findForeignKeys($this->getAssociationTable(), $fkObjects[0]);
348 348
 		$success=true;
349 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
 	}
357 357
 
358 358
 	private function getSourceRecordValues($obj)
359 359
 	{
360
-		$sourceKeys = $this->findForeignKeys($this->getAssociationTable(), $obj);
361
-		$indexValues = $this->getIndexValues(array_values($sourceKeys), $obj);
362
-		$data = array();
360
+		$sourceKeys=$this->findForeignKeys($this->getAssociationTable(), $obj);
361
+		$indexValues=$this->getIndexValues(array_values($sourceKeys), $obj);
362
+		$data=array();
363 363
 		$i=0;
364 364
 		foreach($sourceKeys as $name=>$srcKey)
365
-			$data[$name] = $indexValues[0][$i++];
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 371
 		$data=array();
372 372
 		foreach($foreignKeys as $name=>$fKey)
373
-			$data[$name] = $fkObject->getColumnValue($fKey);
373
+			$data[$name]=$fkObject->getColumnValue($fKey);
374 374
 		return $data;
375 375
 	}
376 376
 }
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	}
166 166
 
167 167
 	/**
168
-	 * @return TDataGatewayCommand
168
+	 * @return \Prado\Data\DataGateway\TDataGatewayCommand
169 169
 	 */
170 170
 	protected function getCommandBuilder()
171 171
 	{
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	}
174 174
 
175 175
 	/**
176
-	 * @return TDataGatewayCommand
176
+	 * @return \Prado\Data\DataGateway\TDataGatewayCommand
177 177
 	 */
178 178
 	protected function getForeignCommandBuilder()
179 179
 	{
@@ -210,6 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @param string active record class name.
211 211
 	 * @param array row data
212 212
 	 * @param array foreign key column names
213
+	 * @param string $type
213 214
 	 * @return TActiveRecord
214 215
 	 */
215 216
 	protected function createFkObject($type,$row,$foreignKeys)
@@ -343,6 +344,9 @@  discard block
 block discarded – undo
343 344
 		return $this->getCommandBuilder()->onExecuteCommand($command, $command->execute()) > 0;
344 345
 	}
345 346
 
347
+	/**
348
+	 * @param TActiveRecord $obj
349
+	 */
346 350
 	private function updateAssociationTable($obj,$fkObjects, $builder)
347 351
 	{
348 352
 		$source = $this->getSourceRecordValues($obj);
Please login to merge, or discard this patch.