Completed
Push — php-cs-fixer ( b6f93e...b9836a )
by Fabio
07:15
created
framework/Web/Services/TJsonResponse.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 abstract class TJsonResponse extends \Prado\TApplicationComponent
28 28
 {
29
-	private $_id = '';
29
+	private $_id='';
30 30
 
31 31
 	/**
32 32
 	 * Initializes the feed.
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function setID($value)
51 51
 	{
52
-		$this->_id = $value;
52
+		$this->_id=$value;
53 53
 	}
54 54
 
55 55
 	/**
Please login to merge, or discard this patch.
framework/Web/Services/TRpcService.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
 	/**
64 64
 	 * const string base api provider class which every API must extend
65 65
 	 */
66
-	const BASE_API_PROVIDER = 'TRpcApiProvider';
66
+	const BASE_API_PROVIDER='TRpcApiProvider';
67 67
 
68 68
 	/**
69 69
 	 * const string base RPC server implementation
70 70
 	 */
71
-	const BASE_RPC_SERVER = 'TRpcServer';
71
+	const BASE_RPC_SERVER='TRpcServer';
72 72
 
73 73
 	/**
74 74
 	 * @var array containing mimetype to protocol handler mappings
75 75
 	 */
76
-	protected $protocolHandlers = [
76
+	protected $protocolHandlers=[
77 77
 		'application/json' => 'TJsonRpcProtocol',
78 78
 		'text/xml' => 'TXmlRpcProtocol'
79 79
 	];
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	/**
82 82
 	 * @var array containing API provider and their configured properties
83 83
 	 */
84
-	protected $apiProviders = [];
84
+	protected $apiProviders=[];
85 85
 
86 86
 	// methods
87 87
 
@@ -92,27 +92,27 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function createApiProvider(TRpcProtocol $protocolHandler, $providerId)
94 94
 	{
95
-		$_properties = $this->apiProviders[$providerId];
95
+		$_properties=$this->apiProviders[$providerId];
96 96
 
97
-		if(($_providerClass = $_properties->remove('class')) === null)
97
+		if(($_providerClass=$_properties->remove('class'))===null)
98 98
 			throw new TConfigurationException('rpcservice_apiprovider_required');
99 99
 
100 100
 		Prado::using($_providerClass);
101 101
 
102
-		$_providerClassName = ($_pos = strrpos($_providerClass, '.')) !== false ? substr($_providerClass, $_pos + 1) : $_providerClass;
102
+		$_providerClassName=($_pos=strrpos($_providerClass, '.'))!==false ? substr($_providerClass, $_pos + 1) : $_providerClass;
103 103
 		if(!is_subclass_of($_providerClassName, self::BASE_API_PROVIDER))
104 104
 			throw new TConfigurationException('rpcservice_apiprovider_invalid');
105 105
 
106
-		if(($_rpcServerClass = $_properties->remove('server')) === null)
107
-			$_rpcServerClass = self::BASE_RPC_SERVER;
106
+		if(($_rpcServerClass=$_properties->remove('server'))===null)
107
+			$_rpcServerClass=self::BASE_RPC_SERVER;
108 108
 
109 109
 		Prado::using($_rpcServerClass);
110 110
 
111
-		$_rpcServerClassName = ($_pos = strrpos($_rpcServerClass, '.')) !== false ? substr($_rpcServerClass, $_pos + 1) : $_rpcServerClass;
112
-		if($_rpcServerClassName !== self::BASE_RPC_SERVER && !is_subclass_of($_rpcServerClassName, self::BASE_RPC_SERVER))
111
+		$_rpcServerClassName=($_pos=strrpos($_rpcServerClass, '.'))!==false ? substr($_rpcServerClass, $_pos + 1) : $_rpcServerClass;
112
+		if($_rpcServerClassName!==self::BASE_RPC_SERVER && !is_subclass_of($_rpcServerClassName, self::BASE_RPC_SERVER))
113 113
 			throw new TConfigurationException('rpcservice_rpcserver_invalid');
114 114
 
115
-		$_apiProvider = new $_providerClassName(new $_rpcServerClassName($protocolHandler));
115
+		$_apiProvider=new $_providerClassName(new $_rpcServerClassName($protocolHandler));
116 116
 		$_apiProvider->setId($providerId);
117 117
 
118 118
 		foreach($_properties as $_key => $_value)
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 	{
139 139
 		foreach($xml->getElementsByTagName('rpcapi') as $_apiProviderXml)
140 140
 		{
141
-			$_properties = $_apiProviderXml->getAttributes();
141
+			$_properties=$_apiProviderXml->getAttributes();
142 142
 
143
-			if(($_id = $_properties->remove('id')) === null || $_id == "")
143
+			if(($_id=$_properties->remove('id'))===null || $_id=="")
144 144
 				throw new TConfigurationException('rpcservice_apiproviderid_required');
145 145
 
146 146
 			if(isset($this->apiProviders[$_id]))
147 147
 				throw new TConfigurationException('rpcservice_apiproviderid_duplicated');
148 148
 
149
-			$this->apiProviders[$_id] = $_properties;
149
+			$this->apiProviders[$_id]=$_properties;
150 150
 		}
151 151
 	}
152 152
 
@@ -155,26 +155,26 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function run()
157 157
 	{
158
-		$_request = $this->getRequest();
158
+		$_request=$this->getRequest();
159 159
 
160
-		if(($_providerId = $_request->getServiceParameter()) == "")
160
+		if(($_providerId=$_request->getServiceParameter())=="")
161 161
 			throw new THttpException(400, 'RPC API-Provider id required');
162 162
 		
163
-		if(($_method = $_request->getRequestType()) != 'POST')
164
-			throw new THttpException(405, 'Invalid request method "' . $_method . '"!'); // TODO Exception muss "Allow POST" Header setzen
163
+		if(($_method=$_request->getRequestType())!='POST')
164
+			throw new THttpException(405, 'Invalid request method "'.$_method.'"!'); // TODO Exception muss "Allow POST" Header setzen
165 165
 
166
-		if(($_mimeType = $_request->getContentType()) === null)
166
+		if(($_mimeType=$_request->getContentType())===null)
167 167
 			throw new THttpException(406, 'Content-Type is missing!'); // TODO Exception muss gültige Content-Type werte zurück geben
168 168
 
169 169
 		if(!in_array($_mimeType, array_keys($this->protocolHandlers)))
170 170
 			throw new THttpException(406, 'Unsupported Content-Type!'); // TODO see previous
171 171
 
172
-		$_protocolHandlerClass = $this->protocolHandlers[$_mimeType];
173
-		$_protocolHandler = new $_protocolHandlerClass;
172
+		$_protocolHandlerClass=$this->protocolHandlers[$_mimeType];
173
+		$_protocolHandler=new $_protocolHandlerClass;
174 174
 
175
-		if(($_result = $this->createApiProvider($_protocolHandler, $_providerId)->processRequest()) !== null)
175
+		if(($_result=$this->createApiProvider($_protocolHandler, $_providerId)->processRequest())!==null)
176 176
 		{
177
-			$_response = $this->getResponse();
177
+			$_response=$this->getResponse();
178 178
 			$_protocolHandler->createResponseHeaders($_response);
179 179
 			$_response->write($_result);
180 180
 		}
Please login to merge, or discard this patch.
framework/Web/Services/TFeedService.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
  */
65 65
 class TFeedService extends \Prado\TService
66 66
 {
67
-	private $_feeds = [];
67
+	private $_feeds=[];
68 68
 
69 69
 	/**
70 70
 	 * Initializes this module.
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function init($config)
75 75
 	{
76
-		if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
76
+		if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
77 77
 		{
78 78
 			if(is_array($config))
79 79
 			{
80 80
 				foreach($config as $id => $feed)
81
-					$this->_feeds[$id] = $feed;
81
+					$this->_feeds[$id]=$feed;
82 82
 			}
83 83
 		}
84 84
 		else
85 85
 		{
86 86
 			foreach($config->getElementsByTagName('feed') as $feed)
87 87
 			{
88
-				if(($id = $feed->getAttributes()->remove('id')) !== null)
89
-					$this->_feeds[$id] = $feed;
88
+				if(($id=$feed->getAttributes()->remove('id'))!==null)
89
+					$this->_feeds[$id]=$feed;
90 90
 				else
91 91
 					throw new TConfigurationException('feedservice_id_required');
92 92
 			}
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function run()
109 109
 	{
110
-		$id = $this->getRequest()->getServiceParameter();
110
+		$id=$this->getRequest()->getServiceParameter();
111 111
 		if(isset($this->_feeds[$id]))
112 112
 		{
113
-			$feedConfig = $this->_feeds[$id];
114
-			$properties = [];
115
-			$feed = null;
116
-			if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
113
+			$feedConfig=$this->_feeds[$id];
114
+			$properties=[];
115
+			$feed=null;
116
+			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
117 117
 			{
118 118
 				if(isset($feedConfig['class']))
119 119
 				{
120
-					$feed = Prado::createComponent($feedConfig['class']);
120
+					$feed=Prado::createComponent($feedConfig['class']);
121 121
 					if($service instanceof IFeedContentProvider)
122
-						$properties = isset($feedConfig['properties'])?$feedConfig['properties']:[];
122
+						$properties=isset($feedConfig['properties']) ? $feedConfig['properties'] : [];
123 123
 					else
124 124
 						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
125 125
 				}
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 			}
129 129
 			else
130 130
 			{
131
-				$properties = $feedConfig->getAttributes();
132
-				if(($class = $properties->remove('class')) !== null)
131
+				$properties=$feedConfig->getAttributes();
132
+				if(($class=$properties->remove('class'))!==null)
133 133
 				{
134
-					$feed = Prado::createComponent($class);
134
+					$feed=Prado::createComponent($class);
135 135
 					if(!($feed instanceof IFeedContentProvider))
136 136
 						throw new TConfigurationException('feedservice_feedtype_invalid', $id);
137 137
 				}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 				$feed->setSubproperty($name, $value);
145 145
 			$feed->init($feedConfig);
146 146
 
147
-			$content = $feed->getFeedContent();
147
+			$content=$feed->getFeedContent();
148 148
 			//$this->getResponse()->setContentType('application/rss+xml');
149 149
 			$this->getResponse()->setContentType($feed->getContentType());
150 150
 			$this->getResponse()->write($content);
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
 				foreach($config as $id => $feed)
81 81
 					$this->_feeds[$id] = $feed;
82 82
 			}
83
-		}
84
-		else
83
+		} else
85 84
 		{
86 85
 			foreach($config->getElementsByTagName('feed') as $feed)
87 86
 			{
@@ -122,11 +121,9 @@  discard block
 block discarded – undo
122 121
 						$properties = isset($feedConfig['properties'])?$feedConfig['properties']:[];
123 122
 					else
124 123
 						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
125
-				}
126
-				else
124
+				} else
127 125
 					throw new TConfigurationException('jsonservice_class_required', $id);
128
-			}
129
-			else
126
+			} else
130 127
 			{
131 128
 				$properties = $feedConfig->getAttributes();
132 129
 				if(($class = $properties->remove('class')) !== null)
@@ -134,8 +131,7 @@  discard block
 block discarded – undo
134 131
 					$feed = Prado::createComponent($class);
135 132
 					if(!($feed instanceof IFeedContentProvider))
136 133
 						throw new TConfigurationException('feedservice_feedtype_invalid', $id);
137
-				}
138
-				else
134
+				} else
139 135
 					throw new TConfigurationException('feedservice_class_required', $id);
140 136
 			}
141 137
 
@@ -148,8 +144,7 @@  discard block
 block discarded – undo
148 144
 			//$this->getResponse()->setContentType('application/rss+xml');
149 145
 			$this->getResponse()->setContentType($feed->getContentType());
150 146
 			$this->getResponse()->write($content);
151
-		}
152
-		else
147
+		} else
153 148
 			throw new THttpException(404, 'feedservice_feed_unknown', $id);
154 149
 	}
155 150
 }
156 151
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/Services/TJsonRpcProtocol.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 class TJsonRpcProtocol extends TRpcProtocol
28 28
 {
29 29
 	protected $_id;
30
-	protected $_specificationVersion = 1.0;
30
+	protected $_specificationVersion=1.0;
31 31
 
32 32
 	/**
33 33
 	 * Handles the RPC request
@@ -38,33 +38,33 @@  discard block
 block discarded – undo
38 38
 	{
39 39
 		try
40 40
 		{
41
-			$_request = $this->decode($requestPayload);
41
+			$_request=$this->decode($requestPayload);
42 42
 
43 43
 			if(isset($_request['jsonrpc']))
44 44
 			{
45
-				$this->_specificationVersion = $_request['jsonrpc'];
45
+				$this->_specificationVersion=$_request['jsonrpc'];
46 46
 				if($this->_specificationVersion > 2.0)
47 47
 					throw new TRpcException('Unsupported specification version', '-32600');
48 48
 			}
49 49
 
50 50
 			if(isset($_request['id']))
51
-				$this->_id = $_request['id'];
51
+				$this->_id=$_request['id'];
52 52
 
53 53
 			if(!isset($_request['method']))
54 54
 					throw new TRpcException('Missing request method', '-32600');
55 55
 
56 56
 			if(!isset($_request['params']))
57
-				$parameters = [];
57
+				$parameters=[];
58 58
 			else
59
-				$parameters = $_request['params'];
59
+				$parameters=$_request['params'];
60 60
 
61 61
 			if(!is_array($parameters))
62
-				$parameters = [$parameters];
62
+				$parameters=[$parameters];
63 63
 
64 64
 			// a request without an id is a notification that doesn't need a response
65
-			if($this->_id !== null)
65
+			if($this->_id!==null)
66 66
 			{
67
-				if($this->_specificationVersion == 2.0)
67
+				if($this->_specificationVersion==2.0)
68 68
 				{
69 69
 					return $this->encode([
70 70
 						'jsonrpc' => '2.0',
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function createErrorResponse(TRpcException $exception)
103 103
 	{
104
-		if($this->_specificationVersion == 2.0)
104
+		if($this->_specificationVersion==2.0)
105 105
 		{
106 106
 			return $this->encode([
107 107
 				'id' => $this->_id,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function decode($data)
143 143
 	{
144
-		$s = json_decode($data, true);
144
+		$s=json_decode($data, true);
145 145
 		self::checkJsonError();
146 146
 		return $s;
147 147
 	}
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function encode($data)
155 155
 	{
156
-		$s = json_encode($data);
156
+		$s=json_encode($data);
157 157
 		self::checkJsonError();
158 158
 		return $s;
159 159
 	}
160 160
 
161 161
 	private static function checkJsonError()
162 162
 	{
163
-		$errnum = json_last_error();
164
-		if($errnum != JSON_ERROR_NONE)
163
+		$errnum=json_last_error();
164
+		if($errnum!=JSON_ERROR_NONE)
165 165
 			throw new \Exception("JSON error: $msg", $err);
166 166
 	}
167 167
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	public function callApiMethod($methodName, $parameters)
176 176
 	{
177 177
 		if(!isset($this->rpcMethods[$methodName]))
178
-			throw new TRpcException('Method "' . $methodName . '" not found', '-32601');
178
+			throw new TRpcException('Method "'.$methodName.'" not found', '-32601');
179 179
 
180 180
 		return call_user_func_array($this->rpcMethods[$methodName]['method'], $parameters);
181 181
 	}
Please login to merge, or discard this patch.
framework/Web/Services/TSoapService.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
  */
97 97
 class TSoapService extends \Prado\TService
98 98
 {
99
-	const DEFAULT_SOAP_SERVER = 'Prado\Web\Services\TSoapServer';
100
-	private $_servers = [];
99
+	const DEFAULT_SOAP_SERVER='Prado\Web\Services\TSoapServer';
100
+	private $_servers=[];
101 101
 	private $_configFile;
102
-	private $_wsdlRequest = false;
102
+	private $_wsdlRequest=false;
103 103
 	private $_serverID;
104 104
 
105 105
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function init($config)
121 121
 	{
122
-		if($this->_configFile !== null)
122
+		if($this->_configFile!==null)
123 123
 		{
124 124
 			if(is_file($this->_configFile))
125 125
 			{
126
-				$dom = new TXmlDocument;
126
+				$dom=new TXmlDocument;
127 127
 				$dom->loadFromFile($this->_configFile);
128 128
 				$this->loadConfig($dom);
129 129
 			}
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	protected function resolveRequest()
146 146
 	{
147
-		$serverID = $this->getRequest()->getServiceParameter();
148
-		if(($pos = strrpos($serverID, '.wsdl')) === strlen($serverID) - 5)
147
+		$serverID=$this->getRequest()->getServiceParameter();
148
+		if(($pos=strrpos($serverID, '.wsdl'))===strlen($serverID) - 5)
149 149
 		{
150
-			$serverID = substr($serverID, 0, $pos);
151
-			$this->_wsdlRequest = true;
150
+			$serverID=substr($serverID, 0, $pos);
151
+			$this->_wsdlRequest=true;
152 152
 		}
153 153
 		else
154
-			$this->_wsdlRequest = false;
155
-		$this->_serverID = $serverID;
154
+			$this->_wsdlRequest=false;
155
+		$this->_serverID=$serverID;
156 156
 		if(!isset($this->_servers[$serverID]))
157 157
 			throw new THttpException(400, 'soapservice_request_invalid', $serverID);
158 158
 	}
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	private function loadConfig($config)
166 166
 	{
167
-		if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
167
+		if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
168 168
 		{
169 169
 			if(is_array($config))
170 170
 			{
171 171
 				foreach($config['soap'] as $id => $server)
172 172
 				{
173
-					$properties = isset($server['properties'])?$server['properties']:[];
173
+					$properties=isset($server['properties']) ? $server['properties'] : [];
174 174
 					if(isset($this->_servers[$id]))
175 175
 						throw new TConfigurationException('soapservice_serverid_duplicated', $id);
176
-					$this->_servers[$id] = $properties;
176
+					$this->_servers[$id]=$properties;
177 177
 				}
178 178
 			}
179 179
 		}
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 		{
182 182
 			foreach($config->getElementsByTagName('soap') as $serverXML)
183 183
 			{
184
-				$properties = $serverXML->getAttributes();
185
-				if(($id = $properties->remove('id')) === null)
184
+				$properties=$serverXML->getAttributes();
185
+				if(($id=$properties->remove('id'))===null)
186 186
 					throw new TConfigurationException('soapservice_serverid_required');
187 187
 				if(isset($this->_servers[$id]))
188 188
 					throw new TConfigurationException('soapservice_serverid_duplicated', $id);
189
-				$this->_servers[$id] = $properties;
189
+				$this->_servers[$id]=$properties;
190 190
 			}
191 191
 		}
192 192
 	}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function setConfigFile($value)
208 208
 	{
209
-		if(($this->_configFile = Prado::getPathOfNamespace($value, Prado::getApplication()->getConfigurationFileExt())) === null)
209
+		if(($this->_configFile=Prado::getPathOfNamespace($value, Prado::getApplication()->getConfigurationFileExt()))===null)
210 210
 			throw new TConfigurationException('soapservice_configfile_invalid', $value);
211 211
 	}
212 212
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @param boolean whether to encode the GET parameters (their names and values), defaults to true.
219 219
 	 * @return string URL for the page and GET parameters
220 220
 	 */
221
-	public function constructUrl($serverID, $getParams = null, $encodeAmpersand = true, $encodeGetItems = true)
221
+	public function constructUrl($serverID, $getParams=null, $encodeAmpersand=true, $encodeGetItems=true)
222 222
 	{
223 223
 		return $this->getRequest()->constructUrl($this->getID(), $serverID, $getParams, $encodeAmpersand, $encodeGetItems);
224 224
 	}
@@ -247,19 +247,19 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function createServer()
249 249
 	{
250
-		$properties = $this->_servers[$this->_serverID];
251
-		$serverClass = null;
252
-		if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP && isset($config['class']))
253
-			$serverClass = $config['class'];
254
-		elseif($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_XML)
255
-			$serverClass = $properties->remove('class');
256
-		if($serverClass === null)
257
-			$serverClass = self::DEFAULT_SOAP_SERVER;
250
+		$properties=$this->_servers[$this->_serverID];
251
+		$serverClass=null;
252
+		if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP && isset($config['class']))
253
+			$serverClass=$config['class'];
254
+		elseif($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_XML)
255
+			$serverClass=$properties->remove('class');
256
+		if($serverClass===null)
257
+			$serverClass=self::DEFAULT_SOAP_SERVER;
258 258
 		Prado::using($serverClass);
259
-		$className = ($pos = strrpos($serverClass, '.')) !== false?substr($serverClass, $pos + 1):$serverClass;
260
-		if($className !== self::DEFAULT_SOAP_SERVER && !is_subclass_of($className, self::DEFAULT_SOAP_SERVER))
259
+		$className=($pos=strrpos($serverClass, '.'))!==false ?substr($serverClass, $pos + 1) : $serverClass;
260
+		if($className!==self::DEFAULT_SOAP_SERVER && !is_subclass_of($className, self::DEFAULT_SOAP_SERVER))
261 261
 			throw new TConfigurationException('soapservice_server_invalid', $serverClass);
262
-		$server = new $className;
262
+		$server=new $className;
263 263
 		$server->setID($this->_serverID);
264 264
 		foreach($properties as $name => $value)
265 265
 			$server->setSubproperty($name, $value);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	public function run()
276 276
 	{
277 277
 		Prado::trace("Running SOAP service", 'Prado\Web\Services\TSoapService');
278
-		$server = $this->createServer();
278
+		$server=$this->createServer();
279 279
 		$this->getResponse()->setContentType('text/xml');
280 280
 		$this->getResponse()->setCharset($server->getEncoding());
281 281
 		if($this->getIsWsdlRequest())
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -126,8 +126,7 @@  discard block
 block discarded – undo
126 126
 				$dom = new TXmlDocument;
127 127
 				$dom->loadFromFile($this->_configFile);
128 128
 				$this->loadConfig($dom);
129
-			}
130
-			else
129
+			} else
131 130
 				throw new TConfigurationException('soapservice_configfile_invalid', $this->_configFile);
132 131
 		}
133 132
 		$this->loadConfig($config);
@@ -149,8 +148,7 @@  discard block
 block discarded – undo
149 148
 		{
150 149
 			$serverID = substr($serverID, 0, $pos);
151 150
 			$this->_wsdlRequest = true;
152
-		}
153
-		else
151
+		} else
154 152
 			$this->_wsdlRequest = false;
155 153
 		$this->_serverID = $serverID;
156 154
 		if(!isset($this->_servers[$serverID]))
@@ -176,8 +174,7 @@  discard block
 block discarded – undo
176 174
 					$this->_servers[$id] = $properties;
177 175
 				}
178 176
 			}
179
-		}
180
-		else
177
+		} else
181 178
 		{
182 179
 			foreach($config->getElementsByTagName('soap') as $serverXML)
183 180
 			{
@@ -284,8 +281,7 @@  discard block
 block discarded – undo
284 281
 			Prado::trace("Generating WSDL", 'Prado\Web\Services\TSoapService');
285 282
 			$this->getResponse()->clear();
286 283
 			$this->getResponse()->write($server->getWsdl());
287
-		}
288
-		else
284
+		} else
289 285
 		{
290 286
 			// provide SOAP service
291 287
 			Prado::trace("Handling SOAP request", 'Prado\Web\Services\TSoapService');
Please login to merge, or discard this patch.
framework/Web/Services/TSoapServer.php 2 patches
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
  */
32 32
 class TSoapServer extends \Prado\TApplicationComponent
33 33
 {
34
-	const WSDL_CACHE_PREFIX = 'wsdl.';
34
+	const WSDL_CACHE_PREFIX='wsdl.';
35 35
 
36 36
 	private $_id;
37 37
 	private $_provider;
38 38
 
39
-	private $_version = '';
40
-	private $_actor = '';
41
-	private $_encoding = '';
42
-	private $_uri = '';
39
+	private $_version='';
40
+	private $_actor='';
41
+	private $_encoding='';
42
+	private $_uri='';
43 43
 	private $_classMap;
44
-	private $_persistent = false;
45
-	private $_wsdlUri = '';
44
+	private $_persistent=false;
45
+	private $_wsdlUri='';
46 46
 
47 47
 	private $_requestedMethod;
48 48
 
@@ -62,9 +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)
65
+		if(strrpos($this->_id, '.wsdl')===strlen($this->_id) - 5)
66 66
 			throw new TInvalidDataValueException('soapserver_id_invalid', $id);
67
-		$this->_id = $id;
67
+		$this->_id=$id;
68 68
 	}
