Completed
Pull Request — master (#54)
by Reginaldo
41:52
created
PagSeguro/source/PagSeguroLibrary/service/PagSeguroConnectionData.class.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -80,6 +80,10 @@  discard block
 block discarded – undo
80 80
      * @param PagSeguroCredentials $credentials
81 81
      * @param $serviceName
82 82
      */
83
+
84
+    /**
85
+     * @param string $serviceName
86
+     */
83 87
     public function __construct(PagSeguroCredentials $credentials, $serviceName)
84 88
     {
85 89
 
@@ -298,6 +302,10 @@  discard block
 block discarded – undo
298 302
      * @param $resource
299 303
      * @return mixed
300 304
      */
305
+
306
+    /**
307
+     * @param string $resource
308
+     */
301 309
     public function getResource($resource)
302 310
     {
303 311
         return $this->resources[$resource];
Please login to merge, or discard this patch.
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * 2007-2014 [PagSeguro Internet Ltda.]
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- *Licensed under the Apache License, Version 2.0 (the "License");
8
- *you may not use this file except in compliance with the License.
9
- *You may obtain a copy of the License at
10
- *
11
- *http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- *Unless required by applicable law or agreed to in writing, software
14
- *distributed under the License is distributed on an "AS IS" BASIS,
15
- *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- *See the License for the specific language governing permissions and
17
- *limitations under the License.
18
- *
19
- *  @author    PagSeguro Internet Ltda.
20
- *  @copyright 2007-2014 PagSeguro Internet Ltda.
21
- *  @license   http://www.apache.org/licenses/LICENSE-2.0
22
- */
3
+	 * 2007-2014 [PagSeguro Internet Ltda.]
4
+	 *
5
+	 * NOTICE OF LICENSE
6
+	 *
7
+	 *Licensed under the Apache License, Version 2.0 (the "License");
8
+	 *you may not use this file except in compliance with the License.
9
+	 *You may obtain a copy of the License at
10
+	 *
11
+	 *http://www.apache.org/licenses/LICENSE-2.0
12
+	 *
13
+	 *Unless required by applicable law or agreed to in writing, software
14
+	 *distributed under the License is distributed on an "AS IS" BASIS,
15
+	 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+	 *See the License for the specific language governing permissions and
17
+	 *limitations under the License.
18
+	 *
19
+	 *  @author    PagSeguro Internet Ltda.
20
+	 *  @copyright 2007-2014 PagSeguro Internet Ltda.
21
+	 *  @license   http://www.apache.org/licenses/LICENSE-2.0
22
+	 */
23 23
 
24 24
 /***
25 25
  * Class PagSeguroConnectionData
@@ -27,297 +27,297 @@  discard block
 block discarded – undo
27 27
 class PagSeguroConnectionData
28 28
 {
29 29
 
30
-    /***
30
+	/***
31 31
      * @var
32 32
      */
33
-    private $serviceName;
34
-    /***
33
+	private $serviceName;
34
+	/***
35 35
      * @var PagSeguroCredentials
36 36
      */
37
-    private $credentials;
38
-    /***
37
+	private $credentials;
38
+	/***
39 39
      * @var
40 40
      */
41
-    private $resources;
42
-    /***
41
+	private $resources;
42
+	/***
43 43
      * @var
44 44
      */
45
-    private $environment;
46
-    /***
45
+	private $environment;
46
+	/***
47 47
      * @var
48 48
      */
49
-    private $webserviceUrl;
50
-    /***
49
+	private $webserviceUrl;
50
+	/***
51 51
      * @var
52 52
      */
53
-    private $paymentUrl;
54
-    /***
53
+	private $paymentUrl;
54
+	/***
55 55
      * @var
56 56
      */
57
-    private $baseUrl;
58
-    /***
57
+	private $baseUrl;
58
+	/***
59 59
      * @var
60 60
      */
61
-    private $installmentUrl;
62
-    /***
61
+	private $installmentUrl;
62
+	/***
63 63
      * @var
64 64
      */
65
-    private $sessionUrl;
66
-    /***
65
+	private $sessionUrl;
66
+	/***
67 67
      * @var
68 68
      */
69
-    private $servicePath;
70
-    /***
69
+	private $servicePath;
70
+	/***
71 71
      * @var
72 72
      */
73
-    private $serviceTimeout;
74
-    /***
73
+	private $serviceTimeout;
74
+	/***
75 75
      * @var
76 76
      */
77
-    private $charset;
77
+	private $charset;
78 78
 
79
-    /***
79
+	/***
80 80
      * @param PagSeguroCredentials $credentials
81 81
      * @param $serviceName
82 82
      */
83
-    public function __construct(PagSeguroCredentials $credentials, $serviceName)
84
-    {
85
-
86
-        $this->credentials = $credentials;
87
-        $this->serviceName = $serviceName;
88
-
89
-        try {
90
-            $this->setEnvironment(PagSeguroConfig::getEnvironment());
91
-            $this->setWebserviceUrl(PagSeguroResources::getWebserviceUrl($this->getEnvironment()));
92
-            $this->setPaymentUrl(PagSeguroResources::getPaymentUrl($this->getEnvironment()));
93
-            $this->setBaseUrl(PagSeguroResources::getBaseUrl($this->getEnvironment()));
94
-            $this->setInstallmentUrl(PagSeguroResources::getInstallmentUrl());
95
-            $this->setAuthorizationUrl(PagSeguroResources::getAuthorizationUrl());
96
-            $this->setSessionUrl(PagSeguroResources::getSessionUrl());
97
-            $this->setCharset(PagSeguroConfig::getApplicationCharset());
98
-
99
-            $this->resources = PagSeguroResources::getData($this->serviceName);
100
-            if (isset($this->resources['servicePath'])) {
101
-                $this->setServicePath($this->resources['servicePath']);
102
-            }
103
-            if (isset($this->resources['serviceTimeout'])) {
104
-                $this->setServiceTimeout($this->resources['serviceTimeout']);
105
-            }
106
-        } catch (Exception $e) {
107
-            throw $e;
108
-        }
109
-    }
110
-
111
-    /***
83
+	public function __construct(PagSeguroCredentials $credentials, $serviceName)
84
+	{
85
+
86
+		$this->credentials = $credentials;
87
+		$this->serviceName = $serviceName;
88
+
89
+		try {
90
+			$this->setEnvironment(PagSeguroConfig::getEnvironment());
91
+			$this->setWebserviceUrl(PagSeguroResources::getWebserviceUrl($this->getEnvironment()));
92
+			$this->setPaymentUrl(PagSeguroResources::getPaymentUrl($this->getEnvironment()));
93
+			$this->setBaseUrl(PagSeguroResources::getBaseUrl($this->getEnvironment()));
94
+			$this->setInstallmentUrl(PagSeguroResources::getInstallmentUrl());
95
+			$this->setAuthorizationUrl(PagSeguroResources::getAuthorizationUrl());
96
+			$this->setSessionUrl(PagSeguroResources::getSessionUrl());
97
+			$this->setCharset(PagSeguroConfig::getApplicationCharset());
98
+
99
+			$this->resources = PagSeguroResources::getData($this->serviceName);
100
+			if (isset($this->resources['servicePath'])) {
101
+				$this->setServicePath($this->resources['servicePath']);
102
+			}
103
+			if (isset($this->resources['serviceTimeout'])) {
104
+				$this->setServiceTimeout($this->resources['serviceTimeout']);
105
+			}
106
+		} catch (Exception $e) {
107
+			throw $e;
108
+		}
109
+	}
110
+
111
+	/***
112 112
      * @return PagSeguroCredentials
113 113
      */
114
-    public function getCredentials()
115
-    {
116
-        return $this->credentials;
117
-    }
114
+	public function getCredentials()
115
+	{
116
+		return $this->credentials;
117
+	}
118 118
 
119
-    /***
119
+	/***
120 120
      * @param PagSeguroCredentials $credentials
121 121
      */
122
-    public function setCredentials(PagSeguroCredentials $credentials)
123
-    {
124
-        $this->credentials = $credentials;
125
-    }
122
+	public function setCredentials(PagSeguroCredentials $credentials)
123
+	{
124
+		$this->credentials = $credentials;
125
+	}
126 126
 
127
-    /***
127
+	/***
128 128
      * @return string
129 129
      */
130
-    public function getCredentialsUrlQuery()
131
-    {
132
-        return http_build_query($this->credentials->getAttributesMap(), '', '&');
133
-    }
130
+	public function getCredentialsUrlQuery()
131
+	{
132
+		return http_build_query($this->credentials->getAttributesMap(), '', '&');
133
+	}
134 134
 
135
-    /***
135
+	/***
136 136
      * @return mixed
137 137
      */
138
-    public function getEnvironment()
139
-    {
140
-        return $this->environment;
141
-    }
138
+	public function getEnvironment()
139
+	{
140
+		return $this->environment;
141
+	}
142 142
 
143
-    /***
143
+	/***
144 144
      * @param $environment
145 145
      */
146
-    public function setEnvironment($environment)
147
-    {
148
-        $this->environment = $environment;
149
-    }
146
+	public function setEnvironment($environment)
147
+	{
148
+		$this->environment = $environment;
149
+	}
150 150
 
151
-    /***
151
+	/***
152 152
      * @return mixed
153 153
      */
154
-    public function getWebserviceUrl()
155
-    {
156
-        return $this->webserviceUrl;
157
-    }
154
+	public function getWebserviceUrl()
155
+	{
156
+		return $this->webserviceUrl;
157
+	}
158 158
 
159
-    /***
159
+	/***
160 160
      * @param $webserviceUrl
161 161
      */
162
-    public function setWebserviceUrl($webserviceUrl)
163
-    {
164
-        $this->webserviceUrl = $webserviceUrl;
165
-    }
162
+	public function setWebserviceUrl($webserviceUrl)
163
+	{
164
+		$this->webserviceUrl = $webserviceUrl;
165
+	}
166 166
 
167
-    /***
167
+	/***
168 168
      * @return mixed
169 169
      */
170
-    public function getPaymentUrl()
171
-    {
172
-        return $this->paymentUrl;
173
-    }
170
+	public function getPaymentUrl()
171
+	{
172
+		return $this->paymentUrl;
173
+	}
174 174
 
175
-    /***
175
+	/***
176 176
      * @param $paymentUrl
177 177
      */
178
-    public function setPaymentUrl($paymentUrl)
179
-    {
180
-        $this->paymentUrl = $paymentUrl;
181
-    }
178
+	public function setPaymentUrl($paymentUrl)
179
+	{
180
+		$this->paymentUrl = $paymentUrl;
181
+	}
182 182
 
183
-    /***
183
+	/***
184 184
      * @return mixed
185 185
      */
186
-    public function getBaseUrl()
187
-    {
188
-        return $this->baseUrl;
189
-    }
186
+	public function getBaseUrl()
187
+	{
188
+		return $this->baseUrl;
189
+	}
190 190
 
191
-    /***
191
+	/***
192 192
      * @param $baseUrl
193 193
      */
194
-    public function setBaseUrl($baseUrl)
195
-    {
196
-        $this->baseUrl = $baseUrl;
197
-    }
194
+	public function setBaseUrl($baseUrl)
195
+	{
196
+		$this->baseUrl = $baseUrl;
197
+	}
198 198
 
199
-    /***
199
+	/***
200 200
      * @return mixed
201 201
      */
202
-    public function getInstallmentUrl()
203
-    {
204
-        return $this->installmentUrl;
205
-    }
202
+	public function getInstallmentUrl()
203
+	{
204
+		return $this->installmentUrl;
205
+	}
206 206
 
207
-    /***
207
+	/***
208 208
      * @param $installmentUrl
209 209
      */
210
-    public function setInstallmentUrl($installmentUrl)
211
-    {
212
-        $this->installmentUrl = $installmentUrl;
213
-    }
210
+	public function setInstallmentUrl($installmentUrl)
211
+	{
212
+		$this->installmentUrl = $installmentUrl;
213
+	}
214 214
 
215
-    /***
215
+	/***
216 216
      * @return mixed
217 217
      */
218
-    public function getAuthorizationUrl()
219
-    {
220
-        return $this->authorizationUrl;
221
-    }
218
+	public function getAuthorizationUrl()
219
+	{
220
+		return $this->authorizationUrl;
221
+	}
222 222
 
223
-    /***
223
+	/***
224 224
      * @param $installmentUrl
225 225
      */
226
-    public function setAuthorizationUrl($authorizationUrl)
227
-    {
228
-        $this->authorizationUrl = $authorizationUrl;
229
-    }
226
+	public function setAuthorizationUrl($authorizationUrl)
227
+	{
228
+		$this->authorizationUrl = $authorizationUrl;
229
+	}
230 230
 
231
-    /***
231
+	/***
232 232
      * @return mixed
233 233
      */
234
-    public function getSessionUrl()
235
-    {
236
-        return $this->sessionUrl;
237
-    }
234
+	public function getSessionUrl()
235
+	{
236
+		return $this->sessionUrl;
237
+	}
238 238
 
239
-    /***
239
+	/***
240 240
      * @param $installmentUrl
241 241
      */
242
-    public function setSessionUrl($sessionUrl)
243
-    {
244
-        $this->sessionUrl = $sessionUrl;
245
-    }
242
+	public function setSessionUrl($sessionUrl)
243
+	{
244
+		$this->sessionUrl = $sessionUrl;
245
+	}
246 246
 
247
-    /***
247
+	/***
248 248
      * @param mixed $version
249 249
      * @return mixed
250 250
      */
251
-    public function getServicePath($version = null)
252
-    {
253
-        if ($version) {
254
-            return $this->servicePath[$version];
255
-        } else {
256
-            return $this->servicePath;
257
-        }
258
-    }
251
+	public function getServicePath($version = null)
252
+	{
253
+		if ($version) {
254
+			return $this->servicePath[$version];
255
+		} else {
256
+			return $this->servicePath;
257
+		}
258
+	}
259 259
 
260
-    /***
260
+	/***
261 261
      * @param $servicePath
262 262
      */
263
-    public function setServicePath($servicePath)
264
-    {
265
-        $this->servicePath = $servicePath;
266
-    }
263
+	public function setServicePath($servicePath)
264
+	{
265
+		$this->servicePath = $servicePath;
266
+	}
267 267
 
268
-    /***
268
+	/***
269 269
      * @return mixed
270 270
      */
271
-    public function getServiceTimeout()
272
-    {
273
-        return $this->serviceTimeout;
274
-    }
271
+	public function getServiceTimeout()
272
+	{
273
+		return $this->serviceTimeout;
274
+	}
275 275
 
276
-    /***
276
+	/***
277 277
      * @param $serviceTimeout
278 278
      */
279
-    public function setServiceTimeout($serviceTimeout)
280
-    {
281
-        $this->serviceTimeout = $serviceTimeout;
282
-    }
279
+	public function setServiceTimeout($serviceTimeout)
280
+	{
281
+		$this->serviceTimeout = $serviceTimeout;
282
+	}
283 283
 
284
-    /***
284
+	/***
285 285
      * @param mixed $version
286 286
      * @return string
287 287
      */
288
-    public function getServiceUrl($version = null)
289
-    {
290
-        if ($version) {
291
-            return $this->getWebserviceUrl() . $this->getServicePath($version);
292
-        } else {
293
-            return $this->getWebserviceUrl() . $this->getServicePath();
294
-        }
295
-    }
288
+	public function getServiceUrl($version = null)
289
+	{
290
+		if ($version) {
291
+			return $this->getWebserviceUrl() . $this->getServicePath($version);
292
+		} else {
293
+			return $this->getWebserviceUrl() . $this->getServicePath();
294
+		}
295
+	}
296 296
 
297
-    /***
297
+	/***
298 298
      * @param $resource
299 299
      * @return mixed
300 300
      */
301
-    public function getResource($resource)
302
-    {
303
-        return $this->resources[$resource];
304
-    }
301
+	public function getResource($resource)
302
+	{
303
+		return $this->resources[$resource];
304
+	}
305 305
 
306
-    /***
306
+	/***
307 307
      * @return mixed
308 308
      */
309
-    public function getCharset()
310
-    {
311
-        return $this->charset;
312
-    }
309
+	public function getCharset()
310
+	{
311
+		return $this->charset;
312
+	}
313 313
 
314
-    /***
314
+	/***
315 315
      * @param $charset
316 316
      */
317
-    public function setCharset($charset)
318
-    {
319
-        $this->charset = $charset;
320
-    }
317
+	public function setCharset($charset)
318
+	{
319
+		$this->charset = $charset;
320
+	}
321 321
 
322 322
 
323 323
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -288,9 +288,9 @@
 block discarded – undo
288 288
     public function getServiceUrl($version = null)
289 289
     {
290 290
         if ($version) {
291
-            return $this->getWebserviceUrl() . $this->getServicePath($version);
291
+            return $this->getWebserviceUrl().$this->getServicePath($version);
292 292
         } else {
293
-            return $this->getWebserviceUrl() . $this->getServicePath();
293
+            return $this->getWebserviceUrl().$this->getServicePath();
294 294
         }
295 295
     }
296 296
 
Please login to merge, or discard this patch.
source/PagSeguroLibrary/service/PagSeguroNotificationService.class.php 4 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -39,6 +39,10 @@  discard block
 block discarded – undo
39 39
      * @param $notificationCode
40 40
      * @return string
41 41
      */
42
+
43
+    /**
44
+     * @param string $notificationCode
45
+     */
42 46
     private static function buildTransactionNotificationUrl(PagSeguroConnectionData $connectionData, $notificationCode)
43 47
     {
44 48
         $url = $connectionData->getServiceUrl();
@@ -50,6 +54,10 @@  discard block
 block discarded – undo
50 54
      * @param $notificationCode
51 55
      * @return string
52 56
      */
57
+
58
+    /**
59
+     * @param string $notificationCode
60
+     */
53 61
     private static function buildAuthorizationNotificationUrl(PagSeguroConnectionData $connectionData, $notificationCode)
54 62
     {
55 63
         $url = $connectionData->getWebserviceUrl() . '/' . $connectionData->getResource('applicationPath');
Please login to merge, or discard this patch.
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * 2007-2014 [PagSeguro Internet Ltda.]
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- *Licensed under the Apache License, Version 2.0 (the "License");
8
- *you may not use this file except in compliance with the License.
9
- *You may obtain a copy of the License at
10
- *
11
- *http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- *Unless required by applicable law or agreed to in writing, software
14
- *distributed under the License is distributed on an "AS IS" BASIS,
15
- *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- *See the License for the specific language governing permissions and
17
- *limitations under the License.
18
- *
19
- *  @author    PagSeguro Internet Ltda.
20
- *  @copyright 2007-2014 PagSeguro Internet Ltda.
21
- *  @license   http://www.apache.org/licenses/LICENSE-2.0
22
- */
3
+	 * 2007-2014 [PagSeguro Internet Ltda.]
4
+	 *
5
+	 * NOTICE OF LICENSE
6
+	 *
7
+	 *Licensed under the Apache License, Version 2.0 (the "License");
8
+	 *you may not use this file except in compliance with the License.
9
+	 *You may obtain a copy of the License at
10
+	 *
11
+	 *http://www.apache.org/licenses/LICENSE-2.0
12
+	 *
13
+	 *Unless required by applicable law or agreed to in writing, software
14
+	 *distributed under the License is distributed on an "AS IS" BASIS,
15
+	 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+	 *See the License for the specific language governing permissions and
17
+	 *limitations under the License.
18
+	 *
19
+	 *  @author    PagSeguro Internet Ltda.
20
+	 *  @copyright 2007-2014 PagSeguro Internet Ltda.
21
+	 *  @license   http://www.apache.org/licenses/LICENSE-2.0
22
+	 */
23 23
 
24 24
 /***
25 25
  * Encapsulates web service calls regarding PagSeguro notifications
@@ -27,36 +27,36 @@  discard block
 block discarded – undo
27 27
 class PagSeguroNotificationService
28 28
 {
29 29
 
30
-    /***
30
+	/***
31 31
      *
32 32
      */
33
-    const SERVICE_NAME = 'notificationService';
33
+	const SERVICE_NAME = 'notificationService';
34 34
 
35
-    private static $logService;
35
+	private static $logService;
36 36
 
37
-    /***
37
+	/***
38 38
      * @param PagSeguroConnectionData $connectionData
39 39
      * @param $notificationCode
40 40
      * @return string
41 41
      */
42
-    private static function buildTransactionNotificationUrl(PagSeguroConnectionData $connectionData, $notificationCode)
43
-    {
44
-        $url = $connectionData->getServiceUrl();
45
-        return "{$url}/{$notificationCode}/?" . $connectionData->getCredentialsUrlQuery();
46
-    }
42
+	private static function buildTransactionNotificationUrl(PagSeguroConnectionData $connectionData, $notificationCode)
43
+	{
44
+		$url = $connectionData->getServiceUrl();
45
+		return "{$url}/{$notificationCode}/?" . $connectionData->getCredentialsUrlQuery();
46
+	}
47 47
 
48
-    /***
48
+	/***
49 49
      * @param PagSeguroConnectionData $connectionData
50 50
      * @param $notificationCode
51 51
      * @return string
52 52
      */
53
-    private static function buildAuthorizationNotificationUrl(PagSeguroConnectionData $connectionData, $notificationCode)
54
-    {
55
-        $url = $connectionData->getWebserviceUrl() . '/' . $connectionData->getResource('applicationPath');
56
-        return "{$url}/{$notificationCode}/?" . $connectionData->getCredentialsUrlQuery();
57
-    }
53
+	private static function buildAuthorizationNotificationUrl(PagSeguroConnectionData $connectionData, $notificationCode)
54
+	{
55
+		$url = $connectionData->getWebserviceUrl() . '/' . $connectionData->getResource('applicationPath');
56
+		return "{$url}/{$notificationCode}/?" . $connectionData->getCredentialsUrlQuery();
57
+	}
58 58
 
59
-    /***
59
+	/***
60 60
      * Returns a transaction from a notification code
61 61
      *
62 62
      * @param PagSeguroCredentials $credentials
@@ -66,35 +66,35 @@  discard block
 block discarded – undo
66 66
      * @return PagSeguroTransaction
67 67
      * @see PagSeguroTransaction
68 68
      */
69
-    public static function checkTransaction(PagSeguroCredentials $credentials, $notificationCode)
70
-    {
69
+	public static function checkTransaction(PagSeguroCredentials $credentials, $notificationCode)
70
+	{
71 71
 
72
-        LogPagSeguro::info("PagSeguroNotificationService.CheckTransaction(notificationCode=$notificationCode) - begin");
73
-        $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
72
+		LogPagSeguro::info("PagSeguroNotificationService.CheckTransaction(notificationCode=$notificationCode) - begin");
73
+		$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
74 74
 
75
-        try {
75
+		try {
76 76
 
77
-            $connection = new PagSeguroHttpConnection();
78
-            $connection->get(
79
-                self::buildTransactionNotificationUrl($connectionData, $notificationCode),
80
-                $connectionData->getServiceTimeout(),
81
-                $connectionData->getCharset()
82
-            );
77
+			$connection = new PagSeguroHttpConnection();
78
+			$connection->get(
79
+				self::buildTransactionNotificationUrl($connectionData, $notificationCode),
80
+				$connectionData->getServiceTimeout(),
81
+				$connectionData->getCharset()
82
+			);
83 83
 
84
-            $transaction = PagSeguroTransactionParser::readTransaction($connection->getResponse());
84
+			$transaction = PagSeguroTransactionParser::readTransaction($connection->getResponse());
85 85
 
86
-            self::$logService = "CheckTransaction";
87
-            return self::searchReturn($connection, $transaction, $notificationCode);
86
+			self::$logService = "CheckTransaction";
87
+			return self::searchReturn($connection, $transaction, $notificationCode);
88 88
 
89
-        } catch (PagSeguroServiceException $err) {
90
-            throw $err;
91
-        } catch (Exception $err) {
92
-            LogPagSeguro::error("Exception: " . $err->getMessage());
93
-            throw $err;
94
-        }
95
-    }
89
+		} catch (PagSeguroServiceException $err) {
90
+			throw $err;
91
+		} catch (Exception $err) {
92
+			LogPagSeguro::error("Exception: " . $err->getMessage());
93
+			throw $err;
94
+		}
95
+	}
96 96
 
97
-    /***
97
+	/***
98 98
      * Returns a authorization from a notification code
99 99
      *
100 100
      * @param PagSeguroCredentials $credentials
@@ -104,79 +104,79 @@  discard block
 block discarded – undo
104 104
      * @return PagSeguroAuthorization
105 105
      * @see PagSeguroAuthorization
106 106
      */
107
-    public static function checkAuthorization(PagSeguroCredentials $credentials, $notificationCode)
108
-    {
109
-
110
-        LogPagSeguro::info(
111
-            "PagSeguroNotificationService.CheckAuthorization(notificationCode=$notificationCode) - begin"
112
-        );
113
-
114
-        $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
115
-
116
-        try {
117
-
118
-            $connection = new PagSeguroHttpConnection();
119
-            $connection->get(
120
-                self::buildAuthorizationNotificationUrl($connectionData, $notificationCode),
121
-                $connectionData->getServiceTimeout(),
122
-                $connectionData->getCharset()
123
-            );
124
-
125
-            $authorization = PagSeguroAuthorizationParser::readAuthorization($connection->getResponse());
126
-            self::$logService = "CheckAuthorization";
127
-            return self::searchReturn($connection, $authorization, $notificationCode);
128
-
129
-        } catch (PagSeguroServiceException $err) {
130
-            throw $err;
131
-        }
132
-        catch (Exception $err) {
133
-            LogPagSeguro::error("Exception: " . $err->getMessage());
134
-            throw $err;
135
-        }
136
-    }
137
-
138
-    /**
139
-     * @param PagSeguroHttpConnection $connection
140
-     * @param string $code
141
-     * @return bool|mixed|string
142
-     * @throws PagSeguroServiceException
143
-     */
144
-    private function searchReturn($connection, $parsers, $code)
145
-    {
146
-        $httpStatus = new PagSeguroHttpStatus($connection->getStatus());
147
-
148
-        switch ($httpStatus->getType()) {
149
-
150
-            case 'OK':
151
-
152
-                LogPagSeguro::info(
153
-                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - end ", self::$logService) .
154
-                    $parsers->toString() . ")"
155
-                );
156
-                break;
157
-
158
-            case 'BAD_REQUEST':
159
-
160
-                $errors = PagSeguroServiceParser::readErrors($connection->getResponse());
161
-
162
-                $err = new PagSeguroServiceException($httpStatus, $errors);
163
-                LogPagSeguro::info(
164
-                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - error ", self::$logService) .
165
-                    $err->getOneLineMessage()
166
-                );
167
-                throw $err;
168
-                break;
169
-
170
-            default:
171
-                $err = new PagSeguroServiceException($httpStatus);
172
-                LogPagSeguro::info(
173
-                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - error ", self::$logService) .
174
-                    $err->getOneLineMessage()
175
-                );
176
-                throw $err;
177
-                break;
178
-        }
179
-        return isset($parsers) ? $parsers : null;
180
-    }
107
+	public static function checkAuthorization(PagSeguroCredentials $credentials, $notificationCode)
108
+	{
109
+
110
+		LogPagSeguro::info(
111
+			"PagSeguroNotificationService.CheckAuthorization(notificationCode=$notificationCode) - begin"
112
+		);
113
+
114
+		$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
115
+
116
+		try {
117
+
118
+			$connection = new PagSeguroHttpConnection();
119
+			$connection->get(
120
+				self::buildAuthorizationNotificationUrl($connectionData, $notificationCode),
121
+				$connectionData->getServiceTimeout(),
122
+				$connectionData->getCharset()
123
+			);
124
+
125
+			$authorization = PagSeguroAuthorizationParser::readAuthorization($connection->getResponse());
126
+			self::$logService = "CheckAuthorization";
127
+			return self::searchReturn($connection, $authorization, $notificationCode);
128
+
129
+		} catch (PagSeguroServiceException $err) {
130
+			throw $err;
131
+		}
132
+		catch (Exception $err) {
133
+			LogPagSeguro::error("Exception: " . $err->getMessage());
134
+			throw $err;
135
+		}
136
+	}
137
+
138
+	/**
139
+	 * @param PagSeguroHttpConnection $connection
140
+	 * @param string $code
141
+	 * @return bool|mixed|string
142
+	 * @throws PagSeguroServiceException
143
+	 */
144
+	private function searchReturn($connection, $parsers, $code)
145
+	{
146
+		$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
147
+
148
+		switch ($httpStatus->getType()) {
149
+
150
+			case 'OK':
151
+
152
+				LogPagSeguro::info(
153
+					sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - end ", self::$logService) .
154
+					$parsers->toString() . ")"
155
+				);
156
+				break;
157
+
158
+			case 'BAD_REQUEST':
159
+
160
+				$errors = PagSeguroServiceParser::readErrors($connection->getResponse());
161
+
162
+				$err = new PagSeguroServiceException($httpStatus, $errors);
163
+				LogPagSeguro::info(
164
+					sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - error ", self::$logService) .
165
+					$err->getOneLineMessage()
166
+				);
167
+				throw $err;
168
+				break;
169
+
170
+			default:
171
+				$err = new PagSeguroServiceException($httpStatus);
172
+				LogPagSeguro::info(
173
+					sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - error ", self::$logService) .
174
+					$err->getOneLineMessage()
175
+				);
176
+				throw $err;
177
+				break;
178
+		}
179
+		return isset($parsers) ? $parsers : null;
180
+	}
181 181
 
182 182
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     private static function buildTransactionNotificationUrl(PagSeguroConnectionData $connectionData, $notificationCode)
43 43
     {
44 44
         $url = $connectionData->getServiceUrl();
45
-        return "{$url}/{$notificationCode}/?" . $connectionData->getCredentialsUrlQuery();
45
+        return "{$url}/{$notificationCode}/?".$connectionData->getCredentialsUrlQuery();
46 46
     }
47 47
 
48 48
     /***
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
      */
53 53
     private static function buildAuthorizationNotificationUrl(PagSeguroConnectionData $connectionData, $notificationCode)
54 54
     {
55
-        $url = $connectionData->getWebserviceUrl() . '/' . $connectionData->getResource('applicationPath');
56
-        return "{$url}/{$notificationCode}/?" . $connectionData->getCredentialsUrlQuery();
55
+        $url = $connectionData->getWebserviceUrl().'/'.$connectionData->getResource('applicationPath');
56
+        return "{$url}/{$notificationCode}/?".$connectionData->getCredentialsUrlQuery();
57 57
     }
58 58
 
59 59
     /***
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         } catch (PagSeguroServiceException $err) {
90 90
             throw $err;
91 91
         } catch (Exception $err) {
92
-            LogPagSeguro::error("Exception: " . $err->getMessage());
92
+            LogPagSeguro::error("Exception: ".$err->getMessage());
93 93
             throw $err;
94 94
         }
95 95
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             throw $err;
131 131
         }
132 132
         catch (Exception $err) {
133
-            LogPagSeguro::error("Exception: " . $err->getMessage());
133
+            LogPagSeguro::error("Exception: ".$err->getMessage());
134 134
             throw $err;
135 135
         }
136 136
     }
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
             case 'OK':
151 151
 
152 152
                 LogPagSeguro::info(
153
-                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - end ", self::$logService) .
154
-                    $parsers->toString() . ")"
153
+                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - end ", self::$logService).
154
+                    $parsers->toString().")"
155 155
                 );
156 156
                 break;
157 157
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
                 $err = new PagSeguroServiceException($httpStatus, $errors);
163 163
                 LogPagSeguro::info(
164
-                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - error ", self::$logService) .
164
+                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - error ", self::$logService).
165 165
                     $err->getOneLineMessage()
166 166
                 );
167 167
                 throw $err;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             default:
171 171
                 $err = new PagSeguroServiceException($httpStatus);
172 172
                 LogPagSeguro::info(
173
-                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - error ", self::$logService) .
173
+                    sprintf("PagSeguroNotificationService.%s(notificationCode=$code) - error ", self::$logService).
174 174
                     $err->getOneLineMessage()
175 175
                 );
176 176
                 throw $err;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,8 +128,7 @@
 block discarded – undo
128 128
 
129 129
         } catch (PagSeguroServiceException $err) {
130 130
             throw $err;
131
-        }
132
-        catch (Exception $err) {
131
+        } catch (Exception $err) {
133 132
             LogPagSeguro::error("Exception: " . $err->getMessage());
134 133
             throw $err;
135 134
         }
Please login to merge, or discard this patch.
PagSeguro/source/PagSeguroLibrary/service/PagSeguroPaymentService.class.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -61,6 +61,10 @@
 block discarded – undo
61 61
      * @throws Exception|PagSeguroServiceException
62 62
      * @throws Exception
63 63
      */
64
+
65
+    /**
66
+     * @param boolean $onlyCheckoutCode
67
+     */
64 68
     public static function createCheckoutRequest(
65 69
         PagSeguroCredentials $credentials,
66 70
         PagSeguroPaymentRequest $paymentRequest,
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -27,107 +27,107 @@
 block discarded – undo
27 27
 class PagSeguroPaymentService
28 28
 {
29 29
 
30
-    /***
30
+	/***
31 31
      *
32 32
      */
33
-    const SERVICE_NAME = 'paymentService';
33
+	const SERVICE_NAME = 'paymentService';
34 34
 
35
-    /***
35
+	/***
36 36
      * @param PagSeguroConnectionData $connectionData
37 37
      * @return string
38 38
      */
39
-    private static function buildCheckoutRequestUrl(PagSeguroConnectionData $connectionData)
40
-    {
41
-        return $connectionData->getServiceUrl() . '/?' . $connectionData->getCredentialsUrlQuery();
42
-    }
39
+	private static function buildCheckoutRequestUrl(PagSeguroConnectionData $connectionData)
40
+	{
41
+		return $connectionData->getServiceUrl() . '/?' . $connectionData->getCredentialsUrlQuery();
42
+	}
43 43
 
44
-    /***
44
+	/***
45 45
      * @param PagSeguroConnectionData $connectionData
46 46
      * @param $code
47 47
      * @return string
48 48
      */
49
-    private static function buildCheckoutUrl(PagSeguroConnectionData $connectionData, $code)
50
-    {
51
-        return $connectionData->getPaymentUrl() . $connectionData->getResource('checkoutUrl') . "?code=$code";
52
-    }
53
-
54
-    // createCheckoutRequest is the actual implementation of the Register method
55
-    // This separation serves as test hook to validate the Uri
56
-    // against the code returned by the service
57
-    /***
49
+	private static function buildCheckoutUrl(PagSeguroConnectionData $connectionData, $code)
50
+	{
51
+		return $connectionData->getPaymentUrl() . $connectionData->getResource('checkoutUrl') . "?code=$code";
52
+	}
53
+
54
+	// createCheckoutRequest is the actual implementation of the Register method
55
+	// This separation serves as test hook to validate the Uri
56
+	// against the code returned by the service
57
+	/***
58 58
      * @param PagSeguroCredentials $credentials
59 59
      * @param PagSeguroPaymentRequest $paymentRequest
60 60
      * @return bool|string
61 61
      * @throws Exception|PagSeguroServiceException
62 62
      * @throws Exception
63 63
      */
64
-    public static function createCheckoutRequest(
65
-        PagSeguroCredentials $credentials,
66
-        PagSeguroPaymentRequest $paymentRequest,
67
-        $onlyCheckoutCode
68
-    ) {
69
-
70
-        LogPagSeguro::info("PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - begin");
71
-
72
-        $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
73
-
74
-        try {
75
-
76
-            $connection = new PagSeguroHttpConnection();
77
-            $connection->post(
78
-                self::buildCheckoutRequestUrl($connectionData),
79
-                PagSeguroPaymentParser::getData($paymentRequest),
80
-                $connectionData->getServiceTimeout(),
81
-                $connectionData->getCharset()
82
-            );
83
-
84
-            $httpStatus = new PagSeguroHttpStatus($connection->getStatus());
85
-
86
-            switch ($httpStatus->getType()) {
87
-
88
-                case 'OK':
89
-                    $PaymentParserData = PagSeguroPaymentParser::readSuccessXml($connection->getResponse());
90
-
91
-                    if ($onlyCheckoutCode) {
92
-                        $paymentReturn = $PaymentParserData->getCode();
93
-                    } else {
94
-                        $paymentReturn = self::buildCheckoutUrl($connectionData, $PaymentParserData->getCode());
95
-                    }
96
-                    LogPagSeguro::info(
97
-                        "PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - end {1}" .
98
-                        $PaymentParserData->getCode()
99
-                    );
100
-                    break;
101
-
102
-                case 'BAD_REQUEST':
103
-                    $errors = PagSeguroPaymentParser::readErrors($connection->getResponse());
104
-                    $e = new PagSeguroServiceException($httpStatus, $errors);
105
-                    LogPagSeguro::error(
106
-                        "PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - error " .
107
-                        $e->getOneLineMessage()
108
-                    );
109
-                    throw $e;
110
-                    break;
111
-
112
-                default:
113
-                    $e = new PagSeguroServiceException($httpStatus);
114
-                    LogPagSeguro::error(
115
-                        "PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - error " .
116
-                        $e->getOneLineMessage()
117
-                    );
118
-                    throw $e;
119
-                    break;
120
-
121
-            }
122
-            return (isset($paymentReturn) ? $paymentReturn : false);
123
-
124
-        } catch (PagSeguroServiceException $e) {
125
-            throw $e;
126
-        }
127
-        catch (Exception $e) {
128
-            LogPagSeguro::error("Exception: " . $e->getMessage());
129
-            throw $e;
130
-        }
131
-
132
-    }
64
+	public static function createCheckoutRequest(
65
+		PagSeguroCredentials $credentials,
66
+		PagSeguroPaymentRequest $paymentRequest,
67
+		$onlyCheckoutCode
68
+	) {
69
+
70
+		LogPagSeguro::info("PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - begin");
71
+
72
+		$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
73
+
74
+		try {
75
+
76
+			$connection = new PagSeguroHttpConnection();
77
+			$connection->post(
78
+				self::buildCheckoutRequestUrl($connectionData),
79
+				PagSeguroPaymentParser::getData($paymentRequest),
80
+				$connectionData->getServiceTimeout(),
81
+				$connectionData->getCharset()
82
+			);
83
+
84
+			$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
85
+
86
+			switch ($httpStatus->getType()) {
87
+
88
+				case 'OK':
89
+					$PaymentParserData = PagSeguroPaymentParser::readSuccessXml($connection->getResponse());
90
+
91
+					if ($onlyCheckoutCode) {
92
+						$paymentReturn = $PaymentParserData->getCode();
93
+					} else {
94
+						$paymentReturn = self::buildCheckoutUrl($connectionData, $PaymentParserData->getCode());
95
+					}
96
+					LogPagSeguro::info(
97
+						"PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - end {1}" .
98
+						$PaymentParserData->getCode()
99
+					);
100
+					break;
101
+
102
+				case 'BAD_REQUEST':
103
+					$errors = PagSeguroPaymentParser::readErrors($connection->getResponse());
104
+					$e = new PagSeguroServiceException($httpStatus, $errors);
105
+					LogPagSeguro::error(
106
+						"PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - error " .
107
+						$e->getOneLineMessage()
108
+					);
109
+					throw $e;
110
+					break;
111
+
112
+				default:
113
+					$e = new PagSeguroServiceException($httpStatus);
114
+					LogPagSeguro::error(
115
+						"PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - error " .
116
+						$e->getOneLineMessage()
117
+					);
118
+					throw $e;
119
+					break;
120
+
121
+			}
122
+			return (isset($paymentReturn) ? $paymentReturn : false);
123
+
124
+		} catch (PagSeguroServiceException $e) {
125
+			throw $e;
126
+		}
127
+		catch (Exception $e) {
128
+			LogPagSeguro::error("Exception: " . $e->getMessage());
129
+			throw $e;
130
+		}
131
+
132
+	}
133 133
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     private static function buildCheckoutRequestUrl(PagSeguroConnectionData $connectionData)
40 40
     {
41
-        return $connectionData->getServiceUrl() . '/?' . $connectionData->getCredentialsUrlQuery();
41
+        return $connectionData->getServiceUrl().'/?'.$connectionData->getCredentialsUrlQuery();
42 42
     }
43 43
 
44 44
     /***
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     private static function buildCheckoutUrl(PagSeguroConnectionData $connectionData, $code)
50 50
     {
51
-        return $connectionData->getPaymentUrl() . $connectionData->getResource('checkoutUrl') . "?code=$code";
51
+        return $connectionData->getPaymentUrl().$connectionData->getResource('checkoutUrl')."?code=$code";
52 52
     }
53 53
 
54 54
     // createCheckoutRequest is the actual implementation of the Register method
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $onlyCheckoutCode
68 68
     ) {
69 69
 
70
-        LogPagSeguro::info("PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - begin");
70
+        LogPagSeguro::info("PagSeguroPaymentService.Register(".$paymentRequest->toString().") - begin");
71 71
 
72 72
         $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
73 73
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                         $paymentReturn = self::buildCheckoutUrl($connectionData, $PaymentParserData->getCode());
95 95
                     }
96 96
                     LogPagSeguro::info(
97
-                        "PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - end {1}" .
97
+                        "PagSeguroPaymentService.Register(".$paymentRequest->toString().") - end {1}".
98 98
                         $PaymentParserData->getCode()
99 99
                     );
100 100
                     break;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                     $errors = PagSeguroPaymentParser::readErrors($connection->getResponse());
104 104
                     $e = new PagSeguroServiceException($httpStatus, $errors);
105 105
                     LogPagSeguro::error(
106
-                        "PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - error " .
106
+                        "PagSeguroPaymentService.Register(".$paymentRequest->toString().") - error ".
107 107
                         $e->getOneLineMessage()
108 108
                     );
109 109
                     throw $e;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                 default:
113 113
                     $e = new PagSeguroServiceException($httpStatus);
114 114
                     LogPagSeguro::error(
115
-                        "PagSeguroPaymentService.Register(" . $paymentRequest->toString() . ") - error " .
115
+                        "PagSeguroPaymentService.Register(".$paymentRequest->toString().") - error ".
116 116
                         $e->getOneLineMessage()
117 117
                     );
118 118
                     throw $e;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             throw $e;
126 126
         }
127 127
         catch (Exception $e) {
128
-            LogPagSeguro::error("Exception: " . $e->getMessage());
128
+            LogPagSeguro::error("Exception: ".$e->getMessage());
129 129
             throw $e;
130 130
         }
131 131
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,8 +123,7 @@
 block discarded – undo
123 123
 
124 124
         } catch (PagSeguroServiceException $e) {
125 125
             throw $e;
126
-        }
127
-        catch (Exception $e) {
126
+        } catch (Exception $e) {
128 127
             LogPagSeguro::error("Exception: " . $e->getMessage());
129 128
             throw $e;
130 129
         }
Please login to merge, or discard this patch.
PagSeguro/source/PagSeguroLibrary/service/PagSeguroRefundService.class.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -29,6 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
     const SERVICE_NAME = 'refundService';
31 31
 
32
+    /**
33
+     * @param PagSeguroConnectionData $connectionData
34
+     */
32 35
     private static function buildRefundURL($connectionData, $transactionCode, $refundValue = null)
33 36
     {
34 37
         if (is_null($refundValue)) {
@@ -40,6 +43,10 @@  discard block
 block discarded – undo
40 43
         }
41 44
     }
42 45
 
46
+    /**
47
+     * @param string $transactionCode
48
+     * @param string $refundValue
49
+     */
43 50
     public static function createRefundRequest(
44 51
         PagSeguroCredentials $credentials,
45 52
         $transactionCode,
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * 2007-2014 [PagSeguro Internet Ltda.]
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- *Licensed under the Apache License, Version 2.0 (the "License");
8
- *you may not use this file except in compliance with the License.
9
- *You may obtain a copy of the License at
10
- *
11
- *http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- *Unless required by applicable law or agreed to in writing, software
14
- *distributed under the License is distributed on an "AS IS" BASIS,
15
- *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- *See the License for the specific language governing permissions and
17
- *limitations under the License.
18
- *
19
- *  @author    PagSeguro Internet Ltda.
20
- *  @copyright 2007-2014 PagSeguro Internet Ltda.
21
- *  @license   http://www.apache.org/licenses/LICENSE-2.0
22
- */
3
+	 * 2007-2014 [PagSeguro Internet Ltda.]
4
+	 *
5
+	 * NOTICE OF LICENSE
6
+	 *
7
+	 *Licensed under the Apache License, Version 2.0 (the "License");
8
+	 *you may not use this file except in compliance with the License.
9
+	 *You may obtain a copy of the License at
10
+	 *
11
+	 *http://www.apache.org/licenses/LICENSE-2.0
12
+	 *
13
+	 *Unless required by applicable law or agreed to in writing, software
14
+	 *distributed under the License is distributed on an "AS IS" BASIS,
15
+	 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+	 *See the License for the specific language governing permissions and
17
+	 *limitations under the License.
18
+	 *
19
+	 *  @author    PagSeguro Internet Ltda.
20
+	 *  @copyright 2007-2014 PagSeguro Internet Ltda.
21
+	 *  @license   http://www.apache.org/licenses/LICENSE-2.0
22
+	 */
23 23
 
24 24
 /***
25 25
  * Encapsulates web service calls regarding PagSeguro refund requests
@@ -27,79 +27,79 @@  discard block
 block discarded – undo
27 27
 class PagSeguroRefundService
28 28
 {
29 29
 
30
-    const SERVICE_NAME = 'refundService';
30
+	const SERVICE_NAME = 'refundService';
31 31
 
32
-    private static function buildRefundURL($connectionData, $transactionCode, $refundValue = null)
33
-    {
34
-        if (is_null($refundValue)) {
35
-            return  $connectionData->getServiceUrl() . '?' . $connectionData->getCredentialsUrlQuery()
36
-                    . "&transactionCode=" . $transactionCode;
37
-        } else {
38
-            return  $connectionData->getServiceUrl() . '?' . $connectionData->getCredentialsUrlQuery()
39
-                    . "&transactionCode=" . $transactionCode . "&refundValue=" . $refundValue;
40
-        }
41
-    }
32
+	private static function buildRefundURL($connectionData, $transactionCode, $refundValue = null)
33
+	{
34
+		if (is_null($refundValue)) {
35
+			return  $connectionData->getServiceUrl() . '?' . $connectionData->getCredentialsUrlQuery()
36
+					. "&transactionCode=" . $transactionCode;
37
+		} else {
38
+			return  $connectionData->getServiceUrl() . '?' . $connectionData->getCredentialsUrlQuery()
39
+					. "&transactionCode=" . $transactionCode . "&refundValue=" . $refundValue;
40
+		}
41
+	}
42 42
 
43
-    public static function createRefundRequest(
44
-        PagSeguroCredentials $credentials,
45
-        $transactionCode,
46
-        $refundValue = null
47
-    ){
43
+	public static function createRefundRequest(
44
+		PagSeguroCredentials $credentials,
45
+		$transactionCode,
46
+		$refundValue = null
47
+	){
48 48
 
49
-        LogPagSeguro::info("PagSeguroRefundService.Register(".$transactionCode.") - begin");
50
-        $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
49
+		LogPagSeguro::info("PagSeguroRefundService.Register(".$transactionCode.") - begin");
50
+		$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
51 51
 
52
-        if (is_null($refundValue)) {
53
-            $url = self::buildRefundURL($connectionData, $transactionCode);
54
-        } else {
55
-            $url = self::buildRefundURL($connectionData, $transactionCode, $refundValue);
56
-        }
52
+		if (is_null($refundValue)) {
53
+			$url = self::buildRefundURL($connectionData, $transactionCode);
54
+		} else {
55
+			$url = self::buildRefundURL($connectionData, $transactionCode, $refundValue);
56
+		}
57 57
 
58
-        try {
58
+		try {
59 59
 
60
-           $connection = new PagSeguroHttpConnection();
61
-           $connection->post(
62
-                $url,
63
-                array(),
64
-                $connectionData->getServiceTimeout(),
65
-                $connectionData->getCharset()
66
-           );
60
+		   $connection = new PagSeguroHttpConnection();
61
+		   $connection->post(
62
+				$url,
63
+				array(),
64
+				$connectionData->getServiceTimeout(),
65
+				$connectionData->getCharset()
66
+		   );
67 67
 
68
-            $httpStatus = new PagSeguroHttpStatus($connection->getStatus());
68
+			$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
69 69
 
70
-            switch ($httpStatus->getType()) {
71
-                case 'OK':
70
+			switch ($httpStatus->getType()) {
71
+				case 'OK':
72 72
 
73
-                    $result = PagSeguroRefundParser::readSuccessXml($connection->getResponse());
74
-                    LogPagSeguro::info(
75
-                        "PagSeguroRefundService.createRefundRequest(".$result.") - end "
76
-                    );
77
-                    break;
78
-                case 'BAD_REQUEST':
79
-                    $errors = PagSeguroRefundParser::readErrors($connection->getResponse());
80
-                    $err = new PagSeguroServiceException($httpStatus, $errors);
81
-                    LogPagSeguro::error(
82
-                        "PagSeguroRefundService.createRefundRequest() - error " .
83
-                        $err->getOneLineMessage()
84
-                    );
85
-                    throw $err;
86
-                    break;
87
-                default:
88
-                    $err = new PagSeguroServiceException($httpStatus);
89
-                    LogPagSeguro::error(
90
-                        "PagSeguroRefundService.createRefundRequest() - error " .
91
-                        $err->getOneLineMessage()
92
-                    );
93
-                    throw $err;
94
-                    break;
95
-            }
96
-            return isset($result) ? $result : false;
73
+					$result = PagSeguroRefundParser::readSuccessXml($connection->getResponse());
74
+					LogPagSeguro::info(
75
+						"PagSeguroRefundService.createRefundRequest(".$result.") - end "
76
+					);
77
+					break;
78
+				case 'BAD_REQUEST':
79
+					$errors = PagSeguroRefundParser::readErrors($connection->getResponse());
80
+					$err = new PagSeguroServiceException($httpStatus, $errors);
81
+					LogPagSeguro::error(
82
+						"PagSeguroRefundService.createRefundRequest() - error " .
83
+						$err->getOneLineMessage()
84
+					);
85
+					throw $err;
86
+					break;
87
+				default:
88
+					$err = new PagSeguroServiceException($httpStatus);
89
+					LogPagSeguro::error(
90
+						"PagSeguroRefundService.createRefundRequest() - error " .
91
+						$err->getOneLineMessage()
92
+					);
93
+					throw $err;
94
+					break;
95
+			}
96
+			return isset($result) ? $result : false;
97 97
 
98
-        } catch (PagSeguroServiceException $err) {
99
-            throw $err;
100
-        } catch (Exception $err) {
101
-            LogPagSeguro::error("Exception: " . $err->getMessage());
102
-            throw $err;
103
-        }
104
-    }
98
+		} catch (PagSeguroServiceException $err) {
99
+			throw $err;
100
+		} catch (Exception $err) {
101
+			LogPagSeguro::error("Exception: " . $err->getMessage());
102
+			throw $err;
103
+		}
104
+	}
105 105
 }
106 106
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
     private static function buildRefundURL($connectionData, $transactionCode, $refundValue = null)
33 33
     {
34 34
         if (is_null($refundValue)) {
35
-            return  $connectionData->getServiceUrl() . '?' . $connectionData->getCredentialsUrlQuery()
36
-                    . "&transactionCode=" . $transactionCode;
35
+            return  $connectionData->getServiceUrl().'?'.$connectionData->getCredentialsUrlQuery()
36
+                    . "&transactionCode=".$transactionCode;
37 37
         } else {
38
-            return  $connectionData->getServiceUrl() . '?' . $connectionData->getCredentialsUrlQuery()
39
-                    . "&transactionCode=" . $transactionCode . "&refundValue=" . $refundValue;
38
+            return  $connectionData->getServiceUrl().'?'.$connectionData->getCredentialsUrlQuery()
39
+                    . "&transactionCode=".$transactionCode."&refundValue=".$refundValue;
40 40
         }
41 41
     }
42 42
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         PagSeguroCredentials $credentials,
45 45
         $transactionCode,
46 46
         $refundValue = null
47
-    ){
47
+    ) {
48 48
 
49 49
         LogPagSeguro::info("PagSeguroRefundService.Register(".$transactionCode.") - begin");
50 50
         $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                     $errors = PagSeguroRefundParser::readErrors($connection->getResponse());
80 80
                     $err = new PagSeguroServiceException($httpStatus, $errors);
81 81
                     LogPagSeguro::error(
82
-                        "PagSeguroRefundService.createRefundRequest() - error " .
82
+                        "PagSeguroRefundService.createRefundRequest() - error ".
83 83
                         $err->getOneLineMessage()
84 84
                     );
85 85
                     throw $err;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 default:
88 88
                     $err = new PagSeguroServiceException($httpStatus);
89 89
                     LogPagSeguro::error(
90
-                        "PagSeguroRefundService.createRefundRequest() - error " .
90
+                        "PagSeguroRefundService.createRefundRequest() - error ".
91 91
                         $err->getOneLineMessage()
92 92
                     );
93 93
                     throw $err;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         } catch (PagSeguroServiceException $err) {
99 99
             throw $err;
100 100
         } catch (Exception $err) {
101
-            LogPagSeguro::error("Exception: " . $err->getMessage());
101
+            LogPagSeguro::error("Exception: ".$err->getMessage());
102 102
             throw $err;
103 103
         }
104 104
     }
Please login to merge, or discard this patch.
PagSeguro/source/PagSeguroLibrary/service/PagSeguroSessionService.class.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -44,6 +44,10 @@
 block discarded – undo
44 44
      * @throws Exception|PagSeguroServiceException
45 45
      * @throws Exception
46 46
      */
47
+
48
+    /**
49
+     * @param PagSeguroAccountCredentials $credentials
50
+     */
47 51
     public static function getSession($credentials)
48 52
     {
49 53
         $connectionData = new PagSeguroConnectionData($credentials, 'sessionService');
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * 2007-2014 [PagSeguro Internet Ltda.]
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- *Licensed under the Apache License, Version 2.0 (the "License");
8
- *you may not use this file except in compliance with the License.
9
- *You may obtain a copy of the License at
10
- *
11
- *http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- *Unless required by applicable law or agreed to in writing, software
14
- *distributed under the License is distributed on an "AS IS" BASIS,
15
- *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- *See the License for the specific language governing permissions and
17
- *limitations under the License.
18
- *
19
- *  @author    PagSeguro Internet Ltda.
20
- *  @copyright 2007-2014 PagSeguro Internet Ltda.
21
- *  @license   http://www.apache.org/licenses/LICENSE-2.0
22
- */
3
+	 * 2007-2014 [PagSeguro Internet Ltda.]
4
+	 *
5
+	 * NOTICE OF LICENSE
6
+	 *
7
+	 *Licensed under the Apache License, Version 2.0 (the "License");
8
+	 *you may not use this file except in compliance with the License.
9
+	 *You may obtain a copy of the License at
10
+	 *
11
+	 *http://www.apache.org/licenses/LICENSE-2.0
12
+	 *
13
+	 *Unless required by applicable law or agreed to in writing, software
14
+	 *distributed under the License is distributed on an "AS IS" BASIS,
15
+	 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+	 *See the License for the specific language governing permissions and
17
+	 *limitations under the License.
18
+	 *
19
+	 *  @author    PagSeguro Internet Ltda.
20
+	 *  @copyright 2007-2014 PagSeguro Internet Ltda.
21
+	 *  @license   http://www.apache.org/licenses/LICENSE-2.0
22
+	 */
23 23
 
24 24
 /***
25 25
  * Encapsulates web service calls regarding PagSeguro session requests
@@ -27,80 +27,80 @@  discard block
 block discarded – undo
27 27
 class PagSeguroSessionService
28 28
 {
29 29
 
30
-    /***
30
+	/***
31 31
      * Build URL for get session.
32 32
      * @param PagSeguroConnectionData $connectionData 
33 33
      * @return string session URL
34 34
      */
35
-    private static function buildSessionURL($connectionData)
36
-    {
37
-        return  $connectionData->getWebserviceUrl() . $connectionData->getSessionUrl();  
38
-    }
35
+	private static function buildSessionURL($connectionData)
36
+	{
37
+		return  $connectionData->getWebserviceUrl() . $connectionData->getSessionUrl();  
38
+	}
39 39
 
40
-    /***
40
+	/***
41 41
      * Get session for direct payment from webservice 
42 42
      * @param $credentials PagSeguroAccountCredentials 
43 43
      * @return bool|string
44 44
      * @throws Exception|PagSeguroServiceException
45 45
      * @throws Exception
46 46
      */
47
-    public static function getSession($credentials)
48
-    {
49
-        $connectionData = new PagSeguroConnectionData($credentials, 'sessionService');
47
+	public static function getSession($credentials)
48
+	{
49
+		$connectionData = new PagSeguroConnectionData($credentials, 'sessionService');
50 50
 
51
-        $url = self::buildSessionURL($connectionData)  . "?" . $connectionData->getCredentialsUrlQuery();
51
+		$url = self::buildSessionURL($connectionData)  . "?" . $connectionData->getCredentialsUrlQuery();
52 52
 
53
-        try {
53
+		try {
54 54
             
55
-            $connection = new PagSeguroHttpConnection();
56
-            $connection->post(
57
-                $url,
58
-                array(),
59
-                $connectionData->getServiceTimeout(),
60
-                $connectionData->getCharset()
61
-             );
55
+			$connection = new PagSeguroHttpConnection();
56
+			$connection->post(
57
+				$url,
58
+				array(),
59
+				$connectionData->getServiceTimeout(),
60
+				$connectionData->getCharset()
61
+			 );
62 62
 
63
-            $httpStatus = new PagSeguroHttpStatus($connection->getStatus());
63
+			$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
64 64
 
65
-            switch ($httpStatus->getType()) {
65
+			switch ($httpStatus->getType()) {
66 66
 
67
-                case 'OK':
67
+				case 'OK':
68 68
 
69
-                    $session = PagSeguroSessionParser::readResult($connection->getResponse());
69
+					$session = PagSeguroSessionParser::readResult($connection->getResponse());
70 70
 
71
-                    return $session->getId();
71
+					return $session->getId();
72 72
 
73
-                    LogPagSeguro::info(
74
-                        "PagSeguroSessionService.getSession()(" . $session->toString() . ") - end {1}"
75
-                    );
76
-                    break;
73
+					LogPagSeguro::info(
74
+						"PagSeguroSessionService.getSession()(" . $session->toString() . ") - end {1}"
75
+					);
76
+					break;
77 77
 
78
-                case 'BAD_REQUEST':
79
-                    $errors = PagSeguroSessionParser::readErrors($connection->getStatus());
80
-                    $e = new PagSeguroServiceException($httpStatus, $errors);
81
-                    LogPagSeguro::error(
82
-                        "PagSeguroSessionService.getSession() - error " . 
83
-                        $e->getOneLineMessage()
84
-                    );
85
-                    throw $e;
86
-                    break;
78
+				case 'BAD_REQUEST':
79
+					$errors = PagSeguroSessionParser::readErrors($connection->getStatus());
80
+					$e = new PagSeguroServiceException($httpStatus, $errors);
81
+					LogPagSeguro::error(
82
+						"PagSeguroSessionService.getSession() - error " . 
83
+						$e->getOneLineMessage()
84
+					);
85
+					throw $e;
86
+					break;
87 87
 
88
-                default:
88
+				default:
89 89
 
90
-                    $e = new PagSeguroServiceException($httpStatus);
91
-                    LogPagSeguro::error(
92
-                        "PagSeguroSessionService.getSession() - error " . 
93
-                        $e->getOneLineMessage() 
94
-                    );
95
-                    throw $e;
96
-                    break;
97
-            }
98
-        } catch (PagSeguroServiceException $e) {
99
-            throw $e;
100
-        } catch (Exception $e) {
101
-            LogPagSeguro::error("Exception: " . $e->getMessage());
102
-            throw $e;
103
-        }
104
-    }
90
+					$e = new PagSeguroServiceException($httpStatus);
91
+					LogPagSeguro::error(
92
+						"PagSeguroSessionService.getSession() - error " . 
93
+						$e->getOneLineMessage() 
94
+					);
95
+					throw $e;
96
+					break;
97
+			}
98
+		} catch (PagSeguroServiceException $e) {
99
+			throw $e;
100
+		} catch (Exception $e) {
101
+			LogPagSeguro::error("Exception: " . $e->getMessage());
102
+			throw $e;
103
+		}
104
+	}
105 105
 
106 106
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     private static function buildSessionURL($connectionData)
36 36
     {
37
-        return  $connectionData->getWebserviceUrl() . $connectionData->getSessionUrl();  
37
+        return  $connectionData->getWebserviceUrl().$connectionData->getSessionUrl();  
38 38
     }
39 39
 
40 40
     /***
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $connectionData = new PagSeguroConnectionData($credentials, 'sessionService');
50 50
 
51
-        $url = self::buildSessionURL($connectionData)  . "?" . $connectionData->getCredentialsUrlQuery();
51
+        $url = self::buildSessionURL($connectionData)."?".$connectionData->getCredentialsUrlQuery();
52 52
 
53 53
         try {
54 54
             
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                     return $session->getId();
72 72
 
73 73
                     LogPagSeguro::info(
74
-                        "PagSeguroSessionService.getSession()(" . $session->toString() . ") - end {1}"
74
+                        "PagSeguroSessionService.getSession()(".$session->toString().") - end {1}"
75 75
                     );
76 76
                     break;
77 77
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                     $errors = PagSeguroSessionParser::readErrors($connection->getStatus());
80 80
                     $e = new PagSeguroServiceException($httpStatus, $errors);
81 81
                     LogPagSeguro::error(
82
-                        "PagSeguroSessionService.getSession() - error " . 
82
+                        "PagSeguroSessionService.getSession() - error ". 
83 83
                         $e->getOneLineMessage()
84 84
                     );
85 85
                     throw $e;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
                     $e = new PagSeguroServiceException($httpStatus);
91 91
                     LogPagSeguro::error(
92
-                        "PagSeguroSessionService.getSession() - error " . 
92
+                        "PagSeguroSessionService.getSession() - error ". 
93 93
                         $e->getOneLineMessage() 
94 94
                     );
95 95
                     throw $e;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         } catch (PagSeguroServiceException $e) {
99 99
             throw $e;
100 100
         } catch (Exception $e) {
101
-            LogPagSeguro::error("Exception: " . $e->getMessage());
101
+            LogPagSeguro::error("Exception: ".$e->getMessage());
102 102
             throw $e;
103 103
         }
104 104
     }
Please login to merge, or discard this patch.
source/PagSeguroLibrary/service/PagSeguroTransactionSearchService.class.php 4 patches
Doc Comments   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     /**
38 38
      * @param PagSeguroConnectionData $connectionData
39
-     * @param $transactionCode
39
+     * @param string $transactionCode
40 40
      * @return string
41 41
      */
42 42
     private static function buildSearchUrlByCode(PagSeguroConnectionData $connectionData, $transactionCode)
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 
261 261
     /**
262 262
      * @param PagSeguroCredentials $credentials
263
-     * @param $reference
264
-     * @param null $initialDate
265
-     * @param null $finalDate
266
-     * @param null $pageNumber
267
-     * @param null $maxPageResults
263
+     * @param string $reference
264
+     * @param string $initialDate
265
+     * @param string $finalDate
266
+     * @param integer $pageNumber
267
+     * @param integer $maxPageResults
268 268
      * @throws Exception
269 269
      * @throws PagSeguroServiceException
270 270
      */
@@ -314,10 +314,10 @@  discard block
 block discarded – undo
314 314
     }
315 315
 
316 316
     /**
317
-     * @param $pageNumber
318
-     * @param $maxPageResults
319
-     * @param $initialDate
320
-     * @param null $finalDate
317
+     * @param integer|null $pageNumber
318
+     * @param integer|null $maxPageResults
319
+     * @param string $initialDate
320
+     * @param string|null $finalDate
321 321
      * @return array
322 322
      */
323 323
     private function buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate = null)
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
     }
335 335
 
336 336
     /**
337
-     * @param $connection
338
-     * @param $code
337
+     * @param PagSeguroHttpConnection $connection
338
+     * @param string $code
339 339
      * @return bool|PagSeguroTransaction
340 340
      * @throws PagSeguroServiceException
341 341
      */
@@ -376,9 +376,9 @@  discard block
 block discarded – undo
376 376
     }
377 377
 
378 378
     /**
379
-     * @param $connection
380
-     * @param null $initialDate
381
-     * @param null $finalDate
379
+     * @param PagSeguroHttpConnection $connection
380
+     * @param string $initialDate
381
+     * @param string|null $finalDate
382 382
      * @return bool|PagSeguroTransactionSearchResult
383 383
      * @throws PagSeguroServiceException
384 384
      */
Please login to merge, or discard this patch.
Indentation   +348 added lines, -348 removed lines patch added patch discarded remove patch
@@ -27,96 +27,96 @@  discard block
 block discarded – undo
27 27
 class PagSeguroTransactionSearchService
28 28
 {
29 29
 
30
-    /**
31
-     *
32
-     */
33
-    const SERVICE_NAME = 'transactionSearchService';
34
-
35
-    private static $logService;
36
-
37
-    /**
38
-     * @param PagSeguroConnectionData $connectionData
39
-     * @param $transactionCode
40
-     * @return string
41
-     */
42
-    private static function buildSearchUrlByCode(PagSeguroConnectionData $connectionData, $transactionCode)
43
-    {
44
-        $url = $connectionData->getServiceUrl('v3');
45
-        return "{$url}/{$transactionCode}/?" . $connectionData->getCredentialsUrlQuery();
46
-    }
47
-
48
-    /**
49
-     * @param PagSeguroConnectionData $connectionData
50
-     * @param array $searchParams
51
-     * @return string
52
-     */
53
-    private static function buildSearchUrlByDate(PagSeguroConnectionData $connectionData, array $searchParams)
54
-    {
55
-        $url = $connectionData->getServiceUrl('v2');
56
-        $initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
57
-        $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
58
-        if ($searchParams['pageNumber'] != null) {
59
-            $page = "&page=" . $searchParams['pageNumber'];
60
-        }
61
-        if ($searchParams['maxPageResults'] != null) {
62
-            $maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
63
-        }
64
-        return "{$url}/?" . $connectionData->getCredentialsUrlQuery() .
65
-            "&initialDate={$initialDate}{$finalDate}{$page}{$maxPageResults}";
66
-    }
67
-
68
-    /**
69
-     * @param PagSeguroConnectionData $connectionData
70
-     * @param array $searchParams
71
-     * @return string
72
-     */
73
-    private static function buildSearchUrlAbandoned(PagSeguroConnectionData $connectionData, array $searchParams)
74
-    {
75
-        $url = $connectionData->getServiceUrl('v2');
76
-
77
-        $initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
78
-        $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
79
-        if ($searchParams['pageNumber'] != null) {
80
-            $page = "&page=" . $searchParams['pageNumber'];
81
-        }
82
-        if ($searchParams['maxPageResults'] != null) {
83
-            $maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
84
-        }
85
-        return "{$url}/abandoned/?" . $connectionData->getCredentialsUrlQuery() .
86
-            "&initialDate={$initialDate}&finalDate={$finalDate}{$page}{$maxPageResults}";
87
-    }
88
-
89
-    /**
90
-     * @param PagSeguroConnectionData $connectionData
91
-     * @param $reference
92
-     * @param null $searchParams
93
-     * @return string
94
-     */
95
-    private static function buildSearchUrlByReference(
96
-        PagSeguroConnectionData $connectionData,
97
-        $reference,
98
-        $searchParams = null
99
-    ){
100
-        $url = $connectionData->getServiceUrl('v2');
101
-        if ($searchParams == null) {
102
-            return "{$url}?" . $connectionData->getCredentialsUrlQuery() . "&reference=" . $reference;
103
-        } else {
104
-
105
-            $initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
106
-            $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
107
-            if ($searchParams['pageNumber'] != null) {
108
-                $page = "&page=" . $searchParams['pageNumber'];
109
-            }
110
-            if ($searchParams['maxPageResults'] != null) {
111
-                $maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
112
-            }
113
-
114
-            return "{$url}?" . $connectionData->getCredentialsUrlQuery() . "&reference=" . $reference
115
-                   . "&initialDate={$initialDate}&finalDate={$finalDate}{$page}{$maxPageResults}";
116
-        }
117
-    }
118
-
119
-    /***
30
+	/**
31
+	 *
32
+	 */
33
+	const SERVICE_NAME = 'transactionSearchService';
34
+
35
+	private static $logService;
36
+
37
+	/**
38
+	 * @param PagSeguroConnectionData $connectionData
39
+	 * @param $transactionCode
40
+	 * @return string
41
+	 */
42
+	private static function buildSearchUrlByCode(PagSeguroConnectionData $connectionData, $transactionCode)
43
+	{
44
+		$url = $connectionData->getServiceUrl('v3');
45
+		return "{$url}/{$transactionCode}/?" . $connectionData->getCredentialsUrlQuery();
46
+	}
47
+
48
+	/**
49
+	 * @param PagSeguroConnectionData $connectionData
50
+	 * @param array $searchParams
51
+	 * @return string
52
+	 */
53
+	private static function buildSearchUrlByDate(PagSeguroConnectionData $connectionData, array $searchParams)
54
+	{
55
+		$url = $connectionData->getServiceUrl('v2');
56
+		$initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
57
+		$finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
58
+		if ($searchParams['pageNumber'] != null) {
59
+			$page = "&page=" . $searchParams['pageNumber'];
60
+		}
61
+		if ($searchParams['maxPageResults'] != null) {
62
+			$maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
63
+		}
64
+		return "{$url}/?" . $connectionData->getCredentialsUrlQuery() .
65
+			"&initialDate={$initialDate}{$finalDate}{$page}{$maxPageResults}";
66
+	}
67
+
68
+	/**
69
+	 * @param PagSeguroConnectionData $connectionData
70
+	 * @param array $searchParams
71
+	 * @return string
72
+	 */
73
+	private static function buildSearchUrlAbandoned(PagSeguroConnectionData $connectionData, array $searchParams)
74
+	{
75
+		$url = $connectionData->getServiceUrl('v2');
76
+
77
+		$initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
78
+		$finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
79
+		if ($searchParams['pageNumber'] != null) {
80
+			$page = "&page=" . $searchParams['pageNumber'];
81
+		}
82
+		if ($searchParams['maxPageResults'] != null) {
83
+			$maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
84
+		}
85
+		return "{$url}/abandoned/?" . $connectionData->getCredentialsUrlQuery() .
86
+			"&initialDate={$initialDate}&finalDate={$finalDate}{$page}{$maxPageResults}";
87
+	}
88
+
89
+	/**
90
+	 * @param PagSeguroConnectionData $connectionData
91
+	 * @param $reference
92
+	 * @param null $searchParams
93
+	 * @return string
94
+	 */
95
+	private static function buildSearchUrlByReference(
96
+		PagSeguroConnectionData $connectionData,
97
+		$reference,
98
+		$searchParams = null
99
+	){
100
+		$url = $connectionData->getServiceUrl('v2');
101
+		if ($searchParams == null) {
102
+			return "{$url}?" . $connectionData->getCredentialsUrlQuery() . "&reference=" . $reference;
103
+		} else {
104
+
105
+			$initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
106
+			$finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
107
+			if ($searchParams['pageNumber'] != null) {
108
+				$page = "&page=" . $searchParams['pageNumber'];
109
+			}
110
+			if ($searchParams['maxPageResults'] != null) {
111
+				$maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
112
+			}
113
+
114
+			return "{$url}?" . $connectionData->getCredentialsUrlQuery() . "&reference=" . $reference
115
+				   . "&initialDate={$initialDate}&finalDate={$finalDate}{$page}{$maxPageResults}";
116
+		}
117
+	}
118
+
119
+	/***
120 120
      * Finds a transaction with a matching transaction code
121 121
      *
122 122
      * @param PagSeguroCredentials $credentials
@@ -126,35 +126,35 @@  discard block
 block discarded – undo
126 126
      * @throws PagSeguroServiceException
127 127
      * @throws Exception
128 128
      */
129
-    public static function searchByCode(PagSeguroCredentials $credentials, $transactionCode)
130
-    {
129
+	public static function searchByCode(PagSeguroCredentials $credentials, $transactionCode)
130
+	{
131 131
 
132
-        LogPagSeguro::info("PagSeguroTransactionSearchService.SearchByCode($transactionCode) - begin");
132
+		LogPagSeguro::info("PagSeguroTransactionSearchService.SearchByCode($transactionCode) - begin");
133 133
 
134
-        $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
134
+		$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
135 135
 
136
-        try {
136
+		try {
137 137
 
138
-            $connection = new PagSeguroHttpConnection();
139
-            $connection->get(
140
-                self::buildSearchUrlByCode($connectionData, $transactionCode),
141
-                $connectionData->getServiceTimeout(),
142
-                $connectionData->getCharset()
143
-            );
138
+			$connection = new PagSeguroHttpConnection();
139
+			$connection->get(
140
+				self::buildSearchUrlByCode($connectionData, $transactionCode),
141
+				$connectionData->getServiceTimeout(),
142
+				$connectionData->getCharset()
143
+			);
144 144
 
145
-            return self::searchByCodeResult($connection, $transactionCode);
145
+			return self::searchByCodeResult($connection, $transactionCode);
146 146
 
147
-        } catch (PagSeguroServiceException $err) {
148
-            throw $err;
149
-        }
150
-        catch (Exception $err) {
151
-            LogPagSeguro::error("Exception: " . $err->getMessage());
152
-            throw $err;
153
-        }
147
+		} catch (PagSeguroServiceException $err) {
148
+			throw $err;
149
+		}
150
+		catch (Exception $err) {
151
+			LogPagSeguro::error("Exception: " . $err->getMessage());
152
+			throw $err;
153
+		}
154 154
 
155
-    }
155
+	}
156 156
 
157
-    /***
157
+	/***
158 158
  * Search transactions associated with this set of credentials within a date range
159 159
  *
160 160
  * @param PagSeguroCredentials $credentials
@@ -167,45 +167,45 @@  discard block
 block discarded – undo
167 167
  * @throws PagSeguroServiceException
168 168
  * @throws Exception
169 169
  */
170
-    public static function searchByDate(
171
-        PagSeguroCredentials $credentials,
172
-        $pageNumber,
173
-        $maxPageResults,
174
-        $initialDate,
175
-        $finalDate = null
176
-    ) {
170
+	public static function searchByDate(
171
+		PagSeguroCredentials $credentials,
172
+		$pageNumber,
173
+		$maxPageResults,
174
+		$initialDate,
175
+		$finalDate = null
176
+	) {
177 177
 
178
-        LogPagSeguro::info(
179
-            "PagSeguroTransactionSearchService.SearchByDate(initialDate=" . PagSeguroHelper::formatDate($initialDate) .
180
-            ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - begin"
181
-        );
178
+		LogPagSeguro::info(
179
+			"PagSeguroTransactionSearchService.SearchByDate(initialDate=" . PagSeguroHelper::formatDate($initialDate) .
180
+			", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - begin"
181
+		);
182 182
 
183
-        $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
183
+		$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
184 184
 
185
-        $searchParams = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate);
185
+		$searchParams = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate);
186 186
 
187
-        try {
187
+		try {
188 188
 
189
-            $connection = new PagSeguroHttpConnection();
190
-            $connection->get(
191
-                self::buildSearchUrlByDate($connectionData, $searchParams),
192
-                $connectionData->getServiceTimeout(),
193
-                $connectionData->getCharset()
194
-            );
189
+			$connection = new PagSeguroHttpConnection();
190
+			$connection->get(
191
+				self::buildSearchUrlByDate($connectionData, $searchParams),
192
+				$connectionData->getServiceTimeout(),
193
+				$connectionData->getCharset()
194
+			);
195 195
 
196
-            self::$logService = "SearchByDate";
197
-            return self::searchResult($connection, $initialDate, $finalDate);
196
+			self::$logService = "SearchByDate";
197
+			return self::searchResult($connection, $initialDate, $finalDate);
198 198
 
199
-        } catch (PagSeguroServiceException $err) {
200
-            throw $err;
201
-        } catch (Exception $err) {
202
-            LogPagSeguro::error("Exception: " . $err->getMessage());
203
-            throw $err;
204
-        }
199
+		} catch (PagSeguroServiceException $err) {
200
+			throw $err;
201
+		} catch (Exception $err) {
202
+			LogPagSeguro::error("Exception: " . $err->getMessage());
203
+			throw $err;
204
+		}
205 205
 
206
-    }
206
+	}
207 207
 
208
-    /***
208
+	/***
209 209
      * Search transactions abandoned associated with this set of credentials within a date range
210 210
      *
211 211
      * @param PagSeguroCredentials $credentials
@@ -218,211 +218,211 @@  discard block
 block discarded – undo
218 218
      * @throws PagSeguroServiceException
219 219
      * @throws Exception
220 220
      */
221
-    public static function searchAbandoned(
222
-        PagSeguroCredentials $credentials,
223
-        $pageNumber,
224
-        $maxPageResults,
225
-        $initialDate,
226
-        $finalDate = null
227
-    ) {
228
-
229
-        LogPagSeguro::info(
230
-            "PagSeguroTransactionSearchService.searchAbandoned(initialDate=" .
231
-            PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
232
-            PagSeguroHelper::formatDate($finalDate) . ") - begin"
233
-        );
234
-
235
-        $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
236
-
237
-        $searchParams = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate);
238
-
239
-        try {
240
-
241
-            $connection = new PagSeguroHttpConnection();
242
-            $connection->get(
243
-                self::buildSearchUrlAbandoned($connectionData, $searchParams),
244
-                $connectionData->getServiceTimeout(),
245
-                $connectionData->getCharset()
246
-            );
247
-
248
-            self::$logService = "searchAbandoned";
249
-            return self::searchResult($connection, $initialDate, $finalDate);
250
-
251
-        } catch (PagSeguroServiceException $err) {
252
-            throw $err;
253
-        }
254
-        catch (Exception $err) {
255
-            LogPagSeguro::error("Exception: " . $err->getMessage());
256
-            throw $err;
257
-        }
258
-
259
-    }
260
-
261
-    /**
262
-     * @param PagSeguroCredentials $credentials
263
-     * @param $reference
264
-     * @param null $initialDate
265
-     * @param null $finalDate
266
-     * @param null $pageNumber
267
-     * @param null $maxPageResults
268
-     * @throws Exception
269
-     * @throws PagSeguroServiceException
270
-     */
271
-    public static function searchByReference(
272
-        PagSeguroCredentials $credentials,
273
-        $reference,
274
-        $initialDate = null,
275
-        $finalDate = null,
276
-        $pageNumber = null,
277
-        $maxPageResults = null
278
-    ) {
279
-
280
-        LogPagSeguro::info(
281
-            "PagSeguroTransactionSearchService.SearchByReference(reference=".$reference.") - begin"
282
-        );
283
-
284
-        $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
285
-
286
-        if ($initialDate)
287
-            $searchParams = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate);
288
-        else
289
-            $searchParams = null;
290
-
291
-        try {
292
-
293
-            $connection = new PagSeguroHttpConnection();
294
-            $connection->get(
295
-                self::buildSearchUrlByReference(
296
-                    $connectionData,
297
-                    $reference,
298
-                    $searchParams
299
-                ),
300
-                $connectionData->getServiceTimeout(),
301
-                $connectionData->getCharset()
302
-            );
303
-
304
-            self::$logService = "SearchByReference";
305
-            return self::searchResult($connection);
306
-
307
-        } catch (PagSeguroServiceException $err) {
308
-            throw $err;
309
-        } catch (Exception $err) {
310
-            LogPagSeguro::error("Exception: " . $err->getMessage());
311
-            throw $err;
312
-        }
313
-
314
-    }
315
-
316
-    /**
317
-     * @param $pageNumber
318
-     * @param $maxPageResults
319
-     * @param $initialDate
320
-     * @param null $finalDate
321
-     * @return array
322
-     */
323
-    private function buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate = null)
324
-    {
325
-        $searchParams = array(
326
-            'initialDate' => PagSeguroHelper::formatDate($initialDate),
327
-            'pageNumber' => $pageNumber,
328
-            'maxPageResults' => $maxPageResults
329
-        );
330
-
331
-        $searchParams['finalDate'] = $finalDate ? PagSeguroHelper::formatDate($finalDate) : null;
332
-
333
-        return $searchParams;
334
-    }
335
-
336
-    /**
337
-     * @param $connection
338
-     * @param $code
339
-     * @return bool|PagSeguroTransaction
340
-     * @throws PagSeguroServiceException
341
-     */
342
-    private function searchByCodeResult($connection, $code)
343
-    {
344
-        $httpStatus = new PagSeguroHttpStatus($connection->getStatus());
345
-
346
-        switch ($httpStatus->getType()) {
347
-
348
-            case 'OK':
349
-                $transaction = PagSeguroTransactionParser::readTransaction($connection->getResponse());
350
-                LogPagSeguro::info(
351
-                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - end " .
352
-                    $transaction->toString()
353
-                );
354
-                break;
355
-
356
-            case 'BAD_REQUEST':
357
-                $errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
358
-                $err = new PagSeguroServiceException($httpStatus, $errors);
359
-                LogPagSeguro::error(
360
-                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - error " .
361
-                    $err->getOneLineMessage()
362
-                );
363
-                throw $err;
364
-                break;
365
-
366
-            default:
367
-                $err = new PagSeguroServiceException($httpStatus);
368
-                LogPagSeguro::error(
369
-                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - error " .
370
-                    $err->getOneLineMessage()
371
-                );
372
-                throw $err;
373
-                break;
374
-        }
375
-        return isset($transaction) ? $transaction : false;
376
-    }
377
-
378
-    /**
379
-     * @param $connection
380
-     * @param null $initialDate
381
-     * @param null $finalDate
382
-     * @return bool|PagSeguroTransactionSearchResult
383
-     * @throws PagSeguroServiceException
384
-     */
385
-    private function searchResult($connection, $initialDate = null, $finalDate = null)
386
-    {
387
-
388
-        $httpStatus = new PagSeguroHttpStatus($connection->getStatus());
389
-
390
-        switch ($httpStatus->getType()) {
391
-
392
-            case 'OK':
393
-
394
-                $searchResult = PagSeguroTransactionParser::readSearchResult($connection->getResponse());
395
-
396
-                LogPagSeguro::info(
397
-                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
398
-                    PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
399
-                    PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $searchResult->toString()
400
-                );
401
-                break;
402
-
403
-            case 'BAD_REQUEST':
404
-                $errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
405
-                $err = new PagSeguroServiceException($httpStatus, $errors);
406
-                LogPagSeguro::error(
407
-                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
408
-                    PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
409
-                    PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $err->getOneLineMessage()
410
-                );
411
-                throw $err;
412
-                break;
413
-
414
-            default:
415
-                $err = new PagSeguroServiceException($httpStatus);
416
-                LogPagSeguro::error(
417
-                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
418
-                    PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
419
-                    PagSeguroHelper::formatDate($finalDate) . ") - end ",  self::$logService) . $err->getOneLineMessage()
420
-                );
421
-                throw $err;
422
-                break;
423
-
424
-        }
425
-
426
-        return isset($searchResult) ? $searchResult : false;
427
-    }
221
+	public static function searchAbandoned(
222
+		PagSeguroCredentials $credentials,
223
+		$pageNumber,
224
+		$maxPageResults,
225
+		$initialDate,
226
+		$finalDate = null
227
+	) {
228
+
229
+		LogPagSeguro::info(
230
+			"PagSeguroTransactionSearchService.searchAbandoned(initialDate=" .
231
+			PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
232
+			PagSeguroHelper::formatDate($finalDate) . ") - begin"
233
+		);
234
+
235
+		$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
236
+
237
+		$searchParams = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate);
238
+
239
+		try {
240
+
241
+			$connection = new PagSeguroHttpConnection();
242
+			$connection->get(
243
+				self::buildSearchUrlAbandoned($connectionData, $searchParams),
244
+				$connectionData->getServiceTimeout(),
245
+				$connectionData->getCharset()
246
+			);
247
+
248
+			self::$logService = "searchAbandoned";
249
+			return self::searchResult($connection, $initialDate, $finalDate);
250
+
251
+		} catch (PagSeguroServiceException $err) {
252
+			throw $err;
253
+		}
254
+		catch (Exception $err) {
255
+			LogPagSeguro::error("Exception: " . $err->getMessage());
256
+			throw $err;
257
+		}
258
+
259
+	}
260
+
261
+	/**
262
+	 * @param PagSeguroCredentials $credentials
263
+	 * @param $reference
264
+	 * @param null $initialDate
265
+	 * @param null $finalDate
266
+	 * @param null $pageNumber
267
+	 * @param null $maxPageResults
268
+	 * @throws Exception
269
+	 * @throws PagSeguroServiceException
270
+	 */
271
+	public static function searchByReference(
272
+		PagSeguroCredentials $credentials,
273
+		$reference,
274
+		$initialDate = null,
275
+		$finalDate = null,
276
+		$pageNumber = null,
277
+		$maxPageResults = null
278
+	) {
279
+
280
+		LogPagSeguro::info(
281
+			"PagSeguroTransactionSearchService.SearchByReference(reference=".$reference.") - begin"
282
+		);
283
+
284
+		$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
285
+
286
+		if ($initialDate)
287
+			$searchParams = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate);
288
+		else
289
+			$searchParams = null;
290
+
291
+		try {
292
+
293
+			$connection = new PagSeguroHttpConnection();
294
+			$connection->get(
295
+				self::buildSearchUrlByReference(
296
+					$connectionData,
297
+					$reference,
298
+					$searchParams
299
+				),
300
+				$connectionData->getServiceTimeout(),
301
+				$connectionData->getCharset()
302
+			);
303
+
304
+			self::$logService = "SearchByReference";
305
+			return self::searchResult($connection);
306
+
307
+		} catch (PagSeguroServiceException $err) {
308
+			throw $err;
309
+		} catch (Exception $err) {
310
+			LogPagSeguro::error("Exception: " . $err->getMessage());
311
+			throw $err;
312
+		}
313
+
314
+	}
315
+
316
+	/**
317
+	 * @param $pageNumber
318
+	 * @param $maxPageResults
319
+	 * @param $initialDate
320
+	 * @param null $finalDate
321
+	 * @return array
322
+	 */
323
+	private function buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate = null)
324
+	{
325
+		$searchParams = array(
326
+			'initialDate' => PagSeguroHelper::formatDate($initialDate),
327
+			'pageNumber' => $pageNumber,
328
+			'maxPageResults' => $maxPageResults
329
+		);
330
+
331
+		$searchParams['finalDate'] = $finalDate ? PagSeguroHelper::formatDate($finalDate) : null;
332
+
333
+		return $searchParams;
334
+	}
335
+
336
+	/**
337
+	 * @param $connection
338
+	 * @param $code
339
+	 * @return bool|PagSeguroTransaction
340
+	 * @throws PagSeguroServiceException
341
+	 */
342
+	private function searchByCodeResult($connection, $code)
343
+	{
344
+		$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
345
+
346
+		switch ($httpStatus->getType()) {
347
+
348
+			case 'OK':
349
+				$transaction = PagSeguroTransactionParser::readTransaction($connection->getResponse());
350
+				LogPagSeguro::info(
351
+					"PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - end " .
352
+					$transaction->toString()
353
+				);
354
+				break;
355
+
356
+			case 'BAD_REQUEST':
357
+				$errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
358
+				$err = new PagSeguroServiceException($httpStatus, $errors);
359
+				LogPagSeguro::error(
360
+					"PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - error " .
361
+					$err->getOneLineMessage()
362
+				);
363
+				throw $err;
364
+				break;
365
+
366
+			default:
367
+				$err = new PagSeguroServiceException($httpStatus);
368
+				LogPagSeguro::error(
369
+					"PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - error " .
370
+					$err->getOneLineMessage()
371
+				);
372
+				throw $err;
373
+				break;
374
+		}
375
+		return isset($transaction) ? $transaction : false;
376
+	}
377
+
378
+	/**
379
+	 * @param $connection
380
+	 * @param null $initialDate
381
+	 * @param null $finalDate
382
+	 * @return bool|PagSeguroTransactionSearchResult
383
+	 * @throws PagSeguroServiceException
384
+	 */
385
+	private function searchResult($connection, $initialDate = null, $finalDate = null)
386
+	{
387
+
388
+		$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
389
+
390
+		switch ($httpStatus->getType()) {
391
+
392
+			case 'OK':
393
+
394
+				$searchResult = PagSeguroTransactionParser::readSearchResult($connection->getResponse());
395
+
396
+				LogPagSeguro::info(
397
+					sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
398
+					PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
399
+					PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $searchResult->toString()
400
+				);
401
+				break;
402
+
403
+			case 'BAD_REQUEST':
404
+				$errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
405
+				$err = new PagSeguroServiceException($httpStatus, $errors);
406
+				LogPagSeguro::error(
407
+					sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
408
+					PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
409
+					PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $err->getOneLineMessage()
410
+				);
411
+				throw $err;
412
+				break;
413
+
414
+			default:
415
+				$err = new PagSeguroServiceException($httpStatus);
416
+				LogPagSeguro::error(
417
+					sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
418
+					PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
419
+					PagSeguroHelper::formatDate($finalDate) . ") - end ",  self::$logService) . $err->getOneLineMessage()
420
+				);
421
+				throw $err;
422
+				break;
423
+
424
+		}
425
+
426
+		return isset($searchResult) ? $searchResult : false;
427
+	}
428 428
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     private static function buildSearchUrlByCode(PagSeguroConnectionData $connectionData, $transactionCode)
43 43
     {
44 44
         $url = $connectionData->getServiceUrl('v3');
45
-        return "{$url}/{$transactionCode}/?" . $connectionData->getCredentialsUrlQuery();
45
+        return "{$url}/{$transactionCode}/?".$connectionData->getCredentialsUrlQuery();
46 46
     }
