Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Web/Services/TJsonService.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	protected function loadJsonServices($config)
82 82
 	{
83
-		if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
83
+		if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
84 84
 		{
85
-			if(is_array($config))
85
+			if (is_array($config))
86 86
 			{
87
-				foreach($config['json'] as $id => $json)
87
+				foreach ($config['json'] as $id => $json)
88 88
 					$this->_services[$id] = $json;
89 89
 			}
90 90
 		}
91 91
 		else
92 92
 		{
93
-			foreach($config->getElementsByTagName('json') as $json)
93
+			foreach ($config->getElementsByTagName('json') as $json)
94 94
 			{
95
-				if(($id = $json->getAttribute('id')) !== null)
95
+				if (($id = $json->getAttribute('id')) !== null)
96 96
 					$this->_services[$id] = $json;
97 97
 				else
98 98
 					throw new TConfigurationException('jsonservice_id_required');
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 	public function run()
108 108
 	{
109 109
 		$id = $this->getRequest()->getServiceParameter();
110
-		if(isset($this->_services[$id]))
110
+		if (isset($this->_services[$id]))
111 111
 		{
112 112
 			$serviceConfig = $this->_services[$id];
113
-			if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
113
+			if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
114 114
 			{
115
-				if(isset($serviceConfig['class']))
115
+				if (isset($serviceConfig['class']))
116 116
 				{
117 117
 					$service = Prado::createComponent($serviceConfig['class']);
118
-					if($service instanceof TJsonResponse)
118
+					if ($service instanceof TJsonResponse)
119 119
 					{
120
-						$properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:[];
120
+						$properties = isset($serviceConfig['properties']) ? $serviceConfig['properties'] : [];
121 121
 						$this->createJsonResponse($service, $properties, $serviceConfig);
122 122
 					}
123 123
 					else
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 			else
130 130
 			{
131 131
 				$properties = $serviceConfig->getAttributes();
132
-				if(($class = $properties->remove('class')) !== null)
132
+				if (($class = $properties->remove('class')) !== null)
133 133
 				{
134 134
 					$service = Prado::createComponent($class);
135
-					if($service instanceof TJsonResponse)
135
+					if ($service instanceof TJsonResponse)
136 136
 						$this->createJsonResponse($service, $properties, $serviceConfig);
137 137
 					else
138 138
 						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 	protected function createJsonResponse($service, $properties, $config)
153 153
 	{
154 154
 		// init service properties
155
-		foreach($properties as $name => $value)
155
+		foreach ($properties as $name => $value)
156 156
 			$service->setSubproperty($name, $value);
157 157
 		$service->init($config);
158 158
 
159 159
 		//send content if not null
160
-		if(($content = $service->getJsonContent()) !== null)
160
+		if (($content = $service->getJsonContent()) !== null)
161 161
 		{
162 162
 			$response = $this->getResponse();
163 163
 			$response->setContentType('application/json');
Please login to merge, or discard this patch.
Braces   +26 added lines, -24 removed lines patch added patch discarded remove patch
@@ -84,18 +84,19 @@  discard block
 block discarded – undo
84 84
 		{
85 85
 			if(is_array($config))
86 86
 			{
87
-				foreach($config['json'] as $id => $json)
88
-					$this->_services[$id] = $json;
87
+				foreach($config['json'] as $id => $json) {
88
+									$this->_services[$id] = $json;
89
+				}
89 90
 			}
90
-		}
91
-		else
91
+		} else
92 92
 		{
93 93
 			foreach($config->getElementsByTagName('json') as $json)
94 94
 			{
95
-				if(($id = $json->getAttribute('id')) !== null)
96
-					$this->_services[$id] = $json;
97
-				else
98
-					throw new TConfigurationException('jsonservice_id_required');
95
+				if(($id = $json->getAttribute('id')) !== null) {
96
+									$this->_services[$id] = $json;
97
+				} else {
98
+									throw new TConfigurationException('jsonservice_id_required');
99
+				}
99 100
 			}
100 101
 		}
101 102
 	}
@@ -119,30 +120,30 @@  discard block
 block discarded – undo
119 120
 					{
120 121
 						$properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:[];
121 122
 						$this->createJsonResponse($service, $properties, $serviceConfig);
123
+					} else {
124
+											throw new TConfigurationException('jsonservice_response_type_invalid', $id);
122 125
 					}
123
-					else
124
-						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
126
+				} else {
127
+									throw new TConfigurationException('jsonservice_class_required', $id);
125 128
 				}
126
-				else
127
-					throw new TConfigurationException('jsonservice_class_required', $id);
128
-			}
129
-			else
129
+			} else
130 130
 			{
131 131
 				$properties = $serviceConfig->getAttributes();
132 132
 				if(($class = $properties->remove('class')) !== null)
133 133
 				{
134 134
 					$service = Prado::createComponent($class);
135
-					if($service instanceof TJsonResponse)
136
-						$this->createJsonResponse($service, $properties, $serviceConfig);
137
-					else
138
-						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
135
+					if($service instanceof TJsonResponse) {
136
+											$this->createJsonResponse($service, $properties, $serviceConfig);
137
+					} else {
138
+											throw new TConfigurationException('jsonservice_response_type_invalid', $id);
139
+					}
140
+				} else {
141
+									throw new TConfigurationException('jsonservice_class_required', $id);
139 142
 				}
140
-				else
141
-					throw new TConfigurationException('jsonservice_class_required', $id);
142 143
 			}
144
+		} else {
145
+					throw new THttpException(404, 'jsonservice_provider_unknown', $id);
143 146
 		}
144
-		else
145
-			throw new THttpException(404, 'jsonservice_provider_unknown', $id);
146 147
 	}
147 148
 
148 149
 	/**
@@ -152,8 +153,9 @@  discard block
 block discarded – undo
152 153
 	protected function createJsonResponse($service, $properties, $config)
153 154
 	{
154 155
 		// init service properties
155
-		foreach($properties as $name => $value)
156
-			$service->setSubproperty($name, $value);
156
+		foreach($properties as $name => $value) {
157
+					$service->setSubproperty($name, $value);
158
+		}
157 159
 		$service->init($config);
158 160
 
159 161
 		//send content if not null
Please login to merge, or discard this patch.
framework/Web/Services/TSoapServer.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function setID($id)
64 64
 	{
65
-		if(strrpos($this->_id, '.wsdl') === strlen($this->_id) - 5)
65
+		if (strrpos($this->_id, '.wsdl') === strlen($this->_id) - 5)
66 66
 			throw new TInvalidDataValueException('soapserver_id_invalid', $id);
67 67
 		$this->_id = $id;
68 68
 	}
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function run()
74 74
 	{
75
-		if(($provider = $this->getProvider()) !== null)
75
+		if (($provider = $this->getProvider()) !== null)
76 76
 		{
77 77
 			Prado::using($provider);
78
-			$providerClass = ($pos = strrpos($provider, '.')) !== false?substr($provider, $pos + 1):$provider;
78
+			$providerClass = ($pos = strrpos($provider, '.')) !== false ?substr($provider, $pos + 1) : $provider;
79 79
 			$this->guessMethodCallRequested($providerClass);
80 80
 			$server = $this->createServer();
81 81
 			$server->setClass($providerClass, $this);
82
-			if($this->_persistent)
82
+			if ($this->_persistent)
83 83
 				$server->setPersistence(SOAP_PERSISTENCE_SESSION);
84 84
 		}
85 85
 		else
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		}
91 91
 		catch (\Exception $e)
92 92
 		{
93
-			if($this->getApplication()->getMode() === TApplicationMode::Debug)
93
+			if ($this->getApplication()->getMode() === TApplicationMode::Debug)
94 94
 				$this->fault($e->getMessage(), $e->__toString());
95 95
 			else
96 96
 				$this->fault($e->getMessage());
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function fault($title, $details = '', $code = 'SERVER', $actor = '', $name = '')
109 109
 	{
110
-		Prado::trace('SOAP-Fault ' . $code . ' ' . $title . ' : ' . $details, 'Prado\Web\Services\TSoapService');
110
+		Prado::trace('SOAP-Fault '.$code.' '.$title.' : '.$details, 'Prado\Web\Services\TSoapService');
111 111
 		$this->_server->fault($code, $title, $actor, $details, $name);
112 112
 	}
113 113
 
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function guessMethodCallRequested($class)
120 120
 	{
121
-		$namespace = $class . 'wsdl';
121
+		$namespace = $class.'wsdl';
122 122
 		$message = file_get_contents("php://input");
123 123
 		$matches = [];
124
-		if(preg_match('/xmlns:([^=]+)="urn:' . $namespace . '"/', $message, $matches))
124
+		if (preg_match('/xmlns:([^=]+)="urn:'.$namespace.'"/', $message, $matches))
125 125
 		{
126
-			if(preg_match('/<' . $matches[1] . ':([a-zA-Z_]+[a-zA-Z0-9_]+)/', $message, $method))
126
+			if (preg_match('/<'.$matches[1].':([a-zA-Z_]+[a-zA-Z0-9_]+)/', $message, $method))
127 127
 			{
128 128
 				$this->_requestedMethod = $method[1];
129 129
 			}
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	protected function createServer()
147 147
 	{
148
-		if($this->_server === null)
148
+		if ($this->_server === null)
149 149
 		{
150
-			if($this->getApplication()->getMode() === TApplicationMode::Debug)
150
+			if ($this->getApplication()->getMode() === TApplicationMode::Debug)
151 151
 				ini_set("soap.wsdl_cache_enabled", 0);
152 152
 			$this->_server = new \SoapServer($this->getWsdlUri(), $this->getOptions());
153 153
 		}
@@ -160,19 +160,19 @@  discard block
 block discarded – undo
160 160
 	protected function getOptions()
161 161
 	{
162 162
 		$options = [];
163
-		if($this->_version === '1.1')
163
+		if ($this->_version === '1.1')
164 164
 			$options['soap_version'] = SOAP_1_1;
165
-		elseif($this->_version === '1.2')
165
+		elseif ($this->_version === '1.2')
166 166
 			$options['soap_version'] = SOAP_1_2;
167
-		if(!empty($this->_actor))
167
+		if (!empty($this->_actor))
168 168
 			$options['actor'] = $this->_actor;
169
-		if(!empty($this->_encoding))
169
+		if (!empty($this->_encoding))
170 170
 			$options['encoding'] = $this->_encoding;
171
-		if(!empty($this->_uri))
171
+		if (!empty($this->_uri))
172 172
 			$options['uri'] = $this->_uri;
173
-		if(is_string($this->_classMap))
173
+		if (is_string($this->_classMap))
174 174
 		{
175
-			foreach(preg_split('/\s*,\s*/', $this->_classMap) as $className)
175
+			foreach (preg_split('/\s*,\s*/', $this->_classMap) as $className)
176 176
 				$options['classmap'][$className] = $className; //complex type uses the class name in the wsdl
177 177
 		}
178 178
 		return $options;
@@ -187,18 +187,18 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function getWsdl()
189 189
 	{
190
-		if($this->_wsdlUri === '')
190
+		if ($this->_wsdlUri === '')
191 191
 		{
192 192
 			$provider = $this->getProvider();
193
-			$providerClass = ($pos = strrpos($provider, '.')) !== false?substr($provider, $pos + 1):$provider;
193
+			$providerClass = ($pos = strrpos($provider, '.')) !== false ?substr($provider, $pos + 1) : $provider;
194 194
 			Prado::using($provider);
195
-			if($this->getApplication()->getMode() === TApplicationMode::Performance && ($cache = $this->getApplication()->getCache()) !== null)
195
+			if ($this->getApplication()->getMode() === TApplicationMode::Performance && ($cache = $this->getApplication()->getCache()) !== null)
196 196
 			{
197
-				$wsdl = $cache->get(self::WSDL_CACHE_PREFIX . $providerClass);
198
-				if(is_string($wsdl))
197
+				$wsdl = $cache->get(self::WSDL_CACHE_PREFIX.$providerClass);
198
+				if (is_string($wsdl))
199 199
 					return $wsdl;
200 200
 				$wsdl = WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding());
201
-				$cache->set(self::WSDL_CACHE_PREFIX . $providerClass, $wsdl);
201
+				$cache->set(self::WSDL_CACHE_PREFIX.$providerClass, $wsdl);
202 202
 				return $wsdl;
203 203
 			}
204 204
 			else
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function getWsdlUri()
217 217
 	{
218
-		if($this->_wsdlUri === '')
219
-			return $this->getRequest()->getBaseUrl() . $this->getService()->constructUrl($this->getID() . '.wsdl', false);
218
+		if ($this->_wsdlUri === '')
219
+			return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID().'.wsdl', false);
220 220
 		else
221 221
 			return $this->_wsdlUri;
222 222
 	}
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 	 */
235 235
 	public function getUri()
236 236
 	{
237
-		if($this->_uri === '')
238
-			return $this->getRequest()->getBaseUrl() . $this->getService()->constructUrl($this->getID(), false);
237
+		if ($this->_uri === '')
238
+			return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID(), false);
239 239
 		else
240 240
 			return $this->_uri;
241 241
 	}
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function setVersion($value)
280 280
 	{
281
-		if($value === '1.1' || $value === '1.2' || $value === '')
281
+		if ($value === '1.1' || $value === '1.2' || $value === '')
282 282
 			$this->_version = $value;
283 283
 		else
284 284
 			throw new TInvalidDataValueException('soapserver_version_invalid', $value);
Please login to merge, or discard this patch.
Braces   +56 added lines, -44 removed lines patch added patch discarded remove patch
@@ -62,8 +62,9 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function setID($id)
64 64
 	{
65
-		if(strrpos($this->_id, '.wsdl') === strlen($this->_id) - 5)
66
-			throw new TInvalidDataValueException('soapserver_id_invalid', $id);
65
+		if(strrpos($this->_id, '.wsdl') === strlen($this->_id) - 5) {
66
+					throw new TInvalidDataValueException('soapserver_id_invalid', $id);
67
+		}
67 68
 		$this->_id = $id;
68 69
 	}
69 70
 
@@ -79,21 +80,22 @@  discard block
 block discarded – undo
79 80
 			$this->guessMethodCallRequested($providerClass);
80 81
 			$server = $this->createServer();
81 82
 			$server->setClass($providerClass, $this);
82
-			if($this->_persistent)
83
-				$server->setPersistence(SOAP_PERSISTENCE_SESSION);
83
+			if($this->_persistent) {
84
+							$server->setPersistence(SOAP_PERSISTENCE_SESSION);
85
+			}
86
+		} else {
87
+					$server = $this->createServer();
84 88
 		}
85
-		else
86
-			$server = $this->createServer();
87 89
 		try
88 90
 		{
89 91
 			$server->handle();
90
-		}
91
-		catch (\Exception $e)
92
+		} catch (\Exception $e)
92 93
 		{
93
-			if($this->getApplication()->getMode() === TApplicationMode::Debug)
94
-				$this->fault($e->getMessage(), $e->__toString());
95
-			else
96
-				$this->fault($e->getMessage());
94
+			if($this->getApplication()->getMode() === TApplicationMode::Debug) {
95
+							$this->fault($e->getMessage(), $e->__toString());
96
+			} else {
97
+							$this->fault($e->getMessage());
98
+			}
97 99
 		}
98 100
 	}