69 69
 
70 70
 	/**
@@ -72,25 +72,25 @@  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
-			$server = $this->createServer();
80
+			$server=$this->createServer();
81 81
 			$server->setClass($providerClass, $this);
82 82
 			if($this->_persistent)
83 83
 				$server->setPersistence(SOAP_PERSISTENCE_SESSION);
84 84
 		}
85 85
 		else
86
-			$server = $this->createServer();
86
+			$server=$this->createServer();
87 87
 		try
88 88
 		{
89 89
 			$server->handle();
90 90
 		}
91
-		catch (\Exception $e)
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());
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 * @param string actors
106 106
 	 * @param string message name
107 107
 	 */
108
-	public function fault($title, $details = '', $code = 'SERVER', $actor = '', $name = '')
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,14 +118,14 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function guessMethodCallRequested($class)
120 120
 	{
121
-		$namespace = $class . 'wsdl';
122
-		$message = file_get_contents("php://input");
123
-		$matches = [];
124
-		if(preg_match('/xmlns:([^=]+)="urn:' . $namespace . '"/', $message, $matches))
121
+		$namespace=$class.'wsdl';
122
+		$message=file_get_contents("php://input");
123
+		$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
-				$this->_requestedMethod = $method[1];
128
+				$this->_requestedMethod=$method[1];
129 129
 			}