47 47
 
48 48
     /**
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $url = $connectionData->getServiceUrl('v2');
56 56
         $initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
57
-        $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
57
+        $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=".$searchParams['finalDate']) : "";
58 58
         if ($searchParams['pageNumber'] != null) {
59
-            $page = "&page=" . $searchParams['pageNumber'];
59
+            $page = "&page=".$searchParams['pageNumber'];
60 60
         }
61 61
         if ($searchParams['maxPageResults'] != null) {
62
-            $maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
62
+            $maxPageResults = "&maxPageResults=".$searchParams['maxPageResults'];
63 63
         }
64
-        return "{$url}/?" . $connectionData->getCredentialsUrlQuery() .
64
+        return "{$url}/?".$connectionData->getCredentialsUrlQuery().
65 65
             "&initialDate={$initialDate}{$finalDate}{$page}{$maxPageResults}";
66 66
     }
67 67
 
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
         $url = $connectionData->getServiceUrl('v2');
76 76
 
77 77
         $initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
78
-        $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
78
+        $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=".$searchParams['finalDate']) : "";
79 79
         if ($searchParams['pageNumber'] != null) {
80
-            $page = "&page=" . $searchParams['pageNumber'];
80
+            $page = "&page=".$searchParams['pageNumber'];
81 81
         }
82 82
         if ($searchParams['maxPageResults'] != null) {
83
-            $maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
83
+            $maxPageResults = "&maxPageResults=".$searchParams['maxPageResults'];
84 84
         }
85
-        return "{$url}/abandoned/?" . $connectionData->getCredentialsUrlQuery() .
85
+        return "{$url}/abandoned/?".$connectionData->getCredentialsUrlQuery().
86 86
             "&initialDate={$initialDate}&finalDate={$finalDate}{$page}{$maxPageResults}";
87 87
     }
88 88
 
@@ -96,22 +96,22 @@  discard block
 block discarded – undo
96 96
         PagSeguroConnectionData $connectionData,
97 97
         $reference,
98 98
         $searchParams = null
99
-    ){
99
+    ) {
100 100
         $url = $connectionData->getServiceUrl('v2');
101 101
         if ($searchParams == null) {
102
-            return "{$url}?" . $connectionData->getCredentialsUrlQuery() . "&reference=" . $reference;
102
+            return "{$url}?".$connectionData->getCredentialsUrlQuery()."&reference=".$reference;
103 103
         } else {
104 104
 
105 105
             $initialDate = $searchParams['initialDate'] != null ? $searchParams['initialDate'] : "";
106
-            $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=" . $searchParams['finalDate']) : "";
106
+            $finalDate = $searchParams['finalDate'] != null ? ("&finalDate=".$searchParams['finalDate']) : "";
107 107
             if ($searchParams['pageNumber'] != null) {
108
-                $page = "&page=" . $searchParams['pageNumber'];
108
+                $page = "&page=".$searchParams['pageNumber'];
109 109
             }
110 110
             if ($searchParams['maxPageResults'] != null) {
111
-                $maxPageResults = "&maxPageResults=" . $searchParams['maxPageResults'];
111
+                $maxPageResults = "&maxPageResults=".$searchParams['maxPageResults'];
112 112
             }
113 113
 
114
-            return "{$url}?" . $connectionData->getCredentialsUrlQuery() . "&reference=" . $reference
114
+            return "{$url}?".$connectionData->getCredentialsUrlQuery()."&reference=".$reference
115 115
                    . "&initialDate={$initialDate}&finalDate={$finalDate}{$page}{$maxPageResults}";
116 116
         }
117 117
     }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             throw $err;
149 149
         }
150 150
         catch (Exception $err) {
151
-            LogPagSeguro::error("Exception: " . $err->getMessage());
151
+            LogPagSeguro::error("Exception: ".$err->getMessage());
152 152
             throw $err;
153 153
         }
154 154
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
     ) {
177 177
 
178 178
         LogPagSeguro::info(
179
-            "PagSeguroTransactionSearchService.SearchByDate(initialDate=" . PagSeguroHelper::formatDate($initialDate) .
180
-            ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - begin"
179
+            "PagSeguroTransactionSearchService.SearchByDate(initialDate=".PagSeguroHelper::formatDate($initialDate).
180
+            ", finalDate=".PagSeguroHelper::formatDate($finalDate).") - begin"
181 181
         );
182 182
 
183 183
         $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         } catch (PagSeguroServiceException $err) {
200 200
             throw $err;
201 201
         } catch (Exception $err) {
202
-            LogPagSeguro::error("Exception: " . $err->getMessage());
202
+            LogPagSeguro::error("Exception: ".$err->getMessage());
203 203
             throw $err;
204 204
         }
205 205
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
     ) {
228 228
 
229 229
         LogPagSeguro::info(
230
-            "PagSeguroTransactionSearchService.searchAbandoned(initialDate=" .
231
-            PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
232
-            PagSeguroHelper::formatDate($finalDate) . ") - begin"
230
+            "PagSeguroTransactionSearchService.searchAbandoned(initialDate=".
231
+            PagSeguroHelper::formatDate($initialDate).", finalDate=".
232
+            PagSeguroHelper::formatDate($finalDate).") - begin"
233 233
         );
234 234
 
235 235
         $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             throw $err;
253 253
         }
254 254
         catch (Exception $err) {
255
-            LogPagSeguro::error("Exception: " . $err->getMessage());
255
+            LogPagSeguro::error("Exception: ".$err->getMessage());
256 256
             throw $err;
257 257
         }
258 258
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         } catch (PagSeguroServiceException $err) {
308 308
             throw $err;
309 309
         } catch (Exception $err) {
310
-            LogPagSeguro::error("Exception: " . $err->getMessage());
310
+            LogPagSeguro::error("Exception: ".$err->getMessage());
311 311
             throw $err;
312 312
         }
313 313
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             case 'OK':
349 349
                 $transaction = PagSeguroTransactionParser::readTransaction($connection->getResponse());
350 350
                 LogPagSeguro::info(
351
-                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - end " .
351
+                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - end ".
352 352
                     $transaction->toString()
353 353
                 );
354 354
                 break;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
                 $errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
358 358
                 $err = new PagSeguroServiceException($httpStatus, $errors);
359 359
                 LogPagSeguro::error(
360
-                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - error " .
360
+                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - error ".
361 361
                     $err->getOneLineMessage()
362 362
                 );
363 363
                 throw $err;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             default:
367 367
                 $err = new PagSeguroServiceException($httpStatus);
368 368
                 LogPagSeguro::error(
369
-                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - error " .
369
+                    "PagSeguroTransactionSearchService.SearchByCode(transactionCode=$code) - error ".
370 370
                     $err->getOneLineMessage()
371 371
                 );
372 372
                 throw $err;
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
                 $searchResult = PagSeguroTransactionParser::readSearchResult($connection->getResponse());
395 395
 
396 396
                 LogPagSeguro::info(
397
-                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
398
-                    PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
399
-                    PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $searchResult->toString()
397
+                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=".
398
+                    PagSeguroHelper::formatDate($initialDate).", finalDate=".
399
+                    PagSeguroHelper::formatDate($finalDate).") - end ", self::$logService).$searchResult->toString()
400 400
                 );
401 401
                 break;
402 402
 
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
                 $errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
405 405
                 $err = new PagSeguroServiceException($httpStatus, $errors);
406 406
                 LogPagSeguro::error(
407
-                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
408
-                    PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
409
-                    PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $err->getOneLineMessage()
407
+                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=".
408
+                    PagSeguroHelper::formatDate($initialDate).", finalDate=".
409
+                    PagSeguroHelper::formatDate($finalDate).") - end ", self::$logService).$err->getOneLineMessage()
410 410
                 );
411 411
                 throw $err;
412 412
                 break;
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
             default:
415 415
                 $err = new PagSeguroServiceException($httpStatus);
416 416
                 LogPagSeguro::error(
417
-                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=" .
418
-                    PagSeguroHelper::formatDate($initialDate) . ", finalDate=" .
419
-                    PagSeguroHelper::formatDate($finalDate) . ") - end ",  self::$logService) . $err->getOneLineMessage()
417
+                    sprintf("PagSeguroTransactionSearchService.%s(initialDate=".
418
+                    PagSeguroHelper::formatDate($initialDate).", finalDate=".
419
+                    PagSeguroHelper::formatDate($finalDate).") - end ", self::$logService).$err->getOneLineMessage()
420 420
                 );
421 421
                 throw $err;
422 422
                 break;
Please login to merge, or discard this patch.
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -146,8 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
         } catch (PagSeguroServiceException $err) {
148 148
             throw $err;
149
-        }
150
-        catch (Exception $err) {
149
+        } catch (Exception $err) {
151 150
             LogPagSeguro::error("Exception: " . $err->getMessage());
152 151
             throw $err;
153 152
         }
@@ -250,8 +249,7 @@  discard block
 block discarded – undo
250 249
 
251 250
         } catch (PagSeguroServiceException $err) {
252 251
             throw $err;
253
-        }
254
-        catch (Exception $err) {
252
+        } catch (Exception $err) {
255 253
             LogPagSeguro::error("Exception: " . $err->getMessage());
256 254
             throw $err;
257 255
         }
@@ -283,10 +281,11 @@  discard block
 block discarded – undo
283 281
 
284 282
         $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
285 283
 
286
-        if ($initialDate)
287
-            $searchParams = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate);
288
-        else
289
-            $searchParams = null;
284
+        if ($initialDate) {
285
+                    $searchParams = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate);
286
+        } else {
287
+                    $searchParams = null;
288
+        }
290 289
 
291 290
         try {
292 291
 
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	 * Get index for sheet
305 305
 	 *
306 306
 	 * @param PHPExcel_Worksheet $pSheet
307
-	 * @return Sheet index
307
+	 * @return integer|null index
308 308
 	 * @throws Exception
309 309
 	 */