99 101
 
@@ -147,8 +149,9 @@  discard block
 block discarded – undo
147 149
 	{
148 150
 		if($this->_server === null)
149 151
 		{
150
-			if($this->getApplication()->getMode() === TApplicationMode::Debug)
151
-				ini_set("soap.wsdl_cache_enabled", 0);
152
+			if($this->getApplication()->getMode() === TApplicationMode::Debug) {
153
+							ini_set("soap.wsdl_cache_enabled", 0);
154
+			}
152 155
 			$this->_server = new \SoapServer($this->getWsdlUri(), $this->getOptions());
153 156
 		}
154 157
 		return $this->_server;
@@ -160,20 +163,26 @@  discard block
 block discarded – undo
160 163
 	protected function getOptions()
161 164
 	{
162 165
 		$options = [];
163
-		if($this->_version === '1.1')
164
-			$options['soap_version'] = SOAP_1_1;
165
-		elseif($this->_version === '1.2')
166
-			$options['soap_version'] = SOAP_1_2;
167
-		if(!empty($this->_actor))
168
-			$options['actor'] = $this->_actor;
169
-		if(!empty($this->_encoding))
170
-			$options['encoding'] = $this->_encoding;
171
-		if(!empty($this->_uri))
172
-			$options['uri'] = $this->_uri;
166
+		if($this->_version === '1.1') {
167
+					$options['soap_version'] = SOAP_1_1;
168
+		} elseif($this->_version === '1.2') {
169
+					$options['soap_version'] = SOAP_1_2;
170
+		}
171
+		if(!empty($this->_actor)) {
172
+					$options['actor'] = $this->_actor;
173
+		}
174
+		if(!empty($this->_encoding)) {
175
+					$options['encoding'] = $this->_encoding;
176
+		}
177
+		if(!empty($this->_uri)) {
178
+					$options['uri'] = $this->_uri;
179
+		}
173 180
 		if(is_string($this->_classMap))
174 181
 		{
175
-			foreach(preg_split('/\s*,\s*/', $this->_classMap) as $className)
176
-				$options['classmap'][$className] = $className; //complex type uses the class name in the wsdl
182
+			foreach(preg_split('/\s*,\s*/', $this->_classMap) as $className) {
183
+							$options['classmap'][$className] = $className;
184
+			}
185
+			//complex type uses the class name in the wsdl
177 186
 		}
178 187
 		return $options;
179 188
 	}
@@ -195,19 +204,19 @@  discard block
 block discarded – undo
195 204
 			if($this->getApplication()->getMode() === TApplicationMode::Performance && ($cache = $this->getApplication()->getCache()) !== null)
196 205
 			{
197 206
 				$wsdl = $cache->get(self::WSDL_CACHE_PREFIX . $providerClass);
198
-				if(is_string($wsdl))
199
-					return $wsdl;
207
+				if(is_string($wsdl)) {
208
+									return $wsdl;
209
+				}
200 210
 				$wsdl = WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding());
201 211
 				$cache->set(self::WSDL_CACHE_PREFIX . $providerClass, $wsdl);
202 212
 				return $wsdl;
203
-			}
204
-			else
213
+			} else
205 214
 			{
206 215
 				return WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding());
