Completed
Push — scrutinizer ( c2ef4a...84e9d0 )
by Fabio
22:07
created
framework/Util/TVarDumper.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -55,6 +55,9 @@
 block discarded – undo
55 55
 			return self::$_output;
56 56
 	}
57 57
 
58
+	/**
59
+	 * @param integer $level
60
+	 */
58 61
 	private static function dumpInternal($var,$level)
59 62
 	{
60 63
 		switch(gettype($var))
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -40,84 +40,84 @@
 block discarded – undo
40 40
 	 * @param integer maximum depth that the dumper should go into the variable. Defaults to 10.
41 41
 	 * @return string the string representation of the variable
42 42
 	 */
43
-	public static function dump($var,$depth=10,$highlight=false)
43
+	public static function dump($var, $depth = 10, $highlight = false)
44 44
 	{
45
-		self::$_output='';
46
-		self::$_objects=array();
47
-		self::$_depth=$depth;
48
-		self::dumpInternal($var,0);
49
-		if($highlight)
45
+		self::$_output = '';
46
+		self::$_objects = array();
47
+		self::$_depth = $depth;
48
+		self::dumpInternal($var, 0);
49
+		if ($highlight)
50 50
 		{
51
-			$result=highlight_string("<?php\n".self::$_output,true);
52
-			return preg_replace('/&lt;\\?php<br \\/>/','',$result,1);
51
+			$result = highlight_string("<?php\n" . self::$_output, true);
52
+			return preg_replace('/&lt;\\?php<br \\/>/', '', $result, 1);
53 53
 		}
54 54
 		else
55 55
 			return self::$_output;
56 56
 	}
57 57
 
58
-	private static function dumpInternal($var,$level)
58
+	private static function dumpInternal($var, $level)
59 59
 	{
60
-		switch(gettype($var))
60
+		switch (gettype($var))
61 61
 		{
62 62
 			case 'boolean':
63
-				self::$_output.=$var?'true':'false';
63
+				self::$_output .= $var ? 'true' : 'false';
64 64
 				break;
65 65
 			case 'integer':
66
-				self::$_output.="$var";
66
+				self::$_output .= "$var";
67 67
 				break;
68 68
 			case 'double':
69
-				self::$_output.="$var";
69
+				self::$_output .= "$var";
70 70
 				break;
71 71
 			case 'string':
72
-				self::$_output.="'$var'";
72
+				self::$_output .= "'$var'";
73 73
 				break;
74 74
 			case 'resource':
75
-				self::$_output.='{resource}';
75
+				self::$_output .= '{resource}';
76 76
 				break;
77 77
 			case 'NULL':
78
-				self::$_output.="null";
78
+				self::$_output .= "null";
79 79
 				break;
80 80
 			case 'unknown type':
81
-				self::$_output.='{unknown}';
81
+				self::$_output .= '{unknown}';
82 82
 				break;
83 83
 			case 'array':
84
-				if(self::$_depth<=$level)
85
-					self::$_output.='array(...)';
86
-				else if(empty($var))
87
-					self::$_output.='array()';
84
+				if (self::$_depth <= $level)
85
+					self::$_output .= 'array(...)';
86
+				else if (empty($var))
87
+					self::$_output .= 'array()';
88 88
 				else
89 89
 				{
90
-					$keys=array_keys($var);
91
-					$spaces=str_repeat(' ',$level*4);
92
-					self::$_output.="array\n".$spaces.'(';
93
-					foreach($keys as $key)
90
+					$keys = array_keys($var);
91
+					$spaces = str_repeat(' ', $level * 4);
92
+					self::$_output .= "array\n" . $spaces . '(';
93
+					foreach ($keys as $key)
94 94
 					{
95
-						self::$_output.="\n".$spaces."    [$key] => ";
96
-						self::$_output.=self::dumpInternal($var[$key],$level+1);
95
+						self::$_output .= "\n" . $spaces . "    [$key] => ";
96
+						self::$_output .= self::dumpInternal($var[$key], $level + 1);
97 97
 					}
98
-					self::$_output.="\n".$spaces.')';
98
+					self::$_output .= "\n" . $spaces . ')';
99 99
 				}
100 100
 				break;
101 101
 			case 'object':
102
-				if(($id=array_search($var,self::$_objects,true))!==false)
103
-					self::$_output.=get_class($var).'#'.($id+1).'(...)';
104
-				else if(self::$_depth<=$level)
105
-					self::$_output.=get_class($var).'(...)';
102
+				if (($id = array_search($var, self::$_objects, true)) !== false)
103
+					self::$_output .= get_class($var) . '#' . ($id + 1) . '(...)';
104
+				else if (self::$_depth <= $level)
105
+					self::$_output .= get_class($var) . '(...)';
106 106
 				else
107 107
 				{
108
-					$id=array_push(self::$_objects,$var);
109
-					$className=get_class($var);
110
-					$members=(array)$var;
111
-					$keys=array_keys($members);
112
-					$spaces=str_repeat(' ',$level*4);
113
-					self::$_output.="$className#$id\n".$spaces.'(';
114
-					foreach($keys as $key)
108
+					$id = array_push(self::$_objects, $var);
109
+					$className = get_class($var);
110
+					$members = (array) $var;
111
+					$keys = array_keys($members);
112
+					$spaces = str_repeat(' ', $level * 4);
113
+					self::$_output .= "$className#$id\n" . $spaces . '(';
114
+					foreach ($keys as $key)
115 115
 					{
116
-						$keyDisplay=strtr(trim($key),array("\0"=>':'));
117
-						self::$_output.="\n".$spaces."    [$keyDisplay] => ";
118
-						self::$_output.=self::dumpInternal($members[$key],$level+1);
116
+						$keyDisplay = strtr(trim($key), array("\0"=>':'));
117
+						self::$_output .= "\n" . $spaces . "    [$keyDisplay] => ";
118
+						self::$_output .= self::dumpInternal($members[$key], $level + 1);
119 119
 					}
120
-					self::$_output.="\n".$spaces.')';
120
+					self::$_output .= "\n" . $spaces . ')';
121 121
 				}
122 122
 				break;
123 123
 		}
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 		{
51 51
 			$result=highlight_string("<?php\n".self::$_output,true);
52 52
 			return preg_replace('/&lt;\\?php<br \\/>/','',$result,1);
53
+		} else {
54
+					return self::$_output;
53 55
 		}
54
-		else
55
-			return self::$_output;
56 56
 	}
57 57
 
58 58
 	private static function dumpInternal($var,$level)
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 				self::$_output.='{unknown}';
82 82
 				break;
83 83
 			case 'array':
84
-				if(self::$_depth<=$level)
85
-					self::$_output.='array(...)';
86
-				else if(empty($var))
87
-					self::$_output.='array()';
88
-				else
84
+				if(self::$_depth<=$level) {
85
+									self::$_output.='array(...)';
86
+				} else if(empty($var)) {
87
+									self::$_output.='array()';
88
+				} else
89 89
 				{
90 90
 					$keys=array_keys($var);
91 91
 					$spaces=str_repeat(' ',$level*4);
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 				}
100 100
 				break;
101 101
 			case 'object':
102
-				if(($id=array_search($var,self::$_objects,true))!==false)
103
-					self::$_output.=get_class($var).'#'.($id+1).'(...)';
104
-				else if(self::$_depth<=$level)
105
-					self::$_output.=get_class($var).'(...)';
106
-				else
102
+				if(($id=array_search($var,self::$_objects,true))!==false) {
103
+									self::$_output.=get_class($var).'#'.($id+1).'(...)';
104
+				} else if(self::$_depth<=$level) {
105
+									self::$_output.=get_class($var).'(...)';
106
+				} else
107 107
 				{
108 108
 					$id=array_push(self::$_objects,$var);
109 109
 					$className=get_class($var);
Please login to merge, or discard this patch.
framework/Web/Javascripts/JSMin.php 4 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -73,6 +73,9 @@  discard block
 block discarded – undo
73 73
 
74 74
   // -- Protected Instance Methods ---------------------------------------------
75 75
 
76
+  /**
77
+   * @param integer $d
78
+   */
76 79
   protected function action($d) {
77 80
     switch($d) {
78 81
       case 1:
@@ -132,6 +135,9 @@  discard block
 block discarded – undo
132 135
     }
133 136
   }
134 137
 
138
+  /**
139
+   * @return string
140
+   */
135 141
   protected function get() {
136 142
     $c = $this->lookAhead;
137 143
     $this->lookAhead = null;
@@ -156,6 +162,9 @@  discard block
 block discarded – undo
156 162
     return ' ';
157 163
   }
158 164
 
165
+  /**
166
+   * @param string $c
167
+   */
159 168
   protected function isAlphaNum($c) {
160 169
     return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
161 170
   }
Please login to merge, or discard this patch.
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -60,229 +60,229 @@
 block discarded – undo
60 60
   // -- Public Static Methods --------------------------------------------------
61 61
 
62 62
   public static function minify($js) {
63
-    $jsmin = new JSMin($js);
64
-    return $jsmin->min();
63
+	$jsmin = new JSMin($js);
64
+	return $jsmin->min();
65 65
   }
66 66
 
67 67
   // -- Public Instance Methods ------------------------------------------------
68 68
 
69 69
   public function __construct($input) {
70
-    $this->input       = str_replace("\r\n", "\n", $input);
71
-    $this->inputLength = strlen($this->input);
70
+	$this->input       = str_replace("\r\n", "\n", $input);
71
+	$this->inputLength = strlen($this->input);
72 72
   }
73 73
 
74 74
   // -- Protected Instance Methods ---------------------------------------------
75 75
 
76 76
   protected function action($d) {
77
-    switch($d) {
78
-      case 1:
79
-        $this->output .= $this->a;
80
-
81
-      case 2:
82
-        $this->a = $this->b;
83
-
84
-        if ($this->a === "'" || $this->a === '"') {
85
-          for (;;) {
86
-            $this->output .= $this->a;
87
-            $this->a       = $this->get();
88
-
89
-            if ($this->a === $this->b) {
90
-              break;
91
-            }
92
-
93
-            if (ord($this->a) <= self::ORD_LF) {
94
-              throw new JSMinException('Unterminated string literal.');
95
-            }
96
-
97
-            if ($this->a === '\\') {
98
-              $this->output .= $this->a;
99
-              $this->a       = $this->get();
100
-            }
101
-          }
102
-        }
103
-
104
-      case 3:
105
-        $this->b = $this->next();
106
-
107
-        if ($this->b === '/' && (
108
-            $this->a === '(' || $this->a === ',' || $this->a === '=' ||
109
-            $this->a === ':' || $this->a === '[' || $this->a === '!' ||
110
-            $this->a === '&' || $this->a === '|' || $this->a === '?')) {
111
-
112
-          $this->output .= $this->a . $this->b;
113
-
114
-          for (;;) {
115
-            $this->a = $this->get();
116
-
117
-            if ($this->a === '/') {
118
-              break;
119
-            } elseif ($this->a === '\\') {
120
-              $this->output .= $this->a;
121
-              $this->a       = $this->get();
122
-            } elseif (ord($this->a) <= self::ORD_LF) {
123
-              throw new JSMinException('Unterminated regular expression '.
124
-                  'literal.');
125
-            }
126
-
127
-            $this->output .= $this->a;
128
-          }
129
-
130
-          $this->b = $this->next();
131
-        }
132
-    }
77
+	switch($d) {
78
+	  case 1:
79
+		$this->output .= $this->a;
80
+
81
+	  case 2:
82
+		$this->a = $this->b;
83
+
84
+		if ($this->a === "'" || $this->a === '"') {
85
+		  for (;;) {
86
+			$this->output .= $this->a;
87
+			$this->a       = $this->get();
88
+
89
+			if ($this->a === $this->b) {
90
+			  break;
91
+			}
92
+
93
+			if (ord($this->a) <= self::ORD_LF) {
94
+			  throw new JSMinException('Unterminated string literal.');
95
+			}
96
+
97
+			if ($this->a === '\\') {
98
+			  $this->output .= $this->a;
99
+			  $this->a       = $this->get();
100
+			}
101
+		  }
102
+		}
103
+
104
+	  case 3:
105
+		$this->b = $this->next();
106
+
107
+		if ($this->b === '/' && (
108
+			$this->a === '(' || $this->a === ',' || $this->a === '=' ||
109
+			$this->a === ':' || $this->a === '[' || $this->a === '!' ||
110
+			$this->a === '&' || $this->a === '|' || $this->a === '?')) {
111
+
112
+		  $this->output .= $this->a . $this->b;
113
+
114
+		  for (;;) {
115
+			$this->a = $this->get();
116
+
117
+			if ($this->a === '/') {
118
+			  break;
119
+			} elseif ($this->a === '\\') {
120
+			  $this->output .= $this->a;
121
+			  $this->a       = $this->get();
122
+			} elseif (ord($this->a) <= self::ORD_LF) {
123
+			  throw new JSMinException('Unterminated regular expression '.
124
+				  'literal.');
125
+			}
126
+
127
+			$this->output .= $this->a;
128
+		  }
129
+
130
+		  $this->b = $this->next();
131
+		}
132
+	}
133 133
   }
134 134
 
135 135
   protected function get() {
136
-    $c = $this->lookAhead;
137
-    $this->lookAhead = null;
138
-
139
-    if ($c === null) {
140
-      if ($this->inputIndex < $this->inputLength) {
141
-        $c = $this->input[$this->inputIndex];
142
-        $this->inputIndex += 1;
143
-      } else {
144
-        $c = null;
145
-      }
146
-    }
147
-
148
-    if ($c === "\r") {
149
-      return "\n";
150
-    }
151
-
152
-    if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
153
-      return $c;
154
-    }
155
-
156
-    return ' ';
136
+	$c = $this->lookAhead;
137
+	$this->lookAhead = null;
138
+
139
+	if ($c === null) {
140
+	  if ($this->inputIndex < $this->inputLength) {
141
+		$c = $this->input[$this->inputIndex];
142
+		$this->inputIndex += 1;
143
+	  } else {
144
+		$c = null;
145
+	  }
146
+	}
147
+
148
+	if ($c === "\r") {
149
+	  return "\n";
150
+	}
151
+
152
+	if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
153
+	  return $c;
154
+	}
155
+
156
+	return ' ';
157 157
   }
158 158
 
159 159
   protected function isAlphaNum($c) {
160
-    return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
160
+	return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
161 161
   }
162 162
 
163 163
   protected function min() {
164
-    $this->a = "\n";
165
-    $this->action(3);
166
-
167
-    while ($this->a !== null) {
168
-      switch ($this->a) {
169
-        case ' ':
170
-          if ($this->isAlphaNum($this->b)) {
171
-            $this->action(1);
172
-          } else {
173
-            $this->action(2);
174
-          }
175
-          break;
176
-
177
-        case "\n":
178
-          switch ($this->b) {
179
-            case '{':
180
-            case '[':
181
-            case '(':
182
-            case '+':
183
-            case '-':
184
-              $this->action(1);
185
-              break;
186
-
187
-            case ' ':
188
-              $this->action(3);
189
-              break;
190
-
191
-            default:
192
-              if ($this->isAlphaNum($this->b)) {
193
-                $this->action(1);
194
-              }
195
-              else {
196
-                $this->action(2);
197
-              }
198
-          }
199
-          break;
200
-
201
-        default:
202
-          switch ($this->b) {
203
-            case ' ':
204
-              if ($this->isAlphaNum($this->a)) {
205
-                $this->action(1);
206
-                break;
207
-              }
208
-
209
-              $this->action(3);
210
-              break;
211
-
212
-            case "\n":
213
-              switch ($this->a) {
214
-                case '}':
215
-                case ']':
216
-                case ')':
217
-                case '+':
218
-                case '-':
219
-                case '"':
220
-                case "'":
221
-                  $this->action(1);
222
-                  break;
223
-
224
-                default:
225
-                  if ($this->isAlphaNum($this->a)) {
226
-                    $this->action(1);
227
-                  }
228
-                  else {
229
-                    $this->action(3);
230
-                  }
231
-              }
232
-              break;
233
-
234
-            default:
235
-              $this->action(1);
236
-              break;
237
-          }
238
-      }
239
-    }
240
-
241
-    return $this->output;
164
+	$this->a = "\n";
165
+	$this->action(3);
166
+
167
+	while ($this->a !== null) {
168
+	  switch ($this->a) {
169
+		case ' ':
170
+		  if ($this->isAlphaNum($this->b)) {
171
+			$this->action(1);
172
+		  } else {
173
+			$this->action(2);
174
+		  }
175
+		  break;
176
+
177
+		case "\n":
178
+		  switch ($this->b) {
179
+			case '{':
180
+			case '[':
181
+			case '(':
182
+			case '+':
183
+			case '-':
184
+			  $this->action(1);
185
+			  break;
186
+
187
+			case ' ':
188
+			  $this->action(3);
189
+			  break;
190
+
191
+			default:
192
+			  if ($this->isAlphaNum($this->b)) {
193
+				$this->action(1);
194
+			  }
195
+			  else {
196
+				$this->action(2);
197
+			  }
198
+		  }
199
+		  break;
200
+
201
+		default:
202
+		  switch ($this->b) {
203
+			case ' ':
204
+			  if ($this->isAlphaNum($this->a)) {
205
+				$this->action(1);
206
+				break;
207
+			  }
208
+
209
+			  $this->action(3);
210
+			  break;
211
+
212
+			case "\n":
213
+			  switch ($this->a) {
214
+				case '}':
215
+				case ']':
216
+				case ')':
217
+				case '+':
218
+				case '-':
219
+				case '"':
220
+				case "'":
221
+				  $this->action(1);
222
+				  break;
223
+
224
+				default:
225
+				  if ($this->isAlphaNum($this->a)) {
226
+					$this->action(1);
227
+				  }
228
+				  else {
229
+					$this->action(3);
230
+				  }
231
+			  }
232
+			  break;
233
+
234
+			default:
235
+			  $this->action(1);
236
+			  break;
237
+		  }
238
+	  }
239
+	}
240
+
241
+	return $this->output;
242 242
   }
243 243
 
244 244
   protected function next() {
245
-    $c = $this->get();
246
-
247
-    if ($c === '/') {
248
-      switch($this->peek()) {
249
-        case '/':
250
-          for (;;) {
251
-            $c = $this->get();
252
-
253
-            if (ord($c) <= self::ORD_LF) {
254
-              return $c;
255
-            }
256
-          }
257
-
258
-        case '*':
259
-          $this->get();
260
-
261
-          for (;;) {
262
-            switch($this->get()) {
263
-              case '*':
264
-                if ($this->peek() === '/') {
265
-                  $this->get();
266
-                  return ' ';
267
-                }
268
-                break;
269
-
270
-              case null:
271
-                throw new JSMinException('Unterminated comment.');
272
-            }
273
-          }
274
-
275
-        default:
276
-          return $c;
277
-      }
278
-    }
279
-
280
-    return $c;
245
+	$c = $this->get();
246
+
247
+	if ($c === '/') {
248
+	  switch($this->peek()) {
249
+		case '/':
250
+		  for (;;) {
251
+			$c = $this->get();
252
+
253
+			if (ord($c) <= self::ORD_LF) {
254
+			  return $c;
255
+			}
256
+		  }
257
+
258
+		case '*':
259
+		  $this->get();
260
+
261
+		  for (;;) {
262
+			switch($this->get()) {
263
+			  case '*':
264
+				if ($this->peek() === '/') {
265
+				  $this->get();
266
+				  return ' ';
267
+				}
268
+				break;
269
+
270
+			  case null:
271
+				throw new JSMinException('Unterminated comment.');
272
+			}
273
+		  }
274
+
275
+		default:
276
+		  return $c;
277
+	  }
278
+	}
279
+
280
+	return $c;
281 281
   }
282 282
 
283 283
   protected function peek() {
284
-    $this->lookAhead = $this->get();
285
-    return $this->lookAhead;
284
+	$this->lookAhead = $this->get();
285
+	return $this->lookAhead;
286 286
   }
287 287
 }
288 288
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
   // -- Protected Instance Methods ---------------------------------------------
75 75
 