310 310
 	public function getIndex(PHPExcel_Worksheet $pSheet)
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @param string $sheetName Sheet name to modify index for
323 323
 	 * @param int $newIndex New index for the sheet
324
-	 * @return New sheet index
324
+	 * @return integer sheet index
325 325
 	 * @throws Exception
326 326
 	 */
327 327
     public function setIndexByName($sheetName, $newIndex)
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * Add named range
458 458
 	 *
459 459
 	 * @param PHPExcel_NamedRange $namedRange
460
-	 * @return PHPExcel
460
+	 * @return boolean
461 461
 	 */
462 462
 	public function addNamedRange(PHPExcel_NamedRange $namedRange) {
463 463
 		if ($namedRange->getScope() == null) {
Please login to merge, or discard this patch.
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * PHPExcel
4
- *
5
- * Copyright (c) 2006 - 2012 PHPExcel
6
- *
7
- * This library is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * This library is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with this library; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
- *
21
- * @category   PHPExcel
22
- * @package    PHPExcel
23
- * @copyright  Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
24
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
- * @version    1.7.7, 2012-05-19
26
- */
3
+	 * PHPExcel
4
+	 *
5
+	 * Copyright (c) 2006 - 2012 PHPExcel
6
+	 *
7
+	 * This library is free software; you can redistribute it and/or
8
+	 * modify it under the terms of the GNU Lesser General Public
9
+	 * License as published by the Free Software Foundation; either
10
+	 * version 2.1 of the License, or (at your option) any later version.
11
+	 *
12
+	 * This library is distributed in the hope that it will be useful,
13
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+	 * Lesser General Public License for more details.
16
+	 *
17
+	 * You should have received a copy of the GNU Lesser General Public
18
+	 * License along with this library; if not, write to the Free Software
19
+	 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+	 *
21
+	 * @category   PHPExcel
22
+	 * @package    PHPExcel
23
+	 * @copyright  Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+	 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
+	 * @version    1.7.7, 2012-05-19
26
+	 */
27 27
 
28 28
 
29 29
 /** PHPExcel root directory */
@@ -191,48 +191,48 @@  discard block
 block discarded – undo
191 191
 		return $this->_workSheetCollection[$this->_activeSheetIndex];
192 192
 	}
193 193
 
194
-    /**
195
-     * Create sheet and add it to this workbook
196
-     *
194
+	/**
195
+	 * Create sheet and add it to this workbook
196
+	 *
197 197
 	 * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
198
-     * @return PHPExcel_Worksheet
199
-     * @throws Exception
200
-     */
201
-    public function createSheet($iSheetIndex = null)
202
-    {
203
-        $newSheet = new PHPExcel_Worksheet($this);
204
-        $this->addSheet($newSheet, $iSheetIndex);
205
-        return $newSheet;
206
-    }
207
-
208
-    /**
209
-     * Add sheet
210
-     *
211
-     * @param PHPExcel_Worksheet $pSheet
198
+	 * @return PHPExcel_Worksheet
199
+	 * @throws Exception
200
+	 */
201
+	public function createSheet($iSheetIndex = null)
202
+	{
203
+		$newSheet = new PHPExcel_Worksheet($this);
204
+		$this->addSheet($newSheet, $iSheetIndex);
205
+		return $newSheet;
206
+	}
207
+
208
+	/**
209
+	 * Add sheet
210
+	 *
211
+	 * @param PHPExcel_Worksheet $pSheet
212 212
 	 * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
213
-     * @return PHPExcel_Worksheet
214
-     * @throws Exception
215
-     */
216
-    public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null)
217
-    {
218
-        if($iSheetIndex === NULL) {
219
-            $this->_workSheetCollection[] = $pSheet;
220
-        } else {
221
-            // Insert the sheet at the requested index
222
-            array_splice(
223
-                $this->_workSheetCollection,
224
-                $iSheetIndex,
225
-                0,
226
-                array($pSheet)
227
-                );
213
+	 * @return PHPExcel_Worksheet
214
+	 * @throws Exception
215
+	 */
216
+	public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null)
217
+	{
218
+		if($iSheetIndex === NULL) {
219
+			$this->_workSheetCollection[] = $pSheet;
220
+		} else {
221
+			// Insert the sheet at the requested index
222
+			array_splice(
223
+				$this->_workSheetCollection,
224
+				$iSheetIndex,
225
+				0,
226
+				array($pSheet)
227
+				);
228 228
 
229 229
 			// Adjust active sheet index if necessary
230 230
 			if ($this->_activeSheetIndex >= $iSheetIndex) {
231 231
 				++$this->_activeSheetIndex;
232 232
 			}
233
-        }
233
+		}
234 234
 		return $pSheet;
235
-    }
235
+	}
236 236
 