207 216
 			}
217
+		} else {
218
+					return file_get_contents($this->_wsdlUri);
208 219
 		}
209
-		else
210
-			return file_get_contents($this->_wsdlUri);
211 220
 	}
212 221
 
213 222
 	/**
@@ -215,10 +224,11 @@  discard block
 block discarded – undo
215 224
 	 */
216 225
 	public function getWsdlUri()
217 226
 	{
218
-		if($this->_wsdlUri === '')
219
-			return $this->getRequest()->getBaseUrl() . $this->getService()->constructUrl($this->getID() . '.wsdl', false);
220
-		else
221
-			return $this->_wsdlUri;
227
+		if($this->_wsdlUri === '') {
228
+					return $this->getRequest()->getBaseUrl() . $this->getService()->constructUrl($this->getID() . '.wsdl', false);
229
+		} else {
230
+					return $this->_wsdlUri;
231
+		}
222 232
 	}
223 233
 
224 234
 	/**
@@ -234,10 +244,11 @@  discard block
 block discarded – undo
234 244
 	 */
235 245
 	public function getUri()
236 246
 	{
237
-		if($this->_uri === '')
238
-			return $this->getRequest()->getBaseUrl() . $this->getService()->constructUrl($this->getID(), false);
239
-		else
240
-			return $this->_uri;
247
+		if($this->_uri === '') {
248
+					return $this->getRequest()->getBaseUrl() . $this->getService()->constructUrl($this->getID(), false);
249
+		} else {
250
+					return $this->_uri;
251
+		}
241 252
 	}
242 253
 
243 254
 	/**
@@ -278,10 +289,11 @@  discard block
 block discarded – undo
278 289
 	 */
279 290
 	public function setVersion($value)
280 291
 	{
281
-		if($value === '1.1' || $value === '1.2' || $value === '')
282
-			$this->_version = $value;
283
-		else
284
-			throw new TInvalidDataValueException('soapserver_version_invalid', $value);
292
+		if($value === '1.1' || $value === '1.2' || $value === '') {
293
+					$this->_version = $value;
294
+		} else {
295
+					throw new TInvalidDataValueException('soapserver_version_invalid', $value);
296
+		}
285 297
 	}
286 298
 
287 299
 	/**
Please login to merge, or discard this patch.
framework/Web/Javascripts/TJavaScript.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	public static function renderScriptFiles($files)
35 35
 	{
36 36
 		$str = '';
37
-		foreach($files as $file)
37
+		foreach ($files as $file)
38 38
 			$str .= self::renderScriptFile($file);
39 39
 		return $str;
40 40
 	}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public static function renderScriptFile($file)
48 48
 	{
49
-		return '<script type="text/javascript" src="' . THttpUtility::htmlEncode($file) . "\"></script>\n";
49
+		return '<script type="text/javascript" src="'.THttpUtility::htmlEncode($file)."\"></script>\n";
50 50
 	}
51 51
 
52 52
 	/**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public static function renderScriptBlocks($scripts)
58 58
 	{
59
-		if(count($scripts))
60
-			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n" . implode("\n", $scripts) . "\n/*]]>*/\n</script>\n";
59
+		if (count($scripts))
60
+			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n", $scripts)."\n/*]]>*/\n</script>\n";
61 61
 		else
62 62
 			return '';
