@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function parseDSN($dsn) |
42 | 42 | { |
43 | - if (is_array($dsn)) { |
|
43 | + if(is_array($dsn)) { |
|
44 | 44 | return $dsn; |
45 | 45 | } |
46 | 46 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | ]; |
58 | 58 | |
59 | 59 | // Find phptype and dbsyntax |
60 | - if (($pos = strpos($dsn, '://')) !== false) { |
|
60 | + if(($pos = strpos($dsn, '://')) !== false) { |
|
61 | 61 | $str = substr($dsn, 0, $pos); |
62 | 62 | $dsn = substr($dsn, $pos + 3); |
63 | 63 | } else { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | // Get phptype and dbsyntax |
69 | 69 | // $str => phptype(dbsyntax) |
70 | - if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) { |
|
70 | + if(preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) { |
|
71 | 71 | $parsed['phptype'] = $arr[1]; |
72 | 72 | $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2]; |
73 | 73 | } else { |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | $parsed['dbsyntax'] = $str; |
76 | 76 | } |
77 | 77 | |
78 | - if (empty($dsn)) { |
|
78 | + if(empty($dsn)) { |
|
79 | 79 | return $parsed; |
80 | 80 | } |
81 | 81 | |
82 | 82 | // Get (if found): username and password |
83 | 83 | // $dsn => username:password@protocol+hostspec/database |
84 | - if (($at = strrpos($dsn, '@')) !== false) { |
|
84 | + if(($at = strrpos($dsn, '@')) !== false) { |
|
85 | 85 | $str = substr($dsn, 0, $at); |
86 | 86 | $dsn = substr($dsn, $at + 1); |
87 | - if (($pos = strpos($str, ':')) !== false) { |
|
87 | + if(($pos = strpos($str, ':')) !== false) { |
|
88 | 88 | $parsed['username'] = rawurldecode(substr($str, 0, $pos)); |
89 | 89 | $parsed['password'] = rawurldecode(substr($str, $pos + 1)); |
90 | 90 | } else { |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | // Find protocol and hostspec |
96 | 96 | |
97 | 97 | // $dsn => proto(proto_opts)/database |
98 | - if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) { |
|
98 | + if(preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) { |
|
99 | 99 | $proto = $match[1]; |
100 | 100 | $proto_opts = (!empty($match[2])) ? $match[2] : false; |
101 | 101 | $dsn = $match[3]; |
102 | 102 | |
103 | 103 | // $dsn => protocol+hostspec/database (old format) |
104 | 104 | } else { |
105 | - if (strpos($dsn, '+') !== false) { |
|
105 | + if(strpos($dsn, '+') !== false) { |
|
106 | 106 | list($proto, $dsn) = explode('+', $dsn, 2); |
107 | 107 | } |
108 | - if (strpos($dsn, '/') !== false) { |
|
108 | + if(strpos($dsn, '/') !== false) { |
|
109 | 109 | list($proto_opts, $dsn) = explode('/', $dsn, 2); |
110 | 110 | } else { |
111 | 111 | $proto_opts = $dsn; |
@@ -116,34 +116,34 @@ discard block |
||
116 | 116 | // process the different protocol options |
117 | 117 | $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp'; |
118 | 118 | $proto_opts = rawurldecode($proto_opts); |
119 | - if ($parsed['protocol'] == 'tcp') { |
|
120 | - if (strpos($proto_opts, ':') !== false) { |
|
119 | + if($parsed['protocol'] == 'tcp') { |
|
120 | + if(strpos($proto_opts, ':') !== false) { |
|
121 | 121 | list($parsed['hostspec'], $parsed['port']) = explode(':', $proto_opts); |
122 | 122 | } else { |
123 | 123 | $parsed['hostspec'] = $proto_opts; |
124 | 124 | } |
125 | - } elseif ($parsed['protocol'] == 'unix') { |
|
125 | + } elseif($parsed['protocol'] == 'unix') { |
|
126 | 126 | $parsed['socket'] = $proto_opts; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Get dabase if any |
130 | 130 | // $dsn => database |
131 | - if (!empty($dsn)) { |
|
131 | + if(!empty($dsn)) { |
|
132 | 132 | // /database |
133 | - if (($pos = strpos($dsn, '?')) === false) { |
|
133 | + if(($pos = strpos($dsn, '?')) === false) { |
|
134 | 134 | $parsed['database'] = $dsn; |
135 | 135 | // /database?param1=value1¶m2=value2 |
136 | 136 | } else { |
137 | 137 | $parsed['database'] = substr($dsn, 0, $pos); |
138 | 138 | $dsn = substr($dsn, $pos + 1); |
139 | - if (strpos($dsn, '&') !== false) { |
|
139 | + if(strpos($dsn, '&') !== false) { |
|
140 | 140 | $opts = explode('&', $dsn); |
141 | 141 | } else { // database?param1=value1 |
142 | 142 | $opts = [$dsn]; |
143 | 143 | } |
144 | - foreach ($opts as $opt) { |
|
144 | + foreach($opts as $opt) { |
|
145 | 145 | list($key, $value) = explode('=', $opt); |
146 | - if (!isset($parsed[$key])) { // don't allow params overwrite |
|
146 | + if(!isset($parsed[$key])) { // don't allow params overwrite |
|
147 | 147 | $parsed[$key] = rawurldecode($value); |
148 | 148 | } |
149 | 149 | } |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * @var array |
74 | 74 | */ |
75 | 75 | private static $_patternPresets = [ |
76 | - 'fulldate' => 'P','full' => 'P', |
|
77 | - 'longdate' => 'D','long' => 'd', |
|
78 | - 'mediumdate' => 'p','medium' => 'p', |
|
79 | - 'shortdate' => 'd','short' => 'd', |
|
76 | + 'fulldate' => 'P', 'full' => 'P', |
|
77 | + 'longdate' => 'D', 'long' => 'd', |
|
78 | + 'mediumdate' => 'p', 'medium' => 'p', |
|
79 | + 'shortdate' => 'd', 'short' => 'd', |
|
80 | 80 | 'fulltime' => 'Q', 'longtime' => 'T', |
81 | 81 | 'mediumtime' => 'q', 'shorttime' => 't']; |
82 | 82 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | //and let the DateFormat handle it. |
123 | 123 | if($pattern === null) |
124 | 124 | $pattern = $string; |
125 | - if (!is_array($pattern) && strlen($pattern) == 0) |
|
125 | + if(!is_array($pattern) && strlen($pattern) == 0) |
|
126 | 126 | $pattern = null; |
127 | 127 | return $pattern; |
128 | 128 | } |
@@ -21,9 +21,9 @@ |
||
21 | 21 | |
22 | 22 | private function validateSecurity() |
23 | 23 | { |
24 | - if ($this->Session["wsat_password"] !== $this->getService()->getPassword()) |
|
24 | + if($this->Session["wsat_password"] !== $this->getService()->getPassword()) |
|
25 | 25 | { |
26 | - if (!$this->getPage() instanceof TWsatLogin) |
|
26 | + if(!$this->getPage() instanceof TWsatLogin) |
|
27 | 27 | { |
28 | 28 | $url = $this->Service->constructUrl('TWsatLogin'); |
29 | 29 | $this->Response->redirect($url); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | public function login() |
20 | 20 | { |
21 | - if ($this->IsValid) |
|
21 | + if($this->IsValid) |
|
22 | 22 | { |
23 | 23 | $this->Session["wsat_password"] = $this->getService()->getPassword(); |
24 | 24 | $url = $this->Service->constructUrl('TWsatHome'); |
@@ -48,10 +48,10 @@ |
||
48 | 48 | |
49 | 49 | public function init($config) |
50 | 50 | { |
51 | - if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
51 | + if($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
52 | 52 | throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
53 | 53 | |
54 | - if (empty($this->_pass)) |
|
54 | + if(empty($this->_pass)) |
|
55 | 55 | throw new TConfigurationException("You need to specify the Password attribute."); |
56 | 56 | |
57 | 57 | $this->setDefaultPage("TWsatHome"); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->_owner = $owner; |
47 | 47 | foreach($this->events() as $event => $handler) |
48 | - $owner->attachEventHandler($event, [$this,$handler]); |
|
48 | + $owner->attachEventHandler($event, [$this, $handler]); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function detach($owner) |
59 | 59 | { |
60 | 60 | foreach($this->events() as $event => $handler) |
61 | - $owner->detachEventHandler($event, [$this,$handler]); |
|
61 | + $owner->detachEventHandler($event, [$this, $handler]); |
|
62 | 62 | $this->_owner = null; |
63 | 63 | } |
64 | 64 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function addCall($method, $args) |
52 | 52 | { |
53 | - $this->add([$method,$args]); |
|
53 | + $this->add([$method, $args]); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $args = func_get_args(); |
98 | 98 | if($this->getCount() === 0) |
99 | - return isset($args[0])?$args[0]:null; |
|
99 | + return isset($args[0]) ? $args[0] : null; |
|
100 | 100 | |
101 | 101 | if(!$this->_iterator) |
102 | 102 | { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function __dycall($method, $args) |
145 | 145 | { |
146 | 146 | if($this->_method == $method) |
147 | - return call_user_func_array([$this,'call'], $args); |
|
147 | + return call_user_func_array([$this, 'call'], $args); |
|
148 | 148 | return null; |
149 | 149 | } |
150 | 150 | } |
151 | 151 | \ No newline at end of file |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | throw new TConfigurationException('logrouter_configfile_invalid', $this->_configFile); |
85 | 85 | } |
86 | 86 | $this->loadConfig($config); |
87 | - $this->getApplication()->attachEventHandler('OnEndRequest', [$this,'collectLogs']); |
|
87 | + $this->getApplication()->attachEventHandler('OnEndRequest', [$this, 'collectLogs']); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | foreach($config['routes'] as $route) |
102 | 102 | { |
103 | - $properties = isset($route['properties'])?$route['properties']:[]; |
|
103 | + $properties = isset($route['properties']) ? $route['properties'] : []; |
|
104 | 104 | if(!isset($route['class'])) |
105 | 105 | throw new TConfigurationException('logrouter_routeclass_required'); |
106 | 106 | $route = Prado::createComponent($route['class']); |
@@ -241,21 +241,21 @@ discard block |
||
241 | 241 | $day = null; |
242 | 242 | } |
243 | 243 | |
244 | - while ($i_format < $pattern_length) |
|
244 | + while($i_format < $pattern_length) |
|
245 | 245 | { |
246 | 246 | $c = $this->charAt($pattern, $i_format); |
247 | 247 | $token = ''; |
248 | - while ($this->charEqual($pattern, $i_format, $c) |
|
248 | + while($this->charEqual($pattern, $i_format, $c) |
|
249 | 249 | && ($i_format < $pattern_length)) |
250 | 250 | { |
251 | 251 | $token .= $this->charAt($pattern, $i_format++); |
252 | 252 | } |
253 | 253 | |
254 | - if ($token == 'yyyy' || $token == 'yy' || $token == 'y') |
|
254 | + if($token == 'yyyy' || $token == 'yy' || $token == 'y') |
|
255 | 255 | { |
256 | - if ($token == 'yyyy') { $x = 4;$y = 4; } |
|
257 | - if ($token == 'yy') { $x = 2;$y = 2; } |
|
258 | - if ($token == 'y') { $x = 2;$y = 4; } |
|
256 | + if($token == 'yyyy') { $x = 4; $y = 4; } |
|
257 | + if($token == 'yy') { $x = 2; $y = 2; } |
|
258 | + if($token == 'y') { $x = 2; $y = 4; } |
|
259 | 259 | $year = $this->getInteger($value, $i_val, $x, $y); |
260 | 260 | if($year === null) |
261 | 261 | return null; |
@@ -263,30 +263,30 @@ discard block |
||
263 | 263 | $i_val += strlen($year); |
264 | 264 | if(strlen($year) == 2) |
265 | 265 | { |
266 | - $iYear = (int)$year; |
|
266 | + $iYear = (int) $year; |
|
267 | 267 | if($iYear > 70) |
268 | 268 | $year = $iYear + 1900; |
269 | 269 | else |
270 | 270 | $year = $iYear + 2000; |
271 | 271 | } |
272 | - $year = (int)$year; |
|
272 | + $year = (int) $year; |
|
273 | 273 | } |
274 | 274 | elseif($token == 'MM' || $token == 'M') |
275 | 275 | { |
276 | - $month = $this->getInteger($value,$i_val, |
|
276 | + $month = $this->getInteger($value, $i_val, |
|
277 | 277 | $this->length($token), 2); |
278 | - $iMonth = (int)$month; |
|
278 | + $iMonth = (int) $month; |
|
279 | 279 | if($month === null || $iMonth < 1 || $iMonth > 12) |
280 | 280 | return null; |
281 | 281 | //throw new TInvalidDataValueException('Invalid month', $value); |
282 | 282 | $i_val += strlen($month); |
283 | 283 | $month = $iMonth; |
284 | 284 | } |
285 | - elseif ($token == 'dd' || $token == 'd') |
|
285 | + elseif($token == 'dd' || $token == 'd') |
|
286 | 286 | { |
287 | - $day = $this->getInteger($value,$i_val, |
|
287 | + $day = $this->getInteger($value, $i_val, |
|
288 | 288 | $this->length($token), 2); |
289 | - $iDay = (int)$day; |
|
289 | + $iDay = (int) $day; |
|
290 | 290 | if($day === null || $iDay < 1 || $iDay > 31) |
291 | 291 | return null; |
292 | 292 | //throw new TInvalidDataValueException('Invalid day', $value); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $i_val += $this->length($token); |
303 | 303 | } |
304 | 304 | } |
305 | - if ($i_val != $this->length($value)) |
|
305 | + if($i_val != $this->length($value)) |
|
306 | 306 | return null; |
307 | 307 | //throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value); |
308 | 308 | if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null)) |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | if(empty($year)) { |
313 | 313 | $year = date('Y'); |
314 | 314 | } |
315 | - $day = (int)$day <= 0 ? 1 : (int)$day; |
|
316 | - $month = (int)$month <= 0 ? 1 : (int)$month; |
|
315 | + $day = (int) $day <= 0 ? 1 : (int) $day; |
|
316 | + $month = (int) $month <= 0 ? 1 : (int) $month; |
|
317 | 317 | |
318 | 318 | $s = new \DateTime; |
319 | 319 | $s->setDate($year, $month, $day); |
@@ -366,12 +366,12 @@ discard block |
||
366 | 366 | private function getInteger($str, $i, $minlength, $maxlength) |
367 | 367 | { |
368 | 368 | //match for digits backwards |
369 | - for ($x = $maxlength; $x >= $minlength; $x--) |
|
369 | + for($x = $maxlength; $x >= $minlength; $x--) |
|
370 | 370 | { |
371 | 371 | $token = $this->substring($str, $i, $x); |
372 | - if ($this->length($token) < $minlength) |
|
372 | + if($this->length($token) < $minlength) |
|
373 | 373 | return null; |
374 | - if (preg_match('/^\d+$/', $token)) |
|
374 | + if(preg_match('/^\d+$/', $token)) |
|
375 | 375 | return $token; |
376 | 376 | } |
377 | 377 | return null; |