130 130
 		}
131 131
 	}
@@ -145,11 +145,11 @@  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
-			$this->_server = new \SoapServer($this->getWsdlUri(), $this->getOptions());
152
+			$this->_server=new \SoapServer($this->getWsdlUri(), $this->getOptions());
153 153
 		}
154 154
 		return $this->_server;
155 155
 	}
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	protected function getOptions()
161 161
 	{
162
-		$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;
162
+		$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 167
 		if(!empty($this->_actor))
168
-			$options['actor'] = $this->_actor;
168
+			$options['actor']=$this->_actor;
169 169
 		if(!empty($this->_encoding))
170
-			$options['encoding'] = $this->_encoding;
170
+			$options['encoding']=$this->_encoding;
171 171
 		if(!empty($this->_uri))
172
-			$options['uri'] = $this->_uri;
172
+			$options['uri']=$this->_uri;
173 173
 		if(is_string($this->_classMap))
174 174
 		{
175 175
 			foreach(preg_split('/\s*,\s*/', $this->_classMap) as $className)
176
-				$options['classmap'][$className] = $className; //complex type uses the class name in the wsdl
176
+				$options['classmap'][$className]=$className; //complex type uses the class name in the wsdl
177 177
 		}
178 178
 		return $options;
179 179
 	}