63 63
 	}
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function renderScriptBlocksCallback($scripts)
71 71
 	{
72
-		if(count($scripts))
73
-			return implode("\n", $scripts) . "\n";
72
+		if (count($scripts))
73
+			return implode("\n", $scripts)."\n";
74 74
 		else
75 75
 			return '';
76 76
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public static function quoteJsLiteral($js)
105 105
 	{
106
-		if($js instanceof TJavaScriptLiteral)
106
+		if ($js instanceof TJavaScriptLiteral)
107 107
 			return $js;
108 108
 		else
109 109
 			return new TJavaScriptLiteral($js);
@@ -141,45 +141,45 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public static function encode($value, $toMap = true, $encodeEmptyStrings = false)
143 143
 	{
144
-		if(is_string($value))
144
+		if (is_string($value))
145 145
 			return self::quoteString($value);
146
-		elseif(is_bool($value))
147
-			return $value?'true':'false';
148
-		elseif(is_array($value))
146
+		elseif (is_bool($value))
147
+			return $value ? 'true' : 'false';
148
+		elseif (is_array($value))
149 149
 		{
150 150
 			$results = '';
151
-			if(($n = count($value)) > 0 && array_keys($value) !== range(0, $n - 1))
151
+			if (($n = count($value)) > 0 && array_keys($value) !== range(0, $n - 1))
152 152
 			{
153
-				foreach($value as $k => $v)
153
+				foreach ($value as $k => $v)
154 154
 				{
155
-					if($v !== '' || $encodeEmptyStrings)
155
+					if ($v !== '' || $encodeEmptyStrings)
156 156
 					{
157
-						if($results !== '')
157
+						if ($results !== '')
158 158
 							$results .= ',';
159
-						$results .= "'$k':" . self::encode($v, $toMap, $encodeEmptyStrings);
159
+						$results .= "'$k':".self::encode($v, $toMap, $encodeEmptyStrings);
160 160
 					}
161 161
 				}
162
-				return '{' . $results . '}';
162
+				return '{'.$results.'}';
163 163
 			}
164 164
 			else
165 165
 			{
166
-				foreach($value as $v)
166
+				foreach ($value as $v)
167 167
 				{
168
-					if($v !== '' || $encodeEmptyStrings)
168
+					if ($v !== '' || $encodeEmptyStrings)
169 169
 					{
170
-						if($results !== '')
170
+						if ($results !== '')
171 171
 							$results .= ',';
172 172
 						$results .= self::encode($v, $toMap, $encodeEmptyStrings);
173 173
 					}
174 174
 				}
175
-				return '[' . $results . ']';
175
+				return '['.$results.']';
176 176
 			}
177 177
 		}
178
-		elseif(is_int($value))
178
+		elseif (is_int($value))
179 179
 			return "$value";
180
-		elseif(is_float($value))
180
+		elseif (is_float($value))
181 181
 		{
182
-			switch($value)
182
+			switch ($value)
183 183
 			{
184 184
 				case -INF:
185 185
 					return 'Number.NEGATIVE_INFINITY';
@@ -189,19 +189,19 @@  discard block
 block discarded – undo
189 189
 					break;
190 190
 				default:
191 191
 					$locale = localeConv();
192
-					if($locale['decimal_point'] == '.')
192
+					if ($locale['decimal_point'] == '.')
193 193
 						return "$value";
194 194
 					else
195 195
 						return str_replace($locale['decimal_point'], '.', "$value");
196 196
 					break;
197 197
 			}
198 198
 		}
199
-		elseif(is_object($value))
199
+		elseif (is_object($value))
200 200
 			if ($value instanceof TJavaScriptLiteral)
201 201
 				return $value->toJavaScriptLiteral();
202 202
 			else
203 203
 				return self::encode(get_object_vars($value), $toMap);
204
-		elseif($value === null)
204
+		elseif ($value === null)
205 205
 			return 'null';
206 206
 		else
207 207
 			return '';
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	 * @param string $sourceEncoding
231 231
 	 */
232 232
 	private static function convertToUtf8(&$value, $sourceEncoding) {
233
-		if(is_string($value))
233
+		if (is_string($value))
234 234
 			$value = iconv($sourceEncoding, 'UTF-8', $value);
235 235
 		elseif (is_array($value))
236 236
 		{
237
-			foreach($value as &$element)
237
+			foreach ($value as &$element)
238 238
 				self::convertToUtf8($element, $sourceEncoding);
239 239
 		}
240 240
 	}
Please login to merge, or discard this patch.
Braces   +54 added lines, -47 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 	public static function renderScriptFiles($files)
35 35
 	{
36 36
 		$str = '';
37
-		foreach($files as $file)
38
-			$str .= self::renderScriptFile($file);
37
+		foreach($files as $file) {
38
+					$str .= self::renderScriptFile($file);
39
+		}
39 40
 		return $str;
40 41
 	}
41 42
 
@@ -56,10 +57,11 @@  discard block
 block discarded – undo
56 57
 	 */
57 58
 	public static function renderScriptBlocks($scripts)
58 59
 	{
59
-		if(count($scripts))
60
-			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n" . implode("\n", $scripts) . "\n/*]]>*/\n</script>\n";
61
-		else
62
-			return '';
60
+		if(count($scripts)) {
61
+					return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n" . implode("\n", $scripts) . "\n/*]]>*/\n</script>\n";
62
+		} else {
63
+					return '';
64
+		}
63 65
 	}
64 66
 
65 67
 	/**
@@ -69,10 +71,11 @@  discard block
 block discarded – undo
69 71
 	 */
70 72
 	public static function renderScriptBlocksCallback($scripts)
71 73
 	{
72
-		if(count($scripts))
73
-			return implode("\n", $scripts) . "\n";
74
-		else
75
-			return '';
74
+		if(count($scripts)) {
75
+					return implode("\n", $scripts) . "\n";
76
+		} else {
77
+					return '';
78
+		}
76 79
 	}
77 80
 
78 81
 	/**
@@ -103,10 +106,11 @@  discard block
 block discarded – undo
103 106
 	 */
104 107
 	public static function quoteJsLiteral($js)
105 108
 	{
106
-		if($js instanceof TJavaScriptLiteral)
107
-			return $js;
108
-		else
109
-			return new TJavaScriptLiteral($js);
109
+		if($js instanceof TJavaScriptLiteral) {
110
+					return $js;
111
+		} else {
112
+					return new TJavaScriptLiteral($js);
113
+		}
110 114
 	}
111 115
 
112 116
 	/**
@@ -141,11 +145,11 @@  discard block
 block discarded – undo
141 145
 	 */
142 146
 	public static function encode($value, $toMap = true, $encodeEmptyStrings = false)
143 147
 	{
144
-		if(is_string($value))
145
-			return self::quoteString($value);
146
-		elseif(is_bool($value))
147
-			return $value?'true':'false';
148
-		elseif(is_array($value))
148
+		if(is_string($value)) {
149
+					return self::quoteString($value);
150
+		} elseif(is_bool($value)) {
151
+					return $value?'true':'false';
152
+		} elseif(is_array($value))
149 153
 		{
150 154
 			$results = '';
151 155
 			if(($n = count($value)) > 0 && array_keys($value) !== range(0, $n - 1))
@@ -154,30 +158,30 @@  discard block
 block discarded – undo
154 158
 				{
155 159
 					if($v !== '' || $encodeEmptyStrings)
156 160
 					{
157
-						if($results !== '')
158
-							$results .= ',';
161
+						if($results !== '') {
162
+													$results .= ',';
163
+						}
159 164
 						$results .= "'$k':" . self::encode($v, $toMap, $encodeEmptyStrings);
160 165
 					}
161 166
 				}
162 167
 				return '{' . $results . '}';
163
-			}
164
-			else
168
+			} else
165 169
 			{
166 170
 				foreach($value as $v)
167 171
 				{
168 172
 					if($v !== '' || $encodeEmptyStrings)
169 173
 					{
170
-						if($results !== '')
171
-							$results .= ',';
174
+						if($results !== '') {
175
+													$results .= ',';
176
+						}
172 177
 						$results .= self::encode($v, $toMap, $encodeEmptyStrings);
173 178
 					}
174 179
 				}
175 180
 				return '[' . $results . ']';
176 181
 			}
177
-		}
178
-		elseif(is_int($value))
179
-			return "$value";
180
-		elseif(is_float($value))
182
+		} elseif(is_int($value)) {
183
+					return "$value";
184
+		} elseif(is_float($value))
181 185
 		{
182 186
 			switch($value)
183 187
 			{
@@ -189,22 +193,24 @@  discard block
 block discarded – undo
189 193
 					break;
190 194
 				default:
191 195
 					$locale = localeConv();
192
-					if($locale['decimal_point'] == '.')
193
-						return "$value";
194
-					else
195
-						return str_replace($locale['decimal_point'], '.', "$value");
196
+					if($locale['decimal_point'] == '.') {
197
+											return "$value";
198
+					} else {
199
+											return str_replace($locale['decimal_point'], '.', "$value");
200
+					}
196 201
 					break;
197 202
 			}
198
-		}
199
-		elseif(is_object($value))
200
-			if ($value instanceof TJavaScriptLiteral)
203
+		} elseif(is_object($value)) {
204
+					if ($value instanceof TJavaScriptLiteral)
201 205
 				return $value->toJavaScriptLiteral();
202
-			else
203
-				return self::encode(get_object_vars($value), $toMap);
204
-		elseif($value === null)
205
-			return 'null';
206
-		else
207
-			return '';
206
+		} else {
207
+							return self::encode(get_object_vars($value), $toMap);
208
+			}
209
+		elseif($value === null) {
210
+					return 'null';
211
+		} else {
212
+					return '';
213
+		}
208 214
 	}