76 76
   protected function action($d) {
77
-    switch($d) {
77
+    switch ($d) {
78 78
       case 1:
79 79
         $this->output .= $this->a;
80 80
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
               $this->output .= $this->a;
121 121
               $this->a       = $this->get();
122 122
             } elseif (ord($this->a) <= self::ORD_LF) {
123
-              throw new JSMinException('Unterminated regular expression '.
123
+              throw new JSMinException('Unterminated regular expression ' .
124 124
                   'literal.');
125 125
             }
126 126
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     $c = $this->get();
246 246
 
247 247
     if ($c === '/') {
248
-      switch($this->peek()) {
248
+      switch ($this->peek()) {
249 249
         case '/':
250 250
           for (;;) {
251 251
             $c = $this->get();
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
           $this->get();
260 260
 
261 261
           for (;;) {
262
-            switch($this->get()) {
262
+            switch ($this->get()) {
263 263
               case '*':
264 264
                 if ($this->peek() === '/') {
265 265
                   $this->get();
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -191,8 +191,7 @@  discard block
 block discarded – undo
191 191
             default:
192 192
               if ($this->isAlphaNum($this->b)) {
193 193
                 $this->action(1);
194
-              }
195
-              else {
194
+              } else {
196 195
                 $this->action(2);
197 196
               }
198 197
           }
@@ -224,8 +223,7 @@  discard block
 block discarded – undo
224 223
                 default:
225 224
                   if ($this->isAlphaNum($this->a)) {
226 225
                     $this->action(1);
227
-                  }
228
-                  else {
226
+                  } else {
229 227
                     $this->action(3);
230 228
                   }
231 229
               }
Please login to merge, or discard this patch.
framework/Web/Javascripts/TJavaScript.php 3 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 
95 95
 	/**
96
-	 * @return Marks a string as a javascript function. Once marke, the string is considered as a
96
+	 * @return TJavaScriptLiteral a string as a javascript function. Once marke, the string is considered as a
97 97
 	 * raw javascript function that is not supposed to be encoded by {@link encode}
98 98
 	 */
99 99
 	public static function quoteJsLiteral($js)
@@ -256,6 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @param string string to be decoded
257 257
 	 * @param bool whether to convert returned objects to associative arrays
258 258
 	 * @param int recursion depth
259
+	 * @param string $value
259 260
 	 * @return mixed decoded variable
260 261
 	 */
261 262
 	public static function jsonDecode($value, $assoc = false, $depth = 512)
@@ -298,7 +299,8 @@  discard block
 block discarded – undo
298 299
 	 * Minimize the size of a javascript script.
299 300
 	 * This method is based on Douglas Crockford's JSMin.
300 301
 	 * @param string code that you want to minimzie
301
-	 * @return minimized version of the code
302
+	 * @param string $code
303
+	 * @return string version of the code
302 304
 	 */
303 305
 	public static function JSMin($code)
304 306
 	{
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public static function renderScriptFiles($files)
30 30
 	{
31
-		$str='';
32
-		foreach($files as $file)
33
-			$str.= self::renderScriptFile($file);
31
+		$str = '';
32
+		foreach ($files as $file)
33
+			$str .= self::renderScriptFile($file);
34 34
 		return $str;
35 35
 	}
36 36
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function renderScriptFile($file)
43 43
 	{
44
-		return '<script type="text/javascript" src="'.THttpUtility::htmlEncode($file)."\"></script>\n";
44
+		return '<script type="text/javascript" src="' . THttpUtility::htmlEncode($file) . "\"></script>\n";
45 45
 	}
46 46
 
47 47
 	/**
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public static function renderScriptBlocks($scripts)
53 53
 	{
54
-		if(count($scripts))
55
-			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n",$scripts)."\n/*]]>*/\n</script>\n";
54
+		if (count($scripts))
55
+			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n" . implode("\n", $scripts) . "\n/*]]>*/\n</script>\n";
56 56
 		else
57 57
 			return '';
58 58
 	}
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public static function renderScriptBlocksCallback($scripts)
66 66
 	{
67
-		if(count($scripts))
68
-			return implode("\n",$scripts)."\n";
67
+		if (count($scripts))
68
+			return implode("\n", $scripts) . "\n";
69 69
 		else
70 70
 			return '';
71 71
 	}
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public static function quoteString($js)
91 91
 	{
92
-		return self::jsonEncode($js,JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
92
+		return self::jsonEncode($js, JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
93 93
 	}
94 94
 
95 95
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public static function quoteJsLiteral($js)
100 100
 	{
101
-		if($js instanceof TJavaScriptLiteral)
101
+		if ($js instanceof TJavaScriptLiteral)
102 102
 			return $js;
103 103
 		else
104 104
 			return new TJavaScriptLiteral($js);
@@ -150,47 +150,47 @@  discard block
 block discarded – undo
150 150
 	 * @param boolean wether to encode empty strings too. Default to false for BC.
151 151
 	 * @return string the encoded string
152 152
 	 */
153
-	public static function encode($value,$toMap=true,$encodeEmptyStrings=false)
153
+	public static function encode($value, $toMap = true, $encodeEmptyStrings = false)
154 154
 	{
155
-		if(is_string($value))
155
+		if (is_string($value))
156 156
 			return self::quoteString($value);
157
-		else if(is_bool($value))
158
-			return $value?'true':'false';
159
-		else if(is_array($value))
157
+		else if (is_bool($value))
158
+			return $value ? 'true' : 'false';
159
+		else if (is_array($value))
160 160
 		{
161
-			$results='';
162
-			if(($n=count($value))>0 && array_keys($value)!==range(0,$n-1))
161
+			$results = '';
162
+			if (($n = count($value)) > 0 && array_keys($value) !== range(0, $n - 1))
163 163
 			{
164
-				foreach($value as $k=>$v)
164
+				foreach ($value as $k=>$v)
165 165
 				{
166
-					if($v!=='' || $encodeEmptyStrings)
166
+					if ($v !== '' || $encodeEmptyStrings)
167 167
 					{
168
-						if($results!=='')
169
-							$results.=',';
170
-						$results.="'$k':".self::encode($v,$toMap,$encodeEmptyStrings);
168
+						if ($results !== '')
169
+							$results .= ',';
170
+						$results .= "'$k':" . self::encode($v, $toMap, $encodeEmptyStrings);
171 171
 					}
172 172
 				}
173
-				return '{'.$results.'}';
173
+				return '{' . $results . '}';
174 174
 			}
175 175
 			else
176 176
 			{
177
-				foreach($value as $v)
177
+				foreach ($value as $v)
178 178
 				{
179
-					if($v!=='' || $encodeEmptyStrings)
179
+					if ($v !== '' || $encodeEmptyStrings)
180 180
 					{
181
-						if($results!=='')
182
-							$results.=',';
183
-						$results.=self::encode($v,$toMap, $encodeEmptyStrings);
181
+						if ($results !== '')
182
+							$results .= ',';
183
+						$results .= self::encode($v, $toMap, $encodeEmptyStrings);
184 184
 					}
185 185
 				}
186
-				return '['.$results.']';
186
+				return '[' . $results . ']';
187 187
 			}
188 188
 		}
189
-		else if(is_integer($value))
189
+		else if (is_integer($value))
190 190
 			return "$value";
191
-		else if(is_float($value))
191
+		else if (is_float($value))
192 192
 		{
193
-			switch($value)
193
+			switch ($value)
194 194
 			{
195 195
 				case -INF:
196 196
 					return 'Number.NEGATIVE_INFINITY';
@@ -199,20 +199,20 @@  discard block
 block discarded – undo
199 199
 					return 'Number.POSITIVE_INFINITY';
200 200
 					break;
201 201
 				default:
202
-					$locale=localeConv();
203
-					if($locale['decimal_point']=='.')
202
+					$locale = localeConv();
203
+					if ($locale['decimal_point'] == '.')
204 204
 						return "$value";
205 205
 					else
206 206
 						return str_replace($locale['decimal_point'], '.', "$value");
207 207
 					break;
208 208
 			}
209 209
 		}
210
-		else if(is_object($value))
210
+		else if (is_object($value))
211 211
 			if ($value instanceof TJavaScriptLiteral)
212 212
 				return $value->toJavaScriptLiteral();
213 213
 			else
214
-				return self::encode(get_object_vars($value),$toMap);
215
-		else if($value===null)
214
+				return self::encode(get_object_vars($value), $toMap);
215
+		else if ($value === null)
216 216
 			return 'null';
217 217
 		else
218 218
 			return '';
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public static function jsonEncode($value, $options = 0)
227 227
 	{
228
-		if (($g=Prado::getApplication()->getGlobalization(false))!==null &&
229
-			strtoupper($enc=$g->getCharset())!='UTF-8') {
228
+		if (($g = Prado::getApplication()->getGlobalization(false)) !== null &&
229
+			strtoupper($enc = $g->getCharset()) != 'UTF-8') {
230 230
 			self::convertToUtf8($value, $enc);
231 231
 		}
232 232
 
233
-		$s = @json_encode($value,$options);
233
+		$s = @json_encode($value, $options);
234 234
 		self::checkJsonError();
235 235
 		return $s;
236 236
 	}
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 * @param string $sourceEncoding
242 242
 	 */
243 243
 	private static function convertToUtf8(&$value, $sourceEncoding) {
244
-		if(is_string($value))
245
-			$value=iconv($sourceEncoding, 'UTF-8', $value);
244
+		if (is_string($value))
245
+			$value = iconv($sourceEncoding, 'UTF-8', $value);
246 246
 		else if (is_array($value))
247 247
 		{
248
-			foreach($value as &$element)
248
+			foreach ($value as &$element)
249 249
 				self::convertToUtf8($element, $sourceEncoding);
250 250
 		}
251 251
 	}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public static function jsonDecode($value, $assoc = false, $depth = 512)
262 262
 	{
263
-		$s= @json_decode($value, $assoc, $depth);
263
+		$s = @json_decode($value, $assoc, $depth);
264 264
 		self::checkJsonError();
265 265
 		return $s;
266 266
 	}
Please login to merge, or discard this patch.
Braces   +54 added lines, -47 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 	public static function renderScriptFiles($files)
30 30
 	{
31 31
 		$str='';
32
-		foreach($files as $file)
33
-			$str.= self::renderScriptFile($file);
32
+		foreach($files as $file) {
33
+					$str.= self::renderScriptFile($file);
34
+		}
34 35
 		return $str;
35 36
 	}
36 37
 
@@ -51,10 +52,11 @@  discard block
 block discarded – undo
51 52
 	 */
52 53
 	public static function renderScriptBlocks($scripts)
53 54
 	{
54
-		if(count($scripts))
55
-			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n",$scripts)."\n/*]]>*/\n</script>\n";
56
-		else
57
-			return '';
55
+		if(count($scripts)) {
56
+					return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n",$scripts)."\n/*]]>*/\n</script>\n";
57
+		} else {
58
+					return '';
59
+		}
58 60
 	}
59 61
 
60 62
 	/**
@@ -64,10 +66,11 @@  discard block
 block discarded – undo
64 66
 	 */
65 67
 	public static function renderScriptBlocksCallback($scripts)
66 68
 	{
67
-		if(count($scripts))
68
-			return implode("\n",$scripts)."\n";
69
-		else
70
-			return '';
69
+		if(count($scripts)) {
70
+					return implode("\n",$scripts)."\n";
71
+		} else {
72
+					return '';
73
+		}
71 74
 	}
72 75
 
73 76
 	/**
@@ -98,10 +101,11 @@  discard block
 block discarded – undo
98 101
 	 */
99 102
 	public static function quoteJsLiteral($js)
100 103
 	{
101
-		if($js instanceof TJavaScriptLiteral)
102
-			return $js;
103
-		else
104
-			return new TJavaScriptLiteral($js);
104
+		if($js instanceof TJavaScriptLiteral) {
105
+					return $js;
106
+		} else {
107
+					return new TJavaScriptLiteral($js);
108
+		}
105 109
 	}
106 110
 
107 111
 	/**
@@ -152,11 +156,11 @@  discard block
 block discarded – undo
152 156
 	 */
153 157
 	public static function encode($value,$toMap=true,$encodeEmptyStrings=false)
154 158
 	{
155
-		if(is_string($value))
156
-			return self::quoteString($value);
157
-		else if(is_bool($value))
158
-			return $value?'true':'false';
159
-		else if(is_array($value))
159
+		if(is_string($value)) {
160
+					return self::quoteString($value);
161
+		} else if(is_bool($value)) {
162
+					return $value?'true':'false';
163
+		} else if(is_array($value))
160 164
 		{
161 165
 			$results='';
162 166
 			if(($n=count($value))>0 && array_keys($value)!==range(0,$n-1))
@@ -165,30 +169,30 @@  discard block
 block discarded – undo
165 169
 				{
166 170
 					if($v!=='' || $encodeEmptyStrings)
167 171
 					{
168
-						if($results!=='')
169
-							$results.=',';
172
+						if($results!=='') {
173
+													$results.=',';
174
+						}
170 175
 						$results.="'$k':".self::encode($v,$toMap,$encodeEmptyStrings);
171 176
 					}
172 177
 				}
173 178
 				return '{'.$results.'}';
174
-			}
175
-			else
179
+			} else
176 180
 			{
177 181
 				foreach($value as $v)
178 182
 				{
179 183
 					if($v!=='' || $encodeEmptyStrings)
180 184
 					{
181
-						if($results!=='')
182
-							$results.=',';
185
+						if($results!=='') {
186
+													$results.=',';
187
+						}
183 188
 						$results.=self::encode($v,$toMap, $encodeEmptyStrings);
184 189
 					}
185 190
 				}
186 191
 				return '['.$results.']';
187 192
 			}
188
-		}
189
-		else if(is_integer($value))
190
-			return "$value";
191
-		else if(is_float($value))
193
+		} else if(is_integer($value)) {
194
+					return "$value";
195
+		} else if(is_float($value))
192 196
 		{
193 197
 			switch($value)
194 198
 			{
@@ -200,22 +204,24 @@  discard block
 block discarded – undo
200 204
 					break;
201 205
 				default:
202 206
 					$locale=localeConv();
203
-					if($locale['decimal_point']=='.')
204
-						return "$value";
205
-					else
206
-						return str_replace($locale['decimal_point'], '.', "$value");
207
+					if($locale['decimal_point']=='.') {
208
+											return "$value";
209
+					} else {
210
+											return str_replace($locale['decimal_point'], '.', "$value");
211
+					}
207 212
 					break;
208 213
 			}
209
-		}
210
-		else if(is_object($value))
211
-			if ($value instanceof TJavaScriptLiteral)
214
+		} else if(is_object($value)) {
215
+					if ($value instanceof TJavaScriptLiteral)
212 216
 				return $value->toJavaScriptLiteral();
213
-			else
214
-				return self::encode(get_object_vars($value),$toMap);
215
-		else if($value===null)
216
-			return 'null';
217
-		else
218
-			return '';
217
+		} else {
218
+							return self::encode(get_object_vars($value),$toMap);
219
+			}
220
+		else if($value===null) {
221
+					return 'null';
222
+		} else {
223
+					return '';
224
+		}
219 225
 	}
220 226
 	/**
221 227
 	 * Encodes a PHP variable into javascript string.
@@ -241,12 +247,13 @@  discard block
 block discarded – undo
241 247
 	 * @param string $sourceEncoding
242 248
 	 */
243 249
 	private static function convertToUtf8(&$value, $sourceEncoding) {
244
-		if(is_string($value))
245
-			$value=iconv($sourceEncoding, 'UTF-8', $value);
246
-		else if (is_array($value))
250
+		if(is_string($value)) {
251
+					$value=iconv($sourceEncoding, 'UTF-8', $value);
252
+		} else if (is_array($value))
247 253
 		{
248
-			foreach($value as &$element)
249
-				self::convertToUtf8($element, $sourceEncoding);
254
+			foreach($value as &$element) {
255
+							self::convertToUtf8($element, $sourceEncoding);
256
+			}
250 257
 		}
251 258
 	}
252 259
 
Please login to merge, or discard this patch.
framework/Web/Services/TJsonService.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -140,6 +140,7 @@
 block discarded – undo
140 140
 	/**
141 141
 	 * Renders content provided by TJsonResponse::getJsonContent() as
142 142
 	 * javascript in JSON format.
143
+	 * @param TJsonResponse $service
143 144
 	 */
144 145
 	protected function createJsonResponse($service,$properties,$config)
145 146
 	{
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TJsonService and TJsonResponse class file.
4
- *
5
- * @author Wei Zhuo <weizhuo[at]gamil[dot]com>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @package System.Web.Services
10
- */
3
+	 * TJsonService and TJsonResponse class file.
4
+	 *
5
+	 * @author Wei Zhuo <weizhuo[at]gamil[dot]com>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @package System.Web.Services
10
+	 */
11 11
 
12 12
 /**
13 13
  * TJsonService class provides to end-users javascript content response in
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * @var array registered services
56 56
 	 */
57
-	private $_services=array();
57
+	private $_services = array();
58 58
 
59 59
 	/**
60 60
 	 * Initializes this module.
@@ -72,20 +72,20 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	protected function loadJsonServices($config)
74 74
 	{
75
-		if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
75
+		if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
76 76
 		{
77
-			if(is_array($config))
77
+			if (is_array($config))
78 78
 			{
79
-				foreach($config['json'] as $id => $json)
79
+				foreach ($config['json'] as $id => $json)
80 80
 					$this->_services[$id] = $json;
81 81
 			}
82 82
 		}
83 83
 		else
84 84
 		{
85
-			foreach($config->getElementsByTagName('json') as $json)
85
+			foreach ($config->getElementsByTagName('json') as $json)
86 86
 			{
87
-				if(($id=$json->getAttribute('id'))!==null)
88
-					$this->_services[$id]=$json;
87
+				if (($id = $json->getAttribute('id')) !== null)
88
+					$this->_services[$id] = $json;
89 89
 				else
90 90
 					throw new TConfigurationException('jsonservice_id_required');
91 91
 			}
@@ -98,58 +98,58 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function run()
100 100
 	{
101
-		$id=$this->getRequest()->getServiceParameter();
102
-		if(isset($this->_services[$id]))
101
+		$id = $this->getRequest()->getServiceParameter();
102
+		if (isset($this->_services[$id]))
103 103
 		{
104
-			$serviceConfig=$this->_services[$id];
105
-			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
104
+			$serviceConfig = $this->_services[$id];
105
+			if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
106 106
 			{
107
-				if(isset($serviceConfig['class']))
107
+				if (isset($serviceConfig['class']))
108 108
 				{
109
-					$service=Prado::createComponent($serviceConfig['class']);
110
-					if($service instanceof TJsonResponse)
109
+					$service = Prado::createComponent($serviceConfig['class']);
110
+					if ($service instanceof TJsonResponse)
111 111
 					{
112
-						$properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:array();
113
-						$this->createJsonResponse($service,$properties,$serviceConfig);
112
+						$properties = isset($serviceConfig['properties']) ? $serviceConfig['properties'] : array();
113
+						$this->createJsonResponse($service, $properties, $serviceConfig);
114 114
 					}
115 115
 					else
116
-						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
116
+						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
117 117
 				}
118 118
 				else
119
-					throw new TConfigurationException('jsonservice_class_required',$id);
119
+					throw new TConfigurationException('jsonservice_class_required', $id);
120 120
 			}
121 121
 			else
122 122
 			{
123
-				$properties=$serviceConfig->getAttributes();
124
-				if(($class=$properties->remove('class'))!==null)
123
+				$properties = $serviceConfig->getAttributes();
124
+				if (($class = $properties->remove('class')) !== null)
125 125
 				{
126
-					$service=Prado::createComponent($class);
127
-					if($service instanceof TJsonResponse)
128
-						$this->createJsonResponse($service,$properties,$serviceConfig);
126
+					$service = Prado::createComponent($class);
127
+					if ($service instanceof TJsonResponse)
128
+						$this->createJsonResponse($service, $properties, $serviceConfig);
129 129
 					else
130
-						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
130
+						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
131 131
 				}
132 132
 				else
133
-					throw new TConfigurationException('jsonservice_class_required',$id);
133
+					throw new TConfigurationException('jsonservice_class_required', $id);
134 134
 			}
135 135
 		}
136 136
 		else
137
-			throw new THttpException(404,'jsonservice_provider_unknown',$id);
137
+			throw new THttpException(404, 'jsonservice_provider_unknown', $id);
138 138
 	}
139 139
 
140 140
 	/**
141 141
 	 * Renders content provided by TJsonResponse::getJsonContent() as
142 142
 	 * javascript in JSON format.
143 143
 	 */
144
-	protected function createJsonResponse($service,$properties,$config)
144
+	protected function createJsonResponse($service, $properties, $config)
145 145
 	{
146 146
 		// init service properties
147
-		foreach($properties as $name=>$value)
148
-			$service->setSubproperty($name,$value);
147
+		foreach ($properties as $name=>$value)
148
+			$service->setSubproperty($name, $value);
149 149
 		$service->init($config);
150 150
 
151 151
 		//send content if not null
152
-		if(($content=$service->getJsonContent())!==null)
152
+		if (($content = $service->getJsonContent()) !== null)
153 153
 		{
154 154
 			$response = $this->getResponse();
155 155
 			$response->setContentType('application/json');
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
  */
176 176
 abstract class TJsonResponse extends TApplicationComponent
177 177
 {
178
-	private $_id='';
178
+	private $_id = '';
179 179
 
180 180
 	/**
181 181
 	 * Initializes the feed.
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function setID($value)
200 200
 	{
201
-		$this->_id=$value;
201
+		$this->_id = $value;
202 202
 	}
203 203
 
204 204
 	/**
Please login to merge, or discard this patch.
Braces   +26 added lines, -24 removed lines patch added patch discarded remove patch
@@ -76,18 +76,19 @@  discard block
 block discarded – undo
76 76
 		{
77 77
 			if(is_array($config))
78 78
 			{
79
-				foreach($config['json'] as $id => $json)
80
-					$this->_services[$id] = $json;
79
+				foreach($config['json'] as $id => $json) {
80
+									$this->_services[$id] = $json;
81
+				}
81 82
 			}
82
-		}
83
-		else
83
+		} else
84 84
 		{
85 85
 			foreach($config->getElementsByTagName('json') as $json)
86 86
 			{
87
-				if(($id=$json->getAttribute('id'))!==null)
88
-					$this->_services[$id]=$json;
89
-				else
90
-					throw new TConfigurationException('jsonservice_id_required');
87
+				if(($id=$json->getAttribute('id'))!==null) {
88
+									$this->_services[$id]=$json;
89
+				} else {
90
+									throw new TConfigurationException('jsonservice_id_required');
91
+				}
91 92
 			}
92 93
 		}
93 94
 	}
@@ -111,30 +112,30 @@  discard block
 block discarded – undo
111 112
 					{
112 113
 						$properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:array();
113 114
 						$this->createJsonResponse($service,$properties,$serviceConfig);
115
+					} else {
116
+											throw new TConfigurationException('jsonservice_response_type_invalid',$id);
114 117
 					}
115
-					else
116
-						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
118
+				} else {
119
+									throw new TConfigurationException('jsonservice_class_required',$id);
117 120
 				}
118
-				else
119
-					throw new TConfigurationException('jsonservice_class_required',$id);
120
-			}
121
-			else
121
+			} else
122 122
 			{
123 123
 				$properties=$serviceConfig->getAttributes();
124 124
 				if(($class=$properties->remove('class'))!==null)
125 125
 				{
126 126
 					$service=Prado::createComponent($class);
127
-					if($service instanceof TJsonResponse)
128
-						$this->createJsonResponse($service,$properties,$serviceConfig);
129
-					else
130
-						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
127
+					if($service instanceof TJsonResponse) {
128
+											$this->createJsonResponse($service,$properties,$serviceConfig);
129
+					} else {
130
+											throw new TConfigurationException('jsonservice_response_type_invalid',$id);
131
+					}
132
+				} else {
133
+									throw new TConfigurationException('jsonservice_class_required',$id);
131 134
 				}
132
-				else
133
-					throw new TConfigurationException('jsonservice_class_required',$id);
134 135
 			}
136
+		} else {
137
+					throw new THttpException(404,'jsonservice_provider_unknown',$id);
135 138
 		}
136
-		else
137
-			throw new THttpException(404,'jsonservice_provider_unknown',$id);
138 139
 	}
139 140
 
140 141
 	/**
@@ -144,8 +145,9 @@  discard block
 block discarded – undo
144 145
 	protected function createJsonResponse($service,$properties,$config)
145 146
 	{
146 147
 		// init service properties
147
-		foreach($properties as $name=>$value)
148
-			$service->setSubproperty($name,$value);
148
+		foreach($properties as $name=>$value) {
149
+					$service->setSubproperty($name,$value);
150
+		}
149 151
 		$service->init($config);
150 152
 
151 153
 		//send content if not null
Please login to merge, or discard this patch.
framework/Web/Services/TPageService.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -369,6 +369,7 @@  discard block
 block discarded – undo
369 369
 
370 370
 	/**
371 371
 	 * @param string default page path to be served if no explicit page is request
372
+	 * @param string $value
372 373
 	 * @throws TInvalidOperationException if the page service is initialized
373 374
 	 */
374 375
 	public function setDefaultPage($value)
@@ -528,6 +529,7 @@  discard block
 block discarded – undo
528 529
 	 * @param array list of GET parameters, null if no GET parameters required
529 530
 	 * @param boolean whether to encode the ampersand in URL, defaults to true.
530 531
 	 * @param boolean whether to encode the GET parameters (their names and values), defaults to true.
532
+	 * @param string $pagePath
531 533
 	 * @return string URL for the page and GET parameters
532 534
 	 */
533 535
 	public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)
@@ -670,6 +672,9 @@  discard block
 block discarded – undo
670 672
 		}
671 673
 	}
672 674
 
675
+	/**
676
+	 * @param string $configPath
677
+	 */
673 678
 	public function loadFromPhp($config,$configPath,$configPagePath)
674 679
 	{
675 680
 		$this->loadApplicationConfigurationFromPhp($config,$configPath);
@@ -683,6 +688,8 @@  discard block
 block discarded – undo
683 688
 	 * @param TXmlElement config xml element
684 689
 	 * @param string the directory containing this configuration
685 690
 	 * @param string the page path that the config XML is associated with. The page path doesn't include the page name.
691
+	 * @param TXmlDocument $dom
692
+	 * @param string $configPath
686 693
 	 */
687 694
 	public function loadFromXml($dom,$configPath,$configPagePath)
688 695
 	{
Please login to merge, or discard this patch.
Spacing   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -77,68 +77,68 @@  discard block
 block discarded – undo
77 77
 	/**
78 78
 	 * Configuration file name
79 79
 	 */
80
-	const CONFIG_FILE_XML='config.xml';
80
+	const CONFIG_FILE_XML = 'config.xml';
81 81
 	/**
82 82
 	 * Configuration file name
83 83
 	 */
84
-	const CONFIG_FILE_PHP='config.php';
84
+	const CONFIG_FILE_PHP = 'config.php';
85 85
 	/**
86 86
 	 * Default base path
87 87
 	 */
88
-	const DEFAULT_BASEPATH='Pages';
88
+	const DEFAULT_BASEPATH = 'Pages';
89 89
 	/**
90 90
 	 * Fallback base path - used to be the default up to Prado < 3.2
91 91
 	 */
92
-	const FALLBACK_BASEPATH='pages';
92
+	const FALLBACK_BASEPATH = 'pages';
93 93
 	/**
94 94
 	 * Prefix of ID used for storing parsed configuration in cache
95 95
 	 */
96
-	const CONFIG_CACHE_PREFIX='prado:pageservice:';
96
+	const CONFIG_CACHE_PREFIX = 'prado:pageservice:';
97 97
 	/**
98 98
 	 * Page template file extension
99 99
 	 */
100
-	const PAGE_FILE_EXT='.page';
100
+	const PAGE_FILE_EXT = '.page';
101 101
 	/**
102 102
 	 * @var string root path of pages
103 103
 	 */
104
-	private $_basePath=null;
104
+	private $_basePath = null;
105 105
 	/**
106 106
 	 * @var string base path class in namespace format
107 107
 	 */
108
-	private $_basePageClass='TPage';
108
+	private $_basePageClass = 'TPage';
109 109
 	/**
110 110
 	 * @var string clientscript manager class in namespace format
111 111
 	 * @since 3.1.7
112 112
 	 */
113
-	private $_clientScriptManagerClass='System.Web.UI.TClientScriptManager';
113
+	private $_clientScriptManagerClass = 'System.Web.UI.TClientScriptManager';
114 114
 	/**
115 115
 	 * @var string default page
116 116
 	 */
117
-	private $_defaultPage='Home';
117
+	private $_defaultPage = 'Home';
118 118
 	/**
119 119
 	 * @var string requested page (path)
120 120
 	 */
121
-	private $_pagePath=null;
121
+	private $_pagePath = null;
122 122
 	/**
123 123
 	 * @var TPage the requested page
124 124
 	 */
125
-	private $_page=null;
125
+	private $_page = null;
126 126
 	/**
127 127
 	 * @var array list of initial page property values
128 128
 	 */
129
-	private $_properties=array();
129
+	private $_properties = array();
130 130
 	/**
131 131
 	 * @var boolean whether service is initialized
132 132
 	 */
133
-	private $_initialized=false;
133
+	private $_initialized = false;
134 134
 	/**
135 135
 	 * @var TThemeManager theme manager
136 136
 	 */
137
-	private $_themeManager=null;
137
+	private $_themeManager = null;
138 138
 	/**
139 139
 	 * @var TTemplateManager template manager
140 140
 	 */
141
-	private $_templateManager=null;
141
+	private $_templateManager = null;
142 142
 
143 143
 	/**
144 144
 	 * Initializes the service.
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function init($config)
149 149
 	{
150
-		Prado::trace("Initializing TPageService",'System.Web.Services.TPageService');
150
+		Prado::trace("Initializing TPageService", 'System.Web.Services.TPageService');
151 151
 
152
-		$pageConfig=$this->loadPageConfig($config);
152
+		$pageConfig = $this->loadPageConfig($config);
153 153
 
154 154
 		$this->initPageContext($pageConfig);
155 155
 
156
-		$this->_initialized=true;
156
+		$this->_initialized = true;
157 157
 	}
158 158
 
159 159
 	/**
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	protected function initPageContext($pageConfig)
167 167
 	{
168
-		$application=$this->getApplication();
169
-		foreach($pageConfig->getApplicationConfigurations() as $appConfig)
168
+		$application = $this->getApplication();
169
+		foreach ($pageConfig->getApplicationConfigurations() as $appConfig)
170 170
 			$application->applyConfiguration($appConfig);
171 171
 
172 172
 		$this->applyConfiguration($pageConfig);
@@ -179,21 +179,21 @@  discard block
 block discarded – undo
179 179
 	protected function applyConfiguration($config)
180 180
 	{
181 181
 		// initial page properties (to be set when page runs)
182
-		$this->_properties=array_merge($this->_properties, $config->getProperties());
182
+		$this->_properties = array_merge($this->_properties, $config->getProperties());
183 183
 		$this->getApplication()->getAuthorizationRules()->mergeWith($config->getRules());
184
-		$pagePath=$this->getRequestedPagePath();
184
+		$pagePath = $this->getRequestedPagePath();
185 185
 		// external configurations
186
-		foreach($config->getExternalConfigurations() as $filePath=>$params)
186
+		foreach ($config->getExternalConfigurations() as $filePath=>$params)
187 187
 		{
188
-			list($configPagePath,$condition)=$params;
189
-			if($condition!==true)
190
-				$condition=$this->evaluateExpression($condition);
191
-			if($condition)
188
+			list($configPagePath, $condition) = $params;
189
+			if ($condition !== true)
190
+				$condition = $this->evaluateExpression($condition);
191
+			if ($condition)
192 192
 			{
193
-				if(($path=Prado::getPathOfNamespace($filePath,Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path))
194
-					throw new TConfigurationException('pageservice_includefile_invalid',$filePath);
195
-				$c=new TPageConfiguration($pagePath);
196
-				$c->loadFromFile($path,$configPagePath);
193
+				if (($path = Prado::getPathOfNamespace($filePath, Prado::getApplication()->getConfigurationFileExt())) === null || !is_file($path))
194
+					throw new TConfigurationException('pageservice_includefile_invalid', $filePath);
195
+				$c = new TPageConfiguration($pagePath);
196
+				$c->loadFromFile($path, $configPagePath);
197 197
 				$this->applyConfiguration($c);
198 198
 			}
199 199
 		}
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	protected function determineRequestedPagePath()
208 208
 	{
209
-		$pagePath=$this->getRequest()->getServiceParameter();
210
-		if(empty($pagePath))
211
-			$pagePath=$this->getDefaultPage();
209
+		$pagePath = $this->getRequest()->getServiceParameter();
210
+		if (empty($pagePath))
211
+			$pagePath = $this->getDefaultPage();
212 212
 		return $pagePath;
213 213
 	}
214 214
 
@@ -219,77 +219,77 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	protected function loadPageConfig($config)
221 221
 	{
222
-		$application=$this->getApplication();
223
-		$pagePath=$this->getRequestedPagePath();
224
-		if(($cache=$application->getCache())===null)
222
+		$application = $this->getApplication();
223
+		$pagePath = $this->getRequestedPagePath();
224
+		if (($cache = $application->getCache()) === null)
225 225
 		{
226
-			$pageConfig=new TPageConfiguration($pagePath);
227
-			if($config!==null)
226
+			$pageConfig = new TPageConfiguration($pagePath);
227
+			if ($config !== null)
228 228
 			{
229
-				if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
230
-					$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
229
+				if ($application->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
230
+					$pageConfig->loadPageConfigurationFromPhp($config, $application->getBasePath(), '');
231 231
 				else
232
-					$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
232
+					$pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), '');
233 233
 			}
234 234
 			$pageConfig->loadFromFiles($this->getBasePath());
235 235
 		}
236 236
 		else
237 237
 		{
238
-			$configCached=true;
239
-			$currentTimestamp=array();
240
-			$arr=$cache->get(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath);
241
-			if(is_array($arr))
238
+			$configCached = true;
239
+			$currentTimestamp = array();
240
+			$arr = $cache->get(self::CONFIG_CACHE_PREFIX . $this->getID() . $pagePath);
241
+			if (is_array($arr))
242 242
 			{
243
-				list($pageConfig,$timestamps)=$arr;
244
-				if($application->getMode()!==TApplicationMode::Performance)
243
+				list($pageConfig, $timestamps) = $arr;
244
+				if ($application->getMode() !== TApplicationMode::Performance)
245 245
 				{
246
-					foreach($timestamps as $fileName=>$timestamp)
246
+					foreach ($timestamps as $fileName=>$timestamp)
247 247
 					{
248
-						if($fileName===0) // application config file
248
+						if ($fileName === 0) // application config file
249 249
 						{
250
-							$appConfigFile=$application->getConfigurationFile();
251
-							$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
252
-							if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0]))
253
-								$configCached=false;
250
+							$appConfigFile = $application->getConfigurationFile();
251
+							$currentTimestamp[0] = $appConfigFile === null ? 0 : @filemtime($appConfigFile);
252
+							if ($currentTimestamp[0] > $timestamp || ($timestamp > 0 && !$currentTimestamp[0]))
253
+								$configCached = false;
254 254
 						}
255 255
 						else
256 256
 						{
257
-							$currentTimestamp[$fileName]=@filemtime($fileName);
258
-							if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName]))
259
-								$configCached=false;
257
+							$currentTimestamp[$fileName] = @filemtime($fileName);
258
+							if ($currentTimestamp[$fileName] > $timestamp || ($timestamp > 0 && !$currentTimestamp[$fileName]))
259
+								$configCached = false;
260 260
 						}
261 261
 					}
262 262
 				}
263 263
 			}
264 264
 			else
265 265
 			{
266
-				$configCached=false;
267
-				$paths=explode('.',$pagePath);
268
-				$configPath=$this->getBasePath();
269
-				$fileName = $this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
266
+				$configCached = false;
267
+				$paths = explode('.', $pagePath);
268
+				$configPath = $this->getBasePath();
269
+				$fileName = $this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP
270 270
 					? self::CONFIG_FILE_PHP
271 271
 					: self::CONFIG_FILE_XML;
272
-				foreach($paths as $path)
272
+				foreach ($paths as $path)
273 273
 				{
274
-					$configFile=$configPath.DIRECTORY_SEPARATOR.$fileName;
275
-					$currentTimestamp[$configFile]=@filemtime($configFile);
276
-					$configPath.=DIRECTORY_SEPARATOR.$path;
274
+					$configFile = $configPath . DIRECTORY_SEPARATOR . $fileName;
275
+					$currentTimestamp[$configFile] = @filemtime($configFile);
276
+					$configPath .= DIRECTORY_SEPARATOR . $path;
277 277
 				}
278
-				$appConfigFile=$application->getConfigurationFile();
279
-				$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
278
+				$appConfigFile = $application->getConfigurationFile();
279
+				$currentTimestamp[0] = $appConfigFile === null ? 0 : @filemtime($appConfigFile);
280 280
 			}
281
-			if(!$configCached)
281
+			if (!$configCached)
282 282
 			{
283
-				$pageConfig=new TPageConfiguration($pagePath);
284
-				if($config!==null)
283
+				$pageConfig = new TPageConfiguration($pagePath);
284
+				if ($config !== null)
285 285
 				{
286
-					if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
287
-						$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
286
+					if ($application->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
287
+						$pageConfig->loadPageConfigurationFromPhp($config, $application->getBasePath(), '');
288 288
 					else
289
-						$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
289
+						$pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), '');
290 290
 				}
291 291
 				$pageConfig->loadFromFiles($this->getBasePath());
292
-				$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath,array($pageConfig,$currentTimestamp));
292
+				$cache->set(self::CONFIG_CACHE_PREFIX . $this->getID() . $pagePath, array($pageConfig, $currentTimestamp));
293 293
 			}
294 294
 		}
295 295
 		return $pageConfig;
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public function getTemplateManager()
302 302
 	{
303
-		if(!$this->_templateManager)
303
+		if (!$this->_templateManager)
304 304
 		{
305
-			$this->_templateManager=new TTemplateManager;
305
+			$this->_templateManager = new TTemplateManager;
306 306
 			$this->_templateManager->init(null);
307 307
 		}
308 308
 		return $this->_templateManager;
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	public function setTemplateManager(TTemplateManager $value)
315 315
 	{
316
-		$this->_templateManager=$value;
316
+		$this->_templateManager = $value;
317 317
 	}
318 318
 
319 319
 	/**
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	public function getThemeManager()
323 323
 	{
324
-		if(!$this->_themeManager)
324
+		if (!$this->_themeManager)
325 325
 		{
326
-			$this->_themeManager=new TThemeManager;
326
+			$this->_themeManager = new TThemeManager;
327 327
 			$this->_themeManager->init(null);
328 328
 		}
329 329
 		return $this->_themeManager;
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function setThemeManager(TThemeManager $value)
336 336
 	{
337
-		$this->_themeManager=$value;
337
+		$this->_themeManager = $value;
338 338
 	}
339 339
 
340 340
 	/**
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	public function getRequestedPagePath()
344 344
 	{
345
-		if($this->_pagePath===null)
345
+		if ($this->_pagePath === null)
346 346
 		{
347
-			$this->_pagePath=strtr($this->determineRequestedPagePath(),'/\\','..');
348
-			if(empty($this->_pagePath))
349
-				throw new THttpException(404,'pageservice_page_required');
347
+			$this->_pagePath = strtr($this->determineRequestedPagePath(), '/\\', '..');
348
+			if (empty($this->_pagePath))
349
+				throw new THttpException(404, 'pageservice_page_required');
350 350
 		}
351 351
 		return $this->_pagePath;
352 352
 	}
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	public function setDefaultPage($value)
375 375
 	{
376
-		if($this->_initialized)
376
+		if ($this->_initialized)
377 377
 			throw new TInvalidOperationException('pageservice_defaultpage_unchangeable');
378 378
 		else
379
-			$this->_defaultPage=$value;
379
+			$this->_defaultPage = $value;
380 380
 	}
381 381
 
382 382
 	/**
@@ -392,14 +392,14 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	public function getBasePath()
394 394
 	{
395
-		if($this->_basePath===null)
395
+		if ($this->_basePath === null)
396 396
 		{
397
-			$basePath=$this->getApplication()->getBasePath().DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
398
-			if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath))
397
+			$basePath = $this->getApplication()->getBasePath() . DIRECTORY_SEPARATOR . self::DEFAULT_BASEPATH;
398
+			if (($this->_basePath = realpath($basePath)) === false || !is_dir($this->_basePath))
399 399
 			{
400
-				$basePath=$this->getApplication()->getBasePath().DIRECTORY_SEPARATOR.self::FALLBACK_BASEPATH;
401
-				if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath))
402
-					throw new TConfigurationException('pageservice_basepath_invalid',$basePath);
400
+				$basePath = $this->getApplication()->getBasePath() . DIRECTORY_SEPARATOR . self::FALLBACK_BASEPATH;
401
+				if (($this->_basePath = realpath($basePath)) === false || !is_dir($this->_basePath))
402
+					throw new TConfigurationException('pageservice_basepath_invalid', $basePath);
403 403
 			}
404 404
 		}
405 405
 		return $this->_basePath;
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 	 */
412 412
 	public function setBasePath($value)
413 413
 	{
414
-		if($this->_initialized)
414
+		if ($this->_initialized)
415 415
 			throw new TInvalidOperationException('pageservice_basepath_unchangeable');
416
-		else if(($path=Prado::getPathOfNamespace($value))===null || !is_dir($path))
417
-			throw new TConfigurationException('pageservice_basepath_invalid',$value);
418
-		$this->_basePath=realpath($path);
416
+		else if (($path = Prado::getPathOfNamespace($value)) === null || !is_dir($path))
417
+			throw new TConfigurationException('pageservice_basepath_invalid', $value);
418
+		$this->_basePath = realpath($path);
419 419
 	}
420 420
 
421 421
 	/**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 */
427 427
 	public function setBasePageClass($value)
428 428
 	{
429
-		$this->_basePageClass=$value;
429
+		$this->_basePageClass = $value;
430 430
 	}
431 431
 
432 432
 	/**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 */
445 445
 	public function setClientScriptManagerClass($value)
446 446
 	{
447
-		$this->_clientScriptManagerClass=$value;
447
+		$this->_clientScriptManagerClass = $value;
448 448
 	}
449 449
 
450 450
 	/**
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function run()
465 465
 	{
466
-		Prado::trace("Running page service",'System.Web.Services.TPageService');
467
-		$this->_page=$this->createPage($this->getRequestedPagePath());
468
-		$this->runPage($this->_page,$this->_properties);
466
+		Prado::trace("Running page service", 'System.Web.Services.TPageService');
467
+		$this->_page = $this->createPage($this->getRequestedPagePath());
468
+		$this->runPage($this->_page, $this->_properties);
469 469
 	}
470 470
 
471 471
 	/**
@@ -477,35 +477,35 @@  discard block
 block discarded – undo
477 477
 	 */
478 478
 	protected function createPage($pagePath)
479 479
 	{
480
-		$path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath,'.',DIRECTORY_SEPARATOR);
481
-		$hasTemplateFile=is_file($path.self::PAGE_FILE_EXT);
482
-		$hasClassFile=is_file($path.Prado::CLASS_FILE_EXT);
480
+		$path = $this->getBasePath() . DIRECTORY_SEPARATOR . strtr($pagePath, '.', DIRECTORY_SEPARATOR);
481
+		$hasTemplateFile = is_file($path . self::PAGE_FILE_EXT);
482
+		$hasClassFile = is_file($path . Prado::CLASS_FILE_EXT);
483 483
 
484
-		if(!$hasTemplateFile && !$hasClassFile)
485
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
484
+		if (!$hasTemplateFile && !$hasClassFile)
485
+			throw new THttpException(404, 'pageservice_page_unknown', $pagePath);
486 486
 
487
-		if($hasClassFile)
487
+		if ($hasClassFile)
488 488
 		{
489
-			$className=basename($path);
490
-			if(!class_exists($className,false))
491
-				include_once($path.Prado::CLASS_FILE_EXT);
489
+			$className = basename($path);
490
+			if (!class_exists($className, false))
491
+				include_once($path . Prado::CLASS_FILE_EXT);
492 492
 		}
493 493
 		else
494 494
 		{
495
-			$className=$this->getBasePageClass();
495
+			$className = $this->getBasePageClass();
496 496
 			Prado::using($className);
497
-			if(($pos=strrpos($className,'.'))!==false)
498
-				$className=substr($className,$pos+1);
497
+			if (($pos = strrpos($className, '.')) !== false)
498
+				$className = substr($className, $pos + 1);
499 499
 		}
500 500
 
501
- 		if(!class_exists($className,false) || ($className!=='TPage' && !is_subclass_of($className,'TPage')))
502
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
501
+ 		if (!class_exists($className, false) || ($className !== 'TPage' && !is_subclass_of($className, 'TPage')))
502
+			throw new THttpException(404, 'pageservice_page_unknown', $pagePath);
503 503
 
504
-		$page=Prado::createComponent($className);
504
+		$page = Prado::createComponent($className);
505 505
 		$page->setPagePath($pagePath);
506 506
 
507
-		if($hasTemplateFile)
508
-			$page->setTemplate($this->getTemplateManager()->getTemplateByFileName($path.self::PAGE_FILE_EXT));
507
+		if ($hasTemplateFile)
508
+			$page->setTemplate($this->getTemplateManager()->getTemplateByFileName($path . self::PAGE_FILE_EXT));
509 509
 
510 510
 		return $page;
511 511
 	}
@@ -515,10 +515,10 @@  discard block
 block discarded – undo
515 515
 	 * @param TPage the page instance to be run
516 516
 	 * @param array list of initial page properties
517 517
 	 */
518
-	protected function runPage($page,$properties)
518
+	protected function runPage($page, $properties)
519 519
 	{
520
-		foreach($properties as $name=>$value)
521
-			$page->setSubProperty($name,$value);
520
+		foreach ($properties as $name=>$value)
521
+			$page->setSubProperty($name, $value);
522 522
 		$page->run($this->getResponse()->createHtmlWriter());
523 523
 	}
524 524
 
@@ -530,9 +530,9 @@  discard block
 block discarded – undo
530 530
 	 * @param boolean whether to encode the GET parameters (their names and values), defaults to true.
531 531
 	 * @return string URL for the page and GET parameters
532 532
 	 */
533
-	public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)
533
+	public function constructUrl($pagePath, $getParams = null, $encodeAmpersand = true, $encodeGetItems = true)
534 534
 	{
535
-		return $this->getRequest()->constructUrl($this->getID(),$pagePath,$getParams,$encodeAmpersand,$encodeGetItems);
535
+		return $this->getRequest()->constructUrl($this->getID(), $pagePath, $getParams, $encodeAmpersand, $encodeGetItems);
536 536
 	}
537 537
 }
538 538
 
@@ -553,23 +553,23 @@  discard block
 block discarded – undo
553 553
 	/**
554 554
 	 * @var array list of application configurations
555 555
 	 */
556
-	private $_appConfigs=array();
556
+	private $_appConfigs = array();
557 557
 	/**
558 558
 	 * @var array list of page initial property values
559 559
 	 */
560
-	private $_properties=array();
560
+	private $_properties = array();
561 561
 	/**
562 562
 	 * @var TAuthorizationRuleCollection list of authorization rules
563 563
 	 */
564
-	private $_rules=array();
564
+	private $_rules = array();
565 565
 	/**
566 566
 	 * @var array list of included configurations
567 567
 	 */
568
-	private $_includes=array();
568
+	private $_includes = array();
569 569
 	/**
570 570
 	 * @var string the currently request page in the format of Path.To.PageName
571 571
 	 */
572
-	private $_pagePath='';
572
+	private $_pagePath = '';
573 573
 
574 574
 	/**
575 575
 	 * Constructor.
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 */
578 578
 	public function __construct($pagePath)
579 579
 	{
580
-		$this->_pagePath=$pagePath;
580
+		$this->_pagePath = $pagePath;
581 581
 	}
582 582
 
583 583
 	/**
@@ -624,24 +624,24 @@  discard block
 block discarded – undo
624 624
 	 */
625 625
 	public function loadFromFiles($basePath)
626 626
 	{
627
-		$paths=explode('.',$this->_pagePath);
628
-		$page=array_pop($paths);
629
-		$path=$basePath;
630
-		$configPagePath='';
631
-		$fileName = Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
627
+		$paths = explode('.', $this->_pagePath);
628
+		$page = array_pop($paths);
629
+		$path = $basePath;
630
+		$configPagePath = '';
631
+		$fileName = Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP
632 632
 			? TPageService::CONFIG_FILE_PHP
633 633
 			: TPageService::CONFIG_FILE_XML;
634
-		foreach($paths as $p)
634
+		foreach ($paths as $p)
635 635
 		{
636
-			$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName,$configPagePath);
637
-			$path.=DIRECTORY_SEPARATOR.$p;
638
-			if($configPagePath==='')
639
-				$configPagePath=$p;
636
+			$this->loadFromFile($path . DIRECTORY_SEPARATOR . $fileName, $configPagePath);
637
+			$path .= DIRECTORY_SEPARATOR . $p;
638
+			if ($configPagePath === '')
639
+				$configPagePath = $p;
640 640
 			else
641
-				$configPagePath.='.'.$p;
641
+				$configPagePath .= '.' . $p;
642 642
 		}
643
-		$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName,$configPagePath);
644
-		$this->_rules=new TAuthorizationRuleCollection($this->_rules);
643
+		$this->loadFromFile($path . DIRECTORY_SEPARATOR . $fileName, $configPagePath);
644
+		$this->_rules = new TAuthorizationRuleCollection($this->_rules);
645 645
 	}
646 646
 
647 647
 	/**
@@ -649,31 +649,31 @@  discard block
 block discarded – undo
649 649
 	 * @param string config file name
650 650
 	 * @param string the page path that the config file is associated with. The page path doesn't include the page name.
651 651
 	 */
652
-	public function loadFromFile($fname,$configPagePath)
652
+	public function loadFromFile($fname, $configPagePath)
653 653
 	{
654
-		Prado::trace("Loading page configuration file $fname",'System.Web.Services.TPageService');
655
-		if(empty($fname) || !is_file($fname))
654
+		Prado::trace("Loading page configuration file $fname", 'System.Web.Services.TPageService');
655
+		if (empty($fname) || !is_file($fname))
656 656
 			return;
657 657
 
658
-		if(Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
658
+		if (Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
659 659
 		{
660 660
 			$fcontent = include $fname;
661
-			$this->loadFromPhp($fcontent,dirname($fname),$configPagePath);
661
+			$this->loadFromPhp($fcontent, dirname($fname), $configPagePath);
662 662
 		}
663 663
 		else
664 664
 		{
665
-			$dom=new TXmlDocument;
666
-			if($dom->loadFromFile($fname))
667
-				$this->loadFromXml($dom,dirname($fname),$configPagePath);
665
+			$dom = new TXmlDocument;
666
+			if ($dom->loadFromFile($fname))
667
+				$this->loadFromXml($dom, dirname($fname), $configPagePath);
668 668
 			else
669
-				throw new TConfigurationException('pageserviceconf_file_invalid',$fname);
669
+				throw new TConfigurationException('pageserviceconf_file_invalid', $fname);
670 670
 		}
671 671
 	}
672 672
 
673
-	public function loadFromPhp($config,$configPath,$configPagePath)
673
+	public function loadFromPhp($config, $configPath, $configPagePath)
674 674
 	{
675
-		$this->loadApplicationConfigurationFromPhp($config,$configPath);
676
-		$this->loadPageConfigurationFromPhp($config,$configPath,$configPagePath);
675
+		$this->loadApplicationConfigurationFromPhp($config, $configPath);
676
+		$this->loadPageConfigurationFromPhp($config, $configPath, $configPagePath);
677 677
 	}
678 678
 
679 679
 	/**
@@ -684,17 +684,17 @@  discard block
 block discarded – undo
684 684
 	 * @param string the directory containing this configuration
685 685
 	 * @param string the page path that the config XML is associated with. The page path doesn't include the page name.
686 686
 	 */
687
-	public function loadFromXml($dom,$configPath,$configPagePath)
687
+	public function loadFromXml($dom, $configPath, $configPagePath)
688 688
 	{
689
-		$this->loadApplicationConfigurationFromXml($dom,$configPath);
690
-		$this->loadPageConfigurationFromXml($dom,$configPath,$configPagePath);
689
+		$this->loadApplicationConfigurationFromXml($dom, $configPath);
690
+		$this->loadPageConfigurationFromXml($dom, $configPath, $configPagePath);
691 691
 	}
692 692
 
693
-	public function loadApplicationConfigurationFromPhp($config,$configPath)
693
+	public function loadApplicationConfigurationFromPhp($config, $configPath)
694 694
 	{
695
-		$appConfig=new TApplicationConfiguration;
696
-		$appConfig->loadFromPhp($config,$configPath);
697
-		$this->_appConfigs[]=$appConfig;
695
+		$appConfig = new TApplicationConfiguration;
696
+		$appConfig->loadFromPhp($config, $configPath);
697
+		$this->_appConfigs[] = $appConfig;
698 698
 	}
699 699
 
700 700
 	/**
@@ -702,102 +702,102 @@  discard block
 block discarded – undo
702 702
 	 * @param TXmlElement config xml element
703 703
 	 * @param string base path corresponding to this xml element
704 704
 	 */
705
-	public function loadApplicationConfigurationFromXml($dom,$configPath)
705
+	public function loadApplicationConfigurationFromXml($dom, $configPath)
706 706
 	{
707
-		$appConfig=new TApplicationConfiguration;
708
-		$appConfig->loadFromXml($dom,$configPath);
709
-		$this->_appConfigs[]=$appConfig;
707
+		$appConfig = new TApplicationConfiguration;
708
+		$appConfig->loadFromXml($dom, $configPath);
709
+		$this->_appConfigs[] = $appConfig;
710 710
 	}
711 711
 
712 712
 	public function loadPageConfigurationFromPhp($config, $configPath, $configPagePath)
713 713
 	{
714 714
 		// authorization
715
-		if(isset($config['authorization']) && is_array($config['authorization']))
715
+		if (isset($config['authorization']) && is_array($config['authorization']))
716 716
 		{
717 717
 			$rules = array();
718
-			foreach($config['authorization'] as $authorization)
718
+			foreach ($config['authorization'] as $authorization)
719 719
 			{
720
-				$patterns=isset($authorization['pages'])?$authorization['pages']:'';
721
-				$ruleApplies=false;
722
-				if(empty($patterns) || trim($patterns)==='*') // null or empty string
723
-					$ruleApplies=true;
720
+				$patterns = isset($authorization['pages']) ? $authorization['pages'] : '';
721
+				$ruleApplies = false;
722
+				if (empty($patterns) || trim($patterns) === '*') // null or empty string
723
+					$ruleApplies = true;
724 724
 				else
725 725
 				{
726
-					foreach(explode(',',$patterns) as $pattern)
726
+					foreach (explode(',', $patterns) as $pattern)
727 727
 					{
728
-						if(($pattern=trim($pattern))!=='')
728
+						if (($pattern = trim($pattern)) !== '')
729 729
 						{
730 730
 							// we know $configPagePath and $this->_pagePath
731
-							if($configPagePath!=='')  // prepend the pattern with ConfigPagePath
732
-								$pattern=$configPagePath.'.'.$pattern;
733
-							if(strcasecmp($pattern,$this->_pagePath)===0)
731
+							if ($configPagePath !== '')  // prepend the pattern with ConfigPagePath
732
+								$pattern = $configPagePath . '.' . $pattern;
733
+							if (strcasecmp($pattern, $this->_pagePath) === 0)
734 734
 							{
735
-								$ruleApplies=true;
735
+								$ruleApplies = true;
736 736
 								break;
737 737
 							}
738
-							if($pattern[strlen($pattern)-1]==='*') // try wildcard matching
738
+							if ($pattern[strlen($pattern) - 1] === '*') // try wildcard matching
739 739
 							{
740
-								if(strncasecmp($this->_pagePath,$pattern,strlen($pattern)-1)===0)
740
+								if (strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1) === 0)
741 741
 								{
742
-									$ruleApplies=true;
742
+									$ruleApplies = true;
743 743
 									break;
744 744
 								}
745 745
 							}
746 746
 						}
747 747
 					}
748 748
 				}
749
-				if($ruleApplies)
749
+				if ($ruleApplies)
750 750
 				{
751
-					$action = isset($authorization['action'])?$authorization['action']:'';
752
-					$users = isset($authorization['users'])?$authorization['users']:'';
753
-					$roles = isset($authorization['roles'])?$authorization['roles']:'';
754
-					$verb = isset($authorization['verb'])?$authorization['verb']:'';
755
-					$ips = isset($authorization['ips'])?$authorization['ips']:'';
756
-					$rules[]=new TAuthorizationRule($action,$users,$roles,$verb,$ips);
751
+					$action = isset($authorization['action']) ? $authorization['action'] : '';
752
+					$users = isset($authorization['users']) ? $authorization['users'] : '';
753
+					$roles = isset($authorization['roles']) ? $authorization['roles'] : '';
754
+					$verb = isset($authorization['verb']) ? $authorization['verb'] : '';
755
+					$ips = isset($authorization['ips']) ? $authorization['ips'] : '';
756
+					$rules[] = new TAuthorizationRule($action, $users, $roles, $verb, $ips);
757 757
 				}
758 758
 			}
759
-			$this->_rules=array_merge($rules,$this->_rules);
759
+			$this->_rules = array_merge($rules, $this->_rules);
760 760
 		}
761 761
 		// pages
762
-		if(isset($config['pages']) && is_array($config['pages']))
762
+		if (isset($config['pages']) && is_array($config['pages']))
763 763
 		{
764
-			if(isset($config['pages']['properties']))
764
+			if (isset($config['pages']['properties']))
765 765
 			{
766 766
 				$this->_properties = array_merge($this->_properties, $config['pages']['properties']);
767 767
 				unset($config['pages']['properties']);
768 768
 			}
769
-			foreach($config['pages'] as $id => $page)
769
+			foreach ($config['pages'] as $id => $page)
770 770
 			{
771 771
 				$properties = array();
772
-				if(isset($page['properties']))
772
+				if (isset($page['properties']))
773 773
 				{
774
-					$properties=$page['properties'];
774
+					$properties = $page['properties'];
775 775
 					unset($page['properties']);
776 776
 				}
777
-				$matching=false;
778
-				$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
779
-				if(strcasecmp($id,$this->_pagePath)===0)
780
-					$matching=true;
781
-				else if($id[strlen($id)-1]==='*') // try wildcard matching
782
-					$matching=strncasecmp($this->_pagePath,$id,strlen($id)-1)===0;
783
-				if($matching)
784
-					$this->_properties=array_merge($this->_properties,$properties);
777
+				$matching = false;
778
+				$id = ($configPagePath === '') ? $id : $configPagePath . '.' . $id;
779
+				if (strcasecmp($id, $this->_pagePath) === 0)
780
+					$matching = true;
781
+				else if ($id[strlen($id) - 1] === '*') // try wildcard matching
782
+					$matching = strncasecmp($this->_pagePath, $id, strlen($id) - 1) === 0;
783
+				if ($matching)
784
+					$this->_properties = array_merge($this->_properties, $properties);
785 785
 			}
786 786
 		}
787 787
 
788 788
 		// external configurations
789
-		if(isset($config['includes']) && is_array($config['includes']))
789
+		if (isset($config['includes']) && is_array($config['includes']))
790 790
 		{
791
-			foreach($config['includes'] as $include)
791
+			foreach ($config['includes'] as $include)
792 792
 			{
793
-				$when = isset($include['when'])?true:false;
794
-				if(!isset($include['file']))
793
+				$when = isset($include['when']) ? true : false;
794
+				if (!isset($include['file']))
795 795
 					throw new TConfigurationException('pageserviceconf_includefile_required');
796 796
 				$filePath = $include['file'];
797
-				if(isset($this->_includes[$filePath]))
798
-					$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
797
+				if (isset($this->_includes[$filePath]))
798
+					$this->_includes[$filePath] = array($configPagePath, '(' . $this->_includes[$filePath][1] . ') || (' . $when . ')');
799 799
 				else
800
-					$this->_includes[$filePath]=array($configPagePath,$when);
800
+					$this->_includes[$filePath] = array($configPagePath, $when);
801 801
 			}
802 802
 		}
803 803
 	}
@@ -808,82 +808,82 @@  discard block
 block discarded – undo
808 808
 	 * @param string base path corresponding to this xml element
809 809
 	 * @param string the page path that the config XML is associated with. The page path doesn't include the page name.
810 810
 	 */
811
-	public function loadPageConfigurationFromXml($dom,$configPath,$configPagePath)
811
+	public function loadPageConfigurationFromXml($dom, $configPath, $configPagePath)
812 812
 	{
813 813
 		// authorization
814
-		if(($authorizationNode=$dom->getElementByTagName('authorization'))!==null)
814
+		if (($authorizationNode = $dom->getElementByTagName('authorization')) !== null)
815 815
 		{
816
-			$rules=array();
817
-			foreach($authorizationNode->getElements() as $node)
816
+			$rules = array();
817
+			foreach ($authorizationNode->getElements() as $node)
818 818
 			{
819
-				$patterns=$node->getAttribute('pages');
820
-				$ruleApplies=false;
821
-				if(empty($patterns) || trim($patterns)==='*') // null or empty string
822
-					$ruleApplies=true;
819
+				$patterns = $node->getAttribute('pages');
820
+				$ruleApplies = false;
821
+				if (empty($patterns) || trim($patterns) === '*') // null or empty string
822
+					$ruleApplies = true;
823 823
 				else
824 824
 				{
825
-					foreach(explode(',',$patterns) as $pattern)
825
+					foreach (explode(',', $patterns) as $pattern)
826 826
 					{
827
-						if(($pattern=trim($pattern))!=='')
827
+						if (($pattern = trim($pattern)) !== '')
828 828
 						{
829 829
 							// we know $configPagePath and $this->_pagePath
830
-							if($configPagePath!=='')  // prepend the pattern with ConfigPagePath
831
-								$pattern=$configPagePath.'.'.$pattern;
832
-							if(strcasecmp($pattern,$this->_pagePath)===0)
830
+							if ($configPagePath !== '')  // prepend the pattern with ConfigPagePath
831
+								$pattern = $configPagePath . '.' . $pattern;
832
+							if (strcasecmp($pattern, $this->_pagePath) === 0)
833 833
 							{
834
-								$ruleApplies=true;
834
+								$ruleApplies = true;
835 835
 								break;
836 836
 							}
837
-							if($pattern[strlen($pattern)-1]==='*') // try wildcard matching
837
+							if ($pattern[strlen($pattern) - 1] === '*') // try wildcard matching
838 838
 							{
839
-								if(strncasecmp($this->_pagePath,$pattern,strlen($pattern)-1)===0)
839
+								if (strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1) === 0)
840 840
 								{
841
-									$ruleApplies=true;
841
+									$ruleApplies = true;
842 842
 									break;
843 843
 								}
844 844
 							}
845 845
 						}
846 846
 					}
847 847
 				}
848
-				if($ruleApplies)
849
-					$rules[]=new TAuthorizationRule($node->getTagName(),$node->getAttribute('users'),$node->getAttribute('roles'),$node->getAttribute('verb'),$node->getAttribute('ips'));
848
+				if ($ruleApplies)
849
+					$rules[] = new TAuthorizationRule($node->getTagName(), $node->getAttribute('users'), $node->getAttribute('roles'), $node->getAttribute('verb'), $node->getAttribute('ips'));
850 850
 			}
851
-			$this->_rules=array_merge($rules,$this->_rules);
851
+			$this->_rules = array_merge($rules, $this->_rules);
852 852
 		}
853 853
 
854 854
 		// pages
855
-		if(($pagesNode=$dom->getElementByTagName('pages'))!==null)
855
+		if (($pagesNode = $dom->getElementByTagName('pages')) !== null)
856 856
 		{
857
-			$this->_properties=array_merge($this->_properties,$pagesNode->getAttributes()->toArray());
857
+			$this->_properties = array_merge($this->_properties, $pagesNode->getAttributes()->toArray());
858 858
 			// at the page folder
859
-			foreach($pagesNode->getElementsByTagName('page') as $node)
859
+			foreach ($pagesNode->getElementsByTagName('page') as $node)
860 860
 			{
861
-				$properties=$node->getAttributes();
862
-				$id=$properties->remove('id');
863
-				if(empty($id))
864
-					throw new TConfigurationException('pageserviceconf_page_invalid',$configPath);
865
-				$matching=false;
866
-				$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
867
-				if(strcasecmp($id,$this->_pagePath)===0)
868
-					$matching=true;
869
-				else if($id[strlen($id)-1]==='*') // try wildcard matching
870
-					$matching=strncasecmp($this->_pagePath,$id,strlen($id)-1)===0;
871
-				if($matching)
872
-					$this->_properties=array_merge($this->_properties,$properties->toArray());
861
+				$properties = $node->getAttributes();
862
+				$id = $properties->remove('id');
863
+				if (empty($id))
864
+					throw new TConfigurationException('pageserviceconf_page_invalid', $configPath);
865
+				$matching = false;
866
+				$id = ($configPagePath === '') ? $id : $configPagePath . '.' . $id;
867
+				if (strcasecmp($id, $this->_pagePath) === 0)
868
+					$matching = true;
869
+				else if ($id[strlen($id) - 1] === '*') // try wildcard matching
870
+					$matching = strncasecmp($this->_pagePath, $id, strlen($id) - 1) === 0;
871
+				if ($matching)
872
+					$this->_properties = array_merge($this->_properties, $properties->toArray());
873 873
 			}
874 874
 		}
875 875
 
876 876
 		// external configurations
877
-		foreach($dom->getElementsByTagName('include') as $node)
877
+		foreach ($dom->getElementsByTagName('include') as $node)
878 878
 		{
879
-			if(($when=$node->getAttribute('when'))===null)
880
-				$when=true;
881
-			if(($filePath=$node->getAttribute('file'))===null)
879
+			if (($when = $node->getAttribute('when')) === null)
880
+				$when = true;
881
+			if (($filePath = $node->getAttribute('file')) === null)
882 882
 				throw new TConfigurationException('pageserviceconf_includefile_required');
883
-			if(isset($this->_includes[$filePath]))
884
-				$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
883
+			if (isset($this->_includes[$filePath]))
884
+				$this->_includes[$filePath] = array($configPagePath, '(' . $this->_includes[$filePath][1] . ') || (' . $when . ')');
885 885
 			else
886
-				$this->_includes[$filePath]=array($configPagePath,$when);
886
+				$this->_includes[$filePath] = array($configPagePath, $when);
887 887
 		}
888 888
 	}
889 889
 }
Please login to merge, or discard this patch.
Braces   +142 added lines, -101 removed lines patch added patch discarded remove patch
@@ -166,8 +166,9 @@  discard block
 block discarded – undo
166 166
 	protected function initPageContext($pageConfig)
167 167
 	{
168 168
 		$application=$this->getApplication();
169
-		foreach($pageConfig->getApplicationConfigurations() as $appConfig)
170
-			$application->applyConfiguration($appConfig);
169
+		foreach($pageConfig->getApplicationConfigurations() as $appConfig) {
170
+					$application->applyConfiguration($appConfig);
171
+		}
171 172
 
172 173
 		$this->applyConfiguration($pageConfig);
173 174
 	}
@@ -186,12 +187,14 @@  discard block
 block discarded – undo
186 187
 		foreach($config->getExternalConfigurations() as $filePath=>$params)
187 188
 		{
188 189
 			list($configPagePath,$condition)=$params;
189
-			if($condition!==true)
190
-				$condition=$this->evaluateExpression($condition);
190
+			if($condition!==true) {
191
+							$condition=$this->evaluateExpression($condition);
192
+			}
191 193
 			if($condition)
192 194
 			{
193
-				if(($path=Prado::getPathOfNamespace($filePath,Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path))
194
-					throw new TConfigurationException('pageservice_includefile_invalid',$filePath);
195
+				if(($path=Prado::getPathOfNamespace($filePath,Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path)) {
196
+									throw new TConfigurationException('pageservice_includefile_invalid',$filePath);
197
+				}
195 198
 				$c=new TPageConfiguration($pagePath);
196 199
 				$c->loadFromFile($path,$configPagePath);
197 200
 				$this->applyConfiguration($c);
@@ -207,8 +210,9 @@  discard block
 block discarded – undo
207 210
 	protected function determineRequestedPagePath()
208 211
 	{
209 212
 		$pagePath=$this->getRequest()->getServiceParameter();
210
-		if(empty($pagePath))
211
-			$pagePath=$this->getDefaultPage();
213
+		if(empty($pagePath)) {
214
+					$pagePath=$this->getDefaultPage();
215
+		}
212 216
 		return $pagePath;
213 217
 	}
214 218
 
@@ -226,14 +230,14 @@  discard block
 block discarded – undo
226 230
 			$pageConfig=new TPageConfiguration($pagePath);
227 231
 			if($config!==null)
228 232
 			{
229
-				if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
230
-					$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
231
-				else
232
-					$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
233
+				if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) {
234
+									$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
235
+				} else {
236
+									$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
237
+				}
233 238
 			}
234 239
 			$pageConfig->loadFromFiles($this->getBasePath());
235
-		}
236
-		else
240
+		} else
237 241
 		{
238 242
 			$configCached=true;
239 243
 			$currentTimestamp=array();
@@ -245,23 +249,25 @@  discard block
 block discarded – undo
245 249
 				{
246 250
 					foreach($timestamps as $fileName=>$timestamp)
247 251
 					{
248
-						if($fileName===0) // application config file
252
+						if($fileName===0) {
253
+							// application config file
249 254
 						{
250 255
 							$appConfigFile=$application->getConfigurationFile();
251
-							$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
252
-							if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0]))
253
-								$configCached=false;
254 256
 						}
255
-						else
257
+							$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
258
+							if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0])) {
259
+															$configCached=false;
260
+							}
261
+						} else
256 262
 						{
257 263
 							$currentTimestamp[$fileName]=@filemtime($fileName);
258
-							if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName]))
259
-								$configCached=false;
264
+							if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName])) {
265
+															$configCached=false;
266
+							}
260 267
 						}
