Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Util/TCallChain.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
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
 	/**
@@ -95,25 +95,25 @@  discard block
 block discarded – undo
95 95
 	public function call()
96 96
 	{
97 97
 		$args = func_get_args();
98
-		if($this->getCount() === 0)
99
-			return isset($args[0])?$args[0]:null;
98
+		if ($this->getCount() === 0)
99
+			return isset($args[0]) ? $args[0] : null;
100 100
 
101
-		if(!$this->_iterator)
101
+		if (!$this->_iterator)
102 102
 		{
103 103
 			$chain_array = array_reverse($this->toArray());
104 104
 			$this->_iterator = new \ArrayIterator($chain_array);
105 105
 		}
106
-		if($this->_iterator->valid())
106
+		if ($this->_iterator->valid())
107 107
 			do {
108 108
 				$handler = $this->_iterator->current();
109 109
 				$this->_iterator->next();
110
-				if(is_array($handler[0]) && $handler[0][0] instanceof IClassBehavior)
110
+				if (is_array($handler[0]) && $handler[0][0] instanceof IClassBehavior)
111 111
 					array_splice($handler[1], 1, count($args), $args);
112 112
 				else
113 113
 					array_splice($handler[1], 0, count($args), $args);
114 114
 				$handler[1][] = $this;
115 115
 				$result = call_user_func_array($handler[0], $handler[1]);
116
-			} while($this->_iterator->valid());
116
+			} while ($this->_iterator->valid());
117 117
 		else
118 118
 			$result = $args[0];
119 119
 		return $result;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function __dycall($method, $args)
145 145
 	{
146
-		if($this->_method == $method)
147
-			return call_user_func_array([$this,'call'], $args);
146
+		if ($this->_method == $method)
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
Please login to merge, or discard this patch.
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -95,27 +95,31 @@  discard block
 block discarded – undo
95 95
 	public function call()
96 96
 	{
97 97
 		$args = func_get_args();
98
-		if($this->getCount() === 0)
99
-			return isset($args[0])?$args[0]:null;
98
+		if($this->getCount() === 0) {
99
+					return isset($args[0])?$args[0]:null;
100
+		}
100 101
 
101 102
 		if(!$this->_iterator)
102 103
 		{
103 104
 			$chain_array = array_reverse($this->toArray());
104 105
 			$this->_iterator = new \ArrayIterator($chain_array);
105 106
 		}
106
-		if($this->_iterator->valid())
107
-			do {
107
+		if($this->_iterator->valid()) {
108
+					do {
108 109
 				$handler = $this->_iterator->current();
110
+		}
109 111
 				$this->_iterator->next();
110
-				if(is_array($handler[0]) && $handler[0][0] instanceof IClassBehavior)
111
-					array_splice($handler[1], 1, count($args), $args);
112
-				else
113
-					array_splice($handler[1], 0, count($args), $args);
112
+				if(is_array($handler[0]) && $handler[0][0] instanceof IClassBehavior) {
113
+									array_splice($handler[1], 1, count($args), $args);
114
+				} else {
115
+									array_splice($handler[1], 0, count($args), $args);
116
+				}
114 117
 				$handler[1][] = $this;
115 118
 				$result = call_user_func_array($handler[0], $handler[1]);
116 119
 			} while($this->_iterator->valid());
117
-		else
118
-			$result = $args[0];
120
+		else {
121
+					$result = $args[0];
122
+		}
119 123
 		return $result;
120 124
 	}
121 125
 
@@ -143,8 +147,9 @@  discard block
 block discarded – undo
143 147
 	 */
144 148
 	public function __dycall($method, $args)
145 149
 	{
146
-		if($this->_method == $method)
147
-			return call_user_func_array([$this,'call'], $args);
150
+		if($this->_method == $method) {
151
+					return call_user_func_array([$this,'call'], $args);
152
+		}
148 153
 		return null;
149 154
 	}
150 155
 }
151 156
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Util/TVarDumper.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		self::$_objects = [];
49 49
 		self::$_depth = $depth;
50 50
 		self::dumpInternal($var, 0);
51
-		if($highlight)
51
+		if ($highlight)
52 52
 		{
53
-			$result = highlight_string("<?php\n" . self::$_output, true);
53
+			$result = highlight_string("<?php\n".self::$_output, true);
54 54
 			return preg_replace('/&lt;\\?php<br \\/>/', '', $result, 1);
55 55
 		}
56 56
 		else
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 
60 60
 	private static function dumpInternal($var, $level)
61 61
 	{
62
-		switch(gettype($var))
62
+		switch (gettype($var))
63 63
 		{
64 64
 			case 'boolean':
65
-				self::$_output .= $var?'true':'false';
65
+				self::$_output .= $var ? 'true' : 'false';
66 66
 				break;
67 67
 			case 'integer':
68 68
 				self::$_output .= "$var";
@@ -83,43 +83,43 @@  discard block
 block discarded – undo
83 83
 				self::$_output .= '{unknown}';
84 84
 				break;
85 85
 			case 'array':
86
-				if(self::$_depth <= $level)
86
+				if (self::$_depth <= $level)
87 87
 					self::$_output .= 'array(...)';
88
-				elseif(empty($var))
88
+				elseif (empty($var))
89 89
 					self::$_output .= 'array()';
90 90
 				else
91 91
 				{
92 92
 					$keys = array_keys($var);
93 93
 					$spaces = str_repeat(' ', $level * 4);
94
-					self::$_output .= "array\n" . $spaces . '(';
95
-					foreach($keys as $key)
94
+					self::$_output .= "array\n".$spaces.'(';
95
+					foreach ($keys as $key)
96 96
 					{
97
-						self::$_output .= "\n" . $spaces . "    [$key] => ";
97
+						self::$_output .= "\n".$spaces."    [$key] => ";
98 98
 						self::$_output .= self::dumpInternal($var[$key], $level + 1);
99 99
 					}
100
-					self::$_output .= "\n" . $spaces . ')';
100
+					self::$_output .= "\n".$spaces.')';
101 101
 				}
102 102
 				break;
103 103
 			case 'object':
104
-				if(($id = array_search($var, self::$_objects, true)) !== false)
105
-					self::$_output .= get_class($var) . '#' . ($id + 1) . '(...)';
106
-				elseif(self::$_depth <= $level)
107
-					self::$_output .= get_class($var) . '(...)';
104
+				if (($id = array_search($var, self::$_objects, true)) !== false)
105
+					self::$_output .= get_class($var).'#'.($id + 1).'(...)';
106
+				elseif (self::$_depth <= $level)
107
+					self::$_output .= get_class($var).'(...)';
108 108
 				else
109 109
 				{
110 110
 					$id = array_push(self::$_objects, $var);
111 111
 					$className = get_class($var);
112
-					$members = (array)$var;
112
+					$members = (array) $var;
113 113
 					$keys = array_keys($members);
114 114
 					$spaces = str_repeat(' ', $level * 4);
115
-					self::$_output .= "$className#$id\n" . $spaces . '(';
116
-					foreach($keys as $key)
115
+					self::$_output .= "$className#$id\n".$spaces.'(';
116
+					foreach ($keys as $key)
117 117
 					{
118 118
 						$keyDisplay = strtr(trim($key), ["\0" => ':']);
119
-						self::$_output .= "\n" . $spaces . "    [$keyDisplay] => ";
119
+						self::$_output .= "\n".$spaces."    [$keyDisplay] => ";
120 120
 						self::$_output .= self::dumpInternal($members[$key], $level + 1);
121 121
 					}
122
-					self::$_output .= "\n" . $spaces . ')';
122
+					self::$_output .= "\n".$spaces.')';
123 123
 				}
124 124
 				break;
125 125
 		}
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 		{
53 53
 			$result = highlight_string("<?php\n" . self::$_output, true);
54 54
 			return preg_replace('/&lt;\\?php<br \\/>/', '', $result, 1);
55
+		} else {
56
+					return self::$_output;
55 57
 		}
56
-		else
57
-			return self::$_output;
58 58
 	}