@@ -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
-			$provider = $this->getProvider();
193
-			$providerClass = ($pos = strrpos($provider, '.')) !== false?substr($provider, $pos + 1):$provider;
192
+			$provider=$this->getProvider();
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);
197
+				$wsdl=$cache->get(self::WSDL_CACHE_PREFIX.$providerClass);
198 198
 				if(is_string($wsdl))
199 199
 					return $wsdl;
200
-				$wsdl = WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding());
201
-				$cache->set(self::WSDL_CACHE_PREFIX . $providerClass, $wsdl);
200
+				$wsdl=WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding());
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
 	}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function setWsdlUri($value)
228 228
 	{
229
-		$this->_wsdlUri = $value;
229
+		$this->_wsdlUri=$value;
230 230
 	}
231 231
 
232 232
 	/**
@@ -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
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	public function setUri($uri)
247 247
 	{
248
-		$this->_uri = $uri;
248
+		$this->_uri=$uri;
249 249
 	}
250 250
 
251 251
 	/**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function setProvider($provider)
263 263
 	{
264
-		$this->_provider = $provider;
264
+		$this->_provider=$provider;
265 265
 	}
266 266
 
267 267
 	/**
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function setVersion($value)
280 280
 	{
281
-		if($value === '1.1' || $value === '1.2' || $value === '')
282
-			$this->_version = $value;
281
+		if($value==='1.1' || $value==='1.2' || $value==='')
282
+			$this->_version=$value;
283 283
 		else
284 284
 			throw new TInvalidDataValueException('soapserver_version_invalid', $value);
285 285
 	}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	public function setActor($value)
299 299
 	{
300
-		$this->_actor = $value;
300
+		$this->_actor=$value;
301 301
 	}
302 302
 
303 303
 	/**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	public function setEncoding($value)
315 315
 	{
316
-		$this->_encoding = $value;
316
+		$this->_encoding=$value;
317 317
 	}
318 318
 
319 319
 	/**
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 */
330 330
 	public function setSessionPersistent($value)