261 268
 					}
262 269
 				}
263
-			}
264
-			else
270
+			} else
265 271
 			{
266 272
 				$configCached=false;
267 273
 				$paths=explode('.',$pagePath);
@@ -283,10 +289,11 @@  discard block
 block discarded – undo
283 289
 				$pageConfig=new TPageConfiguration($pagePath);
284 290
 				if($config!==null)
285 291
 				{
286
-					if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
287
-						$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
288
-					else
289
-						$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
292
+					if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) {
293
+											$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
294
+					} else {
295
+											$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
296
+					}
290 297
 				}
291 298
 				$pageConfig->loadFromFiles($this->getBasePath());
292 299
 				$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath,array($pageConfig,$currentTimestamp));
@@ -345,8 +352,9 @@  discard block
 block discarded – undo
345 352
 		if($this->_pagePath===null)
346 353
 		{
347 354
 			$this->_pagePath=strtr($this->determineRequestedPagePath(),'/\\','..');
348
-			if(empty($this->_pagePath))
349
-				throw new THttpException(404,'pageservice_page_required');
355
+			if(empty($this->_pagePath)) {
356
+							throw new THttpException(404,'pageservice_page_required');
357
+			}
350 358
 		}
351 359
 		return $this->_pagePath;
352 360
 	}