59 59
 
60 60
 	private static function dumpInternal($var, $level)
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 				self::$_output .= '{unknown}';
84 84
 				break;
85 85
 			case 'array':
86
-				if(self::$_depth <= $level)
87
-					self::$_output .= 'array(...)';
88
-				elseif(empty($var))
89
-					self::$_output .= 'array()';
90
-				else
86
+				if(self::$_depth <= $level) {
87
+									self::$_output .= 'array(...)';
88
+				} elseif(empty($var)) {
89
+									self::$_output .= 'array()';
90
+				} else
91 91
 				{
92 92
 					$keys = array_keys($var);
93 93
 					$spaces = str_repeat(' ', $level * 4);
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 				}
102 102
 				break;
103 103
 			case 'object':
104
-				if(($id = array_search($var, self::$_objects, true)) !== false)
105
-					self::$_output .= get_class($var) . '#' . ($id + 1) . '(...)';
106
-				elseif(self::$_depth <= $level)
107
-					self::$_output .= get_class($var) . '(...)';
108
-				else
104
+				if(($id = array_search($var, self::$_objects, true)) !== false) {
105
+									self::$_output .= get_class($var) . '#' . ($id + 1) . '(...)';
106
+				} elseif(self::$_depth <= $level) {
107
+									self::$_output .= get_class($var) . '(...)';
108
+				} else
109 109
 				{
110 110
 					$id = array_push(self::$_objects, $var);
111 111
 					$className = get_class($var);
Please login to merge, or discard this patch.
framework/Util/TDataFieldAccessor.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	{
58 58
 		try
59 59
 		{
60
-			if(is_array($data) || ($data instanceof \ArrayAccess))
60
+			if (is_array($data) || ($data instanceof \ArrayAccess))
61 61
 			{
62
-				if(isset($data[$field]))
62
+				if (isset($data[$field]))
63 63
 					return $data[$field];
64 64
 
65 65
 				$tmp = $data;
@@ -67,25 +67,25 @@  discard block
 block discarded – undo
67 67
 					$tmp = $tmp[$f];
68 68
 				return $tmp;
69 69
 			}
70
-			elseif(is_object($data))
70
+			elseif (is_object($data))
71 71
 			{
72
-				if(strpos($field, '.') === false)  // simple field
72
+				if (strpos($field, '.') === false)  // simple field
73 73
 				{
74
-					if(method_exists($data, 'get' . $field))
75
-						return call_user_func([$data,'get' . $field]);
74
+					if (method_exists($data, 'get'.$field))
75
+						return call_user_func([$data, 'get'.$field]);
76 76
 					else
77 77
 						return $data->{$field};
78 78
 				}
79 79
 				else // field in the format of xxx.yyy.zzz
80 80
 				{
81 81
 					$object = $data;
82
-					foreach(explode('.', $field) as $f)
82
+					foreach (explode('.', $field) as $f)
83 83
 						$object = TDataFieldAccessor::getDataFieldValue($object, $f);
84 84
 					return $object;
85 85
 				}
86 86
 			}
87 87
 		}
88
-		catch(Exception $e)
88
+		catch (Exception $e)
89 89
 		{
90 90
 			throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid', $field, $e->getMessage());
91 91
 		}
Please login to merge, or discard this patch.
Braces   +17 added lines, -15 removed lines patch added patch discarded remove patch
@@ -59,33 +59,35 @@
 block discarded – undo
59 59
 		{
60 60
 			if(is_array($data) || ($data instanceof \ArrayAccess))
61 61
 			{
62
-				if(isset($data[$field]))
63
-					return $data[$field];
62
+				if(isset($data[$field])) {
63
+									return $data[$field];
64
+				}
64 65
 
65 66
 				$tmp = $data;
66
-				foreach (explode(".", $field) as $f)
67
-					$tmp = $tmp[$f];
67
+				foreach (explode(".", $field) as $f) {
68
+									$tmp = $tmp[$f];
69
+				}
68 70
 				return $tmp;
69
-			}
70
-			elseif(is_object($data))
71
+			} elseif(is_object($data))
71 72
 			{
72
-				if(strpos($field, '.') === false)  // simple field
73
+				if(strpos($field, '.') === false) {
74
+					// simple field
73 75
 				{
74 76
 					if(method_exists($data, 'get' . $field))
75 77
 						return call_user_func([$data,'get' . $field]);
76
-					else
77
-						return $data->{$field};
78
-				}
79
-				else // field in the format of xxx.yyy.zzz
78
+				} else {
79
+											return $data->{$field};
80
+					}
81
+				} else // field in the format of xxx.yyy.zzz
80 82
 				{
81 83
 					$object = $data;
82
-					foreach(explode('.', $field) as $f)
83
-						$object = TDataFieldAccessor::getDataFieldValue($object, $f);
84
+					foreach(explode('.', $field) as $f) {
85
+											$object = TDataFieldAccessor::getDataFieldValue($object, $f);
86
+					}
84 87
 					return $object;
85 88
 				}
86 89
 			}
87
-		}
88
-		catch(Exception $e)
90
+		} catch(Exception $e)
89 91
 		{
90 92
 			throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid', $field, $e->getMessage());
91 93
 		}