331 331
 	{
332
-		$this->_persistent = TPropertyValue::ensureBoolean($value);
332
+		$this->_persistent=TPropertyValue::ensureBoolean($value);
333 333
 	}
334 334
 
335 335
 	/**
@@ -345,6 +345,6 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function setClassMaps($classes)
347 347
 	{
348
-		$this->_classMap = $classes;
348
+		$this->_classMap=$classes;
349 349
 	}
350 350
 }
351 351
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -81,14 +81,12 @@  discard block
 block discarded – undo
81 81
 			$server->setClass($providerClass, $this);
82 82
 			if($this->_persistent)
83 83
 				$server->setPersistence(SOAP_PERSISTENCE_SESSION);
84
-		}
85
-		else
84
+		} else
86 85
 			$server = $this->createServer();
87 86
 		try
88 87
 		{
89 88
 			$server->handle();
90
-		}
91
-		catch (\Exception $e)
89
+		} catch (\Exception $e)
92 90
 		{
93 91
 			if($this->getApplication()->getMode() === TApplicationMode::Debug)
94 92
 				$this->fault($e->getMessage(), $e->__toString());
@@ -200,13 +198,11 @@  discard block
 block discarded – undo
200 198
 				$wsdl = WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding());
201 199
 				$cache->set(self::WSDL_CACHE_PREFIX . $providerClass, $wsdl);
202 200
 				return $wsdl;
203
-			}
204
-			else
201
+			} else
205 202
 			{
206 203
 				return WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding());
207 204
 			}
208
-		}
209
-		else
205
+		} else
210 206
 			return file_get_contents($this->_wsdlUri);
211 207
 	}
212 208
 
Please login to merge, or discard this patch.
framework/Web/Services/TPageConfiguration.php 2 patches
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -36,23 +36,23 @@  discard block
 block discarded – undo
36 36
 	/**
37 37
 	 * @var array list of application configurations
38 38
 	 */
39
-	private $_appConfigs = [];
39
+	private $_appConfigs=[];
40 40
 	/**
41 41
 	 * @var array list of page initial property values
42 42
 	 */
43
-	private $_properties = [];
43
+	private $_properties=[];
44 44
 	/**
45 45
 	 * @var TAuthorizationRuleCollection list of authorization rules
46 46
 	 */
47
-	private $_rules = [];
47
+	private $_rules=[];
48 48
 	/**
49 49
 	 * @var array list of included configurations
50 50
 	 */
51
-	private $_includes = [];
51
+	private $_includes=[];
52 52
 	/**
53 53
 	 * @var string the currently request page in the format of Path.To.PageName
54 54
 	 */
55
-	private $_pagePath = '';
55
+	private $_pagePath='';
56 56
 