@@ -373,10 +381,11 @@  discard block
 block discarded – undo
373 381
 	 */
374 382
 	public function setDefaultPage($value)
375 383
 	{
376
-		if($this->_initialized)
377
-			throw new TInvalidOperationException('pageservice_defaultpage_unchangeable');
378
-		else
379
-			$this->_defaultPage=$value;
384
+		if($this->_initialized) {
385
+					throw new TInvalidOperationException('pageservice_defaultpage_unchangeable');
386
+		} else {
387
+					$this->_defaultPage=$value;
388
+		}
380 389
 	}
381 390
 
382 391
 	/**
@@ -398,8 +407,9 @@  discard block
 block discarded – undo
398 407
 			if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath))
399 408
 			{
400 409
 				$basePath=$this->getApplication()->getBasePath().DIRECTORY_SEPARATOR.self::FALLBACK_BASEPATH;
401
-				if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath))
402
-					throw new TConfigurationException('pageservice_basepath_invalid',$basePath);
410
+				if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath)) {
411
+									throw new TConfigurationException('pageservice_basepath_invalid',$basePath);
412
+				}
403 413
 			}
404 414
 		}
405 415
 		return $this->_basePath;
@@ -411,10 +421,11 @@  discard block
 block discarded – undo
411 421
 	 */
412 422
 	public function setBasePath($value)
413 423
 	{
414
-		if($this->_initialized)
415
-			throw new TInvalidOperationException('pageservice_basepath_unchangeable');
416
-		else if(($path=Prado::getPathOfNamespace($value))===null || !is_dir($path))
417
-			throw new TConfigurationException('pageservice_basepath_invalid',$value);
424
+		if($this->_initialized) {
425
+					throw new TInvalidOperationException('pageservice_basepath_unchangeable');
426
+		} else if(($path=Prado::getPathOfNamespace($value))===null || !is_dir($path)) {
427
+					throw new TConfigurationException('pageservice_basepath_invalid',$value);
428
+		}
418 429
 		$this->_basePath=realpath($path);
419 430
 	}
420 431
 
@@ -481,31 +492,35 @@  discard block
 block discarded – undo
481 492
 		$hasTemplateFile=is_file($path.self::PAGE_FILE_EXT);
482 493
 		$hasClassFile=is_file($path.Prado::CLASS_FILE_EXT);
483 494
 
484
-		if(!$hasTemplateFile && !$hasClassFile)
485
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
495
+		if(!$hasTemplateFile && !$hasClassFile) {
496
+					throw new THttpException(404,'pageservice_page_unknown',$pagePath);
497
+		}
486 498
 
487 499
 		if($hasClassFile)
488 500
 		{
489 501
 			$className=basename($path);
490
-			if(!class_exists($className,false))
491
-				include_once($path.Prado::CLASS_FILE_EXT);
492
-		}
493
-		else
502
+			if(!class_exists($className,false)) {
503
+							include_once($path.Prado::CLASS_FILE_EXT);
504
+			}
505
+		} else
494 506
 		{
495 507
 			$className=$this->getBasePageClass();
496 508
 			Prado::using($className);
497
-			if(($pos=strrpos($className,'.'))!==false)
498
-				$className=substr($className,$pos+1);
509
+			if(($pos=strrpos($className,'.'))!==false) {
510
+							$className=substr($className,$pos+1);
511
+			}
499 512
 		}
500 513
 
501
- 		if(!class_exists($className,false) || ($className!=='TPage' && !is_subclass_of($className,'TPage')))
502
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
514
+ 		if(!class_exists($className,false) || ($className!=='TPage' && !is_subclass_of($className,'TPage'))) {
515
+ 					throw new THttpException(404,'pageservice_page_unknown',$pagePath);
516
+ 		}
503 517
 
504 518
 		$page=Prado::createComponent($className);
505 519
 		$page->setPagePath($pagePath);
506 520
 
507
-		if($hasTemplateFile)
508
-			$page->setTemplate($this->getTemplateManager()->getTemplateByFileName($path.self::PAGE_FILE_EXT));
521
+		if($hasTemplateFile) {
522
+					$page->setTemplate($this->getTemplateManager()->getTemplateByFileName($path.self::PAGE_FILE_EXT));
523
+		}
509 524
 
510 525
 		return $page;
511 526
 	}
@@ -517,8 +532,9 @@  discard block
 block discarded – undo
517 532
 	 */
518 533
 	protected function runPage($page,$properties)
519 534
 	{
520
-		foreach($properties as $name=>$value)
521
-			$page->setSubProperty($name,$value);
535
+		foreach($properties as $name=>$value) {
536
+					$page->setSubProperty($name,$value);
537
+		}
522 538
 		$page->run($this->getResponse()->createHtmlWriter());
523 539
 	}
524 540
 
@@ -635,10 +651,11 @@  discard block
 block discarded – undo
635 651
 		{
636 652
 			$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName,$configPagePath);
637 653
 			$path.=DIRECTORY_SEPARATOR.$p;
638
-			if($configPagePath==='')
639
-				$configPagePath=$p;
640
-			else
641
-				$configPagePath.='.'.$p;
654
+			if($configPagePath==='') {
655
+							$configPagePath=$p;
656
+			} else {
657
+							$configPagePath.='.'.$p;
658
+			}
642 659
 		}
643 660
 		$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName,$configPagePath);
644 661
 		$this->_rules=new TAuthorizationRuleCollection($this->_rules);
@@ -652,21 +669,22 @@  discard block
 block discarded – undo
652 669
 	public function loadFromFile($fname,$configPagePath)
653 670
 	{
654 671
 		Prado::trace("Loading page configuration file $fname",'System.Web.Services.TPageService');
655
-		if(empty($fname) || !is_file($fname))
656
-			return;
672
+		if(empty($fname) || !is_file($fname)) {
673
+					return;
674
+		}
657 675
 
658 676
 		if(Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
659 677
 		{
660 678
 			$fcontent = include $fname;
661 679
 			$this->loadFromPhp($fcontent,dirname($fname),$configPagePath);
662
-		}
663
-		else
680
+		} else
664 681
 		{
665 682
 			$dom=new TXmlDocument;
666
-			if($dom->loadFromFile($fname))
667
-				$this->loadFromXml($dom,dirname($fname),$configPagePath);
668
-			else
669
-				throw new TConfigurationException('pageserviceconf_file_invalid',$fname);
683
+			if($dom->loadFromFile($fname)) {
684
+							$this->loadFromXml($dom,dirname($fname),$configPagePath);
685
+			} else {
686
+							throw new TConfigurationException('pageserviceconf_file_invalid',$fname);
687
+			}
670 688
 		}
671 689
 	}
672 690
 
@@ -719,27 +737,32 @@  discard block
 block discarded – undo
719 737
 			{
720 738
 				$patterns=isset($authorization['pages'])?$authorization['pages']:'';
721 739
 				$ruleApplies=false;
722
-				if(empty($patterns) || trim($patterns)==='*') // null or empty string
740
+				if(empty($patterns) || trim($patterns)==='*') {
741
+					// null or empty string
723 742
 					$ruleApplies=true;
724
-				else
743
+				} else
725 744
 				{
726 745
 					foreach(explode(',',$patterns) as $pattern)
727 746
 					{
728 747
 						if(($pattern=trim($pattern))!=='')
729 748
 						{
730 749
 							// we know $configPagePath and $this->_pagePath
731
-							if($configPagePath!=='')  // prepend the pattern with ConfigPagePath
750
+							if($configPagePath!=='') {
751
+								// prepend the pattern with ConfigPagePath
732 752
 								$pattern=$configPagePath.'.'.$pattern;
753
+							}
733 754
 							if(strcasecmp($pattern,$this->_pagePath)===0)
734 755
 							{
735 756
 								$ruleApplies=true;
736 757
 								break;
737 758
 							}
738
-							if($pattern[strlen($pattern)-1]==='*') // try wildcard matching
759
+							if($pattern[strlen($pattern)-1]==='*') {
760
+								// try wildcard matching
739 761
 							{
740 762
 								if(strncasecmp($this->_pagePath,$pattern,strlen($pattern)-1)===0)
741 763
 								{
742 764
 									$ruleApplies=true;
765
+							}
743 766
 									break;
744 767
 								}
745 768
 							}
@@ -776,12 +799,15 @@  discard block
 block discarded – undo
776 799
 				}
777 800
 				$matching=false;
778 801
 				$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
779
-				if(strcasecmp($id,$this->_pagePath)===0)
780
-					$matching=true;
781
-				else if($id[strlen($id)-1]==='*') // try wildcard matching
802
+				if(strcasecmp($id,$this->_pagePath)===0) {
803
+									$matching=true;
804
+				} else if($id[strlen($id)-1]==='*') {
805
+					// try wildcard matching
782 806
 					$matching=strncasecmp($this->_pagePath,$id,strlen($id)-1)===0;
783
-				if($matching)
784
-					$this->_properties=array_merge($this->_properties,$properties);
807
+				}
808
+				if($matching) {
809
+									$this->_properties=array_merge($this->_properties,$properties);
810
+				}
785 811
 			}
786 812
 		}
787 813
 
@@ -791,13 +817,15 @@  discard block
 block discarded – undo
791 817
 			foreach($config['includes'] as $include)
792 818
 			{
793 819
 				$when = isset($include['when'])?true:false;
794
-				if(!isset($include['file']))
795
-					throw new TConfigurationException('pageserviceconf_includefile_required');
820
+				if(!isset($include['file'])) {
821
+									throw new TConfigurationException('pageserviceconf_includefile_required');
822
+				}
796 823
 				$filePath = $include['file'];
797
-				if(isset($this->_includes[$filePath]))
798
-					$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
799
-				else
800
-					$this->_includes[$filePath]=array($configPagePath,$when);
824
+				if(isset($this->_includes[$filePath])) {
825
+									$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
826
+				} else {
827
+									$this->_includes[$filePath]=array($configPagePath,$when);
828
+				}
801 829
 			}
802 830
 		}
803 831
 	}
@@ -818,35 +846,41 @@  discard block
 block discarded – undo
818 846
 			{
819 847
 				$patterns=$node->getAttribute('pages');
820 848
 				$ruleApplies=false;
821
-				if(empty($patterns) || trim($patterns)==='*') // null or empty string
849
+				if(empty($patterns) || trim($patterns)==='*') {
850
+					// null or empty string
822 851
 					$ruleApplies=true;
823
-				else
852
+				} else
824 853
 				{
825 854
 					foreach(explode(',',$patterns) as $pattern)
826 855
 					{
827 856
 						if(($pattern=trim($pattern))!=='')
828 857
 						{
829 858
 							// we know $configPagePath and $this->_pagePath
830
-							if($configPagePath!=='')  // prepend the pattern with ConfigPagePath
859
+							if($configPagePath!=='') {
860
+								// prepend the pattern with ConfigPagePath
831 861
 								$pattern=$configPagePath.'.'.$pattern;
862
+							}
832 863
 							if(strcasecmp($pattern,$this->_pagePath)===0)
833 864
 							{
834 865
 								$ruleApplies=true;
835 866
 								break;
836 867
 							}
837
-							if($pattern[strlen($pattern)-1]==='*') // try wildcard matching
868
+							if($pattern[strlen($pattern)-1]==='*') {
869
+								// try wildcard matching
838 870
 							{
839 871
 								if(strncasecmp($this->_pagePath,$pattern,strlen($pattern)-1)===0)
840 872
 								{
841 873
 									$ruleApplies=true;
874
+							}
842 875
 									break;
843 876
 								}
844 877
 							}
845 878
 						}
846 879
 					}
847 880
 				}
848
-				if($ruleApplies)
849
-					$rules[]=new TAuthorizationRule($node->getTagName(),$node->getAttribute('users'),$node->getAttribute('roles'),$node->getAttribute('verb'),$node->getAttribute('ips'));
881
+				if($ruleApplies) {
882
+									$rules[]=new TAuthorizationRule($node->getTagName(),$node->getAttribute('users'),$node->getAttribute('roles'),$node->getAttribute('verb'),$node->getAttribute('ips'));
883
+				}
850 884
 			}
851 885
 			$this->_rules=array_merge($rules,$this->_rules);
852 886
 		}
@@ -860,30 +894,37 @@  discard block
 block discarded – undo
860 894
 			{
861 895
 				$properties=$node->getAttributes();
862 896
 				$id=$properties->remove('id');
863
-				if(empty($id))
864
-					throw new TConfigurationException('pageserviceconf_page_invalid',$configPath);
897
+				if(empty($id)) {
898
+									throw new TConfigurationException('pageserviceconf_page_invalid',$configPath);
899
+				}
865 900
 				$matching=false;
866 901
 				$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
867
-				if(strcasecmp($id,$this->_pagePath)===0)
868
-					$matching=true;
869
-				else if($id[strlen($id)-1]==='*') // try wildcard matching
902
+				if(strcasecmp($id,$this->_pagePath)===0) {
903
+									$matching=true;
904
+				} else if($id[strlen($id)-1]==='*') {
905
+					// try wildcard matching
870 906
 					$matching=strncasecmp($this->_pagePath,$id,strlen($id)-1)===0;
871
-				if($matching)
872
-					$this->_properties=array_merge($this->_properties,$properties->toArray());
907
+				}
908
+				if($matching) {
909
+									$this->_properties=array_merge($this->_properties,$properties->toArray());
910
+				}
873 911
 			}
874 912
 		}
875 913
 
876 914
 		// external configurations
877 915
 		foreach($dom->getElementsByTagName('include') as $node)
878 916
 		{
879
-			if(($when=$node->getAttribute('when'))===null)
880
-				$when=true;
881
-			if(($filePath=$node->getAttribute('file'))===null)
882
-				throw new TConfigurationException('pageserviceconf_includefile_required');
883
-			if(isset($this->_includes[$filePath]))
884
-				$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
885
-			else
886
-				$this->_includes[$filePath]=array($configPagePath,$when);
917
+			if(($when=$node->getAttribute('when'))===null) {
918
+							$when=true;
919
+			}
920
+			if(($filePath=$node->getAttribute('file'))===null) {
921
+							throw new TConfigurationException('pageserviceconf_includefile_required');
922
+			}
923
+			if(isset($this->_includes[$filePath])) {
924
+							$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
925
+			} else {
926
+							$this->_includes[$filePath]=array($configPagePath,$when);
927
+			}
887 928
 		}
888 929
 	}
889 930
 }
Please login to merge, or discard this patch.
framework/Web/Services/TRpcService.php 3 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -258,6 +258,9 @@  discard block
 block discarded – undo
258 258
  */
259 259
 class TRpcException extends TException