Please login to merge, or discard this patch.
framework/Util/TXmlRpcClient.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,15 +44,15 @@
 block discarded – undo
44 44
 		$_response = $this->performRequest($this->getServerUrl(), $this->encodeRequest($method, $parameters), 'text/xml');
45 45
 
46 46
 		// skip response handling if the request was just a notification request
47
-		if($this->isNotification)
47
+		if ($this->isNotification)
48 48
 			return true;
49 49
 
50 50
 		// decode response
51
-		if(($_response = xmlrpc_decode($_response)) === null)
51
+		if (($_response = xmlrpc_decode($_response)) === null)
52 52
 			throw new TRpcClientResponseException('Empty response received');
53 53
 
54 54
 		// handle error response
55
-		if(xmlrpc_is_fault($_response))
55
+		if (xmlrpc_is_fault($_response))
56 56
 			throw new TRpcClientResponseException($_response['faultString'], $_response['faultCode']);
57 57
 
58 58
 		return $_response;
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,16 +44,19 @@
 block discarded – undo
44 44
 		$_response = $this->performRequest($this->getServerUrl(), $this->encodeRequest($method, $parameters), 'text/xml');
45 45
 
46 46
 		// skip response handling if the request was just a notification request
47
-		if($this->isNotification)
48
-			return true;
47
+		if($this->isNotification) {
48
+					return true;
49
+		}
49 50
 
50 51
 		// decode response
51
-		if(($_response = xmlrpc_decode($_response)) === null)
52
-			throw new TRpcClientResponseException('Empty response received');
52
+		if(($_response = xmlrpc_decode($_response)) === null) {
53
+					throw new TRpcClientResponseException('Empty response received');
54
+		}
53 55
 
54 56
 		// handle error response
55
-		if(xmlrpc_is_fault($_response))
56
-			throw new TRpcClientResponseException($_response['faultString'], $_response['faultCode']);
57
+		if(xmlrpc_is_fault($_response)) {
58
+					throw new TRpcClientResponseException($_response['faultString'], $_response['faultCode']);
59
+		}
57 60
 
58 61
 		return $_response;
59 62
 	}