57 57
 	/**
58 58
 	 * Constructor.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function __construct($pagePath)
62 62
 	{
63
-		$this->_pagePath = $pagePath;
63
+		$this->_pagePath=$pagePath;
64 64
 	}
65 65
 
66 66
 	/**
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function loadFromFiles($basePath)
109 109
 	{
110
-		$paths = explode('.', $this->_pagePath);
111
-		$page = array_pop($paths);
112
-		$path = $basePath;
113
-		$configPagePath = '';
114
-		$fileName = Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP
110
+		$paths=explode('.', $this->_pagePath);
111
+		$page=array_pop($paths);
112
+		$path=$basePath;
113
+		$configPagePath='';
114
+		$fileName=Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
115 115
 			? TPageService::CONFIG_FILE_PHP
116 116
 			: TPageService::CONFIG_FILE_XML;
117 117
 		foreach($paths as $p)
118 118
 		{
119
-			$this->loadFromFile($path . DIRECTORY_SEPARATOR . $fileName, $configPagePath);
120
-			$path .= DIRECTORY_SEPARATOR . $p;
121
-			if($configPagePath === '')
122
-				$configPagePath = $p;
119
+			$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName, $configPagePath);
120
+			$path.=DIRECTORY_SEPARATOR.$p;
121
+			if($configPagePath==='')
122
+				$configPagePath=$p;
123 123
 			else
124
-				$configPagePath .= '.' . $p;
124
+				$configPagePath.='.'.$p;
125 125
 		}
126
-		$this->loadFromFile($path . DIRECTORY_SEPARATOR . $fileName, $configPagePath);
127
-		$this->_rules = new TAuthorizationRuleCollection($this->_rules);
126
+		$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName, $configPagePath);
127
+		$this->_rules=new TAuthorizationRuleCollection($this->_rules);
128 128
 	}
129 129
 
130 130
 	/**
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 		if(empty($fname) || !is_file($fname))
139 139
 			return;
140 140
 
141
-		if(Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
141
+		if(Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
142 142
 		{
143
-			$fcontent = include $fname;
143
+			$fcontent=include $fname;
144 144
 			$this->loadFromPhp($fcontent, dirname($fname), $configPagePath);
145 145
 		}
146 146
 		else
147 147
 		{
148
-			$dom = new TXmlDocument;
148
+			$dom=new TXmlDocument;
149 149
 			if($dom->loadFromFile($fname))
150 150
 				$this->loadFromXml($dom, dirname($fname), $configPagePath);
151 151
 			else
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 
176 176
 	public function loadApplicationConfigurationFromPhp($config, $configPath)
177 177
 	{
178
-		$appConfig = new TApplicationConfiguration;
178
+		$appConfig=new TApplicationConfiguration;
179 179
 		$appConfig->loadFromPhp($config, $configPath);
180
-		$this->_appConfigs[] = $appConfig;
180
+		$this->_appConfigs[]=$appConfig;
181 181
 	}
182 182
 
183 183
 	/**
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function loadApplicationConfigurationFromXml($dom, $configPath)
189 189
 	{
190
-		$appConfig = new TApplicationConfiguration;
190
+		$appConfig=new TApplicationConfiguration;
191 191
 		$appConfig->loadFromXml($dom, $configPath);
192
-		$this->_appConfigs[] = $appConfig;
192
+		$this->_appConfigs[]=$appConfig;
193 193
 	}
194 194
 
195 195
 	public function loadPageConfigurationFromPhp($config, $configPath, $configPagePath)
@@ -197,32 +197,32 @@  discard block
 block discarded – undo
197 197
 		// authorization
198 198
 		if(isset($config['authorization']) && is_array($config['authorization']))
199 199
 		{
200
-			$rules = [];
200
+			$rules=[];
201 201
 			foreach($config['authorization'] as $authorization)
202 202
 			{
203
-				$patterns = isset($authorization['pages'])?$authorization['pages']:'';
204
-				$ruleApplies = false;
205
-				if(empty($patterns) || trim($patterns) === '*') // null or empty string
206
-					$ruleApplies = true;
203
+				$patterns=isset($authorization['pages']) ? $authorization['pages'] : '';
204
+				$ruleApplies=false;
205
+				if(empty($patterns) || trim($patterns)==='*') // null or empty string
206
+					$ruleApplies=true;
207 207
 				else
208 208
 				{
209 209
 					foreach(explode(',', $patterns) as $pattern)
210 210
 					{
211
-						if(($pattern = trim($pattern)) !== '')
211
+						if(($pattern=trim($pattern))!=='')
212 212
 						{
213 213
 							// we know $configPagePath and $this->_pagePath
214
-							if($configPagePath !== '')  // prepend the pattern with ConfigPagePath
215
-								$pattern = $configPagePath . '.' . $pattern;
216
-							if(strcasecmp($pattern, $this->_pagePath) === 0)
214
+							if($configPagePath!=='')  // prepend the pattern with ConfigPagePath
215
+								$pattern=$configPagePath.'.'.$pattern;
216
+							if(strcasecmp($pattern, $this->_pagePath)===0)
217 217
 							{
218
-								$ruleApplies = true;
218
+								$ruleApplies=true;
219 219
 								break;
220 220
 							}
221
-							if($pattern[strlen($pattern) - 1] === '*') // try wildcard matching
221
+							if($pattern[strlen($pattern) - 1]==='*') // try wildcard matching
222 222
 							{
223
-								if(strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1) === 0)
223
+								if(strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1)===0)
224 224
 								{
225
-									$ruleApplies = true;
225
+									$ruleApplies=true;
226 226
 									break;
227 227
 								}
228 228
 							}
@@ -231,40 +231,40 @@  discard block
 block discarded – undo
231 231
 				}
232 232
 				if($ruleApplies)
233 233
 				{
234
-					$action = isset($authorization['action'])?$authorization['action']:'';
235
-					$users = isset($authorization['users'])?$authorization['users']:'';
236
-					$roles = isset($authorization['roles'])?$authorization['roles']:'';
237
-					$verb = isset($authorization['verb'])?$authorization['verb']:'';
238
-					$ips = isset($authorization['ips'])?$authorization['ips']:'';
239
-					$rules[] = new TAuthorizationRule($action, $users, $roles, $verb, $ips);
234
+					$action=isset($authorization['action']) ? $authorization['action'] : '';
235
+					$users=isset($authorization['users']) ? $authorization['users'] : '';
236
+					$roles=isset($authorization['roles']) ? $authorization['roles'] : '';
237
+					$verb=isset($authorization['verb']) ? $authorization['verb'] : '';
238
+					$ips=isset($authorization['ips']) ? $authorization['ips'] : '';
239
+					$rules[]=new TAuthorizationRule($action, $users, $roles, $verb, $ips);
240 240
 				}
241 241
 			}
242
-			$this->_rules = array_merge($rules, $this->_rules);
242
+			$this->_rules=array_merge($rules, $this->_rules);
243 243
 		}
244 244
 		// pages
245 245
 		if(isset($config['pages']) && is_array($config['pages']))
246 246
 		{
247 247
 			if(isset($config['pages']['properties']))
248 248
 			{
249
-				$this->_properties = array_merge($this->_properties, $config['pages']['properties']);
249
+				$this->_properties=array_merge($this->_properties, $config['pages']['properties']);
250 250
 				unset($config['pages']['properties']);
251 251
 			}
252 252
 			foreach($config['pages'] as $id => $page)
253 253
 			{
254
-				$properties = [];
254
+				$properties=[];
255 255
 				if(isset($page['properties']))
256 256
 				{
257
-					$properties = $page['properties'];
257
+					$properties=$page['properties'];
258 258
 					unset($page['properties']);
259 259
 				}
260
-				$matching = false;
261
-				$id = ($configPagePath === '')?$id:$configPagePath . '.' . $id;
262
-				if(strcasecmp($id, $this->_pagePath) === 0)
263
-					$matching = true;
264
-				elseif($id[strlen($id) - 1] === '*') // try wildcard matching
265
-					$matching = strncasecmp($this->_pagePath, $id, strlen($id) - 1) === 0;
260
+				$matching=false;
261
+				$id=($configPagePath==='') ? $id : $configPagePath.'.'.$id;
262
+				if(strcasecmp($id, $this->_pagePath)===0)
263
+					$matching=true;
264
+				elseif($id[strlen($id) - 1]==='*') // try wildcard matching
265
+					$matching=strncasecmp($this->_pagePath, $id, strlen($id) - 1)===0;
266 266
 				if($matching)
267
-					$this->_properties = array_merge($this->_properties, $properties);
267
+					$this->_properties=array_merge($this->_properties, $properties);
268 268
 			}
269 269
 		}
270 270
 
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
 		{
274 274
 			foreach($config['includes'] as $include)
275 275
 			{
276
-				$when = isset($include['when'])?true:false;
276
+				$when=isset($include['when']) ?true:false;
277 277
 				if(!isset($include['file']))
278 278
 					throw new TConfigurationException('pageserviceconf_includefile_required');
279
-				$filePath = $include['file'];
279
+				$filePath=$include['file'];
280 280
 				if(isset($this->_includes[$filePath]))
281
-					$this->_includes[$filePath] = [$configPagePath,'(' . $this->_includes[$filePath][1] . ') || (' . $when . ')'];
281
+					$this->_includes[$filePath]=[$configPagePath, '('.$this->_includes[$filePath][1].') || ('.$when.')'];
282 282
 				else
283
-					$this->_includes[$filePath] = [$configPagePath,$when];
283
+					$this->_includes[$filePath]=[$configPagePath, $when];
284 284
 			}
285 285
 		}
286 286
 	}
@@ -294,34 +294,34 @@  discard block
 block discarded – undo
294 294
 	public function loadPageConfigurationFromXml($dom, $configPath, $configPagePath)
295 295
 	{
296 296
 		// authorization
297
-		if(($authorizationNode = $dom->getElementByTagName('authorization')) !== null)
297
+		if(($authorizationNode=$dom->getElementByTagName('authorization'))!==null)
298 298
 		{
299
-			$rules = [];
299
+			$rules=[];
300 300
 			foreach($authorizationNode->getElements() as $node)
301 301
 			{
302
-				$patterns = $node->getAttribute('pages');
303
-				$ruleApplies = false;
304
-				if(empty($patterns) || trim($patterns) === '*') // null or empty string
305
-					$ruleApplies = true;
302
+				$patterns=$node->getAttribute('pages');
303
+				$ruleApplies=false;
304
+				if(empty($patterns) || trim($patterns)==='*') // null or empty string
305
+					$ruleApplies=true;
306 306
 				else
307 307
 				{
308 308
 					foreach(explode(',', $patterns) as $pattern)
309 309
 					{
310
-						if(($pattern = trim($pattern)) !== '')
310
+						if(($pattern=trim($pattern))!=='')
311 311
 						{
312 312
 							// we know $configPagePath and $this->_pagePath
313
-							if($configPagePath !== '')  // prepend the pattern with ConfigPagePath
314
-								$pattern = $configPagePath . '.' . $pattern;
315
-							if(strcasecmp($pattern, $this->_pagePath) === 0)
313
+							if($configPagePath!=='')  // prepend the pattern with ConfigPagePath
314
+								$pattern=$configPagePath.'.'.$pattern;
315
+							if(strcasecmp($pattern, $this->_pagePath)===0)
316 316
 							{
317
-								$ruleApplies = true;
317
+								$ruleApplies=true;
318 318
 								break;
319 319
 							}
320
-							if($pattern[strlen($pattern) - 1] === '*') // try wildcard matching
320
+							if($pattern[strlen($pattern) - 1]==='*') // try wildcard matching
321 321
 							{
322
-								if(strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1) === 0)
322
+								if(strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1)===0)
323 323
 								{
324
-									$ruleApplies = true;
324
+									$ruleApplies=true;
325 325
 									break;
326 326
 								}
327 327
 							}
@@ -329,44 +329,44 @@  discard block
 block discarded – undo
329 329
 					}
330 330
 				}
331 331
 				if($ruleApplies)
332
-					$rules[] = new TAuthorizationRule($node->getTagName(), $node->getAttribute('users'), $node->getAttribute('roles'), $node->getAttribute('verb'), $node->getAttribute('ips'));
332
+					$rules[]=new TAuthorizationRule($node->getTagName(), $node->getAttribute('users'), $node->getAttribute('roles'), $node->getAttribute('verb'), $node->getAttribute('ips'));
333 333
 			}
334
-			$this->_rules = array_merge($rules, $this->_rules);
334
+			$this->_rules=array_merge($rules, $this->_rules);
335 335
 		}
336 336
 
337 337
 		// pages
338
-		if(($pagesNode = $dom->getElementByTagName('pages')) !== null)
338
+		if(($pagesNode=$dom->getElementByTagName('pages'))!==null)
339 339
 		{
340
-			$this->_properties = array_merge($this->_properties, $pagesNode->getAttributes()->toArray());
340
+			$this->_properties=array_merge($this->_properties, $pagesNode->getAttributes()->toArray());
341 341
 			// at the page folder
342 342
 			foreach($pagesNode->getElementsByTagName('page') as $node)
343 343
 			{
344
-				$properties = $node->getAttributes();
345
-				$id = $properties->remove('id');
344
+				$properties=$node->getAttributes();
345
+				$id=$properties->remove('id');
346 346
 				if(empty($id))
347 347
 					throw new TConfigurationException('pageserviceconf_page_invalid', $configPath);
348
-				$matching = false;
349
-				$id = ($configPagePath === '')?$id:$configPagePath . '.' . $id;
350
-				if(strcasecmp($id, $this->_pagePath) === 0)
351
-					$matching = true;
352
-				elseif($id[strlen($id) - 1] === '*') // try wildcard matching
353
-					$matching = strncasecmp($this->_pagePath, $id, strlen($id) - 1) === 0;
348
+				$matching=false;
349
+				$id=($configPagePath==='') ? $id : $configPagePath.'.'.$id;
350
+				if(strcasecmp($id, $this->_pagePath)===0)
351
+					$matching=true;
352
+				elseif($id[strlen($id) - 1]==='*') // try wildcard matching
353
+					$matching=strncasecmp($this->_pagePath, $id, strlen($id) - 1)===0;
354 354
 				if($matching)
355
-					$this->_properties = array_merge($this->_properties, $properties->toArray());
355
+					$this->_properties=array_merge($this->_properties, $properties->toArray());
356 356
 			}
357 357
 		}
358 358
 
359 359
 		// external configurations
360 360
 		foreach($dom->getElementsByTagName('include') as $node)
361 361
 		{
362
-			if(($when = $node->getAttribute('when')) === null)
363
-				$when = true;
364
-			if(($filePath = $node->getAttribute('file')) === null)
362
+			if(($when=$node->getAttribute('when'))===null)
363
+				$when=true;
364
+			if(($filePath=$node->getAttribute('file'))===null)
365 365
 				throw new TConfigurationException('pageserviceconf_includefile_required');
366 366
 			if(isset($this->_includes[$filePath]))
367
-				$this->_includes[$filePath] = [$configPagePath,'(' . $this->_includes[$filePath][1] . ') || (' . $when . ')'];
367
+				$this->_includes[$filePath]=[$configPagePath, '('.$this->_includes[$filePath][1].') || ('.$when.')'];
368 368
 			else
369
-				$this->_includes[$filePath] = [$configPagePath,$when];
369
+				$this->_includes[$filePath]=[$configPagePath, $when];
370 370
 		}
371 371
 	}
372 372
 }
373 373
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -142,8 +142,7 @@
 block discarded – undo
142 142
 		{
143 143
 			$fcontent = include $fname;
144 144
 			$this->loadFromPhp($fcontent, dirname($fname), $configPagePath);
145
-		}
146
-		else
145
+		} else
147 146
 		{
148 147
 			$dom = new TXmlDocument;
149 148
 			if($dom->loadFromFile($fname))
Please login to merge, or discard this patch.
framework/Web/Services/TJsonService.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	/**
63 63
 	 * @var array registered services
64 64
 	 */