260 260
 {
261
+	/**
262
+	 * @param string $message
263
+	 */
261 264
 	public function __construct($message, $errorCode = -1)
262 265
 	{
263 266
 		$this->setErrorCode($errorCode);
@@ -334,7 +337,7 @@  discard block
 block discarded – undo
334 337
 	}
335 338
 
336 339
 	/**
337
-	 * @return rpc server instance
340
+	 * @return TRpcServer server instance
338 341
 	 */
339 342
 	public function getRpcServer()
340 343
 	{
@@ -366,6 +369,7 @@  discard block
 block discarded – undo
366 369
 	/**
367 370
 	 * @param string request payload
368 371
 	 * Processed the request ans returns the response, if any
372
+	 * @param string $requestPayload
369 373
 	 * @return processed response
370 374
 	 * @abstract
371 375
 	 */
@@ -641,7 +645,6 @@  discard block
 block discarded – undo
641 645
 	/**
642 646
 	 * Registers a new RPC method and handler details
643 647
 	 * @param string $methodName
644
-	 * @param array $handlerDetails containing the callback handler
645 648
 	 */
646 649
 	public function addMethod($methodName, $methodDetails)
647 650
 	{
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -90,28 +90,28 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		$_properties = $this->apiProviders[$providerId];
92 92
 
93
-		if(($_providerClass = $_properties->remove('class')) === null)
93
+		if (($_providerClass = $_properties->remove('class')) === null)
94 94
 			throw new TConfigurationException('rpcservice_apiprovider_required');
95 95
 
96 96
 		Prado::using($_providerClass);
97 97
 
98 98
 		$_providerClassName = ($_pos = strrpos($_providerClass, '.')) !== false ? substr($_providerClass, $_pos + 1) : $_providerClass;
99
-		if(!is_subclass_of($_providerClassName, self::BASE_API_PROVIDER))
99
+		if (!is_subclass_of($_providerClassName, self::BASE_API_PROVIDER))
100 100
 			throw new TConfigurationException('rpcservice_apiprovider_invalid');
101 101
 
102
-		if(($_rpcServerClass = $_properties->remove('server')) === null)
102
+		if (($_rpcServerClass = $_properties->remove('server')) === null)
103 103
 			$_rpcServerClass = self::BASE_RPC_SERVER;
104 104
 
105 105
 		Prado::using($_rpcServerClass);
106 106
 
107 107
 		$_rpcServerClassName = ($_pos = strrpos($_rpcServerClass, '.')) !== false ? substr($_rpcServerClass, $_pos + 1) : $_rpcServerClass;
108
-		if($_rpcServerClassName!==self::BASE_RPC_SERVER && !is_subclass_of($_rpcServerClassName, self::BASE_RPC_SERVER))
108
+		if ($_rpcServerClassName !== self::BASE_RPC_SERVER && !is_subclass_of($_rpcServerClassName, self::BASE_RPC_SERVER))
109 109
 			throw new TConfigurationException('rpcservice_rpcserver_invalid');
110 110
 
111 111
 		$_apiProvider = new $_providerClassName(new $_rpcServerClassName($protocolHandler));
112 112
 		$_apiProvider->setId($providerId);
113 113
 
114
-		foreach($_properties as $_key => $_value)
114
+		foreach ($_properties as $_key => $_value)
115 115
 			$_apiProvider->setSubProperty($_key, $_value);
116 116
 
117 117
 		return $_apiProvider;
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function loadConfig(TXmlElement $xml)
134 134
 	{
135
-		foreach($xml->getElementsByTagName('rpcapi') as $_apiProviderXml)
135
+		foreach ($xml->getElementsByTagName('rpcapi') as $_apiProviderXml)
136 136
 		{
137 137
 			$_properties = $_apiProviderXml->getAttributes();
138 138
 
139
-			if(($_id = $_properties->remove('id')) === null || $_id == "")
139
+			if (($_id = $_properties->remove('id')) === null || $_id == "")
140 140
 				throw new TConfigurationException('rpcservice_apiproviderid_required');
141 141
 
142
-			if(isset($this->apiProviders[$_id]))
142
+			if (isset($this->apiProviders[$_id]))
143 143
 				throw new TConfigurationException('rpcservice_apiproviderid_duplicated');
144 144
 
145 145
 			$this->apiProviders[$_id] = $_properties;
@@ -153,22 +153,22 @@  discard block
 block discarded – undo
153 153
 	{
154 154
 		$_request = $this->getRequest();
155 155
 
156
-		if(($_providerId = $_request->getServiceParameter()) == "")
156
+		if (($_providerId = $_request->getServiceParameter()) == "")
157 157
 			throw new THttpException(400, 'RPC API-Provider id required');
158 158
 		
159
-		if(($_method = $_request->getRequestType()) != 'POST')
160
-			throw new THttpException(405, 'Invalid request method "'.$_method.'"!'); // TODO Exception muss "Allow POST" Header setzen
159
+		if (($_method = $_request->getRequestType()) != 'POST')
160
+			throw new THttpException(405, 'Invalid request method "' . $_method . '"!'); // TODO Exception muss "Allow POST" Header setzen
161 161
 
162
-		if(($_mimeType = $_request->getContentType()) === null)
162
+		if (($_mimeType = $_request->getContentType()) === null)
163 163
 			throw new THttpException(406, 'Content-Type is missing!'); // TODO Exception muss gültige Content-Type werte zurück geben
164 164
 
165
-		if(!in_array($_mimeType, array_keys($this->protocolHandlers)))
165
+		if (!in_array($_mimeType, array_keys($this->protocolHandlers)))
166 166
 			throw new THttpException(406, 'Unsupported Content-Type!'); // TODO see previous
167 167
 
168 168
 		$_protocolHandlerClass = $this->protocolHandlers[$_mimeType];
169 169
 		$_protocolHandler = new $_protocolHandlerClass;
170 170
 
171
-		if(($_result = $this->createApiProvider($_protocolHandler, $_providerId)->processRequest()) !== null)
171
+		if (($_result = $this->createApiProvider($_protocolHandler, $_providerId)->processRequest()) !== null)
172 172
 		{
173 173
 			$_response = $this->getResponse();
174 174
 			$_protocolHandler->createResponseHeaders($_response);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		{
239 239
 			return $this->handler->callMethod($this->getPayload());
240 240
 		}
241
-		catch(TRpcException $e)
241
+		catch (TRpcException $e)
242 242
 		{
243 243
 			return $this->handler->createErrorResponse($e);
244 244
 		}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	{
321 321
 		$this->rpcServer = $rpcServer;
322 322
 
323
-		foreach($this->registerMethods() as $_methodName => $_methodDetails)
323
+		foreach ($this->registerMethods() as $_methodName => $_methodDetails)
324 324
 			$this->rpcServer->addRpcMethod($_methodName, $_methodDetails);
325 325
 	}
326 326
 
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	 */
419 419
 	public function callApiMethod($methodName, $parameters)
420 420
 	{
421
-		if(!isset($this->rpcMethods[$methodName]))
422
-			throw new TRpcException('Method "'.$methodName.'" not found');
421
+		if (!isset($this->rpcMethods[$methodName]))
422
+			throw new TRpcException('Method "' . $methodName . '" not found');
423 423
 
424
-		if($parameters === null)
424
+		if ($parameters === null)
425 425
 			$parameters = array();
426 426
 
427
-		if(!is_array($parameters))
427
+		if (!is_array($parameters))
428 428
 			$parameters = array($parameters);
429 429
 		return call_user_func_array($this->rpcMethods[$methodName]['method'], $parameters);
430 430
 	}
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
  */
446 446
 class TJsonRpcProtocol extends TRpcProtocol
447 447
 {
448
-	protected $_id=null;
449
-	protected $_specificationVersion=1.0;
448
+	protected $_id = null;
449
+	protected $_specificationVersion = 1.0;
450 450
 
451 451
 	/**
452 452
 	 * Handles the RPC request
@@ -459,31 +459,31 @@  discard block
 block discarded – undo
459 459
 		{
460 460
 			$_request = $this->decode($requestPayload);
461 461
 
462
-			if(isset($_request['jsonrpc']))
462
+			if (isset($_request['jsonrpc']))
463 463
 			{
464
-				$this->_specificationVersion=$_request['jsonrpc'];
465
-				if($this->_specificationVersion > 2.0)
464
+				$this->_specificationVersion = $_request['jsonrpc'];
465
+				if ($this->_specificationVersion > 2.0)
466 466
 					throw new TRpcException('Unsupported specification version', '-32600');
467 467
 			}
468 468
 
469
-			if(isset($_request['id']))
470
-				$this->_id=$_request['id'];
469
+			if (isset($_request['id']))
470
+				$this->_id = $_request['id'];
471 471
 
472
-			if(!isset($_request['method']))
472
+			if (!isset($_request['method']))
473 473
 					throw new TRpcException('Missing request method', '-32600');
474 474
 
475
-			if(!isset($_request['params']))
475
+			if (!isset($_request['params']))
476 476
 				$parameters = array();
477 477
 			else
478 478
 				$parameters = $_request['params'];
479 479
 
480
-			if(!is_array($parameters))
480
+			if (!is_array($parameters))
481 481
 				$parameters = array($parameters);
482 482
 
483 483
 			// a request without an id is a notification that doesn't need a response
484
-			if($this->_id !== null)
484
+			if ($this->_id !== null)
485 485
 			{
486
-				if($this->_specificationVersion==2.0)
486
+				if ($this->_specificationVersion == 2.0)
487 487
 				{
488 488
 					return $this->encode(array(
489 489
 						'jsonrpc' => '2.0',
@@ -499,15 +499,15 @@  discard block
 block discarded – undo
499 499
 				}
500 500
 			}
501 501
 		}
502
-		catch(TRpcException $e)
502
+		catch (TRpcException $e)
503 503
 		{
504 504
 			return $this->createErrorResponse($e);
505 505
 		}
506
-		catch(THttpException $e)
506
+		catch (THttpException $e)
507 507
 		{
508 508
 			throw $e;
509 509
 		}
510
-		catch(Exception $e)
510
+		catch (Exception $e)
511 511
 		{
512 512
 			return $this->createErrorResponse(new TRpcException('An internal error occured', '-32603'));
513 513
 		}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public function createErrorResponse(TRpcException $exception)
522 522
 	{
523
-		if($this->_specificationVersion==2.0)
523
+		if ($this->_specificationVersion == 2.0)
524 524
 		{
525 525
 			return $this->encode(array(
526 526
 				'id' => $this->_id,
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	private static function checkJsonError()
581 581
 	{
582 582
 		$errnum = json_last_error();
583
-		if($errnum != JSON_ERROR_NONE)
583
+		if ($errnum != JSON_ERROR_NONE)
584 584
 			throw new Exception("JSON error: $msg", $err);
585 585
 	}
586 586
 
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 	 */
594 594
 	public function callApiMethod($methodName, $parameters)
595 595
 	{
596
-		if(!isset($this->rpcMethods[$methodName]))
597
-			throw new TRpcException('Method "'.$methodName.'" not found', '-32601');
596
+		if (!isset($this->rpcMethods[$methodName]))
597
+			throw new TRpcException('Method "' . $methodName . '" not found', '-32601');
598 598
 
599 599
 		return call_user_func_array($this->rpcMethods[$methodName]['method'], $parameters);
600 600
 	}
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
 		{
664 664
 			return xmlrpc_server_call_method($this->_xmlrpcServer, $requestPayload, null);
665 665
 		}
666
-		catch(TRpcException $e)
666
+		catch (TRpcException $e)
667 667
 		{
668 668
 			return $this->createErrorResponse($e);
669 669
 		}
670
-		catch(THttpException $e)
670
+		catch (THttpException $e)
671 671
 		{
672 672
 			throw $e;
673 673
 		}
674
-		catch(Exception $e)
674
+		catch (Exception $e)
675 675
 		{
676 676
 			return $this->createErrorResponse(new TRpcException('An internal error occured'));
677 677
 		}
Please login to merge, or discard this patch.
Braces   +78 added lines, -60 removed lines patch added patch discarded remove patch
@@ -90,29 +90,34 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		$_properties = $this->apiProviders[$providerId];
92 92
 
93
-		if(($_providerClass = $_properties->remove('class')) === null)
94
-			throw new TConfigurationException('rpcservice_apiprovider_required');
93
+		if(($_providerClass = $_properties->remove('class')) === null) {
94
+					throw new TConfigurationException('rpcservice_apiprovider_required');
95
+		}
95 96
 
96 97
 		Prado::using($_providerClass);
97 98
 
98 99
 		$_providerClassName = ($_pos = strrpos($_providerClass, '.')) !== false ? substr($_providerClass, $_pos + 1) : $_providerClass;
99
-		if(!is_subclass_of($_providerClassName, self::BASE_API_PROVIDER))
100
-			throw new TConfigurationException('rpcservice_apiprovider_invalid');
100
+		if(!is_subclass_of($_providerClassName, self::BASE_API_PROVIDER)) {
101
+					throw new TConfigurationException('rpcservice_apiprovider_invalid');
102
+		}
101 103
 
102
-		if(($_rpcServerClass = $_properties->remove('server')) === null)
103
-			$_rpcServerClass = self::BASE_RPC_SERVER;
104
+		if(($_rpcServerClass = $_properties->remove('server')) === null) {
105
+					$_rpcServerClass = self::BASE_RPC_SERVER;
106
+		}
104 107
 
105 108
 		Prado::using($_rpcServerClass);
106 109
 
107 110
 		$_rpcServerClassName = ($_pos = strrpos($_rpcServerClass, '.')) !== false ? substr($_rpcServerClass, $_pos + 1) : $_rpcServerClass;
108
-		if($_rpcServerClassName!==self::BASE_RPC_SERVER && !is_subclass_of($_rpcServerClassName, self::BASE_RPC_SERVER))
109
-			throw new TConfigurationException('rpcservice_rpcserver_invalid');
111
+		if($_rpcServerClassName!==self::BASE_RPC_SERVER && !is_subclass_of($_rpcServerClassName, self::BASE_RPC_SERVER)) {
112
+					throw new TConfigurationException('rpcservice_rpcserver_invalid');
113
+		}
110 114
 
111 115
 		$_apiProvider = new $_providerClassName(new $_rpcServerClassName($protocolHandler));
112 116
 		$_apiProvider->setId($providerId);
113 117
 
114
-		foreach($_properties as $_key => $_value)
115
-			$_apiProvider->setSubProperty($_key, $_value);
118
+		foreach($_properties as $_key => $_value) {
119
+					$_apiProvider->setSubProperty($_key, $_value);
120
+		}
116 121
 
117 122
 		return $_apiProvider;
118 123
 	}
@@ -136,11 +141,13 @@  discard block
 block discarded – undo
136 141
 		{
137 142
 			$_properties = $_apiProviderXml->getAttributes();
138 143
 
139
-			if(($_id = $_properties->remove('id')) === null || $_id == "")
140
-				throw new TConfigurationException('rpcservice_apiproviderid_required');
144
+			if(($_id = $_properties->remove('id')) === null || $_id == "") {
145
+							throw new TConfigurationException('rpcservice_apiproviderid_required');
146
+			}
141 147
 
142
-			if(isset($this->apiProviders[$_id]))
143
-				throw new TConfigurationException('rpcservice_apiproviderid_duplicated');
148
+			if(isset($this->apiProviders[$_id])) {
149
+							throw new TConfigurationException('rpcservice_apiproviderid_duplicated');
150
+			}
144 151
 
145 152
 			$this->apiProviders[$_id] = $_properties;
146 153
 		}
@@ -153,17 +160,24 @@  discard block
 block discarded – undo
153 160
 	{
154 161
 		$_request = $this->getRequest();
155 162
 
156
-		if(($_providerId = $_request->getServiceParameter()) == "")
157
-			throw new THttpException(400, 'RPC API-Provider id required');
163
+		if(($_providerId = $_request->getServiceParameter()) == "") {
164
+					throw new THttpException(400, 'RPC API-Provider id required');
165
+		}
158 166
 		
159
-		if(($_method = $_request->getRequestType()) != 'POST')
160
-			throw new THttpException(405, 'Invalid request method "'.$_method.'"!'); // TODO Exception muss "Allow POST" Header setzen
167
+		if(($_method = $_request->getRequestType()) != 'POST') {
168
+					throw new THttpException(405, 'Invalid request method "'.$_method.'"!');
169
+		}
170
+		// TODO Exception muss "Allow POST" Header setzen
161 171
 
162
-		if(($_mimeType = $_request->getContentType()) === null)
163
-			throw new THttpException(406, 'Content-Type is missing!'); // TODO Exception muss gültige Content-Type werte zurück geben
172
+		if(($_mimeType = $_request->getContentType()) === null) {
173
+					throw new THttpException(406, 'Content-Type is missing!');
174
+		}
175
+		// TODO Exception muss gültige Content-Type werte zurück geben
164 176
 
165
-		if(!in_array($_mimeType, array_keys($this->protocolHandlers)))
166
-			throw new THttpException(406, 'Unsupported Content-Type!'); // TODO see previous
177
+		if(!in_array($_mimeType, array_keys($this->protocolHandlers))) {
178
+					throw new THttpException(406, 'Unsupported Content-Type!');
179
+		}
180
+		// TODO see previous
167 181
 
168 182
 		$_protocolHandlerClass = $this->protocolHandlers[$_mimeType];
169 183
 		$_protocolHandler = new $_protocolHandlerClass;
@@ -237,8 +251,7 @@  discard block
 block discarded – undo
237 251
 		try
238 252
 		{
239 253
 			return $this->handler->callMethod($this->getPayload());
240
-		}
241
-		catch(TRpcException $e)
254
+		} catch(TRpcException $e)
242 255
 		{
243 256
 			return $this->handler->createErrorResponse($e);
244 257
 		}
@@ -320,8 +333,9 @@  discard block
 block discarded – undo
320 333
 	{
321 334
 		$this->rpcServer = $rpcServer;
322 335
 
323
-		foreach($this->registerMethods() as $_methodName => $_methodDetails)
324
-			$this->rpcServer->addRpcMethod($_methodName, $_methodDetails);
336
+		foreach($this->registerMethods() as $_methodName => $_methodDetails) {
337
+					$this->rpcServer->addRpcMethod($_methodName, $_methodDetails);
338
+		}
325 339
 	}
326 340
 
327 341
 	/**
@@ -418,14 +432,17 @@  discard block
 block discarded – undo
418 432
 	 */
419 433
 	public function callApiMethod($methodName, $parameters)
420 434
 	{
421
-		if(!isset($this->rpcMethods[$methodName]))
422
-			throw new TRpcException('Method "'.$methodName.'" not found');
435
+		if(!isset($this->rpcMethods[$methodName])) {
436
+					throw new TRpcException('Method "'.$methodName.'" not found');
437
+		}
423 438
 
424
-		if($parameters === null)
425
-			$parameters = array();
439
+		if($parameters === null) {
440
+					$parameters = array();
441
+		}
426 442
 
427
-		if(!is_array($parameters))
428
-			$parameters = array($parameters);
443
+		if(!is_array($parameters)) {
444
+					$parameters = array($parameters);
445
+		}
429 446
 		return call_user_func_array($this->rpcMethods[$methodName]['method'], $parameters);
430 447
 	}
431 448
 }
@@ -462,23 +479,28 @@  discard block
 block discarded – undo
462 479
 			if(isset($_request['jsonrpc']))
463 480
 			{
464 481
 				$this->_specificationVersion=$_request['jsonrpc'];
465
-				if($this->_specificationVersion > 2.0)
466
-					throw new TRpcException('Unsupported specification version', '-32600');
482
+				if($this->_specificationVersion > 2.0) {
483
+									throw new TRpcException('Unsupported specification version', '-32600');
484
+				}
467 485
 			}
468 486
 
469
-			if(isset($_request['id']))
470
-				$this->_id=$_request['id'];
487
+			if(isset($_request['id'])) {
488
+							$this->_id=$_request['id'];
489
+			}
471 490
 
472
-			if(!isset($_request['method']))
473
-					throw new TRpcException('Missing request method', '-32600');
491
+			if(!isset($_request['method'])) {
492
+								throw new TRpcException('Missing request method', '-32600');
493
+			}
474 494
 
475
-			if(!isset($_request['params']))
476
-				$parameters = array();
477
-			else
478
-				$parameters = $_request['params'];
495
+			if(!isset($_request['params'])) {
496
+							$parameters = array();
497
+			} else {
498
+							$parameters = $_request['params'];
499
+			}
479 500
 
480
-			if(!is_array($parameters))
481
-				$parameters = array($parameters);
501
+			if(!is_array($parameters)) {
502
+							$parameters = array($parameters);
503
+			}
482 504
 
483 505
 			// a request without an id is a notification that doesn't need a response
484 506
 			if($this->_id !== null)
@@ -498,16 +520,13 @@  discard block
 block discarded – undo
498 520
 					));
499 521
 				}
500 522
 			}
501
-		}
502
-		catch(TRpcException $e)
523
+		} catch(TRpcException $e)
503 524
 		{
504 525
 			return $this->createErrorResponse($e);
505
-		}
506
-		catch(THttpException $e)
526
+		} catch(THttpException $e)
507 527
 		{
508 528
 			throw $e;
509
-		}
510
-		catch(Exception $e)
529
+		} catch(Exception $e)
511 530
 		{
512 531
 			return $this->createErrorResponse(new TRpcException('An internal error occured', '-32603'));
513 532
 		}
@@ -580,8 +599,9 @@  discard block
 block discarded – undo
580 599
 	private static function checkJsonError()
581 600
 	{
582 601
 		$errnum = json_last_error();
583
-		if($errnum != JSON_ERROR_NONE)
584
-			throw new Exception("JSON error: $msg", $err);
602
+		if($errnum != JSON_ERROR_NONE) {
603
+					throw new Exception("JSON error: $msg", $err);
604
+		}
585 605
 	}
586 606
 
587 607
 	/**
@@ -593,8 +613,9 @@  discard block
 block discarded – undo
593 613
 	 */
594 614
 	public function callApiMethod($methodName, $parameters)
595 615
 	{
596
-		if(!isset($this->rpcMethods[$methodName]))
597
-			throw new TRpcException('Method "'.$methodName.'" not found', '-32601');
616
+		if(!isset($this->rpcMethods[$methodName])) {
617
+					throw new TRpcException('Method "'.$methodName.'" not found', '-32601');
618
+		}
598 619
 
599 620
 		return call_user_func_array($this->rpcMethods[$methodName]['method'], $parameters);
600 621
 	}
@@ -662,16 +683,13 @@  discard block
 block discarded – undo
662 683
 		try
663 684
 		{
664 685
 			return xmlrpc_server_call_method($this->_xmlrpcServer, $requestPayload, null);
665
-		}
666
-		catch(TRpcException $e)
686
+		} catch(TRpcException $e)
667 687
 		{
668 688
 			return $this->createErrorResponse($e);
669
-		}
670
-		catch(THttpException $e)
689
+		} catch(THttpException $e)
671 690
 		{
672 691
 			throw $e;
673
-		}
674
-		catch(Exception $e)
692
+		} catch(Exception $e)
675 693
 		{
676 694
 			return $this->createErrorResponse(new TRpcException('An internal error occured'));
677 695
 		}
Please login to merge, or discard this patch.
framework/Web/TAssetManager.php 3 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -101,6 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * Sets the root directory storing published asset files.
102 102
 	 * The directory must be in namespace format.
103 103
 	 * @param string the root directory storing published asset files
104
+	 * @param string $value
104 105
 	 * @throws TInvalidOperationException if the module is initialized already
105 106
 	 */
106 107
 	public function setBasePath($value)
@@ -125,6 +126,7 @@  discard block
 block discarded – undo
125 126
 
126 127
 	/**
127 128
 	 * @param string the base url that the published asset files can be accessed
129
+	 * @param string $value
128 130
 	 * @throws TInvalidOperationException if the module is initialized already
129 131
 	 */
130 132
 	public function setBaseUrl($value)
@@ -215,6 +217,7 @@  discard block
 block discarded – undo
215 217
 	 * This method does not perform any publishing. It merely tells you
216 218
 	 * if the file path is published, what the URL will be to access it.
217 219
 	 * @param string directory or file path being published
220
+	 * @param string $path
218 221
 	 * @return string the published URL for the file path
219 222
 	 */
220 223
 	public function getPublishedUrl($path)
@@ -230,6 +233,7 @@  discard block
 block discarded – undo
230 233
 	 * Generate a CRC32 hash for the directory path. Collisions are higher
231 234
 	 * than MD5 but generates a much smaller hash string.
232 235
 	 * @param string string to be hashed.
236
+	 * @param string $dir
233 237
 	 * @return string hashed string.
234 238
 	 */
235 239
 	protected function hash($dir)
@@ -243,6 +247,8 @@  discard block
 block discarded – undo
243 247
 	 * or has an older file modification time.
244 248
 	 * @param string source file path
245 249
 	 * @param string destination directory (if not exists, it will be created)
250
+	 * @param string $src
251
+	 * @param string $dst
246 252
 	 */
247 253
 	protected function copyFile($src,$dst)