209 215
 	/**
210 216
 	 * Encodes a PHP variable into javascript string.
@@ -230,12 +236,13 @@  discard block
 block discarded – undo
230 236
 	 * @param string $sourceEncoding
231 237
 	 */
232 238
 	private static function convertToUtf8(&$value, $sourceEncoding) {
233
-		if(is_string($value))
234
-			$value = iconv($sourceEncoding, 'UTF-8', $value);
235
-		elseif (is_array($value))
239
+		if(is_string($value)) {
240
+					$value = iconv($sourceEncoding, 'UTF-8', $value);
241
+		} elseif (is_array($value))
236 242
 		{
237
-			foreach($value as &$element)
238
-				self::convertToUtf8($element, $sourceEncoding);
243
+			foreach($value as &$element) {
244
+							self::convertToUtf8($element, $sourceEncoding);
245
+			}
239 246
 		}
240 247
 	}
241 248
 
Please login to merge, or discard this patch.
framework/Web/THttpCookieCollection.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function insertAt($index, $item)
56 56
 	{
57
-		if($item instanceof THttpCookie)
57
+		if ($item instanceof THttpCookie)
58 58
 		{
59 59
 			parent::insertAt($index, $item);
60
-			if($this->_o instanceof THttpResponse)
60
+			if ($this->_o instanceof THttpResponse)
61 61
 				$this->_o->addCookie($item);
62 62
 		}
63 63
 		else
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	public function removeAt($index)
75 75
 	{
76 76
 		$item = parent::removeAt($index);
77
-		if($this->_o instanceof THttpResponse)
77
+		if ($this->_o instanceof THttpResponse)
78 78
 			$this->_o->removeCookie($item);
79 79
 		return $item;
80 80
 	}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function itemAt($index)
87 87
 	{
88
-		if(is_int($index))
88
+		if (is_int($index))
89 89
 			return parent::itemAt($index);
90 90
 		else
91 91
 			return $this->findCookieByName($index);
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function findCookieByName($name)
100 100
 	{
101
-		foreach($this as $cookie)
102
-			if($cookie->getName() === $name)
101
+		foreach ($this as $cookie)
102
+			if ($cookie->getName() === $name)
103 103
 				return $cookie;
104 104
 		return null;
105 105
 	}
Please login to merge, or discard this patch.
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -57,11 +57,12 @@  discard block
 block discarded – undo
57 57
 		if($item instanceof THttpCookie)
58 58
 		{
59 59
 			parent::insertAt($index, $item);
60
-			if($this->_o instanceof THttpResponse)
61
-				$this->_o->addCookie($item);
60
+			if($this->_o instanceof THttpResponse) {
61
+							$this->_o->addCookie($item);
62
+			}
63
+		} else {
64
+					throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
62 65
 		}
63
-		else
64
-			throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
65 66
 	}
66 67
 
67 68
 	/**
@@ -74,8 +75,9 @@  discard block
 block discarded – undo
74 75
 	public function removeAt($index)
75 76
 	{
76 77
 		$item = parent::removeAt($index);
77
-		if($this->_o instanceof THttpResponse)
78
-			$this->_o->removeCookie($item);
78
+		if($this->_o instanceof THttpResponse) {
79
+					$this->_o->removeCookie($item);
80
+		}
79 81
 		return $item;
80 82
 	}
81 83
 
@@ -85,10 +87,11 @@  discard block
 block discarded – undo
85 87
 	 */
86 88
 	public function itemAt($index)
87 89
 	{
88
-		if(is_int($index))
89
-			return parent::itemAt($index);
90
-		else
91
-			return $this->findCookieByName($index);
90
+		if(is_int($index)) {
91
+					return parent::itemAt($index);
92
+		} else {
93
+					return $this->findCookieByName($index);
94
+		}
92 95
 	}
93 96
 
94 97
 	/**
@@ -98,9 +101,10 @@  discard block
 block discarded – undo
98 101
 	 */
99 102
 	public function findCookieByName($name)
100 103
 	{
101
-		foreach($this as $cookie)
102
-			if($cookie->getName() === $name)
104
+		foreach($this as $cookie) {
105
+					if($cookie->getName() === $name)
103 106
 				return $cookie;
107
+		}
104 108
 		return null;
105 109
 	}
106 110
 }
107 111
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/TControlCollection.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function insertAt($index, $item)
62 62
 	{
63
-		if($item instanceof TControl)
63
+		if ($item instanceof TControl)
64 64
 		{
65 65
 			parent::insertAt($index, $item);
66 66
 			$this->_o->addedControl($item);
67 67
 		}
68
-		elseif(is_string($item) || ($item instanceof IRenderable))
68
+		elseif (is_string($item) || ($item instanceof IRenderable))
69 69
 			parent::insertAt($index, $item);
70 70
 		else
71 71
 			throw new TInvalidDataTypeException('controlcollection_control_required');
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	public function removeAt($index)
82 82
 	{
83 83
 		$item = parent::removeAt($index);
84
-		if($item instanceof TControl)
84
+		if ($item instanceof TControl)
85 85
 			$this->_o->removedControl($item);
86 86
 		return $item;
87 87
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	public function clear()
93 93
 	{
94 94
 		parent::clear();
95
-		if($this->_o instanceof INamingContainer)
95
+		if ($this->_o instanceof INamingContainer)
96 96
 			$this->_o->clearNamingContainer();
97 97
 	}
98 98
 }
99 99
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		{
65 65
 			parent::insertAt($index, $item);
66 66
 			$this->_o->addedControl($item);
67
+		} elseif(is_string($item) || ($item instanceof IRenderable)) {
68
+					parent::insertAt($index, $item);
69
+		} else {
70
+					throw new TInvalidDataTypeException('controlcollection_control_required');
67 71
 		}
68
-		elseif(is_string($item) || ($item instanceof IRenderable))
69
-			parent::insertAt($index, $item);
70
-		else
71
-			throw new TInvalidDataTypeException('controlcollection_control_required');
72 72
 	}