65
-	private $_services = [];
65
+	private $_services=[];
66 66
 
67 67
 	/**
68 68
 	 * Initializes this module.
@@ -80,20 +80,20 @@  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 85
 			if(is_array($config))
86 86
 			{
87 87
 				foreach($config['json'] as $id => $json)
88
-					$this->_services[$id] = $json;
88
+					$this->_services[$id]=$json;
89 89
 			}
90 90
 		}
91 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;
95
+				if(($id=$json->getAttribute('id'))!==null)
96
+					$this->_services[$id]=$json;
97 97
 				else
98 98
 					throw new TConfigurationException('jsonservice_id_required');
99 99
 			}
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function run()
108 108
 	{
109
-		$id = $this->getRequest()->getServiceParameter();
109
+		$id=$this->getRequest()->getServiceParameter();
110 110
 		if(isset($this->_services[$id]))
111 111
 		{
112
-			$serviceConfig = $this->_services[$id];
113
-			if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP)
112
+			$serviceConfig=$this->_services[$id];
113
+			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
114 114
 			{
115 115
 				if(isset($serviceConfig['class']))
116 116
 				{
117
-					$service = Prado::createComponent($serviceConfig['class']);
117
+					$service=Prado::createComponent($serviceConfig['class']);
118 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
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 			}
129 129
 			else
130 130
 			{
131
-				$properties = $serviceConfig->getAttributes();
132
-				if(($class = $properties->remove('class')) !== null)
131
+				$properties=$serviceConfig->getAttributes();
132
+				if(($class=$properties->remove('class'))!==null)
133 133
 				{
134
-					$service = Prado::createComponent($class);
134
+					$service=Prado::createComponent($class);
135 135
 					if($service instanceof TJsonResponse)
136 136
 						$this->createJsonResponse($service, $properties, $serviceConfig);
137 137
 					else
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
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
-			$response = $this->getResponse();
162
+			$response=$this->getResponse();
163 163
 			$response->setContentType('application/json');
164 164
 			$response->setCharset('UTF-8');
165 165
 			//send content
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
 				foreach($config['json'] as $id => $json)
88 88
 					$this->_services[$id] = $json;
89 89
 			}
90
-		}
91
-		else
90
+		} else
92 91
 		{
93 92
 			foreach($config->getElementsByTagName('json') as $json)
94 93
 			{
@@ -119,14 +118,11 @@  discard block
 block discarded – undo
119 118
 					{
120 119
 						$properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:[];
121 120
 						$this->createJsonResponse($service, $properties, $serviceConfig);
122
-					}
123
-					else
121
+					} else
124 122
 						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
125
-				}
126
-				else
123
+				} else
127 124
 					throw new TConfigurationException('jsonservice_class_required', $id);
128
-			}
129
-			else
125
+			} else
130 126
 			{
131 127
 				$properties = $serviceConfig->getAttributes();
132 128
 				if(($class = $properties->remove('class')) !== null)
@@ -136,12 +132,10 @@  discard block
 block discarded – undo
136 132
 						$this->createJsonResponse($service, $properties, $serviceConfig);
137 133
 					else
138 134
 						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
139
-				}
140
-				else
135
+				} else
141 136
 					throw new TConfigurationException('jsonservice_class_required', $id);
142 137
 			}
143
-		}
144
-		else
138
+		} else
145 139
 			throw new THttpException(404, 'jsonservice_provider_unknown', $id);
146 140
 	}
147 141
 
Please login to merge, or discard this patch.
framework/Web/THttpCookie.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @var string domain of the cookie
30 30
 	 */