248 254
 	{
@@ -265,6 +271,8 @@  discard block
 block discarded – undo
265 271
 	 * File modification time is used to ensure the copied files are latest.
266 272
 	 * @param string the source directory
267 273
 	 * @param string the destination directory
274
+	 * @param string $src
275
+	 * @param string $dst
268 276
 	 * @todo a generic solution to ignore certain directories and files
269 277
 	 */
270 278
 	public function copyDirectory($src,$dst)
@@ -306,6 +314,8 @@  discard block
 block discarded – undo
306 314
 	 * @param string tar filename
307 315
 	 * @param string MD5 checksum for the corresponding tar file.
308 316
 	 * @param boolean Wether or not to check the time stamp of the file for publishing. Defaults to false.
317
+	 * @param string $tarfile
318
+	 * @param string $md5sum
309 319
 	 * @return string URL path to the directory where the tar file was extracted.
310 320
 	 */
311 321
 	public function publishTarFile($tarfile, $md5sum, $checkTimestamp=false)
@@ -336,6 +346,7 @@  discard block
 block discarded – undo
336 346
 	 * N.B Tar file must not be compressed.
337 347
 	 * @param string tar file
338 348
 	 * @param string path where the contents of tar file are to be extracted
349
+	 * @param string $destination
339 350
 	 * @return boolean true if extract successful, false otherwise.
340 351
 	 */
341 352
 	protected function deployTarFile($path,$destination)
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
 	/**
46 46
 	 * Default web accessible base path for storing private files
47 47
 	 */
48
-	const DEFAULT_BASEPATH='assets';
48
+	const DEFAULT_BASEPATH = 'assets';
49 49
 	/**
50 50
 	 * @var string base web accessible path for storing private files
51 51
 	 */
52
-	private $_basePath=null;
52
+	private $_basePath = null;
53 53
 	/**
54 54
 	 * @var string base URL for accessing the publishing directory.
55 55
 	 */
56
-	private $_baseUrl=null;
56
+	private $_baseUrl = null;
57 57
 	/**
58 58
 	 * @var boolean whether to use timestamp checking to ensure files are published with up-to-date versions.
59 59
 	 */
60
-	private $_checkTimestamp=false;
60
+	private $_checkTimestamp = false;
61 61
 	/**
62 62
 	 * @var TApplication application instance
63 63
 	 */
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * @var array published assets
67 67
 	 */
68
-	private $_published=array();
68
+	private $_published = array();
69 69
 	/**
70 70
 	 * @var boolean whether the module is initialized
71 71
 	 */
72
-	private $_initialized=false;
72
+	private $_initialized = false;
73 73
 
74 74
 	/**
75 75
 	 * Initializes the module.
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function init($config)
80 80
 	{
81
-		$application=$this->getApplication();
82
-		if($this->_basePath===null)
83
-			$this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
84
-		if(!is_writable($this->_basePath) || !is_dir($this->_basePath))
85
-			throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath);
86
-		if($this->_baseUrl===null)
87
-			$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()),'/\\').'/'.self::DEFAULT_BASEPATH;
81
+		$application = $this->getApplication();
82
+		if ($this->_basePath === null)
83
+			$this->_basePath = dirname($application->getRequest()->getApplicationFilePath()) . DIRECTORY_SEPARATOR . self::DEFAULT_BASEPATH;
84
+		if (!is_writable($this->_basePath) || !is_dir($this->_basePath))
85
+			throw new TConfigurationException('assetmanager_basepath_invalid', $this->_basePath);
86
+		if ($this->_baseUrl === null)
87
+			$this->_baseUrl = rtrim(dirname($application->getRequest()->getApplicationUrl()), '/\\') . '/' . self::DEFAULT_BASEPATH;
88 88
 		$application->setAssetManager($this);
89
-		$this->_initialized=true;
89
+		$this->_initialized = true;
90 90
 	}
91 91
 
92 92
 	/**
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function setBasePath($value)
107 107
 	{
108
-		if($this->_initialized)
108
+		if ($this->_initialized)
109 109
 			throw new TInvalidOperationException('assetmanager_basepath_unchangeable');
110 110
 		else
111 111
 		{
112
-			$this->_basePath=Prado::getPathOfNamespace($value);
113
-			if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath))
114
-				throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value);
112
+			$this->_basePath = Prado::getPathOfNamespace($value);
113
+			if ($this->_basePath === null || !is_dir($this->_basePath) || !is_writable($this->_basePath))
114
+				throw new TInvalidDataValueException('assetmanager_basepath_invalid', $value);
115 115
 		}
116 116
 	}
117 117
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function setBaseUrl($value)
131 131
 	{
132
-		if($this->_initialized)
132
+		if ($this->_initialized)
133 133
 			throw new TInvalidOperationException('assetmanager_baseurl_unchangeable');
134 134
 		else
135
-			$this->_baseUrl=rtrim($value,'/');
135
+			$this->_baseUrl = rtrim($value, '/');
136 136
 	}
137 137
 
138 138
 	/**
@@ -149,30 +149,30 @@  discard block
 block discarded – undo
149 149
 	 * @throws TInvalidDataValueException if the file path to be published is
150 150
 	 * invalid
151 151
 	 */
152
-	public function publishFilePath($path,$checkTimestamp=false)
152
+	public function publishFilePath($path, $checkTimestamp = false)
153 153
 	{
154
-		if(isset($this->_published[$path]))
154
+		if (isset($this->_published[$path]))
155 155
 			return $this->_published[$path];
156
-		else if(empty($path) || ($fullpath=realpath($path))===false)
157
-			throw new TInvalidDataValueException('assetmanager_filepath_invalid',$path);
158
-		else if(is_file($fullpath))
156
+		else if (empty($path) || ($fullpath = realpath($path)) === false)
157
+			throw new TInvalidDataValueException('assetmanager_filepath_invalid', $path);
158
+		else if (is_file($fullpath))
159 159
 		{
160
-			$dir=$this->hash(dirname($fullpath));
161
-			$fileName=basename($fullpath);
162
-			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
163
-			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
164
-				$this->copyFile($fullpath,$dst);
165
-			return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName;
160
+			$dir = $this->hash(dirname($fullpath));
161
+			$fileName = basename($fullpath);
162
+			$dst = $this->_basePath . DIRECTORY_SEPARATOR . $dir;
163
+			if (!is_file($dst . DIRECTORY_SEPARATOR . $fileName) || $checkTimestamp || $this->getApplication()->getMode() !== TApplicationMode::Performance)
164
+				$this->copyFile($fullpath, $dst);
165
+			return $this->_published[$path] = $this->_baseUrl . '/' . $dir . '/' . $fileName;
166 166
 		}
167 167
 		else
168 168
 		{
169
-			$dir=$this->hash($fullpath);
170
-			if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
169
+			$dir = $this->hash($fullpath);
170
+			if (!is_dir($this->_basePath . DIRECTORY_SEPARATOR . $dir) || $checkTimestamp || $this->getApplication()->getMode() !== TApplicationMode::Performance)
171 171
 			{
172
-				Prado::trace("Publishing directory $fullpath",'System.Web.UI.TAssetManager');
173
-				$this->copyDirectory($fullpath,$this->_basePath.DIRECTORY_SEPARATOR.$dir);
172
+				Prado::trace("Publishing directory $fullpath", 'System.Web.UI.TAssetManager');
173
+				$this->copyDirectory($fullpath, $this->_basePath . DIRECTORY_SEPARATOR . $dir);
174 174
 			}
175
-			return $this->_published[$path]=$this->_baseUrl.'/'.$dir;
175
+			return $this->_published[$path] = $this->_baseUrl . '/' . $dir;
176 176
 		}
177 177
 	}
178 178
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @param $values List of published assets
190 190
 	 * @since 3.1.6
191 191
 	 */
192
-	protected function setPublished($values=array())
192
+	protected function setPublished($values = array())
193 193
 	{
194 194
 		$this->_published = $values;
195 195
 	}
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 	 */
204 204
 	public function getPublishedPath($path)
205 205
 	{
206
-		$path=realpath($path);
207
-		if(is_file($path))
208
-			return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash(dirname($path)).DIRECTORY_SEPARATOR.basename($path);
206
+		$path = realpath($path);
207
+		if (is_file($path))
208
+			return $this->_basePath . DIRECTORY_SEPARATOR . $this->hash(dirname($path)) . DIRECTORY_SEPARATOR . basename($path);
209 209
 		else
210
-			return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash($path);
210
+			return $this->_basePath . DIRECTORY_SEPARATOR . $this->hash($path);
211 211
 	}
212 212
 
213 213
 	/**
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function getPublishedUrl($path)
221 221
 	{
222
-		$path=realpath($path);
223
-		if(is_file($path))
224
-			return $this->_baseUrl.'/'.$this->hash(dirname($path)).'/'.basename($path);
222
+		$path = realpath($path);
223
+		if (is_file($path))
224
+			return $this->_baseUrl . '/' . $this->hash(dirname($path)) . '/' . basename($path);
225 225
 		else
226
-			return $this->_baseUrl.'/'.$this->hash($path);
226
+			return $this->_baseUrl . '/' . $this->hash($path);
227 227
 	}
228 228
 
229 229
 	/**
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 */
235 235
 	protected function hash($dir)
236 236
 	{
237
-		return sprintf('%x',crc32($dir.Prado::getVersion()));
237
+		return sprintf('%x', crc32($dir . Prado::getVersion()));
238 238
 	}
239 239
 
240 240
 	/**
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
 	 * @param string source file path
245 245
 	 * @param string destination directory (if not exists, it will be created)
246 246
 	 */
247
-	protected function copyFile($src,$dst)
247
+	protected function copyFile($src, $dst)
248 248
 	{
249
-		if(!is_dir($dst))
249
+		if (!is_dir($dst))
250 250
 		{
251 251
 			@mkdir($dst);
252 252
 			@chmod($dst, PRADO_CHMOD);
253 253
 		}
254
-		$dstFile=$dst.DIRECTORY_SEPARATOR.basename($src);
255
-		if(@filemtime($dstFile)<@filemtime($src))
254
+		$dstFile = $dst . DIRECTORY_SEPARATOR . basename($src);
255
+		if (@filemtime($dstFile) < @filemtime($src))
256 256
 		{
257
-			Prado::trace("Publishing file $src to $dstFile",'System.Web.TAssetManager');
258
-			@copy($src,$dstFile);
257
+			Prado::trace("Publishing file $src to $dstFile", 'System.Web.TAssetManager');
258
+			@copy($src, $dstFile);
259 259
 		}
260 260
 	}
261 261
 
@@ -267,29 +267,29 @@  discard block
 block discarded – undo
267 267
 	 * @param string the destination directory
268 268
 	 * @todo a generic solution to ignore certain directories and files
269 269
 	 */
270
-	public function copyDirectory($src,$dst)
270
+	public function copyDirectory($src, $dst)
271 271
 	{
272
-		if(!is_dir($dst))
272
+		if (!is_dir($dst))
273 273
 		{
274 274
 			@mkdir($dst);
275 275
 			@chmod($dst, PRADO_CHMOD);
276 276
 		}
277
-		if($folder=@opendir($src))
277
+		if ($folder = @opendir($src))
278 278
 		{
279
-			while($file=@readdir($folder))
279
+			while ($file = @readdir($folder))
280 280
 			{
281
-				if($file==='.' || $file==='..' || $file==='.svn')
281
+				if ($file === '.' || $file === '..' || $file === '.svn')
282 282
 					continue;
283
-				else if(is_file($src.DIRECTORY_SEPARATOR.$file))
283
+				else if (is_file($src . DIRECTORY_SEPARATOR . $file))
284 284
 				{
285
-					if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file))
285
+					if (@filemtime($dst . DIRECTORY_SEPARATOR . $file) < @filemtime($src . DIRECTORY_SEPARATOR . $file))
286 286
 					{
287
-						@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
288
-						@chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
287
+						@copy($src . DIRECTORY_SEPARATOR . $file, $dst . DIRECTORY_SEPARATOR . $file);
288
+						@chmod($dst . DIRECTORY_SEPARATOR . $file, PRADO_CHMOD);
289 289
 					}
290 290
 				}
291 291
 				else
292
-					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
292
+					$this->copyDirectory($src . DIRECTORY_SEPARATOR . $file, $dst . DIRECTORY_SEPARATOR . $file);
293 293
 			}
294 294
 			closedir($folder);
295 295
 		} else {
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
 	 * @param boolean Wether or not to check the time stamp of the file for publishing. Defaults to false.
309 309
 	 * @return string URL path to the directory where the tar file was extracted.
310 310
 	 */
311
-	public function publishTarFile($tarfile, $md5sum, $checkTimestamp=false)
311
+	public function publishTarFile($tarfile, $md5sum, $checkTimestamp = false)
312 312
 	{
313
-		if(isset($this->_published[$md5sum]))
313
+		if (isset($this->_published[$md5sum]))
314 314
 			return $this->_published[$md5sum];
315
-		else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath))
316
-			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid',$md5sum);
315
+		else if (($fullpath = realpath($md5sum)) === false || !is_file($fullpath))
316
+			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid', $md5sum);
317 317
 		else
318 318
 		{
319
-			$dir=$this->hash(dirname($fullpath));
320
-			$fileName=basename($fullpath);
321
-			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
322
-			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
319
+			$dir = $this->hash(dirname($fullpath));
320
+			$fileName = basename($fullpath);
321
+			$dst = $this->_basePath . DIRECTORY_SEPARATOR . $dir;
322
+			if (!is_file($dst . DIRECTORY_SEPARATOR . $fileName) || $checkTimestamp || $this->getApplication()->getMode() !== TApplicationMode::Performance)
323 323
 			{
324
-				if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName)<@filemtime($fullpath))
324
+				if (@filemtime($dst . DIRECTORY_SEPARATOR . $fileName) < @filemtime($fullpath))
325 325
 				{
326
-					$this->copyFile($fullpath,$dst);
327
-					$this->deployTarFile($tarfile,$dst);
326
+					$this->copyFile($fullpath, $dst);
327
+					$this->deployTarFile($tarfile, $dst);
328 328
 				}
329 329
 			}
330
-			return $this->_published[$md5sum]=$this->_baseUrl.'/'.$dir;
330
+			return $this->_published[$md5sum] = $this->_baseUrl . '/' . $dir;
331 331
 		}
332 332
 	}
333 333
 
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 	 * @param string path where the contents of tar file are to be extracted
339 339
 	 * @return boolean true if extract successful, false otherwise.
340 340
 	 */
341
-	protected function deployTarFile($path,$destination)
341
+	protected function deployTarFile($path, $destination)
342 342
 	{
343
-		if(($fullpath=realpath($path))===false || !is_file($fullpath))
344
-			throw new TIOException('assetmanager_tarfile_invalid',$path);
343
+		if (($fullpath = realpath($path)) === false || !is_file($fullpath))
344
+			throw new TIOException('assetmanager_tarfile_invalid', $path);
345 345
 		else
346 346
 		{
347 347
 			Prado::using('System.IO.TTarFileExtractor');
Please login to merge, or discard this patch.
Braces   +52 added lines, -45 removed lines patch added patch discarded remove patch
@@ -79,12 +79,15 @@  discard block
 block discarded – undo
79 79
 	public function init($config)
80 80
 	{
81 81
 		$application=$this->getApplication();
82
-		if($this->_basePath===null)
83
-			$this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
84
-		if(!is_writable($this->_basePath) || !is_dir($this->_basePath))
85
-			throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath);
86
-		if($this->_baseUrl===null)
87
-			$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()),'/\\').'/'.self::DEFAULT_BASEPATH;
82
+		if($this->_basePath===null) {
83
+					$this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
84
+		}
85
+		if(!is_writable($this->_basePath) || !is_dir($this->_basePath)) {
86
+					throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath);
87
+		}
88
+		if($this->_baseUrl===null) {
89
+					$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()),'/\\').'/'.self::DEFAULT_BASEPATH;
90
+		}
88 91
 		$application->setAssetManager($this);
89 92
 		$this->_initialized=true;
90 93
 	}
@@ -105,13 +108,14 @@  discard block
 block discarded – undo
105 108
 	 */
106 109
 	public function setBasePath($value)
107 110
 	{
108
-		if($this->_initialized)
109
-			throw new TInvalidOperationException('assetmanager_basepath_unchangeable');
110
-		else
111
+		if($this->_initialized) {
112
+					throw new TInvalidOperationException('assetmanager_basepath_unchangeable');
113
+		} else
111 114
 		{
112 115
 			$this->_basePath=Prado::getPathOfNamespace($value);
113
-			if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath))
114
-				throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value);
116
+			if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath)) {
117
+							throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value);
118
+			}
115 119
 		}
116 120
 	}
117 121
 
@@ -129,10 +133,11 @@  discard block
 block discarded – undo
129 133
 	 */
130 134
 	public function setBaseUrl($value)
131 135
 	{
132
-		if($this->_initialized)
133
-			throw new TInvalidOperationException('assetmanager_baseurl_unchangeable');
134
-		else
135
-			$this->_baseUrl=rtrim($value,'/');
136
+		if($this->_initialized) {
137
+					throw new TInvalidOperationException('assetmanager_baseurl_unchangeable');
138
+		} else {
139
+					$this->_baseUrl=rtrim($value,'/');
140
+		}
136 141
 	}
137 142
 
138 143
 	/**
@@ -151,20 +156,20 @@  discard block
 block discarded – undo
151 156
 	 */
152 157
 	public function publishFilePath($path,$checkTimestamp=false)