237 237
 	/**
238 238
 	 * Remove sheet by index
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		}
317 317
 	}
318 318
 
319
-    /**
319
+	/**
320 320
 	 * Set index for sheet by sheet name.
321 321
 	 *
322 322
 	 * @param string $sheetName Sheet name to modify index for
@@ -324,22 +324,22 @@  discard block
 block discarded – undo
324 324
 	 * @return New sheet index
325 325
 	 * @throws Exception
326 326
 	 */
327
-    public function setIndexByName($sheetName, $newIndex)
328
-    {
329
-        $oldIndex = $this->getIndex($this->getSheetByName($sheetName));
330
-        $pSheet = array_splice(
331
-            $this->_workSheetCollection,
332
-            $oldIndex,
333
-            1
334
-            );
335
-        array_splice(
336
-            $this->_workSheetCollection,
337
-            $newIndex,
338
-            0,
339
-            $pSheet
340
-            );
341
-        return $newIndex;
342
-    }
327
+	public function setIndexByName($sheetName, $newIndex)
328
+	{
329
+		$oldIndex = $this->getIndex($this->getSheetByName($sheetName));
330
+		$pSheet = array_splice(
331
+			$this->_workSheetCollection,
332
+			$oldIndex,
333
+			1
334
+			);
335
+		array_splice(
336
+			$this->_workSheetCollection,
337
+			$newIndex,
338
+			0,
339
+			$pSheet
340
+			);
341
+		return $newIndex;
342
+	}
343 343
 