Please login to merge, or discard this patch.
framework/Util/TLogger.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function log($message, $level, $category = 'Uncategorized', $ctl = null)
71 71
 	{
72
-		if($ctl) {
73
-			if($ctl instanceof TControl)
72
+		if ($ctl) {
73
+			if ($ctl instanceof TControl)
74 74
 				$ctl = $ctl->ClientId;
75
-			elseif(!is_string($ctl))
75
+			elseif (!is_string($ctl))
76 76
 				$ctl = null;
77 77
 		} else
78 78
 			$ctl = null;
79
-		$this->_logs[] = [$message,$level,$category,microtime(true),memory_get_usage(),$ctl];
79
+		$this->_logs[] = [$message, $level, $category, microtime(true), memory_get_usage(), $ctl];
80 80
 	}
81 81
 
82 82
 	/**
@@ -118,17 +118,17 @@  discard block
 block discarded – undo
118 118
 		$this->_categories = $categories;
119 119
 		$this->_controls = $controls;
120 120
 		$this->_timestamp = $timestamp;
121
-		if(empty($levels) && empty($categories) && empty($controls) && null === $timestamp)
121
+		if (empty($levels) && empty($categories) && empty($controls) && null === $timestamp)
122 122
 			return $this->_logs;
123 123
 		$logs = $this->_logs;
124
-		if(!empty($levels))
125
-			$logs = array_values(array_filter(array_filter($logs, [$this,'filterByLevels'])));
126
-		if(!empty($categories))
127
-			$logs = array_values(array_filter(array_filter($logs, [$this,'filterByCategories'])));
128
-		if(!empty($controls))
129
-			$logs = array_values(array_filter(array_filter($logs, [$this,'filterByControl'])));
130
-		if(null !== $timestamp)
131
-			$logs = array_values(array_filter(array_filter($logs, [$this,'filterByTimeStamp'])));
124
+		if (!empty($levels))
125
+			$logs = array_values(array_filter(array_filter($logs, [$this, 'filterByLevels'])));
126
+		if (!empty($categories))
127
+			$logs = array_values(array_filter(array_filter($logs, [$this, 'filterByCategories'])));
128
+		if (!empty($controls))
129
+			$logs = array_values(array_filter(array_filter($logs, [$this, 'filterByControl'])));
130
+		if (null !== $timestamp)
131
+			$logs = array_values(array_filter(array_filter($logs, [$this, 'filterByTimeStamp'])));
132 132
 		return $logs;
133 133
 	}
134 134
 
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
 		$this->_categories = $categories;
163 163
 		$this->_controls = $controls;
164 164
 		$this->_timestamp = $timestamp;
165
-		if(empty($levels) && empty($categories) && empty($controls) && null === $timestamp)
165
+		if (empty($levels) && empty($categories) && empty($controls) && null === $timestamp)
166 166
 		{
167 167
 			$this->_logs = [];
168 168
 			return;
169 169
 		}
170 170
 		$logs = $this->_logs;
171
-		if(!empty($levels))
172
-			$logs = array_filter(array_filter($logs, [$this,'filterByLevels']));
173
-		if(!empty($categories))
174
-			$logs = array_filter(array_filter($logs, [$this,'filterByCategories']));
175
-		if(!empty($controls))
176
-			$logs = array_filter(array_filter($logs, [$this,'filterByControl']));
177
-		if(null !== $timestamp)
178
-			$logs = array_filter(array_filter($logs, [$this,'filterByTimeStamp']));
171
+		if (!empty($levels))
172
+			$logs = array_filter(array_filter($logs, [$this, 'filterByLevels']));
173
+		if (!empty($categories))
174
+			$logs = array_filter(array_filter($logs, [$this, 'filterByCategories']));
175
+		if (!empty($controls))
176
+			$logs = array_filter(array_filter($logs, [$this, 'filterByControl']));
177
+		if (null !== $timestamp)
178
+			$logs = array_filter(array_filter($logs, [$this, 'filterByTimeStamp']));
179 179
 		$this->_logs = array_values(array_diff_key($this->_logs, $logs));
180 180
 	}
181 181
 
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	private function filterByCategories($value)
187 187
 	{
188
-		foreach($this->_categories as $category)
188
+		foreach ($this->_categories as $category)
189 189
 		{
190 190
 			// element 2 is the category
191
-			if($value[2] === $category || strpos($value[2], $category . '.') === 0)
191
+			if ($value[2] === $category || strpos($value[2], $category.'.') === 0)
192 192
 				return $value;
193 193
 		}
194 194
 		return false;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	private function filterByLevels($value)
202 202
 	{
203 203
 		// element 1 are the levels
204
-		if($value[1] & $this->_levels)
204
+		if ($value[1] & $this->_levels)
205 205
 			return $value;
206 206
 		else
207 207
 			return false;
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 	private function filterByControl($value)
215 215
 	{
216 216
 		// element 5 are the control client ids
217
-		foreach($this->_controls as $control)
217
+		foreach ($this->_controls as $control)
218 218
 		{
219
-			if($value[5] === $control || strpos($value[5], $control) === 0)
219
+			if ($value[5] === $control || strpos($value[5], $control) === 0)
220 220
 				return $value;
221 221
 		}
222 222
 		return false;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	private function filterByTimeStamp($value)
230 230
 	{
231 231
 		// element 3 is the timestamp
232
-		if($value[3] <= $this->_timestamp)
232
+		if ($value[3] <= $this->_timestamp)
233 233
 			return $value;
234 234
 		else
235 235
 			return false;
Please login to merge, or discard this patch.
Braces   +51 added lines, -36 removed lines patch added patch discarded remove patch
@@ -70,12 +70,14 @@  discard block
 block discarded – undo
70 70
 	public function log($message, $level, $category = 'Uncategorized', $ctl = null)
71 71
 	{
72 72
 		if($ctl) {
73
-			if($ctl instanceof TControl)
74
-				$ctl = $ctl->ClientId;
75
-			elseif(!is_string($ctl))
76
-				$ctl = null;
77
-		} else
78
-			$ctl = null;
73
+			if($ctl instanceof TControl) {
74
+							$ctl = $ctl->ClientId;
75
+			} elseif(!is_string($ctl)) {
76
+							$ctl = null;
77
+			}
78
+		} else {
79
+					$ctl = null;
80
+		}
79 81
 		$this->_logs[] = [$message,$level,$category,microtime(true),memory_get_usage(),$ctl];
80 82
 	}
81 83
 
@@ -118,17 +120,22 @@  discard block
 block discarded – undo
118 120
 		$this->_categories = $categories;
119 121
 		$this->_controls = $controls;
120 122
 		$this->_timestamp = $timestamp;
121
-		if(empty($levels) && empty($categories) && empty($controls) && null === $timestamp)
122
-			return $this->_logs;
123
+		if(empty($levels) && empty($categories) && empty($controls) && null === $timestamp) {
124
+					return $this->_logs;
125
+		}
123 126
 		$logs = $this->_logs;
124
-		if(!empty($levels))
125
-			$logs = array_values(array_filter(array_filter($logs, [$this,'filterByLevels'])));
126
-		if(!empty($categories))
127
-			$logs = array_values(array_filter(array_filter($logs, [$this,'filterByCategories'])));
128
-		if(!empty($controls))
129
-			$logs = array_values(array_filter(array_filter($logs, [$this,'filterByControl'])));
130
-		if(null !== $timestamp)
131
-			$logs = array_values(array_filter(array_filter($logs, [$this,'filterByTimeStamp'])));
127
+		if(!empty($levels)) {
128
+					$logs = array_values(array_filter(array_filter($logs, [$this,'filterByLevels'])));
129
+		}
130
+		if(!empty($categories)) {
131
+					$logs = array_values(array_filter(array_filter($logs, [$this,'filterByCategories'])));
132
+		}
133
+		if(!empty($controls)) {
134
+					$logs = array_values(array_filter(array_filter($logs, [$this,'filterByControl'])));
135
+		}
136
+		if(null !== $timestamp) {
137
+					$logs = array_values(array_filter(array_filter($logs, [$this,'filterByTimeStamp'])));
138
+		}
132 139
 		return $logs;
133 140
 	}
134 141
 
@@ -168,14 +175,18 @@  discard block
 block discarded – undo
168 175
 			return;
169 176
 		}
170 177
 		$logs = $this->_logs;
171
-		if(!empty($levels))
172
-			$logs = array_filter(array_filter($logs, [$this,'filterByLevels']));
173
-		if(!empty($categories))
174
-			$logs = array_filter(array_filter($logs, [$this,'filterByCategories']));
175
-		if(!empty($controls))
176
-			$logs = array_filter(array_filter($logs, [$this,'filterByControl']));
177
-		if(null !== $timestamp)
178
-			$logs = array_filter(array_filter($logs, [$this,'filterByTimeStamp']));
178
+		if(!empty($levels)) {
179
+					$logs = array_filter(array_filter($logs, [$this,'filterByLevels']));
180
+		}
181
+		if(!empty($categories)) {
182
+					$logs = array_filter(array_filter($logs, [$this,'filterByCategories']));
183
+		}
184
+		if(!empty($controls)) {
185
+					$logs = array_filter(array_filter($logs, [$this,'filterByControl']));
186
+		}
187
+		if(null !== $timestamp) {
188
+					$logs = array_filter(array_filter($logs, [$this,'filterByTimeStamp']));
189
+		}
179 190
 		$this->_logs = array_values(array_diff_key($this->_logs, $logs));
180 191
 	}
181 192
 
@@ -188,8 +199,9 @@  discard block
 block discarded – undo
188 199
 		foreach($this->_categories as $category)
189 200
 		{
190 201
 			// element 2 is the category
191
-			if($value[2] === $category || strpos($value[2], $category . '.') === 0)
192
-				return $value;
202
+			if($value[2] === $category || strpos($value[2], $category . '.') === 0) {
203
+							return $value;
204
+			}
193 205
 		}
194 206
 		return false;
195 207
 	}
@@ -201,10 +213,11 @@  discard block
 block discarded – undo
201 213
 	private function filterByLevels($value)
202 214
 	{
203 215
 		// element 1 are the levels
204
-		if($value[1] & $this->_levels)
205
-			return $value;
206
-		else
207
-			return false;
216
+		if($value[1] & $this->_levels) {
217
+					return $value;
218
+		} else {
219
+					return false;
220
+		}
208 221
 	}
209 222
 
210 223
 	/**
@@ -216,8 +229,9 @@  discard block
 block discarded – undo
216 229
 		// element 5 are the control client ids
217 230
 		foreach($this->_controls as $control)
218 231
 		{
219
-			if($value[5] === $control || strpos($value[5], $control) === 0)
220
-				return $value;
232
+			if($value[5] === $control || strpos($value[5], $control) === 0) {
233
+							return $value;
234
+			}
221 235
 		}
222 236
 		return false;
223 237
 	}
@@ -229,10 +243,11 @@  discard block
 block discarded – undo
229 243
 	private function filterByTimeStamp($value)
230 244
 	{
231 245
 		// element 3 is the timestamp
232
-		if($value[3] <= $this->_timestamp)
233
-			return $value;
234
-		else
235
-			return false;
246
+		if($value[3] <= $this->_timestamp) {
247
+					return $value;
248
+		} else {
249
+					return false;
250
+		}
236 251
 	}
237 252
 }
238 253
 
Please login to merge, or discard this patch.
framework/Util/TSimpleDateFormatter.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -127,31 +127,31 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function getMonthPattern()
129 129
 	{
130
-		if(is_int(strpos($this->pattern, 'MMMM')))
130
+		if (is_int(strpos($this->pattern, 'MMMM')))
131 131
 			return 'MMMM';
132
-		if(is_int(strpos($this->pattern, 'MMM')))
132
+		if (is_int(strpos($this->pattern, 'MMM')))
133 133
 			return 'MMM';
134
-		if(is_int(strpos($this->pattern, 'MM')))
134
+		if (is_int(strpos($this->pattern, 'MM')))
135 135
 			return 'MM';
136
-		if(is_int(strpos($this->pattern, 'M')))
136
+		if (is_int(strpos($this->pattern, 'M')))
137 137
 			return 'M';
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	public function getDayPattern()
142 142
 	{
143
-		if(is_int(strpos($this->pattern, 'dd')))
143
+		if (is_int(strpos($this->pattern, 'dd')))
144 144
 			return 'dd';
145
-		if(is_int(strpos($this->pattern, 'd')))
145
+		if (is_int(strpos($this->pattern, 'd')))
146 146
 			return 'd';
147 147
 		return false;
148 148
 	}
149 149
 
150 150
 	public function getYearPattern()
151 151
 	{
152
-		if(is_int(strpos($this->pattern, 'yyyy')))
152
+		if (is_int(strpos($this->pattern, 'yyyy')))
153 153
 			return 'yyyy';
154
-		if(is_int(strpos($this->pattern, 'yy')))
154
+		if (is_int(strpos($this->pattern, 'yy')))
155 155
 			return 'yy';
156 156
 		return false;
157 157
 	}
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	public function getDayMonthYearOrdering()
160 160
 	{
161 161
 		$ordering = [];
162
-		if(is_int($day = strpos($this->pattern, 'd')))
162
+		if (is_int($day = strpos($this->pattern, 'd')))
163 163
 			$ordering['day'] = $day;
164
-		if(is_int($month = strpos($this->pattern, 'M')))
164
+		if (is_int($month = strpos($this->pattern, 'M')))
165 165
 			$ordering['month'] = $month;
166
-		if(is_int($year = strpos($this->pattern, 'yy')))
166
+		if (is_int($year = strpos($this->pattern, 'yy')))
167 167
 			$ordering['year'] = $year;
168 168
 		asort($ordering);
169 169
 		return array_keys($ordering);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	private function getDate($value)
178 178
 	{
179
-		if(is_numeric($value))
179
+		if (is_numeric($value))
180 180
 		{
181 181
 			$date = new \DateTime;
182 182
 			$date->setTimeStamp($value);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function isValidDate($value)
193 193
 	{
194
-		if($value === null) {
194
+		if ($value === null) {
195 195
 			return false;
196 196
 		} else {
197 197
 			return $this->parse($value, false) !== null;
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function parse($value, $defaultToCurrentTime = true)
208 208
 	{
209
-		if(is_int($value) || is_float($value))
209
+		if (is_int($value) || is_float($value))
210 210
 			return $value;
211
-		elseif(!is_string($value))
211
+		elseif (!is_string($value))
212 212
 			throw new TInvalidDataValueException('date_to_parse_must_be_string', $value);
213 213
 
214
-		if(empty($this->pattern)) return time();
214
+		if (empty($this->pattern)) return time();
215 215
 
216 216
 		$date = time();
217 217
 
218
-		if($this->length(trim($value)) < 1)
218
+		if ($this->length(trim($value)) < 1)
219 219
 			return $defaultToCurrentTime ? $date : null;
220 220
 
221 221
 		$pattern = $this->pattern;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		$x = null; $y = null;
229 229
 
230 230
 
231
-		if($defaultToCurrentTime)
231
+		if ($defaultToCurrentTime)
232 232
 		{
233 233
 			$year = "{$date['year']}";
234 234
 			$month = $date['mon'];
@@ -253,30 +253,30 @@  discard block
 block discarded – undo
253 253
 
254 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
-				if($year === null)
260
+				if ($year === null)
261 261
 					return null;
262 262
 					//throw new TInvalidDataValueException('Invalid year', $value);
263 263
 				$i_val += strlen($year);
264
-				if(strlen($year) == 2)
264
+				if (strlen($year) == 2)
265 265
 				{
266
-					$iYear = (int)$year;
267
-					if($iYear > 70)
266
+					$iYear = (int) $year;
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
-			elseif($token == 'MM' || $token == 'M')
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;
279
-				if($month === null || $iMonth < 1 || $iMonth > 12)
278
+				$iMonth = (int) $month;
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);
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 			}
285 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;
290
-				if($day === null || $iDay < 1 || $iDay > 31)
289
+				$iDay = (int) $day;
290
+				if ($day === null || $iDay < 1 || $iDay > 31)
291 291
 					return null;
292 292
 					//throw new TInvalidDataValueException('Invalid day', $value);
293 293
 				$i_val += strlen($day);
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			}
296 296
 			else
297 297
 			{
298
-				if($this->substring($value, $i_val, $this->length($token)) != $token)
298
+				if ($this->substring($value, $i_val, $this->length($token)) != $token)
299 299
 					return null;
300 300
 					//throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value);
301 301
 				else
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
 		if ($i_val != $this->length($value))
306 306
 			return null;
307 307
 			//throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value);
308
-		if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null))
308
+		if (!$defaultToCurrentTime && ($month === null || $day === null || $year === null))
309 309
 			return null;
310 310
 		else
311 311
 		{
312
-			if(empty($year)) {
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);
Please login to merge, or discard this patch.
Braces   +80 added lines, -60 removed lines patch added patch discarded remove patch
@@ -127,44 +127,55 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function getMonthPattern()
129 129
 	{
130
-		if(is_int(strpos($this->pattern, 'MMMM')))
131
-			return 'MMMM';
132
-		if(is_int(strpos($this->pattern, 'MMM')))
133
-			return 'MMM';
134
-		if(is_int(strpos($this->pattern, 'MM')))
135
-			return 'MM';
136
-		if(is_int(strpos($this->pattern, 'M')))
137
-			return 'M';
130
+		if(is_int(strpos($this->pattern, 'MMMM'))) {
131
+					return 'MMMM';
132
+		}
133
+		if(is_int(strpos($this->pattern, 'MMM'))) {
134
+					return 'MMM';
135
+		}
136
+		if(is_int(strpos($this->pattern, 'MM'))) {
137
+					return 'MM';
138
+		}
139
+		if(is_int(strpos($this->pattern, 'M'))) {
140
+					return 'M';
141
+		}
138 142
 		return false;
139 143
 	}
140 144
 
141 145
 	public function getDayPattern()
142 146
 	{
143
-		if(is_int(strpos($this->pattern, 'dd')))
144
-			return 'dd';
145
-		if(is_int(strpos($this->pattern, 'd')))
146
-			return 'd';
147
+		if(is_int(strpos($this->pattern, 'dd'))) {
148
+					return 'dd';
149
+		}
150
+		if(is_int(strpos($this->pattern, 'd'))) {
151
+					return 'd';
152
+		}
147 153
 		return false;
148 154
 	}
149 155
 
150 156
 	public function getYearPattern()
151 157
 	{
152
-		if(is_int(strpos($this->pattern, 'yyyy')))
153
-			return 'yyyy';
154
-		if(is_int(strpos($this->pattern, 'yy')))
155
-			return 'yy';
158
+		if(is_int(strpos($this->pattern, 'yyyy'))) {
159
+					return 'yyyy';
160
+		}
161
+		if(is_int(strpos($this->pattern, 'yy'))) {
162
+					return 'yy';
163
+		}
156 164
 		return false;
157 165
 	}
158 166
 
159 167
 	public function getDayMonthYearOrdering()
160 168
 	{
161 169
 		$ordering = [];
162
-		if(is_int($day = strpos($this->pattern, 'd')))
163
-			$ordering['day'] = $day;
164
-		if(is_int($month = strpos($this->pattern, 'M')))
165
-			$ordering['month'] = $month;
166
-		if(is_int($year = strpos($this->pattern, 'yy')))
167
-			$ordering['year'] = $year;
170
+		if(is_int($day = strpos($this->pattern, 'd'))) {
171
+					$ordering['day'] = $day;
172
+		}
173
+		if(is_int($month = strpos($this->pattern, 'M'))) {
174
+					$ordering['month'] = $month;
175
+		}
176
+		if(is_int($year = strpos($this->pattern, 'yy'))) {
177
+					$ordering['year'] = $year;
178
+		}
168 179
 		asort($ordering);
169 180
 		return array_keys($ordering);
170 181
 	}
@@ -206,17 +217,21 @@  discard block
 block discarded – undo
206 217
 	 */
207 218
 	public function parse($value, $defaultToCurrentTime = true)
208 219
 	{
209
-		if(is_int($value) || is_float($value))
210
-			return $value;
211
-		elseif(!is_string($value))
212
-			throw new TInvalidDataValueException('date_to_parse_must_be_string', $value);
220
+		if(is_int($value) || is_float($value)) {
221
+					return $value;
222
+		} elseif(!is_string($value)) {
223
+					throw new TInvalidDataValueException('date_to_parse_must_be_string', $value);
224
+		}
213 225
 
214
-		if(empty($this->pattern)) return time();
226
+		if(empty($this->pattern)) {
227
+			return time();
228
+		}
215 229
 
216 230
 		$date = time();
217 231
 
218
-		if($this->length(trim($value)) < 1)
219
-			return $defaultToCurrentTime ? $date : null;
232
+		if($this->length(trim($value)) < 1) {
233
+					return $defaultToCurrentTime ? $date : null;
234
+		}
220 235
 
221 236
 		$pattern = $this->pattern;
222 237
 
@@ -233,8 +248,7 @@  discard block
 block discarded – undo
233 248
 			$year = "{$date['year']}";
234 249
 			$month = $date['mon'];
235 250
 			$day = $date['mday'];
236
-		}
237
-		else
251
+		} else
238 252
 		{
239 253
 			$year = null;
240 254
 			$month = null;
@@ -257,57 +271,61 @@  discard block
 block discarded – undo
257 271
 				if ($token == 'yy')   { $x = 2;$y = 2; }
258 272
 				if ($token == 'y')    { $x = 2;$y = 4; }
259 273
 				$year = $this->getInteger($value, $i_val, $x, $y);
260
-				if($year === null)
261
-					return null;
274
+				if($year === null) {
275
+									return null;
276
+				}
262 277
 					//throw new TInvalidDataValueException('Invalid year', $value);
263 278
 				$i_val += strlen($year);
264 279
 				if(strlen($year) == 2)
265 280
 				{
266 281
 					$iYear = (int)$year;
267
-					if($iYear > 70)
268
-						$year = $iYear + 1900;
269
-					else
270
-						$year = $iYear + 2000;
282
+					if($iYear > 70) {
283
+											$year = $iYear + 1900;
284
+					} else {
285
+											$year = $iYear + 2000;
286
+					}
271 287
 				}
272 288
 				$year = (int)$year;
273
-			}
274
-			elseif($token == 'MM' || $token == 'M')
289
+			} elseif($token == 'MM' || $token == 'M')
275 290
 			{
276 291
 				$month = $this->getInteger($value,$i_val,
277 292
 									$this->length($token), 2);
278 293
 				$iMonth = (int)$month;
279
-				if($month === null || $iMonth < 1 || $iMonth > 12)
280
-					return null;
294
+				if($month === null || $iMonth < 1 || $iMonth > 12) {
295
+									return null;
296
+				}
281 297
 					//throw new TInvalidDataValueException('Invalid month', $value);
282 298
 				$i_val += strlen($month);
283 299
 				$month = $iMonth;
284
-			}
285
-			elseif ($token == 'dd' || $token == 'd')
300
+			} elseif ($token == 'dd' || $token == 'd')
286 301
 			{
287 302
 				$day = $this->getInteger($value,$i_val,
288 303
 									$this->length($token), 2);
289 304
 				$iDay = (int)$day;
290
-				if($day === null || $iDay < 1 || $iDay > 31)
291
-					return null;
305
+				if($day === null || $iDay < 1 || $iDay > 31) {
306
+									return null;
307
+				}
292 308
 					//throw new TInvalidDataValueException('Invalid day', $value);
293 309
 				$i_val += strlen($day);
294 310
 				$day = $iDay;
295
-			}
296
-			else
311
+			} else
297 312
 			{
298
-				if($this->substring($value, $i_val, $this->length($token)) != $token)
299
-					return null;
313
+				if($this->substring($value, $i_val, $this->length($token)) != $token) {
314
+									return null;
315
+				}
300 316
 					//throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value);
301
-				else
302
-					$i_val += $this->length($token);
317
+				else {
318
+									$i_val += $this->length($token);
319
+				}
303 320
 			}