31
-	private $_domain = '';
31
+	private $_domain='';
32 32
 	/**
33 33
 	 * @var string name of the cookie
34 34
 	 */
@@ -36,23 +36,23 @@  discard block
 block discarded – undo
36 36
 	/**
37 37
 	 * @var string value of the cookie
38 38
 	 */
39
-	private $_value = '';
39
+	private $_value='';
40 40
 	/**
41 41
 	 * @var integer expire of the cookie
42 42
 	 */
43
-	private $_expire = 0;
43
+	private $_expire=0;
44 44
 	/**
45 45
 	 * @var string path of the cookie
46 46
 	 */
47
-	private $_path = '/';
47
+	private $_path='/';
48 48
 	/**
49 49
 	 * @var boolean whether cookie should be sent via secure connection
50 50
 	 */
51
-	private $_secure = false;
51
+	private $_secure=false;
52 52
 	/**
53 53
 	 * @var boolean if true the cookie value will be unavailable to JavaScript
54 54
 	 */
55
-	private $_httpOnly = false;
55
+	private $_httpOnly=false;
56 56
 
57 57
 	/**
58 58
 	 * Constructor.
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function __construct($name, $value)
63 63
 	{
64
-		$this->_name = $name;
65
-		$this->_value = $value;
64
+		$this->_name=$name;
65
+		$this->_value=$value;
66 66
 	}
67 67
 
68 68
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function setDomain($value)
80 80
 	{
81
-		$this->_domain = $value;
81
+		$this->_domain=$value;
82 82
 	}
83 83
 
84 84
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function setExpire($value)
96 96
 	{
97
-		$this->_expire = TPropertyValue::ensureInteger($value);
97
+		$this->_expire=TPropertyValue::ensureInteger($value);
98 98
 	}
99 99
 
100 100
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function setHttpOnly($value)
112 112
 	{
113
-		$this->_httpOnly = TPropertyValue::ensureBoolean($value);
113
+		$this->_httpOnly=TPropertyValue::ensureBoolean($value);
114 114
 	}
115 115
 
116 116
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function setName($value)
128 128
 	{
129
-		$this->_name = $value;
129
+		$this->_name=$value;
130 130
 	}
131 131
 
132 132
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function setValue($value)
144 144
 	{
145
-		$this->_value = $value;
145
+		$this->_value=$value;
146 146
 	}
147 147
 
148 148
 	/**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function setPath($value)
160 160
 	{
161
-		$this->_path = $value;
161
+		$this->_path=$value;
162 162
 	}
163 163
 
164 164
 	/**
@@ -174,6 +174,6 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function setSecure($value)
176 176
 	{
177
-		$this->_secure = TPropertyValue::ensureBoolean($value);
177
+		$this->_secure=TPropertyValue::ensureBoolean($value);
178 178
 	}
179 179
 }
180 180
\ No newline at end of file
Please login to merge, or discard this patch.