344 344
 	/**
345 345
 	 * Get sheet count
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 	 */
725 725
 	public function garbageCollect()
726 726
 	{
727
-    	// how many references are there to each cellXf ?
727
+		// how many references are there to each cellXf ?
728 728
 		$countReferencesCellXf = array();
729 729
 		foreach ($this->_cellXfCollection as $index => $cellXf) {
730 730
 			$countReferencesCellXf[$index] = 0;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 /** PHPExcel root directory */
30
-if (!defined('PHPEXCEL_ROOT')) {
31
-	define('PHPEXCEL_ROOT', dirname(__FILE__) . '/');
32
-	require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
30
+if ( ! defined('PHPEXCEL_ROOT')) {
31
+	define('PHPEXCEL_ROOT', dirname(__FILE__).'/');
32
+	require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php');
33 33
 }
34 34
 
35 35
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 */
135 135
 	public function disconnectWorksheets() {
136
-		foreach($this->_workSheetCollection as $k => &$worksheet) {
136
+		foreach ($this->_workSheetCollection as $k => &$worksheet) {
137 137
 			$worksheet->disconnectCells();
138 138
 			$this->_workSheetCollection[$k] = null;
139 139
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null)
217 217
     {
218
-        if($iSheetIndex === NULL) {
218
+        if ($iSheetIndex === NULL) {
219 219
             $this->_workSheetCollection[] = $pSheet;
220 220
         } else {
221 221
             // Insert the sheet at the requested index
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 			return $worksheet;
393 393
 		}
394 394
 
395
-		throw new Exception('Workbook does not contain sheet:' . $pValue);
395
+		throw new Exception('Workbook does not contain sheet:'.$pValue);
396 396
 	}
397 397
 
398 398
 	/**
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		// update the cellXfs
439 439
 		foreach ($pSheet->getCellCollection(false) as $cellID) {
440 440
 			$cell = $pSheet->getCell($cellID);
441
-			$cell->setXfIndex( $cell->getXfIndex() + $countCellXfs );
441
+			$cell->setXfIndex($cell->getXfIndex() + $countCellXfs);
442 442
 		}
443 443
 
444 444
 		return $this->addSheet($pSheet, $iSheetIndex);
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
 			}
488 488
 
489 489
 			// then look for local defined name (has priority over global defined name if both names exist)
490
-			if (($pSheet !== NULL) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
491
-				$returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange];
490
+			if (($pSheet !== NULL) && isset($this->_namedRanges[$pSheet->getTitle().'!'.$namedRange])) {
491
+				$returnValue = $this->_namedRanges[$pSheet->getTitle().'!'.$namedRange];
492 492
 			}
493 493
 		}
494 494
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 				unset($this->_namedRanges[$namedRange]);
509 509
 			}
510 510
 		} else {
511
-			if (isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
512
-				unset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]);
511
+			if (isset($this->_namedRanges[$pSheet->getTitle().'!'.$namedRange])) {
512
+				unset($this->_namedRanges[$pSheet->getTitle().'!'.$namedRange]);
513 513
 			}
514 514
 		}
515 515
 		return $this;
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 * Implement PHP __clone to create a deep clone, not just a shallow copy.
546 546
 	 */
547 547
 	public function __clone() {
548
-		foreach($this as $key => $val) {
548
+		foreach ($this as $key => $val) {
549 549
 			if (is_object($val) || (is_array($val))) {
550 550
 				$this->{$key} = unserialize(serialize($val));
551 551
 			}
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 				foreach ($worksheet->getCellCollection(false) as $cellID) {
634 634
 					$cell = $worksheet->getCell($cellID);
635 635
 					$xfIndex = $cell->getXfIndex();
636
-					if ($xfIndex > $pIndex ) {
636
+					if ($xfIndex > $pIndex) {
637 637
 						// decrease xf index by 1
638 638
 						$cell->setXfIndex($xfIndex - 1);
639 639
 					} else if ($xfIndex == $pIndex) {
@@ -780,19 +780,19 @@  discard block
 block discarded – undo
780 780
 			// for all cells
781 781
 			foreach ($sheet->getCellCollection(false) as $cellID) {
782 782
 				$cell = $sheet->getCell($cellID);
783
-				$cell->setXfIndex( $map[$cell->getXfIndex()] );
783
+				$cell->setXfIndex($map[$cell->getXfIndex()]);
784 784
 			}
785 785
 
786 786
 			// for all row dimensions
787 787
 			foreach ($sheet->getRowDimensions() as $rowDimension) {
788 788
 				if ($rowDimension->getXfIndex() !== null) {
789
-					$rowDimension->setXfIndex( $map[$rowDimension->getXfIndex()] );
789
+					$rowDimension->setXfIndex($map[$rowDimension->getXfIndex()]);
790 790
 				}
791 791
 			}
792 792
 
793 793
 			// for all column dimensions
794 794
 			foreach ($sheet->getColumnDimensions() as $columnDimension) {
795
-				$columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] );
795
+				$columnDimension->setXfIndex($map[$columnDimension->getXfIndex()]);
796 796
 			}
797 797
 		}
798 798
 
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/CachedObjectStorage/APC.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @access	public
81 81
      * @param	string			$pCoord		Coordinate address of the cell to update
82 82
      * @param	PHPExcel_Cell	$cell		Cell to update
83
-	 * @return	void
83
+	 * @return	PHPExcel_Cell
84 84
      * @throws	Exception
85 85
      */
86 86
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @access	public
104 104
 	 * @param	string		$pCoord		Coordinate address of the cell to check
105
-	 * @return	void
105
+	 * @return	boolean
106 106
 	 * @return	boolean
107 107
 	 */
108 108
 	public function isDataSet($pCoord) {
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 	private $_cacheTime = 600;
53 53
 
54 54
 
55
-    /**
56
-     * Store cell data in cache for the current cell object if it's "dirty",
57
-     *     and the 'nullify' the current cell object
58
-     *
55
+	/**
56
+	 * Store cell data in cache for the current cell object if it's "dirty",
57
+	 *     and the 'nullify' the current cell object
58
+	 *
59 59
 	 * @access	private
60 60
 	 * @return	void
61
-     * @throws	Exception
62
-     */
61
+	 * @throws	Exception
62
+	 */
63 63
 	private function _storeData() {
64 64
 		if ($this->_currentCellIsDirty) {
65 65
 			$this->_currentObject->detach();
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
 	}	//	function _storeData()
75 75
 
76 76
 
77
-    /**
78
-     * Add or Update a cell in cache identified by coordinate address
79
-     *
77
+	/**
78
+	 * Add or Update a cell in cache identified by coordinate address
79
+	 *
80 80
 	 * @access	public
81
-     * @param	string			$pCoord		Coordinate address of the cell to update
82
-     * @param	PHPExcel_Cell	$cell		Cell to update
81
+	 * @param	string			$pCoord		Coordinate address of the cell to update
82
+	 * @param	PHPExcel_Cell	$cell		Cell to update
83 83
 	 * @return	void
84
-     * @throws	Exception
85
-     */
84
+	 * @throws	Exception
85
+	 */
86 86
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
87 87
 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
88 88
 			$this->_storeData();
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
 	}	//	function isDataSet()
125 125
 
126 126
 
127
-    /**
128
-     * Get cell at a specific coordinate
129
-     *
127
+	/**
128
+	 * Get cell at a specific coordinate
129
+	 *
130 130
 	 * @access	public
131
-     * @param 	string 			$pCoord		Coordinate of the cell
132
-     * @throws 	Exception
133
-     * @return 	PHPExcel_Cell 	Cell that was found, or null if not found
134
-     */
131
+	 * @param 	string 			$pCoord		Coordinate of the cell
132
+	 * @throws 	Exception
133
+	 * @return 	PHPExcel_Cell 	Cell that was found, or null if not found
134
+	 */
135 135
 	public function getCacheData($pCoord) {
136 136
 		if ($pCoord === $this->_currentObjectID) {
137 137
 			return $this->_currentObject;
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
 	}	//	function getCacheData()
163 163
 
164 164
 
165
-    /**
166
-     * Delete a cell in cache identified by coordinate address
167
-     *
165
+	/**
166
+	 * Delete a cell in cache identified by coordinate address
167
+	 *
168 168
 	 * @access	public
169
-     * @param	string			$pCoord		Coordinate address of the cell to delete
170
-     * @throws	Exception
171
-     */
169
+	 * @param	string			$pCoord		Coordinate address of the cell to delete
170
+	 * @throws	Exception
171
+	 */
172 172
 	public function deleteCacheData($pCoord) {
173 173
 		//	Delete the entry from APC
174 174
 		apc_delete($this->_cachePrefix.$pCoord.'.cache');
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		if ($this->_currentCellIsDirty) {
65 65
 			$this->_currentObject->detach();
66 66
 
67
-			if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
67
+			if ( ! apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache', serialize($this->_currentObject), $this->_cacheTime)) {
68 68
 				$this->__destruct();
69 69
 				throw new Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
70 70
 			}
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
 		parent::copyCellCollection($parent);
190 190
 		//	Get a new id for the new file name
191 191
 		$baseUnique = $this->_getUniqueID();
192
-		$newCachePrefix = substr(md5($baseUnique),0,8).'.';
192
+		$newCachePrefix = substr(md5($baseUnique), 0, 8).'.';
193 193
 		$cacheList = $this->getCellList();
194
-		foreach($cacheList as $cellID) {
194
+		foreach ($cacheList as $cellID) {
195 195
 			if ($cellID != $this->_currentObjectID) {
196 196
 				$obj = apc_fetch($this->_cachePrefix.$cellID.'.cache');
197 197
 				if ($obj === false) {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 					parent::deleteCacheData($cellID);
200 200
 					throw new Exception('Cell entry '.$cellID.' no longer exists in APC');
201 201
 				}
202
-				if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
202
+				if ( ! apc_store($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) {
203 203
 					$this->__destruct();
204 204
 					throw new Exception('Failed to store cell '.$cellID.' in APC');
205 205
 				}
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 	 * @param	array of mixed		$arguments	Additional initialisation arguments
240 240
 	 */
241 241
 	public function __construct(PHPExcel_Worksheet $parent, $arguments) {
242
-		$cacheTime	= (isset($arguments['cacheTime']))	? $arguments['cacheTime']	: 600;
242
+		$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
243 243
 
244 244
 		if ($this->_cachePrefix === NULL) {
245 245
 			$baseUnique = $this->_getUniqueID();
246
-			$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
246
+			$this->_cachePrefix = substr(md5($baseUnique), 0, 8).'.';
247 247
 			$this->_cacheTime = $cacheTime;
248 248
 
249 249
 			parent::__construct($parent);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function __destruct() {
260 260
 		$cacheList = $this->getCellList();
261
-		foreach($cacheList as $cellID) {
261
+		foreach ($cacheList as $cellID) {
262 262
 			apc_delete($this->_cachePrefix.$cellID.'.cache');
263 263
 		}
264 264
 	}	//	function __destruct()
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 * @return	boolean
273 273
 	 */
274 274
 	public static function cacheMethodIsAvailable() {
275
-		if (!function_exists('apc_store')) {
275
+		if ( ! function_exists('apc_store')) {
276 276
 			return false;
277 277
 		}
278 278
 		if (apc_sma_info() === false) {
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/CachedObjectStorage/Memcache.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @param	string			$pCoord		Coordinate address of the cell to update
88 88
      * @param	PHPExcel_Cell	$cell		Cell to update
89
-	 * @return	void
89
+	 * @return	PHPExcel_Cell
90 90
      * @throws	Exception
91 91
      */
92 92
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
108 108
 	 *
109 109
 	 * @param	string		$pCoord		Coordinate address of the cell to check
110
-	 * @return	void
110
+	 * @return	boolean
111 111
 	 * @return	boolean
112 112
 	 */
113 113
 	public function isDataSet($pCoord) {
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 	private $_memcache = null;
58 58
 
59 59
 
60
-    /**
61
-     * Store cell data in cache for the current cell object if it's "dirty",
62
-     *     and the 'nullify' the current cell object
63
-     *
60
+	/**
61
+	 * Store cell data in cache for the current cell object if it's "dirty",
62
+	 *     and the 'nullify' the current cell object
63
+	 *
64 64
 	 * @return	void
65
-     * @throws	Exception
66
-     */
65
+	 * @throws	Exception
66
+	 */
67 67
 	private function _storeData() {
68 68
 		if ($this->_currentCellIsDirty) {
69 69
 			$this->_currentObject->detach();
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 	}	//	function _storeData()
82 82
 
83 83
 
84
-    /**
85
-     * Add or Update a cell in cache identified by coordinate address
86
-     *
87
-     * @param	string			$pCoord		Coordinate address of the cell to update
88
-     * @param	PHPExcel_Cell	$cell		Cell to update
84
+	/**
85
+	 * Add or Update a cell in cache identified by coordinate address
86
+	 *
87
+	 * @param	string			$pCoord		Coordinate address of the cell to update
88
+	 * @param	PHPExcel_Cell	$cell		Cell to update
89 89
 	 * @return	void
90
-     * @throws	Exception
91
-     */
90
+	 * @throws	Exception
91
+	 */
92 92
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
93 93
 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
94 94
 			$this->_storeData();
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 
131 131
 
132 132
 	/**
133
-     * Get cell at a specific coordinate
134
-     *
135
-     * @param 	string 			$pCoord		Coordinate of the cell
136
-     * @throws 	Exception
137
-     * @return 	PHPExcel_Cell 	Cell that was found, or null if not found
138
-     */
133
+	 * Get cell at a specific coordinate
134
+	 *
135
+	 * @param 	string 			$pCoord		Coordinate of the cell
136
+	 * @throws 	Exception
137
+	 * @return 	PHPExcel_Cell 	Cell that was found, or null if not found
138
+	 */
139 139
 	public function getCacheData($pCoord) {
140 140
 		if ($pCoord === $this->_currentObjectID) {
141 141
 			return $this->_currentObject;
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	}	//	function getCacheData()
167 167
 
168 168
 
169
-    /**
170
-     * Delete a cell in cache identified by coordinate address
171
-     *
172
-     * @param	string			$pCoord		Coordinate address of the cell to delete
173
-     * @throws	Exception
174
-     */
169
+	/**
170
+	 * Delete a cell in cache identified by coordinate address
171
+	 *
172
+	 * @param	string			$pCoord		Coordinate address of the cell to delete
173
+	 * @throws	Exception
174
+	 */
175 175
 	public function deleteCacheData($pCoord) {
176 176
 		//	Delete the entry from Memcache
177 177
 		$this->_memcache->delete($this->_cachePrefix.$pCoord.'.cache');
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 *
265 265
 	 * @param	string	$host		Memcache server
266 266
 	 * @param	integer	$port		Memcache port
267
-     * @throws	Exception
267
+	 * @throws	Exception
268 268
 	 */
269 269
 	public function failureCallback($host, $port) {
270 270
 		throw new Exception('memcache '.$host.':'.$port.' failed');
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 			$this->_currentObject->detach();
70 70
 
71 71
 			$obj = serialize($this->_currentObject);
72
-			if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
73
-				if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
72
+			if ( ! $this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, NULL, $this->_cacheTime)) {
73
+				if ( ! $this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, NULL, $this->_cacheTime)) {
74 74
 					$this->__destruct();
75 75
 					throw new Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache');
76 76
 				}
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 		parent::copyCellCollection($parent);
192 192
 		//	Get a new id for the new file name
193 193
 		$baseUnique = $this->_getUniqueID();
194
-		$newCachePrefix = substr(md5($baseUnique),0,8).'.';
194
+		$newCachePrefix = substr(md5($baseUnique), 0, 8).'.';
195 195
 		$cacheList = $this->getCellList();
196
-		foreach($cacheList as $cellID) {
196
+		foreach ($cacheList as $cellID) {
197 197
 			if ($cellID != $this->_currentObjectID) {
198 198
 				$obj = $this->_memcache->get($this->_cachePrefix.$cellID.'.cache');
199 199
 				if ($obj === false) {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 					parent::deleteCacheData($cellID);
202 202
 					throw new Exception('Cell entry '.$cellID.' no longer exists in MemCache');
203 203
 				}
204
-				if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) {
204
+				if ( ! $this->_memcache->add($newCachePrefix.$cellID.'.cache', $obj, NULL, $this->_cacheTime)) {
205 205
 					$this->__destruct();
206 206
 					throw new Exception('Failed to store cell '.$cellID.' in MemCache');
207 207
 				}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @return	void
218 218
 	 */
219 219
 	public function unsetWorksheetCells() {
220
-		if(!is_null($this->_currentObject)) {
220
+		if ( ! is_null($this->_currentObject)) {
221 221
 			$this->_currentObject->detach();
222 222
 			$this->_currentObject = $this->_currentObjectID = null;
223 223
 		}
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
 	 * @param	array of mixed		$arguments	Additional initialisation arguments
240 240
 	 */
241 241
 	public function __construct(PHPExcel_Worksheet $parent, $arguments) {
242
-		$memcacheServer	= (isset($arguments['memcacheServer']))	? $arguments['memcacheServer']	: 'localhost';
243
-		$memcachePort	= (isset($arguments['memcachePort']))	? $arguments['memcachePort']	: 11211;
244
-		$cacheTime		= (isset($arguments['cacheTime']))		? $arguments['cacheTime']		: 600;
242
+		$memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost';
243
+		$memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
244
+		$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
245 245
 
246 246
 		if (is_null($this->_cachePrefix)) {
247 247
 			$baseUnique = $this->_getUniqueID();
248
-			$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
248
+			$this->_cachePrefix = substr(md5($baseUnique), 0, 8).'.';
249 249
 
250 250
 			//	Set a new Memcache object and connect to the Memcache server
251 251
 			$this->_memcache = new Memcache();
252
-			if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
252
+			if ( ! $this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
253 253
 				throw new Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort);
254 254
 			}
255 255
 			$this->_cacheTime = $cacheTime;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function __destruct() {
278 278
 		$cacheList = $this->getCellList();
279
-		foreach($cacheList as $cellID) {
279
+		foreach ($cacheList as $cellID) {
280 280
 			$this->_memcache->delete($this->_cachePrefix.$cellID.'.cache');
281 281
 		}
282 282
 	}	//	function __destruct()
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 * @return	boolean
289 289
 	 */
290 290
 	public static function cacheMethodIsAvailable() {
291
-		if (!function_exists('memcache_add')) {
291
+		if ( ! function_exists('memcache_add')) {
292 292
 			return false;
293 293
 		}
294 294
 
Please login to merge, or discard this patch.