73 73
 
74 74
 	/**
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 	public function removeAt($index)
82 82
 	{
83 83
 		$item = parent::removeAt($index);
84
-		if($item instanceof TControl)
85
-			$this->_o->removedControl($item);
84
+		if($item instanceof TControl) {
85
+					$this->_o->removedControl($item);
86
+		}
86 87
 		return $item;
87 88
 	}
88 89
 
@@ -92,7 +93,8 @@  discard block
 block discarded – undo
92 93
 	public function clear()
93 94
 	{
94 95
 		parent::clear();
95
-		if($this->_o instanceof INamingContainer)
96
-			$this->_o->clearNamingContainer();
96
+		if($this->_o instanceof INamingContainer) {
97
+					$this->_o->clearNamingContainer();
98
+		}
97 99
 	}
98 100
 }
99 101
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/TTheme.php 2 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -89,33 +89,33 @@  discard block
 block discarded – undo
89 89
 		$this->_name = basename($themePath);
90 90
 		$cacheValid = false;
91 91
 		// TODO: the following needs to be cleaned up (Qiang)
92
-		if(($cache = $this->getApplication()->getCache()) !== null)
92
+		if (($cache = $this->getApplication()->getCache()) !== null)
93 93
 		{
94
-			$array = $cache->get(self::THEME_CACHE_PREFIX . $themePath);
95
-			if(is_array($array))
94
+			$array = $cache->get(self::THEME_CACHE_PREFIX.$themePath);
95
+			if (is_array($array))
96 96
 			{
97 97
 				list($skins, $cssFiles, $jsFiles, $timestamp) = $array;
98
-				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
98
+				if ($this->getApplication()->getMode() !== TApplicationMode::Performance)
99 99
 				{
100
-					if(($dir = opendir($themePath)) === false)
100
+					if (($dir = opendir($themePath)) === false)
101 101
 						throw new TIOException('theme_path_inexistent', $themePath);
102 102
 					$cacheValid = true;
103
-					while(($file = readdir($dir)) !== false)
103
+					while (($file = readdir($dir)) !== false)
104 104
 					{
105
-						if($file === '.' || $file === '..')
105
+						if ($file === '.' || $file === '..')
106 106
 							continue;
107
-						elseif(basename($file, '.css') !== $file)
108
-							$this->_cssFiles[] = $themeUrl . '/' . $file;
109
-						elseif(basename($file, '.js') !== $file)
110
-							$this->_jsFiles[] = $themeUrl . '/' . $file;
111
-						elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp)
107
+						elseif (basename($file, '.css') !== $file)
108
+							$this->_cssFiles[] = $themeUrl.'/'.$file;
109
+						elseif (basename($file, '.js') !== $file)
110
+							$this->_jsFiles[] = $themeUrl.'/'.$file;
111
+						elseif (basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath.DIRECTORY_SEPARATOR.$file) > $timestamp)
112 112
 						{
113 113
 							$cacheValid = false;
114 114
 							break;
115 115
 						}
116 116
 					}
117 117
 					closedir($dir);
118
-					if($cacheValid)
118
+					if ($cacheValid)
119 119
 						$this->_skins = $skins;
120 120
 				}
121 121
 				else
@@ -127,34 +127,34 @@  discard block
 block discarded – undo
127 127
 				}
128 128
 			}
129 129
 		}
130
-		if(!$cacheValid)
130
+		if (!$cacheValid)
131 131
 		{
132 132
 			$this->_cssFiles = [];
133 133
 			$this->_jsFiles = [];
134 134
 			$this->_skins = [];
135
-			if(($dir = opendir($themePath)) === false)
135
+			if (($dir = opendir($themePath)) === false)
136 136
 				throw new TIOException('theme_path_inexistent', $themePath);
137
-			while(($file = readdir($dir)) !== false)
137
+			while (($file = readdir($dir)) !== false)
138 138
 			{
139
-				if($file === '.' || $file === '..')
139
+				if ($file === '.' || $file === '..')
140 140
 					continue;
141
-				elseif(basename($file, '.css') !== $file)
142
-					$this->_cssFiles[] = $themeUrl . '/' . $file;
143
-				elseif(basename($file, '.js') !== $file)
144
-					$this->_jsFiles[] = $themeUrl . '/' . $file;
145
-				elseif(basename($file, self::SKIN_FILE_EXT) !== $file)
141
+				elseif (basename($file, '.css') !== $file)
142
+					$this->_cssFiles[] = $themeUrl.'/'.$file;
143
+				elseif (basename($file, '.js') !== $file)
144
+					$this->_jsFiles[] = $themeUrl.'/'.$file;
145
+				elseif (basename($file, self::SKIN_FILE_EXT) !== $file)
146 146
 				{
147
-					$template = new TTemplate(file_get_contents($themePath . '/' . $file), $themePath, $themePath . '/' . $file);
148
-					foreach($template->getItems() as $skin)
147
+					$template = new TTemplate(file_get_contents($themePath.'/'.$file), $themePath, $themePath.'/'.$file);
148
+					foreach ($template->getItems() as $skin)
149 149
 					{
150
-						if(!isset($skin[2]))  // a text string, ignored
150
+						if (!isset($skin[2]))  // a text string, ignored
151 151
 							continue;
152
-						elseif($skin[0] !== -1)
152
+						elseif ($skin[0] !== -1)
153 153
 							throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath));
154 154
 						$type = $skin[1];
155
-						$id = isset($skin[2]['skinid'])?$skin[2]['skinid']:0;
155
+						$id = isset($skin[2]['skinid']) ? $skin[2]['skinid'] : 0;
156 156
 						unset($skin[2]['skinid']);
157
-						if(isset($this->_skins[$type][$id]))
157
+						if (isset($this->_skins[$type][$id]))
158 158
 							throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath));
159 159
 						/*
160 160
 						foreach($skin[2] as $name=>$value)
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 			closedir($dir);
171 171
 			sort($this->_cssFiles);
172 172
 			sort($this->_jsFiles);
173
-			if($cache !== null)
174
-				$cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]);
173
+			if ($cache !== null)
174
+				$cache->set(self::THEME_CACHE_PREFIX.$themePath, [$this->_skins, $this->_cssFiles, $this->_jsFiles, time()]);
175 175
 		}
176 176
 	}
177 177
 
@@ -251,22 +251,22 @@  discard block
 block discarded – undo
251 251
 	public function applySkin($control)
252 252
 	{
253 253
 		$type = get_class($control);
254
-		if(($id = $control->getSkinID()) === '')
254
+		if (($id = $control->getSkinID()) === '')
255 255
 			$id = 0;
256
-		if(isset($this->_skins[$type][$id]))
256
+		if (isset($this->_skins[$type][$id]))
257 257
 		{
258
-			foreach($this->_skins[$type][$id] as $name => $value)
258
+			foreach ($this->_skins[$type][$id] as $name => $value)
259 259
 			{
260 260
 				Prado::trace("Applying skin $name to $type", 'Prado\Web\UI\TThemeManager');
261
-				if(is_array($value))
261
+				if (is_array($value))
262 262
 				{
263
-					switch($value[0])
263
+					switch ($value[0])
264 264
 					{
265 265
 						case TTemplate::CONFIG_EXPRESSION:
266 266
 							$value = $this->evaluateExpression($value[1]);
267 267
 							break;
268 268
 						case TTemplate::CONFIG_ASSET:
269
-							$value = $this->_themeUrl . '/' . ltrim($value[1], '/');
269
+							$value = $this->_themeUrl.'/'.ltrim($value[1], '/');
270 270
 							break;
271 271
 						case TTemplate::CONFIG_DATABIND:
272 272
 							$control->bindProperty($name, $value[1]);
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 							break;
286 286
 					}
287 287
 				}
288
-				if(!is_array($value))
288
+				if (!is_array($value))
289 289
 				{
290
-					if(strpos($name, '.') === false)	// is simple property or custom attribute
290
+					if (strpos($name, '.') === false)	// is simple property or custom attribute
291 291
 					{
292
-						if($control->hasProperty($name))
292
+						if ($control->hasProperty($name))
293 293
 						{
294
-							if($control->canSetProperty($name))
294
+							if ($control->canSetProperty($name))
295 295
 							{
296
-								$setter = 'set' . $name;
296
+								$setter = 'set'.$name;
297 297
 								$control->$setter($value);
298 298
 							}
299 299
 							else
Please login to merge, or discard this patch.
Braces   +50 added lines, -40 removed lines patch added patch discarded remove patch
@@ -97,28 +97,29 @@  discard block
 block discarded – undo
97 97
 				list($skins, $cssFiles, $jsFiles, $timestamp) = $array;
98 98
 				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
99 99
 				{
100
-					if(($dir = opendir($themePath)) === false)
101
-						throw new TIOException('theme_path_inexistent', $themePath);
100
+					if(($dir = opendir($themePath)) === false) {
101
+											throw new TIOException('theme_path_inexistent', $themePath);
102
+					}
102 103
 					$cacheValid = true;
103 104
 					while(($file = readdir($dir)) !== false)
104 105
 					{
105
-						if($file === '.' || $file === '..')
106
-							continue;
107
-						elseif(basename($file, '.css') !== $file)
108
-							$this->_cssFiles[] = $themeUrl . '/' . $file;
109
-						elseif(basename($file, '.js') !== $file)
110
-							$this->_jsFiles[] = $themeUrl . '/' . $file;
111
-						elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp)
106
+						if($file === '.' || $file === '..') {
107
+													continue;
108
+						} elseif(basename($file, '.css') !== $file) {
109
+													$this->_cssFiles[] = $themeUrl . '/' . $file;
110
+						} elseif(basename($file, '.js') !== $file) {
111
+													$this->_jsFiles[] = $themeUrl . '/' . $file;
112
+						} elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp)
112 113
 						{
113 114
 							$cacheValid = false;
114 115
 							break;
115 116
 						}
116 117
 					}
117 118
 					closedir($dir);
118
-					if($cacheValid)
119
-						$this->_skins = $skins;
120
-				}
121
-				else
119
+					if($cacheValid) {
120
+											$this->_skins = $skins;
121
+					}
122
+				} else
122 123
 				{
123 124
 					$cacheValid = true;
124 125
 					$this->_cssFiles = $cssFiles;
@@ -132,30 +133,34 @@  discard block
 block discarded – undo
132 133
 			$this->_cssFiles = [];
133 134
 			$this->_jsFiles = [];
134 135
 			$this->_skins = [];
135
-			if(($dir = opendir($themePath)) === false)
136
-				throw new TIOException('theme_path_inexistent', $themePath);
136
+			if(($dir = opendir($themePath)) === false) {
137
+							throw new TIOException('theme_path_inexistent', $themePath);
138
+			}
137 139
 			while(($file = readdir($dir)) !== false)
138 140
 			{
139
-				if($file === '.' || $file === '..')
140
-					continue;
141
-				elseif(basename($file, '.css') !== $file)
142
-					$this->_cssFiles[] = $themeUrl . '/' . $file;
143
-				elseif(basename($file, '.js') !== $file)
144
-					$this->_jsFiles[] = $themeUrl . '/' . $file;
145
-				elseif(basename($file, self::SKIN_FILE_EXT) !== $file)
141
+				if($file === '.' || $file === '..') {
142
+									continue;
143
+				} elseif(basename($file, '.css') !== $file) {
144
+									$this->_cssFiles[] = $themeUrl . '/' . $file;
145
+				} elseif(basename($file, '.js') !== $file) {
146
+									$this->_jsFiles[] = $themeUrl . '/' . $file;
147
+				} elseif(basename($file, self::SKIN_FILE_EXT) !== $file)
146 148
 				{
147 149
 					$template = new TTemplate(file_get_contents($themePath . '/' . $file), $themePath, $themePath . '/' . $file);
148 150
 					foreach($template->getItems() as $skin)
149 151
 					{
150
-						if(!isset($skin[2]))  // a text string, ignored
152
+						if(!isset($skin[2])) {
153
+							// a text string, ignored
151 154
 							continue;
152
-						elseif($skin[0] !== -1)
153
-							throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath));
155
+						} elseif($skin[0] !== -1) {
156
+													throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath));
157
+						}
154 158
 						$type = $skin[1];
155 159
 						$id = isset($skin[2]['skinid'])?$skin[2]['skinid']:0;
156 160
 						unset($skin[2]['skinid']);
157
-						if(isset($this->_skins[$type][$id]))
158
-							throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath));
161
+						if(isset($this->_skins[$type][$id])) {
162
+													throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath));
163
+						}
159 164
 						/*
160 165
 						foreach($skin[2] as $name=>$value)
161 166
 						{
@@ -170,8 +175,9 @@  discard block
 block discarded – undo
170 175
 			closedir($dir);
171 176
 			sort($this->_cssFiles);
172 177
 			sort($this->_jsFiles);
173
-			if($cache !== null)
174
-				$cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]);
178
+			if($cache !== null) {
179
+							$cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]);
180
+			}
175 181
 		}
176 182
 	}
177 183
 
@@ -251,8 +257,9 @@  discard block
 block discarded – undo
251 257
 	public function applySkin($control)
252 258
 	{
253 259
 		$type = get_class($control);
254
-		if(($id = $control->getSkinID()) === '')
255
-			$id = 0;
260
+		if(($id = $control->getSkinID()) === '') {
261
+					$id = 0;
262
+		}
256 263
 		if(isset($this->_skins[$type][$id]))
257 264
 		{
258 265
 			foreach($this->_skins[$type][$id] as $name => $value)
@@ -287,29 +294,32 @@  discard block
 block discarded – undo
287 294
 				}
288 295
 				if(!is_array($value))
289 296
 				{
290
-					if(strpos($name, '.') === false)	// is simple property or custom attribute
297
+					if(strpos($name, '.') === false) {
298
+						// is simple property or custom attribute
291 299
 					{
292 300
 						if($control->hasProperty($name))
293 301
 						{
294 302
 							if($control->canSetProperty($name))
295 303
 							{
296 304
 								$setter = 'set' . $name;
305
+					}
297 306
 								$control->$setter($value);
307
+							} else {
308
+															throw new TConfigurationException('theme_property_readonly', $type, $name);
298 309
 							}
299
-							else
300
-								throw new TConfigurationException('theme_property_readonly', $type, $name);
310
+						} else {
311
+													throw new TConfigurationException('theme_property_undefined', $type, $name);
301 312
 						}
302
-						else
303
-							throw new TConfigurationException('theme_property_undefined', $type, $name);
304
-					}
305
-					else	// complex property
313
+					} else {
314
+						// complex property
306 315
 						$control->setSubProperty($name, $value);
316
+					}
307 317
 				}
308 318
 			}
309 319
 			return true;
320
+		} else {
321
+					return false;
310 322
 		}
311
-		else
312
-			return false;
313 323
 	}
314 324
 
315 325
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveEditCommandColumn.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@
 block discarded – undo
36 36
  */