153 158
 	{
154
-		if(isset($this->_published[$path]))
155
-			return $this->_published[$path];
156
-		else if(empty($path) || ($fullpath=realpath($path))===false)
157
-			throw new TInvalidDataValueException('assetmanager_filepath_invalid',$path);
158
-		else if(is_file($fullpath))
159
+		if(isset($this->_published[$path])) {
160
+					return $this->_published[$path];
161
+		} else if(empty($path) || ($fullpath=realpath($path))===false) {
162
+					throw new TInvalidDataValueException('assetmanager_filepath_invalid',$path);
163
+		} else if(is_file($fullpath))
159 164
 		{
160 165
 			$dir=$this->hash(dirname($fullpath));
161 166
 			$fileName=basename($fullpath);
162 167
 			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
163
-			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
164
-				$this->copyFile($fullpath,$dst);
168
+			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) {
169
+							$this->copyFile($fullpath,$dst);
170
+			}
165 171
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName;
166
-		}
167
-		else
172
+		} else
168 173
 		{
169 174
 			$dir=$this->hash($fullpath);
170 175
 			if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
@@ -204,10 +209,11 @@  discard block
 block discarded – undo
204 209
 	public function getPublishedPath($path)
205 210
 	{
206 211
 		$path=realpath($path);
207
-		if(is_file($path))
208
-			return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash(dirname($path)).DIRECTORY_SEPARATOR.basename($path);
209
-		else
210
-			return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash($path);
212
+		if(is_file($path)) {
213
+					return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash(dirname($path)).DIRECTORY_SEPARATOR.basename($path);
214
+		} else {
215
+					return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash($path);
216
+		}
211 217
 	}
212 218
 
213 219
 	/**
@@ -220,10 +226,11 @@  discard block
 block discarded – undo
220 226
 	public function getPublishedUrl($path)
221 227
 	{
222 228
 		$path=realpath($path);
223
-		if(is_file($path))
224
-			return $this->_baseUrl.'/'.$this->hash(dirname($path)).'/'.basename($path);
225
-		else
226
-			return $this->_baseUrl.'/'.$this->hash($path);
229
+		if(is_file($path)) {
230
+					return $this->_baseUrl.'/'.$this->hash(dirname($path)).'/'.basename($path);
231
+		} else {
232
+					return $this->_baseUrl.'/'.$this->hash($path);
233
+		}
227 234
 	}
228 235
 
229 236
 	/**
@@ -278,18 +285,18 @@  discard block
 block discarded – undo
278 285
 		{
279 286
 			while($file=@readdir($folder))
280 287
 			{
281
-				if($file==='.' || $file==='..' || $file==='.svn')
282
-					continue;
283
-				else if(is_file($src.DIRECTORY_SEPARATOR.$file))
288
+				if($file==='.' || $file==='..' || $file==='.svn') {
289
+									continue;
290
+				} else if(is_file($src.DIRECTORY_SEPARATOR.$file))
284 291
 				{
285 292
 					if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file))
286 293
 					{
287 294
 						@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
288 295
 						@chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
289 296
 					}
297
+				} else {
298
+									$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
290 299
 				}
291
-				else
292
-					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
293 300
 			}
294 301
 			closedir($folder);
295 302
 		} else {
@@ -310,11 +317,11 @@  discard block
 block discarded – undo
310 317
 	 */
311 318
 	public function publishTarFile($tarfile, $md5sum, $checkTimestamp=false)
312 319
 	{
313
-		if(isset($this->_published[$md5sum]))
314
-			return $this->_published[$md5sum];
315
-		else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath))
316
-			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid',$md5sum);
317
-		else
320
+		if(isset($this->_published[$md5sum])) {
321
+					return $this->_published[$md5sum];
322
+		} else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath)) {
323
+					throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid',$md5sum);
324
+		} else
318 325
 		{
319 326
 			$dir=$this->hash(dirname($fullpath));
320 327
 			$fileName=basename($fullpath);
@@ -340,9 +347,9 @@  discard block
 block discarded – undo
340 347
 	 */
341 348
 	protected function deployTarFile($path,$destination)
342 349
 	{
343
-		if(($fullpath=realpath($path))===false || !is_file($fullpath))
344
-			throw new TIOException('assetmanager_tarfile_invalid',$path);
345
-		else
350
+		if(($fullpath=realpath($path))===false || !is_file($fullpath)) {
351
+					throw new TIOException('assetmanager_tarfile_invalid',$path);
352
+		} else
346 353
 		{
347 354
 			Prado::using('System.IO.TTarFileExtractor');
348 355
 			$tar = new TTarFileExtractor($fullpath);
Please login to merge, or discard this patch.
framework/Web/TCacheHttpSession.php 4 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -74,6 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 	/**
76 76
 	 * @param string the ID of the cache module.
77
+	 * @param string $value
77 78
 	 */
78 79
 	public function setCacheModuleID($value)
79 80
 	{
@@ -130,6 +131,7 @@  discard block
 block discarded – undo
130 131
 
131 132
 	/**
132 133
      * @param string prefix of session variable name to avoid conflict with other cache data
134
+     * @param string $value
133 135
      */
134 136
 	public function setKeyPrefix($value)
135 137
 	{
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	 * It reads the CacheModule property.
51 51
 	 * @param TXmlElement module configuration
52 52
 	 */
53
-    public function init($config)
54
-    {
53
+	public function init($config)
54
+	{
55 55
 		if($this->_cacheModuleID==='')
56 56
 			throw new TConfigurationException('cachesession_cachemoduleid_required');
57 57
 		else if(($cache=$this->getApplication()->getModule($this->_cacheModuleID))===null)
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			throw new TConfigurationException('cachesession_cachemodule_invalid',$this->_cacheModuleID);
63 63
 		$this->setUseCustomStorage(true);
64 64
 		parent::init($config);
65
-    }
65
+	}
66 66
 
67 67
 	/**
68 68
 	 * @return string the ID of the cache module.
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function _read($id)
97 97
 	{
98
-	    return $this->_cache->get($this->calculateKey($id));
98
+		return $this->_cache->get($this->calculateKey($id));
99 99
 	}
100 100
 
101 101
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function _destroy($id)
119 119
 	{
120
-	    return $this->_cache->delete($this->calculateKey($id));
120
+		return $this->_cache->delete($this->calculateKey($id));
121 121
 	}
122 122
 
123 123
 	/**
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function getKeyPrefix()
127 127
 	{
128
-	    return $this->_prefix;
128
+		return $this->_prefix;
129 129
 	}
130 130
 
131 131
 	/**
132
-     * @param string prefix of session variable name to avoid conflict with other cache data
133
-     */
132
+	 * @param string prefix of session variable name to avoid conflict with other cache data
133
+	 */
134 134
 	public function setKeyPrefix($value)
135 135
 	{
136
-	    $this->_prefix=$value;
136
+		$this->_prefix=$value;
137 137
 	}
138 138
 
139 139
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function calculateKey($id)
144 144
 	{
145
-	    return $this->_prefix.':'.$id;
145
+		return $this->_prefix.':'.$id;
146 146
 	}
147 147
 }
148 148
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
  */
41 41
 class TCacheHttpSession extends THttpSession
42 42
 {
43
-	private $_prefix='session';
44
-	private $_cacheModuleID='';
43
+	private $_prefix = 'session';
44
+	private $_cacheModuleID = '';
45 45
 	private $_cache;
46 46
 
47 47
 	/**
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
     public function init($config)
54 54
     {
55
-		if($this->_cacheModuleID==='')
55
+		if ($this->_cacheModuleID === '')
56 56
 			throw new TConfigurationException('cachesession_cachemoduleid_required');
57
-		else if(($cache=$this->getApplication()->getModule($this->_cacheModuleID))===null)
58
-			throw new TConfigurationException('cachesession_cachemodule_inexistent',$this->_cacheModuleID);
59
-		else if($cache instanceof ICache)
60
-			$this->_cache=$cache;
57
+		else if (($cache = $this->getApplication()->getModule($this->_cacheModuleID)) === null)
58
+			throw new TConfigurationException('cachesession_cachemodule_inexistent', $this->_cacheModuleID);
59
+		else if ($cache instanceof ICache)
60
+			$this->_cache = $cache;
61 61
 		else
62
-			throw new TConfigurationException('cachesession_cachemodule_invalid',$this->_cacheModuleID);
62
+			throw new TConfigurationException('cachesession_cachemodule_invalid', $this->_cacheModuleID);
63 63
 		$this->setUseCustomStorage(true);
64 64
 		parent::init($config);
65 65
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function setCacheModuleID($value)
79 79
 	{
80
-		$this->_cacheModuleID=$value;
80
+		$this->_cacheModuleID = $value;
81 81
 	}
82 82
 
83 83
 	/**
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 	 * @param string session data
105 105
 	 * @return boolean whether session write is successful
106 106
 	 */
107
-	public function _write($id,$data)
107
+	public function _write($id, $data)
108 108
 	{
109
-		return $this->_cache->set($this->calculateKey($id),$data,$this->getTimeout());
109
+		return $this->_cache->set($this->calculateKey($id), $data, $this->getTimeout());
110 110
 	}
111 111
 
112 112
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
 	public function setKeyPrefix($value)
135 135
 	{
136
-	    $this->_prefix=$value;
136
+	    $this->_prefix = $value;
137 137
 	}
138 138
 
139 139
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function calculateKey($id)
144 144
 	{
145
-	    return $this->_prefix.':'.$id;
145
+	    return $this->_prefix . ':' . $id;
146 146
 	}
147 147
 }
148 148
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,14 +52,15 @@
 block discarded – undo
52 52
 	 */
53 53
     public function init($config)
54 54
     {
55
-		if($this->_cacheModuleID==='')
56
-			throw new TConfigurationException('cachesession_cachemoduleid_required');
57
-		else if(($cache=$this->getApplication()->getModule($this->_cacheModuleID))===null)
58
-			throw new TConfigurationException('cachesession_cachemodule_inexistent',$this->_cacheModuleID);
59
-		else if($cache instanceof ICache)
60
-			$this->_cache=$cache;
61
-		else
62
-			throw new TConfigurationException('cachesession_cachemodule_invalid',$this->_cacheModuleID);
55
+		if($this->_cacheModuleID==='') {
56
+					throw new TConfigurationException('cachesession_cachemoduleid_required');
57
+		} else if(($cache=$this->getApplication()->getModule($this->_cacheModuleID))===null) {
58
+					throw new TConfigurationException('cachesession_cachemodule_inexistent',$this->_cacheModuleID);
59
+		} else if($cache instanceof ICache) {
60
+					$this->_cache=$cache;
61
+		} else {
62
+					throw new TConfigurationException('cachesession_cachemodule_invalid',$this->_cacheModuleID);
63
+		}
63 64
 		$this->setUseCustomStorage(true);
64 65
 		parent::init($config);
65 66
     }
Please login to merge, or discard this patch.
framework/Web/THttpRequest.php 3 patches
Doc Comments   +22 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,6 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 	/**
142 142
 	 * @param string id of this module
143
+	 * @param string $value
143 144
 	 */
144 145
 	public function setID($value)
145 146
 	{
@@ -258,6 +259,7 @@  discard block
 block discarded – undo
258 259
 
259 260
 	/**
260 261
 	 * Saves the current UrlManager instance to cache.
262
+	 * @param TUrlManager $manager
261 263
 	 * @return boolean true if UrlManager instance was cached, false otherwise.
262 264
 	 */
263 265
 	protected function cacheUrlManager($manager)
@@ -314,6 +316,7 @@  discard block
 block discarded – undo
314 316
 	 * by loading it as an application module and setting this property
315 317
 	 * with the module ID.
316 318
 	 * @param string the ID of the URL manager module
319
+	 * @param string $value
317 320
 	 */
318 321
 	public function setUrlManager($value)
319 322
 	{
@@ -349,7 +352,7 @@  discard block
 block discarded – undo
349 352
 	}
350 353
 
351 354
 	/**
352
-	 * @return THttpRequestUrlFormat the format of URLs. Defaults to THttpRequestUrlFormat::Get.
355
+	 * @return string the format of URLs. Defaults to THttpRequestUrlFormat::Get.
353 356
 	 */
354 357
 	public function getUrlFormat()
355 358
 	{
@@ -379,6 +382,7 @@  discard block
 block discarded – undo
379 382
 
380 383
 	/**
381 384
 	 * @param string separator used to separate GET variable name and value when URL format is Path.
385
+	 * @param string $value
382 386
 	 * @throws TInvalidDataValueException if the separator is not a single character
383 387
 	 */
384 388
 	public function setUrlParamSeparator($value)
@@ -620,6 +624,7 @@  discard block
 block discarded – undo
620 624
 
621 625
 	/**
622 626
 	 * @param boolean whether cookies should be validated.
627
+	 * @param boolean $value
623 628
 	 */
624 629
 	public function setEnableCookieValidation($value)
625 630
 	{
@@ -710,6 +715,7 @@  discard block
 block discarded – undo
710 715
 	 * @param array GET parameters, null if not needed
711 716
 	 * @param boolean whether to encode the ampersand in URL, defaults to true.
712 717
 	 * @param boolean whether to encode the GET parameters (their names and values), defaults to false.
718
+	 * @param string $serviceID
713 719
 	 * @return string URL
714 720
 	 * @see TUrlManager::constructUrl
715 721
 	 */
@@ -915,6 +921,7 @@  discard block
 block discarded – undo
915 921
 	 * Returns whether there is an element at the specified offset.
916 922
 	 * This method is required by the interface ArrayAccess.
917 923
 	 * @param mixed the offset to check on
924
+	 * @param integer $offset
918 925
 	 * @return boolean
919 926
 	 */
920 927
 	public function offsetExists($offset)
@@ -926,6 +933,7 @@  discard block
 block discarded – undo
926 933
 	 * Returns the element at the specified offset.
927 934
 	 * This method is required by the interface ArrayAccess.
928 935
 	 * @param integer the offset to retrieve element.
936
+	 * @param integer $offset
929 937
 	 * @return mixed the element at the offset, null if no element is found at the offset
930 938
 	 */
931 939
 	public function offsetGet($offset)
@@ -938,6 +946,8 @@  discard block
 block discarded – undo
938 946
 	 * This method is required by the interface ArrayAccess.
939 947
 	 * @param integer the offset to set element
940 948
 	 * @param mixed the element value
949
+	 * @param integer $offset
950
+	 * @param string $item
941 951
 	 */
942 952
 	public function offsetSet($offset,$item)
943 953
 	{
@@ -948,6 +958,7 @@  discard block
 block discarded – undo
948 958
 	 * Unsets the element at the specified offset.
949 959
 	 * This method is required by the interface ArrayAccess.
950 960
 	 * @param mixed the offset to unset element
961
+	 * @param integer $offset
951 962
 	 */
952 963
 	public function offsetUnset($offset)
953 964
 	{
@@ -980,6 +991,7 @@  discard block
 block discarded – undo
980 991
 	/**
981 992
 	 * Constructor.
982 993
 	 * @param mixed owner of this collection.
994
+	 * @param THttpResponse $owner
983 995
 	 */
984 996
 	public function __construct($owner=null)
985 997
 	{
@@ -992,6 +1004,7 @@  discard block
 block discarded – undo
992 1004
 	 * operations for each newly added THttpCookie object.
993 1005
 	 * @param integer the specified position.
994 1006
 	 * @param mixed new item
1007
+	 * @param integer $index
995 1008
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a THttpCookie object.
996 1009
 	 */
997 1010
 	public function insertAt($index,$item)
@@ -1011,6 +1024,7 @@  discard block
 block discarded – undo
1011 1024
 	 * This overrides the parent implementation by performing additional
1012 1025
 	 * cleanup work when removing a TCookie object.
1013 1026
 	 * @param integer the index of the item to be removed.
1027
+	 * @param integer $index
1014 1028
 	 * @return mixed the removed item.
1015 1029
 	 */
1016 1030
 	public function removeAt($index)
@@ -1109,6 +1123,7 @@  discard block
 block discarded – undo
1109 1123
 
1110 1124
 	/**
1111 1125
 	 * @param string the domain to associate the cookie with
1126
+	 * @param string $value
1112 1127
 	 */
1113 1128
 	public function setDomain($value)
1114 1129
 	{
@@ -1125,6 +1140,7 @@  discard block
 block discarded – undo
1125 1140
 
1126 1141
 	/**
1127 1142
 	 * @param integer the time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch.
1143
+	 * @param integer $value
1128 1144
 	 */
1129 1145
 	public function setExpire($value)
1130 1146
 	{
@@ -1157,6 +1173,7 @@  discard block
 block discarded – undo
1157 1173
 
1158 1174
 	/**
1159 1175
 	 * @param string the name of the cookie
1176
+	 * @param string $value
1160 1177
 	 */
1161 1178
 	public function setName($value)
1162 1179
 	{
@@ -1173,6 +1190,7 @@  discard block
 block discarded – undo
1173 1190
 
1174 1191
 	/**
1175 1192
 	 * @param string the value of the cookie
1193
+	 * @param string $value
1176 1194
 	 */
1177 1195
 	public function setValue($value)
1178 1196
 	{
@@ -1189,6 +1207,7 @@  discard block
 block discarded – undo
1189 1207
 
1190 1208
 	/**
1191 1209
 	 * @param string the path on the server in which the cookie will be available on
1210
+	 * @param string $value
1192 1211
 	 */
1193 1212
 	public function setPath($value)
1194 1213
 	{
@@ -1205,6 +1224,7 @@  discard block
 block discarded – undo
1205 1224
 
1206 1225
 	/**
1207 1226
 	 * @param boolean ether the cookie should only be transmitted over a secure HTTPS connection
1227
+	 * @param boolean $value
1208 1228
 	 */
1209 1229
 	public function setSecure($value)
1210 1230
 	{
@@ -1287,6 +1307,7 @@  discard block
 block discarded – undo
1287 1307
 	 * Constructor.
1288 1308
 	 * Decomposes the specified URI into parts.
1289 1309
 	 * @param string URI to be represented
1310
+	 * @param string $uri
1290 1311
 	 * @throws TInvalidDataValueException if URI is of bad format
1291 1312
 	 */
1292 1313
 	public function __construct($uri)
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -66,34 +66,34 @@  discard block
 block discarded – undo
66 66
  * @package System.Web
67 67
  * @since 3.0
68 68
  */
69
-class THttpRequest extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule
69
+class THttpRequest extends TApplicationComponent implements IteratorAggregate, ArrayAccess, Countable, IModule
70 70
 {
71
-	const CGIFIX__PATH_INFO		= 1;
72
-	const CGIFIX__SCRIPT_NAME	= 2;
71
+	const CGIFIX__PATH_INFO = 1;
72
+	const CGIFIX__SCRIPT_NAME = 2;
73 73
 	/**
74 74
 	 * @var TUrlManager the URL manager module
75 75
 	 */
76
-	private $_urlManager=null;
76
+	private $_urlManager = null;
77 77
 	/**
78 78
 	 * @var string the ID of the URL manager module
79 79
 	 */
80
-	private $_urlManagerID='';
80
+	private $_urlManagerID = '';
81 81
 	/**
82 82
 	 * @var string Separator used to separate GET variable name and value when URL format is Path.
83 83
 	 */
84
-	private $_separator=',';
84
+	private $_separator = ',';
85 85
 	/**
86 86
 	 * @var string requested service ID
87 87
 	 */
88
-	private $_serviceID=null;
88
+	private $_serviceID = null;
89 89
 	/**
90 90
 	 * @var string requested service parameter
91 91
 	 */
92
-	private $_serviceParam=null;
92
+	private $_serviceParam = null;
93 93
 	/**
94 94
 	 * @var THttpCookieCollection cookies sent from user
95 95
 	 */
96
-	private $_cookies=null;
96
+	private $_cookies = null;
97 97
 	/**
98 98
 	 * @var string requested URI (URL w/o host info)
99 99
 	 */
@@ -105,20 +105,20 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @var boolean whether the session ID should be kept in cookie only
107 107
 	 */
108
-	private $_cookieOnly=null;
109
-	private $_urlFormat=THttpRequestUrlFormat::Get;
108
+	private $_cookieOnly = null;
109
+	private $_urlFormat = THttpRequestUrlFormat::Get;
110 110
 	private $_services;
111
-	private $_requestResolved=false;
112
-	private $_enableCookieValidation=false;
113
-	private $_cgiFix=0;
111
+	private $_requestResolved = false;
112
+	private $_enableCookieValidation = false;
113
+	private $_cgiFix = 0;
114 114
 	/**
115 115
 	 * @var boolean whether to cache the TUrlManager class (useful with a lot of TUrlMappings)
116 116
 	 */
117
-	private $_enableCache=false;
117
+	private $_enableCache = false;
118 118
 	/**
119 119
 	 * @var string request URL
120 120
 	 */
121
-	private $_url=null;
121
+	private $_url = null;
122 122
 
123 123
 	/**
124 124
 	 * @var string module id
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	/**
129 129
 	 * @var array contains all request variables
130 130
 	 */
131
-	private $_items=array();
131
+	private $_items = array();
132 132
 
133 133
 	/**
134 134
 	 * @return string id of this module
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function setID($value)
145 145
 	{
146
-		$this->_id=$value;
146
+		$this->_id = $value;
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 	public function init($config)
155 155
 	{
156 156
 		// Fill in default request info when the script is run in command line
157
-		if(php_sapi_name()==='cli')
157
+		if (php_sapi_name() === 'cli')
158 158
 		{
159
-			$_SERVER['REMOTE_ADDR']='127.0.0.1';
160
-			$_SERVER['REQUEST_METHOD']='GET';
161
-			$_SERVER['SERVER_NAME']='localhost';
162
-			$_SERVER['SERVER_PORT']=80;
163
-			$_SERVER['HTTP_USER_AGENT']='';
159
+			$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
160
+			$_SERVER['REQUEST_METHOD'] = 'GET';
161
+			$_SERVER['SERVER_NAME'] = 'localhost';
162
+			$_SERVER['SERVER_PORT'] = 80;
163
+			$_SERVER['HTTP_USER_AGENT'] = '';
164 164
 		}
165 165
 
166 166
 		// Info about server variables:
@@ -169,30 +169,30 @@  discard block
 block discarded – undo
169 169
 		// QUERY_STRING is the string following the '?' in the ur (eg the a=x part in http://foo/bar?a=x)
170 170
 		// REQUEST_URI contains the URI part entered in the browser address bar
171 171
 		// SCRIPT_FILENAME is the file path to the executing script
172
-		if(isset($_SERVER['REQUEST_URI']))
173
-			$this->_requestUri=$_SERVER['REQUEST_URI'];
172
+		if (isset($_SERVER['REQUEST_URI']))
173
+			$this->_requestUri = $_SERVER['REQUEST_URI'];
174 174
 		else  // TBD: in this case, SCRIPT_NAME need to be escaped
175
-			$this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING'])?'':'?'.$_SERVER['QUERY_STRING']);
176
-
177
-		if($this->_cgiFix&self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
178
-			$this->_pathInfo=substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME']));
179
-		elseif(isset($_SERVER['PATH_INFO']))
180
-			$this->_pathInfo=$_SERVER['PATH_INFO'];
181
-		else if(strpos($_SERVER['PHP_SELF'],$_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME'])
182
-			$this->_pathInfo=substr($_SERVER['PHP_SELF'],strlen($_SERVER['SCRIPT_NAME']));
175
+			$this->_requestUri = $_SERVER['SCRIPT_NAME'] . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']);
176
+
177
+		if ($this->_cgiFix & self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
178
+			$this->_pathInfo = substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME']));
179
+		elseif (isset($_SERVER['PATH_INFO']))
180
+			$this->_pathInfo = $_SERVER['PATH_INFO'];
181
+		else if (strpos($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME']) === 0 && $_SERVER['PHP_SELF'] !== $_SERVER['SCRIPT_NAME'])
182
+			$this->_pathInfo = substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME']));
183 183
 		else
184
-			$this->_pathInfo='';
184
+			$this->_pathInfo = '';
185 185
 
186
-		if(get_magic_quotes_gpc())
186
+		if (get_magic_quotes_gpc())
187 187
 		{
188
-			if(isset($_GET))
189
-				$_GET=$this->stripSlashes($_GET);
190
-			if(isset($_POST))
191
-				$_POST=$this->stripSlashes($_POST);
192
-			if(isset($_REQUEST))
193
-				$_REQUEST=$this->stripSlashes($_REQUEST);
194
-			if(isset($_COOKIE))
195
-				$_COOKIE=$this->stripSlashes($_COOKIE);
188
+			if (isset($_GET))
189
+				$_GET = $this->stripSlashes($_GET);
190
+			if (isset($_POST))
191
+				$_POST = $this->stripSlashes($_POST);
192
+			if (isset($_REQUEST))
193
+				$_REQUEST = $this->stripSlashes($_REQUEST);
194
+			if (isset($_COOKIE))
195
+				$_COOKIE = $this->stripSlashes($_COOKIE);
196 196
 		}
197 197
 
198 198
 		$this->getApplication()->setRequest($this);
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function stripSlashes(&$data)
208 208
 	{
209
-		return is_array($data)?array_map(array($this,'stripSlashes'),$data):stripslashes($data);
209
+		return is_array($data) ? array_map(array($this, 'stripSlashes'), $data) : stripslashes($data);
210 210
 	}
211 211
 
212 212
 	/**
@@ -214,21 +214,21 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	public function getUrl()
216 216
 	{
217
-		if($this->_url===null)
217
+		if ($this->_url === null)
218 218
 		{
219
-			$secure=$this->getIsSecureConnection();
220
-			$url=$secure?'https://':'http://';
221
-			if(empty($_SERVER['HTTP_HOST']))
219
+			$secure = $this->getIsSecureConnection();
220
+			$url = $secure ? 'https://' : 'http://';
221
+			if (empty($_SERVER['HTTP_HOST']))
222 222
 			{
223
-				$url.=$_SERVER['SERVER_NAME'];
224
-				$port=$_SERVER['SERVER_PORT'];
225
-				if(($port!=80 && !$secure) || ($port!=443 && $secure))
226
-					$url.=':'.$port;
223
+				$url .= $_SERVER['SERVER_NAME'];
224
+				$port = $_SERVER['SERVER_PORT'];
225
+				if (($port != 80 && !$secure) || ($port != 443 && $secure))
226
+					$url .= ':' . $port;
227 227
 			}
228 228
 			else
229
-				$url.=$_SERVER['HTTP_HOST'];
230
-			$url.=$this->getRequestUri();
231
-			$this->_url=new TUri($url);
229
+				$url .= $_SERVER['HTTP_HOST'];
230
+			$url .= $this->getRequestUri();
231
+			$this->_url = new TUri($url);
232 232
 		}
233 233
 		return $this->_url;
234 234
 	}
@@ -262,16 +262,16 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function cacheUrlManager($manager)
264 264
 	{
265
-		if($this->getEnableCache())
265
+		if ($this->getEnableCache())
266 266
 		{
267 267
 			$cache = $this->getApplication()->getCache();
268
-			if($cache !== null)
268
+			if ($cache !== null)
269 269
 			{
270 270
 				$dependencies = null;
271
-				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
271
+				if ($this->getApplication()->getMode() !== TApplicationMode::Performance)
272 272
 					if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile())
273 273
 					{
274
-						$fn = Prado::getPathOfNamespace($fn,$this->getApplication()->getConfigurationFileExt());
274
+						$fn = Prado::getPathOfNamespace($fn, $this->getApplication()->getConfigurationFileExt());
275 275
 						$dependencies = new TFileCacheDependency($fn);
276 276
 					}
277 277
 				return $cache->set($this->getCacheKey(), $manager, 0, $dependencies);
@@ -286,13 +286,13 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	protected function loadCachedUrlManager()
288 288
 	{
289
-		if($this->getEnableCache())
289
+		if ($this->getEnableCache())
290 290
 		{
291 291
 			$cache = $this->getApplication()->getCache();
292
-			if($cache !== null)
292
+			if ($cache !== null)
293 293
 			{
294 294
 				$manager = $cache->get($this->getCacheKey());
295
-				if($manager instanceof TUrlManager)
295
+				if ($manager instanceof TUrlManager)
296 296
 					return $manager;
297 297
 			}
298 298
 		}
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function setUrlManager($value)
319 319
 	{
320
-		$this->_urlManagerID=$value;
320
+		$this->_urlManagerID = $value;
321 321
 	}
322 322
 
323 323
 	/**
@@ -325,22 +325,22 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	public function getUrlManagerModule()
327 327
 	{
328
-		if($this->_urlManager===null)
328
+		if ($this->_urlManager === null)
329 329
 		{
330
-			if(($this->_urlManager = $this->loadCachedUrlManager())===null)
330
+			if (($this->_urlManager = $this->loadCachedUrlManager()) === null)
331 331
 			{
332
-				if(empty($this->_urlManagerID))
332
+				if (empty($this->_urlManagerID))
333 333
 				{
334
-					$this->_urlManager=new TUrlManager;
334
+					$this->_urlManager = new TUrlManager;
335 335
 					$this->_urlManager->init(null);
336 336
 				}
337 337
 				else
338 338
 				{
339
-					$this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID);
340
-					if($this->_urlManager===null)
341
-						throw new TConfigurationException('httprequest_urlmanager_inexist',$this->_urlManagerID);
342
-					if(!($this->_urlManager instanceof TUrlManager))
343
-						throw new TConfigurationException('httprequest_urlmanager_invalid',$this->_urlManagerID);
339
+					$this->_urlManager = $this->getApplication()->getModule($this->_urlManagerID);
340
+					if ($this->_urlManager === null)
341
+						throw new TConfigurationException('httprequest_urlmanager_inexist', $this->_urlManagerID);
342
+					if (!($this->_urlManager instanceof TUrlManager))
343
+						throw new TConfigurationException('httprequest_urlmanager_invalid', $this->_urlManagerID);
344 344
 				}
345 345
 				$this->cacheUrlManager($this->_urlManager);
346 346
 			}
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function setUrlFormat($value)
368 368
 	{
369
-		$this->_urlFormat=TPropertyValue::ensureEnum($value,'THttpRequestUrlFormat');
369
+		$this->_urlFormat = TPropertyValue::ensureEnum($value, 'THttpRequestUrlFormat');
370 370
 	}
371 371
 
372 372
 	/**
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	public function setUrlParamSeparator($value)
385 385
 	{
386
-		if(strlen($value)===1)
387
-			$this->_separator=$value;
386
+		if (strlen($value) === 1)
387
+			$this->_separator = $value;
388 388
 		else
389 389
 			throw new TInvalidDataValueException('httprequest_separator_invalid');
390 390
 	}
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	 */
395 395
 	public function getRequestType()
396 396
 	{
397
-		return isset($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:null;
397
+		return isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
398 398
 	}
399 399
 
400 400
 	/**
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	public function getContentType($mimetypeOnly = true)
405 405
 	{
406
-		if(!isset($_SERVER['CONTENT_TYPE']))
406
+		if (!isset($_SERVER['CONTENT_TYPE']))
407 407
 			return null;
408 408
 
409
-		if($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false)
409
+		if ($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false)
410 410
 			return substr($_SERVER['CONTENT_TYPE'], 0, $_pos);
411 411
 
412 412
 		return $_SERVER['CONTENT_TYPE'];
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 */
418 418
 	public function getIsSecureConnection()
419 419
 	{
420
-			return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'],'off');
420
+			return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'off');
421 421
 	}
422 422
 
423 423
 	/**
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 */
434 434
 	public function getQueryString()
435 435
 	{
436
-		return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:null;
436
+		return isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
437 437
 	}
438 438
 
439 439
 	/**
@@ -441,30 +441,30 @@  discard block
 block discarded – undo
441 441
 	 */
442 442
 	public function getHttpProtocolVersion()
443 443
 	{
444
-		return isset($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:null;
444
+		return isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : null;
445 445
 	}
446 446
 
447 447
 	/**
448 448
 	 * @param integer|null Either {@link CASE_UPPER} or {@link CASE_LOWER} or as is null (default)
449 449
 	 * @return array
450 450
 	 */
451
-	public function getHeaders($case=null)
451
+	public function getHeaders($case = null)
452 452
 	{
453 453
 		static $result;
454 454
 
455
-		if($result === null && function_exists('apache_request_headers')) {
455
+		if ($result === null && function_exists('apache_request_headers')) {
456 456
 			$result = apache_request_headers();
457 457
 		}
458
-		elseif($result === null) {
458
+		elseif ($result === null) {
459 459
 			$result = array();
460
-			foreach($_SERVER as $key=>$value) {
461
-				if(strncasecmp($key, 'HTTP_', 5) !== 0) continue;
462
-					$key = str_replace(' ','-', ucwords(strtolower(str_replace('_',' ', substr($key, 5)))));
460
+			foreach ($_SERVER as $key=>$value) {
461
+				if (strncasecmp($key, 'HTTP_', 5) !== 0) continue;
462
+					$key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
463 463
 					$result[$key] = $value;
464 464
 			}
465 465
 		}
466 466
 
467
-		if($case !== null)
467
+		if ($case !== null)
468 468
 			return array_change_key_case($result, $case);
469 469
 
470 470
 		return $result;
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
 	 * 						false - force http
486 486
 	 * @return string schema and hostname of the requested URL
487 487
 	 */
488
-	public function getBaseUrl($forceSecureConnection=null)
488
+	public function getBaseUrl($forceSecureConnection = null)
489 489
 	{
490
-		$url=$this->getUrl();
491
-		$scheme=($forceSecureConnection)?"https": (($forceSecureConnection === null)?$url->getScheme():'http');
492
-		$host=$url->getHost();
493
-		if (($port=$url->getPort())) $host.=':'.$port;
494
-		return $scheme.'://'.$host;
490
+		$url = $this->getUrl();
491
+		$scheme = ($forceSecureConnection) ? "https" : (($forceSecureConnection === null) ? $url->getScheme() : 'http');
492
+		$host = $url->getHost();
493
+		if (($port = $url->getPort())) $host .= ':' . $port;
494
+		return $scheme . '://' . $host;
495 495
 	}
496 496
 
497 497
 	/**
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
 	 */
500 500
 	public function getApplicationUrl()
501 501
 	{
502
-		if($this->_cgiFix&self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
502
+		if ($this->_cgiFix & self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
503 503
 			return $_SERVER['ORIG_SCRIPT_NAME'];
504 504
 
505
-		return isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:null;
505
+		return isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : null;
506 506
 	}
507 507
 
508 508
 	/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	 * 						false - force http
513 513
 	 * @return string entry script URL (w/ host part)
514 514
 	 */
515
-	public function getAbsoluteApplicationUrl($forceSecureConnection=null)
515
+	public function getAbsoluteApplicationUrl($forceSecureConnection = null)
516 516
 	{
517 517
 		return $this->getBaseUrl($forceSecureConnection) . $this->getApplicationUrl();
518 518
 	}
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 */
523 523
 	public function getApplicationFilePath()
524 524
 	{
525
-		return realpath(isset($_SERVER['SCRIPT_FILENAME'])?$_SERVER['SCRIPT_FILENAME']:null);
525
+		return realpath(isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : null);
526 526
 	}
527 527
 
528 528
 	/**
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	public function getServerName()
532 532
 	{
533
-		return isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:null;
533
+		return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null;
534 534
 	}
535 535
 
536 536
 	/**
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	public function getServerPort()
540 540
 	{
541
-		return isset($_SERVER['SERVER_PORT'])?$_SERVER['SERVER_PORT']:null;
541
+		return isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : null;
542 542
 	}
543 543
 
544 544
 	/**
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	 */
547 547
 	public function getUrlReferrer()
548 548
 	{
549
-		return isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:null;
549
+		return isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
550 550
 	}
551 551
 
552 552
 	/**
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		{
560 560
 			return get_browser();
561 561
 		}
562
-		catch(TPhpErrorException $e)
562
+		catch (TPhpErrorException $e)
563 563
 		{
564 564
 			throw new TConfigurationException('httprequest_browscap_required');
565 565
 		}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 	 */
571 571
 	public function getUserAgent()
572 572
 	{
573
-		return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null;
573
+		return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
574 574
 	}
575 575
 
576 576
 	/**
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	 */
579 579
 	public function getUserHostAddress()
580 580
 	{
581
-		return isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:null;
581
+		return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
582 582
 	}
583 583
 
584 584
 	/**
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	 */
587 587
 	public function getUserHost()
588 588
 	{
589
-		return isset($_SERVER['REMOTE_HOST'])?$_SERVER['REMOTE_HOST']:null;
589
+		return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null;
590 590
 	}
591 591
 
592 592
 	/**
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 	public function getAcceptTypes()
596 596
 	{
597 597
 		// TBD: break it into array??
598
-		return isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:null;
598
+		return isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
599 599
 	}
600 600
 
601 601
 	/**
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	 */
624 624
 	public function setEnableCookieValidation($value)
625 625
 	{
626
-		$this->_enableCookieValidation=TPropertyValue::ensureBoolean($value);
626
+		$this->_enableCookieValidation = TPropertyValue::ensureBoolean($value);
627 627
 	}
628 628
 
629 629
 	/**
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 	 */
644 644
 	public function setCgiFix($value)
645 645
 	{
646
-		$this->_cgiFix=TPropertyValue::ensureInteger($value);
646
+		$this->_cgiFix = TPropertyValue::ensureInteger($value);
647 647
 	}
648 648
 
649 649
 	/**
@@ -651,22 +651,22 @@  discard block
 block discarded – undo
651 651
 	 */
652 652
 	public function getCookies()
653 653
 	{
654
-		if($this->_cookies===null)
654
+		if ($this->_cookies === null)
655 655
 		{
656
-			$this->_cookies=new THttpCookieCollection;
657
-			if($this->getEnableCookieValidation())
656
+			$this->_cookies = new THttpCookieCollection;
657
+			if ($this->getEnableCookieValidation())
658 658
 			{
659
-				$sm=$this->getApplication()->getSecurityManager();
660
-				foreach($_COOKIE as $key=>$value)
659
+				$sm = $this->getApplication()->getSecurityManager();
660
+				foreach ($_COOKIE as $key=>$value)
661 661
 				{
662
-					if(($value=$sm->validateData($value))!==false)
663
-						$this->_cookies->add(new THttpCookie($key,$value));
662
+					if (($value = $sm->validateData($value)) !== false)
663
+						$this->_cookies->add(new THttpCookie($key, $value));
664 664
 				}
665 665
 			}
666 666
 			else
667 667
 			{
668
-				foreach($_COOKIE as $key=>$value)
669
-					$this->_cookies->add(new THttpCookie($key,$value));
668
+				foreach ($_COOKIE as $key=>$value)
669
+					$this->_cookies->add(new THttpCookie($key, $value));
670 670
 			}
671 671
 		}
672 672
 		return $this->_cookies;
@@ -713,13 +713,13 @@  discard block
 block discarded – undo
713 713
 	 * @return string URL
714 714
 	 * @see TUrlManager::constructUrl
715 715
 	 */
716
-	public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true)
716
+	public function constructUrl($serviceID, $serviceParam, $getItems = null, $encodeAmpersand = true, $encodeGetItems = true)
717 717
 	{
718
-		if ($this->_cookieOnly===null)
719
-				$this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies');
720
-		$url=$this->getUrlManagerModule()->constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems);
721
-		if(defined('SID') && SID != '' && !$this->_cookieOnly)
722
-			return $url . (strpos($url,'?')===false? '?' : ($encodeAmpersand?'&amp;':'&')) . SID;
718
+		if ($this->_cookieOnly === null)
719
+				$this->_cookieOnly = (int) ini_get('session.use_cookies') && (int) ini_get('session.use_only_cookies');
720
+		$url = $this->getUrlManagerModule()->constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems);
721
+		if (defined('SID') && SID != '' && !$this->_cookieOnly)
722
+			return $url . (strpos($url, '?') === false ? '?' : ($encodeAmpersand ? '&amp;' : '&')) . SID;
723 723
 		else
724 724
 			return $url;
725 725
 	}
@@ -747,15 +747,15 @@  discard block
 block discarded – undo
747 747
 	 */
748 748
 	public function resolveRequest($serviceIDs)
749 749
 	{
750
-		Prado::trace("Resolving request from ".$_SERVER['REMOTE_ADDR'],'System.Web.THttpRequest');
751
-		$getParams=$this->parseUrl();
752
-		foreach($getParams as $name=>$value)
753
-			$_GET[$name]=$value;
754
-		$this->_items=array_merge($_GET,$_POST);
755
-		$this->_requestResolved=true;
756
-		foreach($serviceIDs as $serviceID)
750
+		Prado::trace("Resolving request from " . $_SERVER['REMOTE_ADDR'], 'System.Web.THttpRequest');
751
+		$getParams = $this->parseUrl();
752
+		foreach ($getParams as $name=>$value)
753
+			$_GET[$name] = $value;
754
+		$this->_items = array_merge($_GET, $_POST);
755
+		$this->_requestResolved = true;
756
+		foreach ($serviceIDs as $serviceID)
757 757
 		{
758
-			if($this->contains($serviceID))
758
+			if ($this->contains($serviceID))
759 759
 			{
760 760
 				$this->setServiceID($serviceID);
761 761
 				$this->setServiceParameter($this->itemAt($serviceID));
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 	 */
788 788
 	public function setServiceID($value)
789 789
 	{
790
-		$this->_serviceID=$value;
790
+		$this->_serviceID = $value;
791 791
 	}
792 792
 
793 793
 	/**
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 	 */
805 805
 	public function setServiceParameter($value)
806 806
 	{
807
-		$this->_serviceParam=$value;
807
+		$this->_serviceParam = $value;
808 808
 	}
809 809
 
810 810
 	//------ The following methods enable THttpRequest to be TMap-like -----
@@ -862,9 +862,9 @@  discard block
 block discarded – undo
862 862
 	 * @param mixed key
863 863
 	 * @param mixed value
864 864
 	 */
865
-	public function add($key,$value)
865
+	public function add($key, $value)
866 866
 	{
867
-		$this->_items[$key]=$value;
867
+		$this->_items[$key] = $value;
868 868
 	}
869 869
 
870 870
 	/**
@@ -875,9 +875,9 @@  discard block
 block discarded – undo
875 875
 	 */
876 876
 	public function remove($key)
877 877
 	{
878
-		if(isset($this->_items[$key]) || array_key_exists($key,$this->_items))
878
+		if (isset($this->_items[$key]) || array_key_exists($key, $this->_items))
879 879
 		{
880
-			$value=$this->_items[$key];
880
+			$value = $this->_items[$key];
881 881
 			unset($this->_items[$key]);
882 882
 			return $value;
883 883
 		}
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	 */
891 891
 	public function clear()
892 892
 	{
893
-		foreach(array_keys($this->_items) as $key)
893
+		foreach (array_keys($this->_items) as $key)
894 894
 			$this->remove($key);
895 895
 	}
896 896
 
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 	 */
901 901
 	public function contains($key)
902 902
 	{
903
-		return isset($this->_items[$key]) || array_key_exists($key,$this->_items);
903
+		return isset($this->_items[$key]) || array_key_exists($key, $this->_items);
904 904
 	}
905 905
 
906 906
 	/**
@@ -939,9 +939,9 @@  discard block
 block discarded – undo
939 939
 	 * @param integer the offset to set element
940 940
 	 * @param mixed the element value
941 941
 	 */
942
-	public function offsetSet($offset,$item)
942
+	public function offsetSet($offset, $item)
943 943
 	{
944
-		$this->add($offset,$item);
944
+		$this->add($offset, $item);
945 945
 	}
946 946
 
947 947
 	/**
@@ -981,9 +981,9 @@  discard block
 block discarded – undo
981 981
 	 * Constructor.
982 982
 	 * @param mixed owner of this collection.
983 983
 	 */
984
-	public function __construct($owner=null)
984
+	public function __construct($owner = null)
985 985
 	{
986
-		$this->_o=$owner;
986
+		$this->_o = $owner;
987 987
 	}
988 988
 
989 989
 	/**
@@ -994,12 +994,12 @@  discard block
 block discarded – undo
994 994
 	 * @param mixed new item
995 995
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a THttpCookie object.
996 996
 	 */
997
-	public function insertAt($index,$item)
997
+	public function insertAt($index, $item)
998 998
 	{
999
-		if($item instanceof THttpCookie)
999
+		if ($item instanceof THttpCookie)
1000 1000
 		{
1001
-			parent::insertAt($index,$item);
1002
-			if($this->_o instanceof THttpResponse)
1001
+			parent::insertAt($index, $item);
1002
+			if ($this->_o instanceof THttpResponse)
1003 1003
 				$this->_o->addCookie($item);
1004 1004
 		}
1005 1005
 		else
@@ -1015,8 +1015,8 @@  discard block
 block discarded – undo
1015 1015
 	 */
1016 1016
 	public function removeAt($index)
1017 1017
 	{
1018
-		$item=parent::removeAt($index);
1019
-		if($this->_o instanceof THttpResponse)
1018
+		$item = parent::removeAt($index);
1019
+		if ($this->_o instanceof THttpResponse)
1020 1020
 			$this->_o->removeCookie($item);
1021 1021
 		return $item;
1022 1022
 	}
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 	 */
1028 1028
 	public function itemAt($index)
1029 1029
 	{
1030
-		if(is_integer($index))
1030
+		if (is_integer($index))
1031 1031
 			return parent::itemAt($index);
1032 1032
 		else
1033 1033
 			return $this->findCookieByName($index);
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	 */
1041 1041
 	public function findCookieByName($name)
1042 1042
 	{
1043
-		foreach($this as $cookie)
1044
-			if($cookie->getName()===$name)
1043
+		foreach ($this as $cookie)
1044
+			if ($cookie->getName() === $name)
1045 1045
 				return $cookie;
1046 1046
 		return null;
1047 1047
 	}
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 	/**
1063 1063
 	 * @var string domain of the cookie
1064 1064
 	 */
1065
-	private $_domain='';
1065
+	private $_domain = '';
1066 1066
 	/**
1067 1067
 	 * @var string name of the cookie
1068 1068
 	 */
@@ -1070,33 +1070,33 @@  discard block
 block discarded – undo
1070 1070
 	/**
1071 1071
 	 * @var string value of the cookie
1072 1072
 	 */
1073
-	private $_value='';
1073
+	private $_value = '';
1074 1074
 	/**
1075 1075
 	 * @var integer expire of the cookie
1076 1076
 	 */
1077
-	private $_expire=0;
1077
+	private $_expire = 0;
1078 1078
 	/**
1079 1079
 	 * @var string path of the cookie
1080 1080
 	 */
1081
-	private $_path='/';
1081
+	private $_path = '/';
1082 1082
 	/**
1083 1083
 	 * @var boolean whether cookie should be sent via secure connection
1084 1084
 	 */
1085
-	private $_secure=false;
1085
+	private $_secure = false;
1086 1086
 	/**
1087 1087
 	 * @var boolean if true the cookie value will be unavailable to JavaScript
1088 1088
 	 */
1089
-	private $_httpOnly=false;
1089
+	private $_httpOnly = false;
1090 1090
 
1091 1091
 	/**
1092 1092
 	 * Constructor.
1093 1093
 	 * @param string name of this cookie
1094 1094
 	 * @param string value of this cookie
1095 1095
 	 */
1096
-	public function __construct($name,$value)
1096
+	public function __construct($name, $value)
1097 1097
 	{
1098
-		$this->_name=$name;
1099
-		$this->_value=$value;
1098
+		$this->_name = $name;
1099
+		$this->_value = $value;
1100 1100
 	}
1101 1101
 
1102 1102
 	/**
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 	 */
1113 1113
 	public function setDomain($value)
1114 1114
 	{
1115
-		$this->_domain=$value;
1115
+		$this->_domain = $value;
1116 1116
 	}
1117 1117
 
1118 1118
 	/**
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 	 */
1129 1129
 	public function setExpire($value)
1130 1130
 	{
1131
-		$this->_expire=TPropertyValue::ensureInteger($value);
1131
+		$this->_expire = TPropertyValue::ensureInteger($value);
1132 1132
 	}
1133 1133
 
1134 1134
 	/**
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 	 */
1161 1161
 	public function setName($value)
1162 1162
 	{
1163
-		$this->_name=$value;
1163
+		$this->_name = $value;
1164 1164
 	}
1165 1165
 
1166 1166
 	/**
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 	 */
1177 1177
 	public function setValue($value)
1178 1178
 	{
1179
-		$this->_value=$value;
1179
+		$this->_value = $value;
1180 1180
 	}
1181 1181
 
1182 1182
 	/**
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 	 */
1193 1193
 	public function setPath($value)
1194 1194
 	{
1195
-		$this->_path=$value;
1195
+		$this->_path = $value;
1196 1196
 	}
1197 1197
 
1198 1198
 	/**
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 	 */
1209 1209
 	public function setSecure($value)
1210 1210
 	{
1211
-		$this->_secure=TPropertyValue::ensureBoolean($value);
1211
+		$this->_secure = TPropertyValue::ensureBoolean($value);
1212 1212
 	}
1213 1213
 }
1214 1214
 
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 	/**
1237 1237
 	 * @var array list of default ports for known schemes
1238 1238
 	 */
1239
-	private static $_defaultPort=array(
1239
+	private static $_defaultPort = array(
1240 1240
 		'ftp'=>21,
1241 1241
 		'gopher'=>70,
1242 1242
 		'http'=>80,
@@ -1291,22 +1291,22 @@  discard block
 block discarded – undo
1291 1291
 	 */
1292 1292
 	public function __construct($uri)
1293 1293
 	{
1294
-		if(($ret=@parse_url($uri))!==false)
1294
+		if (($ret = @parse_url($uri)) !== false)
1295 1295
 		{
1296 1296
 			// decoding???
1297
-			$this->_scheme=isset($ret['scheme'])?$ret['scheme']:'';
1298
-			$this->_host=isset($ret['host'])?$ret['host']:'';
1299
-			$this->_port=isset($ret['port'])?$ret['port']:'';
1300
-			$this->_user=isset($ret['user'])?$ret['user']:'';
1301
-			$this->_pass=isset($ret['pass'])?$ret['pass']:'';
1302
-			$this->_path=isset($ret['path'])?$ret['path']:'';
1303
-			$this->_query=isset($ret['query'])?$ret['query']:'';
1304
-			$this->_fragment=isset($ret['fragment'])?$ret['fragment']:'';
1305
-			$this->_uri=$uri;
1297
+			$this->_scheme = isset($ret['scheme']) ? $ret['scheme'] : '';
1298
+			$this->_host = isset($ret['host']) ? $ret['host'] : '';
1299
+			$this->_port = isset($ret['port']) ? $ret['port'] : '';
1300
+			$this->_user = isset($ret['user']) ? $ret['user'] : '';
1301
+			$this->_pass = isset($ret['pass']) ? $ret['pass'] : '';
1302
+			$this->_path = isset($ret['path']) ? $ret['path'] : '';
1303
+			$this->_query = isset($ret['query']) ? $ret['query'] : '';
1304
+			$this->_fragment = isset($ret['fragment']) ? $ret['fragment'] : '';
1305
+			$this->_uri = $uri;
1306 1306
 		}
1307 1307
 		else
1308 1308
 		{
1309
-			throw new TInvalidDataValueException('uri_format_invalid',$uri);
1309
+			throw new TInvalidDataValueException('uri_format_invalid', $uri);
1310 1310
 		}
1311 1311
 	}
1312 1312
 
@@ -1399,8 +1399,8 @@  discard block
 block discarded – undo
1399 1399
  */
1400 1400
 class THttpRequestUrlFormat extends TEnumerable
1401 1401
 {
1402
-	const Get='Get';
1403
-	const Path='Path';
1404
-	const HiddenPath='HiddenPath';
1402
+	const Get = 'Get';
1403
+	const Path = 'Path';
1404
+	const HiddenPath = 'HiddenPath';
1405 1405
 }
1406 1406
 
Please login to merge, or discard this patch.
Braces   +109 added lines, -83 removed lines patch added patch discarded remove patch
@@ -169,30 +169,37 @@  discard block
 block discarded – undo
169 169
 		// QUERY_STRING is the string following the '?' in the ur (eg the a=x part in http://foo/bar?a=x)
170 170
 		// REQUEST_URI contains the URI part entered in the browser address bar
171 171
 		// SCRIPT_FILENAME is the file path to the executing script
172
-		if(isset($_SERVER['REQUEST_URI']))
173
-			$this->_requestUri=$_SERVER['REQUEST_URI'];
174
-		else  // TBD: in this case, SCRIPT_NAME need to be escaped
172
+		if(isset($_SERVER['REQUEST_URI'])) {
173
+					$this->_requestUri=$_SERVER['REQUEST_URI'];
174
+		} else {
175
+			// TBD: in this case, SCRIPT_NAME need to be escaped
175 176
 			$this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING'])?'':'?'.$_SERVER['QUERY_STRING']);
177
+		}
176 178
 
177
-		if($this->_cgiFix&self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
178
-			$this->_pathInfo=substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME']));
179
-		elseif(isset($_SERVER['PATH_INFO']))
180
-			$this->_pathInfo=$_SERVER['PATH_INFO'];
181
-		else if(strpos($_SERVER['PHP_SELF'],$_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME'])
182
-			$this->_pathInfo=substr($_SERVER['PHP_SELF'],strlen($_SERVER['SCRIPT_NAME']));
183
-		else
184
-			$this->_pathInfo='';
179
+		if($this->_cgiFix&self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO'])) {
180
+					$this->_pathInfo=substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME']));
181
+		} elseif(isset($_SERVER['PATH_INFO'])) {
182
+					$this->_pathInfo=$_SERVER['PATH_INFO'];
183
+		} else if(strpos($_SERVER['PHP_SELF'],$_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME']) {
184
+					$this->_pathInfo=substr($_SERVER['PHP_SELF'],strlen($_SERVER['SCRIPT_NAME']));
185
+		} else {
186
+					$this->_pathInfo='';
187
+		}
185 188
 
186 189
 		if(get_magic_quotes_gpc())
187 190
 		{
188
-			if(isset($_GET))
189
-				$_GET=$this->stripSlashes($_GET);
190
-			if(isset($_POST))
191
-				$_POST=$this->stripSlashes($_POST);
192
-			if(isset($_REQUEST))
193
-				$_REQUEST=$this->stripSlashes($_REQUEST);
194
-			if(isset($_COOKIE))
195
-				$_COOKIE=$this->stripSlashes($_COOKIE);
191
+			if(isset($_GET)) {
192
+							$_GET=$this->stripSlashes($_GET);
193
+			}
194
+			if(isset($_POST)) {
195
+							$_POST=$this->stripSlashes($_POST);
196
+			}
197
+			if(isset($_REQUEST)) {
198
+							$_REQUEST=$this->stripSlashes($_REQUEST);
199
+			}
200
+			if(isset($_COOKIE)) {
201
+							$_COOKIE=$this->stripSlashes($_COOKIE);
202
+			}
196 203
 		}
197 204
 
198 205
 		$this->getApplication()->setRequest($this);
@@ -222,11 +229,12 @@  discard block
 block discarded – undo
222 229
 			{
223 230
 				$url.=$_SERVER['SERVER_NAME'];
224 231
 				$port=$_SERVER['SERVER_PORT'];
225
-				if(($port!=80 && !$secure) || ($port!=443 && $secure))
226
-					$url.=':'.$port;
232
+				if(($port!=80 && !$secure) || ($port!=443 && $secure)) {
233
+									$url.=':'.$port;
234
+				}
235
+			} else {
236
+							$url.=$_SERVER['HTTP_HOST'];
227 237
 			}
228
-			else
229
-				$url.=$_SERVER['HTTP_HOST'];
230 238
 			$url.=$this->getRequestUri();
231 239
 			$this->_url=new TUri($url);
232 240
 		}
@@ -268,10 +276,11 @@  discard block
 block discarded – undo
268 276
 			if($cache !== null)
269 277
 			{
270 278
 				$dependencies = null;
271
-				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
272
-					if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile())
279
+				if($this->getApplication()->getMode() !== TApplicationMode::Performance) {
280
+									if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile())
273 281
 					{
274 282
 						$fn = Prado::getPathOfNamespace($fn,$this->getApplication()->getConfigurationFileExt());
283
+				}
275 284
 						$dependencies = new TFileCacheDependency($fn);
276 285
 					}
277 286
 				return $cache->set($this->getCacheKey(), $manager, 0, $dependencies);
@@ -292,8 +301,9 @@  discard block
 block discarded – undo
292 301
 			if($cache !== null)
293 302
 			{
294 303
 				$manager = $cache->get($this->getCacheKey());
295
-				if($manager instanceof TUrlManager)
296
-					return $manager;
304
+				if($manager instanceof TUrlManager) {
305
+									return $manager;
306
+				}
297 307
 			}
298 308
 		}
299 309
 		return null;
@@ -333,14 +343,15 @@  discard block
 block discarded – undo
333 343
 				{
334 344
 					$this->_urlManager=new TUrlManager;
335 345
 					$this->_urlManager->init(null);
336
-				}
337
-				else
346
+				} else
338 347
 				{
339 348
 					$this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID);
340
-					if($this->_urlManager===null)
341
-						throw new TConfigurationException('httprequest_urlmanager_inexist',$this->_urlManagerID);
342
-					if(!($this->_urlManager instanceof TUrlManager))
343
-						throw new TConfigurationException('httprequest_urlmanager_invalid',$this->_urlManagerID);
349
+					if($this->_urlManager===null) {
350
+											throw new TConfigurationException('httprequest_urlmanager_inexist',$this->_urlManagerID);
351
+					}
352
+					if(!($this->_urlManager instanceof TUrlManager)) {
353
+											throw new TConfigurationException('httprequest_urlmanager_invalid',$this->_urlManagerID);
354
+					}
344 355
 				}
345 356
 				$this->cacheUrlManager($this->_urlManager);
346 357
 			}
@@ -383,10 +394,11 @@  discard block
 block discarded – undo
383 394
 	 */
384 395
 	public function setUrlParamSeparator($value)
385 396
 	{
386
-		if(strlen($value)===1)
387
-			$this->_separator=$value;
388
-		else
389
-			throw new TInvalidDataValueException('httprequest_separator_invalid');
397
+		if(strlen($value)===1) {
398
+					$this->_separator=$value;
399
+		} else {
400
+					throw new TInvalidDataValueException('httprequest_separator_invalid');
401
+		}
390 402
 	}
391 403
 
392 404
 	/**
@@ -403,11 +415,13 @@  discard block
 block discarded – undo
403 415
 	 */
404 416
 	public function getContentType($mimetypeOnly = true)
405 417
 	{
406
-		if(!isset($_SERVER['CONTENT_TYPE']))
407
-			return null;
418
+		if(!isset($_SERVER['CONTENT_TYPE'])) {
419
+					return null;
420
+		}
408 421
 
409
-		if($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false)
410
-			return substr($_SERVER['CONTENT_TYPE'], 0, $_pos);
422
+		if($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false) {
423
+					return substr($_SERVER['CONTENT_TYPE'], 0, $_pos);
424
+		}
411 425
 
412 426
 		return $_SERVER['CONTENT_TYPE'];
413 427
 	}
@@ -454,18 +468,20 @@  discard block
 block discarded – undo
454 468
 
455 469
 		if($result === null && function_exists('apache_request_headers')) {
456 470
 			$result = apache_request_headers();
457
-		}
458
-		elseif($result === null) {
471
+		} elseif($result === null) {
459 472
 			$result = array();
460 473
 			foreach($_SERVER as $key=>$value) {
461
-				if(strncasecmp($key, 'HTTP_', 5) !== 0) continue;
474
+				if(strncasecmp($key, 'HTTP_', 5) !== 0) {
475
+					continue;
476
+				}
462 477
 					$key = str_replace(' ','-', ucwords(strtolower(str_replace('_',' ', substr($key, 5)))));
463 478
 					$result[$key] = $value;
464 479
 			}
465 480
 		}
466 481
 
467
-		if($case !== null)
468
-			return array_change_key_case($result, $case);
482
+		if($case !== null) {
483
+					return array_change_key_case($result, $case);
484
+		}
469 485
 
470 486
 		return $result;
471 487
 	}
@@ -490,7 +506,9 @@  discard block
 block discarded – undo
490 506
 		$url=$this->getUrl();
491 507
 		$scheme=($forceSecureConnection)?"https": (($forceSecureConnection === null)?$url->getScheme():'http');
492 508
 		$host=$url->getHost();
493
-		if (($port=$url->getPort())) $host.=':'.$port;
509
+		if (($port=$url->getPort())) {
510
+			$host.=':'.$port;
511
+		}
494 512
 		return $scheme.'://'.$host;
495 513
 	}
496 514
 
@@ -499,8 +517,9 @@  discard block
 block discarded – undo
499 517
 	 */
500 518
 	public function getApplicationUrl()
501 519
 	{
502
-		if($this->_cgiFix&self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
503
-			return $_SERVER['ORIG_SCRIPT_NAME'];
520
+		if($this->_cgiFix&self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME'])) {
521
+					return $_SERVER['ORIG_SCRIPT_NAME'];
522
+		}
504 523
 
505 524
 		return isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:null;
506 525
 	}
@@ -558,8 +577,7 @@  discard block
 block discarded – undo
558 577
 		try
559 578
 		{
560 579
 			return get_browser();
561
-		}
562
-		catch(TPhpErrorException $e)
580
+		} catch(TPhpErrorException $e)
563 581
 		{
564 582
 			throw new TConfigurationException('httprequest_browscap_required');
565 583
 		}
@@ -659,14 +677,15 @@  discard block
 block discarded – undo
659 677
 				$sm=$this->getApplication()->getSecurityManager();
660 678
 				foreach($_COOKIE as $key=>$value)
661 679
 				{
662
-					if(($value=$sm->validateData($value))!==false)
663
-						$this->_cookies->add(new THttpCookie($key,$value));
680
+					if(($value=$sm->validateData($value))!==false) {
681
+											$this->_cookies->add(new THttpCookie($key,$value));
682
+					}
664 683
 				}
665
-			}
666
-			else
684
+			} else
667 685
 			{
668
-				foreach($_COOKIE as $key=>$value)
669
-					$this->_cookies->add(new THttpCookie($key,$value));
686
+				foreach($_COOKIE as $key=>$value) {
687
+									$this->_cookies->add(new THttpCookie($key,$value));
688
+				}
670 689
 			}
671 690
 		}
672 691
 		return $this->_cookies;
@@ -715,13 +734,15 @@  discard block
 block discarded – undo
715 734
 	 */
716 735
 	public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true)
717 736
 	{
718
-		if ($this->_cookieOnly===null)
719
-				$this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies');
737
+		if ($this->_cookieOnly===null) {
738
+						$this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies');
739
+		}
720 740
 		$url=$this->getUrlManagerModule()->constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems);
721
-		if(defined('SID') && SID != '' && !$this->_cookieOnly)
722
-			return $url . (strpos($url,'?')===false? '?' : ($encodeAmpersand?'&amp;':'&')) . SID;
723
-		else
724
-			return $url;
741
+		if(defined('SID') && SID != '' && !$this->_cookieOnly) {
742
+					return $url . (strpos($url,'?')===false? '?' : ($encodeAmpersand?'&amp;':'&')) . SID;
743
+		} else {
744
+					return $url;
745
+		}
725 746
 	}
726 747
 
727 748
 	/**
@@ -749,8 +770,9 @@  discard block
 block discarded – undo
749 770
 	{
750 771
 		Prado::trace("Resolving request from ".$_SERVER['REMOTE_ADDR'],'System.Web.THttpRequest');
751 772
 		$getParams=$this->parseUrl();
752
-		foreach($getParams as $name=>$value)
753
-			$_GET[$name]=$value;
773
+		foreach($getParams as $name=>$value) {
774
+					$_GET[$name]=$value;
775
+		}
754 776
 		$this->_items=array_merge($_GET,$_POST);
755 777
 		$this->_requestResolved=true;
756 778
 		foreach($serviceIDs as $serviceID)
@@ -880,9 +902,9 @@  discard block
 block discarded – undo
880 902
 			$value=$this->_items[$key];
881 903
 			unset($this->_items[$key]);
882 904
 			return $value;
905
+		} else {
906
+					return null;
883 907
 		}
884
-		else
885
-			return null;
886 908
 	}
887 909
 
888 910
 	/**
@@ -890,8 +912,9 @@  discard block
 block discarded – undo
890 912
 	 */
891 913
 	public function clear()
892 914
 	{
893
-		foreach(array_keys($this->_items) as $key)
894
-			$this->remove($key);
915
+		foreach(array_keys($this->_items) as $key) {
916
+					$this->remove($key);
917
+		}
895 918
 	}
896 919
 
897 920
 	/**
@@ -999,11 +1022,12 @@  discard block
 block discarded – undo
999 1022
 		if($item instanceof THttpCookie)
1000 1023
 		{
1001 1024
 			parent::insertAt($index,$item);
1002
-			if($this->_o instanceof THttpResponse)
1003
-				$this->_o->addCookie($item);
1025
+			if($this->_o instanceof THttpResponse) {
1026
+							$this->_o->addCookie($item);
1027
+			}
1028
+		} else {
1029
+					throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
1004 1030
 		}
1005
-		else
1006
-			throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
1007 1031
 	}
1008 1032
 
1009 1033
 	/**
@@ -1016,8 +1040,9 @@  discard block
 block discarded – undo
1016 1040
 	public function removeAt($index)
1017 1041
 	{
1018 1042
 		$item=parent::removeAt($index);
1019
-		if($this->_o instanceof THttpResponse)
1020
-			$this->_o->removeCookie($item);
1043
+		if($this->_o instanceof THttpResponse) {
1044
+					$this->_o->removeCookie($item);
1045
+		}
1021 1046
 		return $item;
1022 1047
 	}
1023 1048
 
@@ -1027,10 +1052,11 @@  discard block
 block discarded – undo
1027 1052
 	 */
1028 1053
 	public function itemAt($index)
1029 1054
 	{
1030
-		if(is_integer($index))
1031
-			return parent::itemAt($index);
1032
-		else
1033
-			return $this->findCookieByName($index);
1055
+		if(is_integer($index)) {
1056
+					return parent::itemAt($index);
1057
+		} else {
1058
+					return $this->findCookieByName($index);
1059
+		}
1034 1060
 	}
1035 1061
 
1036 1062
 	/**
@@ -1040,9 +1066,10 @@  discard block
 block discarded – undo
1040 1066
 	 */
1041 1067
 	public function findCookieByName($name)
1042 1068
 	{
1043
-		foreach($this as $cookie)
1044
-			if($cookie->getName()===$name)
1069
+		foreach($this as $cookie) {
1070
+					if($cookie->getName()===$name)
1045 1071
 				return $cookie;
1072
+		}
1046 1073
 		return null;
1047 1074
 	}
1048 1075
 }
@@ -1303,8 +1330,7 @@  discard block
 block discarded – undo
1303 1330
 			$this->_query=isset($ret['query'])?$ret['query']:'';
1304 1331
 			$this->_fragment=isset($ret['fragment'])?$ret['fragment']:'';
1305 1332
 			$this->_uri=$uri;
1306
-		}
1307
-		else
1333
+		} else
1308 1334
 		{
1309 1335
 			throw new TInvalidDataValueException('uri_format_invalid',$uri);
1310 1336
 		}
Please login to merge, or discard this patch.