304 321
 		}
305
-		if ($i_val != $this->length($value))
306
-			return null;
322
+		if ($i_val != $this->length($value)) {
323
+					return null;
324
+		}
307 325
 			//throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value);
308
-		if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null))
309
-			return null;
310
-		else
326
+		if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null)) {
327
+					return null;
328
+		} else
311 329
 		{
312 330
 			if(empty($year)) {
313 331
 				$year = date('Y');
@@ -369,10 +387,12 @@  discard block
 block discarded – undo
369 387
 		for ($x = $maxlength; $x >= $minlength; $x--)
370 388
 		{
371 389
 			$token = $this->substring($str, $i, $x);
372
-			if ($this->length($token) < $minlength)
373
-				return null;
374
-			if (preg_match('/^\d+$/', $token))
375
-				return $token;
390
+			if ($this->length($token) < $minlength) {
391
+							return null;
392
+			}
393
+			if (preg_match('/^\d+$/', $token)) {
394
+							return $token;
395
+			}
376 396
 		}
377 397
 		return null;
378 398
 	}
Please login to merge, or discard this patch.
framework/Util/TFirePhpLogRoute.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function processLogs($logs)
38 38
 	{
39
-		if(empty($logs) || $this->getApplication()->getMode() === 'Performance')
39
+		if (empty($logs) || $this->getApplication()->getMode() === 'Performance')
40 40
 			return;
41 41
 
42
-		if(headers_sent()) {
42
+		if (headers_sent()) {
43 43
 			echo '
44 44
 				<div style="width:100%; background-color:darkred; color:#FFF; padding:2px">
45
-					TFirePhpLogRoute.GroupLabel "<i>' . $this -> getGroupLabel() . '</i>" -
45
+					TFirePhpLogRoute.GroupLabel "<i>' . $this -> getGroupLabel().'</i>" -
46 46
 					Routing to FirePHP impossible, because headers already sent!
47 47
 				</div>
48 48
 			';
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 		$first = $logs[0][3];
60 60
 		$c = count($logs);
61
-		for($i = 0,$n = $c;$i < $n;++$i)
61
+		for ($i = 0, $n = $c; $i < $n; ++$i)
62 62
 		{
63 63
 			$message = $logs[$i][0];
64 64
 			$level = $logs[$i][1];
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	protected static function translateLogLevel($level)
91 91
 	{
92
-		switch($level)
92
+		switch ($level)
93 93
 		{
94 94
 			case TLogger::INFO:
95 95
 				return FirePHP::INFO;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function getGroupLabel()
114 114
 	{
115
-		if($this->_groupLabel === null)
115
+		if ($this->_groupLabel === null)
116 116
 			$this->_groupLabel = self::DEFAULT_LABEL;
117 117
 
118 118
 		return $this->_groupLabel;
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function processLogs($logs)
38 38
 	{
39
-		if(empty($logs) || $this->getApplication()->getMode() === 'Performance')
40
-			return;
39
+		if(empty($logs) || $this->getApplication()->getMode() === 'Performance') {
40
+					return;
41
+		}
41 42
 
42 43
 		if(headers_sent()) {
43 44
 			echo '
@@ -68,8 +69,7 @@  discard block
 block discarded – undo
68 69
 			{
69 70
 				$delta = $logs[$i + 1][3] - $logs[$i][3];
70 71
 				$total = $logs[$i + 1][3] - $first;
71
-			}
72
-			else
72
+			} else
73 73
 			{
74 74
 				$delta = '?';
75 75
 				$total = $logs[$i][3] - $first;
@@ -112,8 +112,9 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function getGroupLabel()
114 114
 	{
115
-		if($this->_groupLabel === null)
116
-			$this->_groupLabel = self::DEFAULT_LABEL;
115
+		if($this->_groupLabel === null) {
116
+					$this->_groupLabel = self::DEFAULT_LABEL;
117
+		}
117 118
 
118 119
 		return $this->_groupLabel;
119 120
 	}
Please login to merge, or discard this patch.
framework/Util/TBrowserLogRoute.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function processLogs($logs)
34 34
 	{
35
-		if(empty($logs) || $this->getApplication()->getMode() === 'Performance') return;
35
+		if (empty($logs) || $this->getApplication()->getMode() === 'Performance') return;
36 36
 		$first = $logs[0][3];
37 37
 		$even = true;
38 38
 		$response = $this->getApplication()->getResponse();
39 39
 		$response->write($this->renderHeader());
40
-		for($i = 0,$n = count($logs);$i < $n;++$i)
40
+		for ($i = 0, $n = count($logs); $i < $n; ++$i)
41 41
 		{
42 42
 			if ($i < $n - 1)
43 43
 			{
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	protected function renderHeader()
75 75
 	{
76 76
 		$string = '';
77
-		if($className = $this->getCssClass())
77
+		if ($className = $this->getCssClass())
78 78
 		{
79 79
 			$string = <<<EOD
80 80
 <table class="$className">
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		$delta = sprintf('%0.6f', $info['delta']);
113 113
 		$msg = preg_replace('/\(line[^\)]+\)$/', '', $log[0]); //remove line number info
114 114
 		$msg = THttpUtility::htmlEncode($msg);
115
-		if($this->getCssClass())
115
+		if ($this->getCssClass())
116 116
 		{
117 117
 			$colorCssClass = $log[1];
118 118
 			$messageCssClass = $info['even'] ? 'even' : 'odd';
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 	protected function getColorLevel($level)
147 147
 	{
148
-		switch($level)
148
+		switch ($level)
149 149
 		{
150 150
 			case TLogger::DEBUG: return 'green';
151 151
 			case TLogger::INFO: return 'black';
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
 	protected function renderFooter()
162 162
 	{
163 163
 		$string = '';
164
-		if($this->getCssClass())
164
+		if ($this->getCssClass())
165 165
 		{
166 166
 			$string .= '<tr class="footer"><td colspan="5">';
167
-			foreach(self::$_levelValues as $name => $level)
167
+			foreach (self::$_levelValues as $name => $level)
168 168
 			{
169
-				$string .= '<span class="level' . $level . '">' . strtoupper($name) . "</span>";
169
+				$string .= '<span class="level'.$level.'">'.strtoupper($name)."</span>";
170 170
 			}
171 171
 		}
172 172
 		else
173 173
 		{
174 174
 			$string .= "<tr><td colspan=\"5\" style=\"text-align:center; background-color:black; border-top: 1px solid #ccc; padding:0.2em;\">";
175
-			foreach(self::$_levelValues as $name => $level)
175
+			foreach (self::$_levelValues as $name => $level)
176 176
 			{
177
-				$string .= "<span style=\"color:white; border:1px solid white; background-color:" . $this->getColorLevel($level);
178
-				$string .= ";margin: 0.5em; padding:0.01em;\">" . strtoupper($name) . "</span>";
177
+				$string .= "<span style=\"color:white; border:1px solid white; background-color:".$this->getColorLevel($level);
178
+				$string .= ";margin: 0.5em; padding:0.01em;\">".strtoupper($name)."</span>";
179 179
 			}
180 180
 		}
181 181
 		$string .= '</td></tr></table>';
Please login to merge, or discard this patch.
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function processLogs($logs)
34 34
 	{
35
-		if(empty($logs) || $this->getApplication()->getMode() === 'Performance') return;
35
+		if(empty($logs) || $this->getApplication()->getMode() === 'Performance') {
36
+			return;
37
+		}
36 38
 		$first = $logs[0][3];
37 39
 		$even = true;
38 40
 		$response = $this->getApplication()->getResponse();
@@ -43,8 +45,7 @@  discard block
 block discarded – undo
43 45
 			{
44 46
 				$timing['delta'] = $logs[$i + 1][3] - $logs[$i][3];
45 47
 				$timing['total'] = $logs[$i + 1][3] - $first;
46
-			}
47
-			else
48
+			} else
48 49
 			{
49 50
 				$timing['delta'] = '?';
50 51
 				$timing['total'] = $logs[$i][3] - $first;
@@ -87,8 +88,7 @@  discard block
 block discarded – undo
87 88
 		<th>Category</th><th>Message</th><th>Time Spent (s)</th><th>Cumulated Time Spent (s)</th>
88 89
 	</tr>
89 90
 EOD;
90
-		}
91
-		else
91
+		} else
92 92
 		{
93 93
 			$string = <<<EOD
94 94
 <table cellspacing="0" cellpadding="2" border="0" width="100%" style="table-layout:auto">
@@ -125,8 +125,7 @@  discard block
 block discarded – undo
125 125
 		<td class="cumulatedtime">{$total}</td>
126 126
 	</tr>
127 127
 EOD;
128
-		}
129
-		else
128
+		} else
130 129
 		{
131 130
 			$bgcolor = $info['even'] ? "#fff" : "#eee";
132 131
 			$color = $this->getColorLevel($log[1]);
@@ -168,8 +167,7 @@  discard block
 block discarded – undo
168 167
 			{
169 168
 				$string .= '<span class="level' . $level . '">' . strtoupper($name) . "</span>";
170 169
 			}
171
-		}
172
-		else
170
+		} else
173 171
 		{
174 172
 			$string .= "<tr><td colspan=\"5\" style=\"text-align:center; background-color:black; border-top: 1px solid #ccc; padding:0.2em;\">";
175 173
 			foreach(self::$_levelValues as $name => $level)
Please login to merge, or discard this patch.
framework/Util/TRpcClient.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public static function create($type, $serverUrl, $isNotification = false)
83 83
 	{
84
-		if(($_handler = constant('TRpcClientTypesEnumerable::' . strtoupper($type))) === null)
84
+		if (($_handler = constant('TRpcClientTypesEnumerable::'.strtoupper($type))) === null)
85 85
 			throw new TApplicationException('rpcclient_unsupported_handler');
86 86
 
87 87
 		return new $_handler($serverUrl, $isNotification);
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	protected function performRequest($serverUrl, $payload, $mimeType)
113 113
 	{
114
-		if(($_response = @file_get_contents($serverUrl, false, $this->createStreamContext($payload, $mimeType))) === false)
115
-			throw new TRpcClientRequestException('Request failed ("' . $http_response_header[0] . '")');
114
+		if (($_response = @file_get_contents($serverUrl, false, $this->createStreamContext($payload, $mimeType))) === false)
115
+			throw new TRpcClientRequestException('Request failed ("'.$http_response_header[0].'")');
116 116
 
117 117
 		return $_response;
118 118
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public static function create($type, $serverUrl, $isNotification = false)
83 83
 	{
84
-		if(($_handler = constant('TRpcClientTypesEnumerable::' . strtoupper($type))) === null)
85
-			throw new TApplicationException('rpcclient_unsupported_handler');
84
+		if(($_handler = constant('TRpcClientTypesEnumerable::' . strtoupper($type))) === null) {
85
+					throw new TApplicationException('rpcclient_unsupported_handler');
86
+		}
86 87
 
87 88
 		return new $_handler($serverUrl, $isNotification);
88 89
 	}
@@ -111,8 +112,9 @@  discard block
 block discarded – undo
111 112
 	 */
112 113
 	protected function performRequest($serverUrl, $payload, $mimeType)
113 114
 	{
114
-		if(($_response = @file_get_contents($serverUrl, false, $this->createStreamContext($payload, $mimeType))) === false)
115
-			throw new TRpcClientRequestException('Request failed ("' . $http_response_header[0] . '")');
115
+		if(($_response = @file_get_contents($serverUrl, false, $this->createStreamContext($payload, $mimeType))) === false) {
116
+					throw new TRpcClientRequestException('Request failed ("' . $http_response_header[0] . '")');
117
+		}
116 118
 
117 119
 		return $_response;
118 120
 	}
Please login to merge, or discard this patch.