37 37
 class TActiveEditCommandColumn extends TEditCommandColumn {
38 38
 	protected function createButton($commandName, $text, $causesValidation, $validationGroup) {
39
-		if($this->getButtonType() === TButtonColumnType::LinkButton)
39
+		if ($this->getButtonType() === TButtonColumnType::LinkButton)
40 40
 			$button = new TActiveLinkButton;
41
-		elseif($this->getButtonType() === TButtonColumnType::PushButton)
41
+		elseif ($this->getButtonType() === TButtonColumnType::PushButton)
42 42
 				$button = new TActiveButton;
43 43
 			else  // image buttons
44 44
 			{
45 45
 				$button = new TActiveImageButton;
46 46
 				$button->setToolTip($text);
47
-				if(strcasecmp($commandName, 'Update') === 0)
47
+				if (strcasecmp($commandName, 'Update') === 0)
48 48
 					$url = $this->getUpdateImageUrl();
49
-				elseif(strcasecmp($commandName, 'Cancel') === 0)
49
+				elseif (strcasecmp($commandName, 'Cancel') === 0)
50 50
 						$url = $this->getCancelImageUrl();
51 51
 					else
52 52
 						$url = $this->getEditImageUrl();
Please login to merge, or discard this patch.
Braces   +12 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,20 +36,21 @@
 block discarded – undo
36 36
  */
37 37
 class TActiveEditCommandColumn extends TEditCommandColumn {
38 38
 	protected function createButton($commandName, $text, $causesValidation, $validationGroup) {
39
-		if($this->getButtonType() === TButtonColumnType::LinkButton)
40
-			$button = new TActiveLinkButton;
41
-		elseif($this->getButtonType() === TButtonColumnType::PushButton)
42
-				$button = new TActiveButton;
43
-			else  // image buttons
39
+		if($this->getButtonType() === TButtonColumnType::LinkButton) {
40
+					$button = new TActiveLinkButton;
41
+		} elseif($this->getButtonType() === TButtonColumnType::PushButton) {
42
+						$button = new TActiveButton;
43
+		} else  // image buttons
44 44
 			{
45 45
 				$button = new TActiveImageButton;
46 46
 				$button->setToolTip($text);
47
-				if(strcasecmp($commandName, 'Update') === 0)
48
-					$url = $this->getUpdateImageUrl();
49
-				elseif(strcasecmp($commandName, 'Cancel') === 0)
50
-						$url = $this->getCancelImageUrl();
51
-					else
52
-						$url = $this->getEditImageUrl();
47
+				if(strcasecmp($commandName, 'Update') === 0) {
48
+									$url = $this->getUpdateImageUrl();
49
+				} elseif(strcasecmp($commandName, 'Cancel') === 0) {
50
+										$url = $this->getCancelImageUrl();
51
+				} else {
52
+											$url = $this->getEditImageUrl();
53
+					}
53 54
 				$button->setImageUrl($url);
54 55
 			}
55 56
 		$button->setText($text);
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function flushContent()
61 61
 	{
62
-		foreach($this->_writers as $writer)
62
+		foreach ($this->_writers as $writer)
63 63
 			echo $writer->flush();
64 64
 		parent::flushContent();
65 65
 	}
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function httpRedirect($url)
88 88
 	{
89
-		if($url[0] === '/')
90
-			$url = $this->getRequest()->getBaseUrl() . $url;
89
+		if ($url[0] === '/')
90
+			$url = $this->getRequest()->getBaseUrl().$url;
91 91
 		$this->_redirectUrl = str_replace('&amp;', '&', $url);
92 92
 	}
93 93
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function flushContent()
61 61
 	{
62
-		foreach($this->_writers as $writer)
63
-			echo $writer->flush();
62
+		foreach($this->_writers as $writer) {
63
+					echo $writer->flush();
64
+		}
64 65
 		parent::flushContent();
65 66
 	}
66 67
 
@@ -86,8 +87,9 @@  discard block
 block discarded – undo
86 87
 	 */
87 88
 	public function httpRedirect($url)
88 89
 	{
89
-		if($url[0] === '/')
90
-			$url = $this->getRequest()->getBaseUrl() . $url;
90
+		if($url[0] === '/') {
91
+					$url = $this->getRequest()->getBaseUrl() . $url;
92
+		}
91 93
 		$this->_redirectUrl = str_replace('&amp;', '&', $url);
92 94
 	}
93 95
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveControlAdapter.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	protected function setBaseControlClass($type)
72 72
 	{
73
-		if($type === null)
73
+		if ($type === null)
74 74
 		{
75
-			if($this->getControl() instanceof ICallbackEventHandler)
75
+			if ($this->getControl() instanceof ICallbackEventHandler)
76 76
 				$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl';
77 77
 			else
78 78
 				$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl';
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	public function render($writer)
96 96
 	{
97 97
 		$this->getPage()->getClientScript()->registerPradoScript('ajax');
98
-		if($this->_control->getVisible(false))
98
+		if ($this->_control->getVisible(false))
99 99
 		{
100 100
 			parent::render($writer);
101 101
 		} else {
102
-			$writer->write("<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\"></span>");
102
+			$writer->write("<span id=\"".$this->_control->getClientID()."\" style=\"display:none\"></span>");
103 103
 		}
104 104
 	}
105 105
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function getBaseActiveControl()
118 118
 	{
119
-		if($this->_baseActiveControl === null)
119
+		if ($this->_baseActiveControl === null)
120 120
 		{
121 121
 			$type = $this->_activeControlType;
122 122
 			$this->_baseActiveControl = new $type($this->getControl());
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	protected function getIsTrackingPageState()
131 131
 	{
132
-		if($this->getPage()->getIsCallback())
132
+		if ($this->getPage()->getIsCallback())
133 133
 		{
134 134
 			$target = $this->getPage()->getCallbackEventTarget();
135
-			if($target instanceof ICallbackEventHandler)
135
+			if ($target instanceof ICallbackEventHandler)
136 136
 			{
137 137
 				$client = $target->getActiveControl()->getClientSide();
138 138
 				return $client->getEnablePageStateUpdate();
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function onLoad($param)
148 148
 	{
149
-		if($this->getIsTrackingPageState())
149
+		if ($this->getIsTrackingPageState())
150 150
 		{
151 151
 		  $stateTrackerClass = $this->_stateTrackerClass;
152 152
 			$this->_stateTracker = new $stateTrackerClass($this->getControl());
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function saveState()
163 163
 	{
164
-		if(($this->_stateTracker !== null)
164
+		if (($this->_stateTracker !== null)
165 165
 			&& $this->getControl()->getActiveControl()->canUpdateClientSide(true))
166 166
 		{
167 167
 			$this->_stateTracker->respondToChanges();
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,13 +72,14 @@
 block discarded – undo
72 72
 	{
73 73
 		if($type === null)
74 74
 		{
75
-			if($this->getControl() instanceof ICallbackEventHandler)
76
-				$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl';
77
-			else
78
-				$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl';
75
+			if($this->getControl() instanceof ICallbackEventHandler) {
76
+							$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl';
77
+			} else {
78
+							$this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl';
79
+			}
80
+		} else {
81
+					$this->_activeControlType = $type;
79 82
 		}
80
-		else
81
-			$this->_activeControlType = $type;
82 83
 	}
83 84
 
84 85
 	/**
Please login to merge, or discard this patch.