Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Commit 0b0a951

Browse files
author
dpfaffenbauer
committed
fix coding style issues and travis ci config
1 parent 5013573 commit 0b0a951

8 files changed

+145
-19
lines changed

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: php
2+
3+
php:
4+
- 5.3
5+
- 5.4
6+
- 5.5
7+
- 5.6
8+
- hhvm
9+
10+
before_script:
11+
- composer install -n --dev --prefer-source
12+
13+
script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
14+
15+
after_script:
16+
- wget https://scrutinizer-ci.com/ocular.phar
17+
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover

src/AbstractDatatransGateway.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
<?php
2+
/**
3+
* w-vision
4+
*
5+
* LICENSE
6+
*
7+
* This source file is subject to the GNU General Public License version 3 (GPLv3)
8+
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9+
* files that are distributed with this source code.
10+
*
11+
* @copyright Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12+
* @license GNU General Public License version 3 (GPLv3)
13+
*/
214

315
namespace Omnipay\Datatrans;
416

@@ -28,7 +40,8 @@ public function getDefaultParameters()
2840
* @param $value
2941
* @return $this
3042
*/
31-
public function setMerchantId($value) {
43+
public function setMerchantId($value)
44+
{
3245
return $this->setParameter('merchantId', $value);
3346
}
3447

@@ -37,22 +50,25 @@ public function setMerchantId($value) {
3750
*
3851
* @return string
3952
*/
40-
public function getMerchantId() {
53+
public function getMerchantId()
54+
{
4155
return $this->getParameter('merchantId');
4256
}
4357

4458
/**
4559
* @param $value
4660
* @return $this
4761
*/
48-
public function setSign($value) {
62+
public function setSign($value)
63+
{
4964
return $this->setParameter('sign', $value);
5065
}
5166

5267
/**
5368
* @return string
5469
*/
55-
public function getSign() {
70+
public function getSign()
71+
{
5672
return $this->getParameter('sign');
5773
}
5874
}

src/Gateway.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
<?php
2+
/**
3+
* w-vision
4+
*
5+
* LICENSE
6+
*
7+
* This source file is subject to the GNU General Public License version 3 (GPLv3)
8+
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9+
* files that are distributed with this source code.
10+
*
11+
* @copyright Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12+
* @license GNU General Public License version 3 (GPLv3)
13+
*/
214

315
namespace Omnipay\Datatrans;
416

5-
use Omnipay\Common\AbstractGateway;
6-
717
/**
818
* Datatrans Gateway
9-
*
10-
* @TODO: add optional fields
1119
*/
1220
class Gateway extends AbstractDatatransGateway
1321
{

src/Message/AbstractRequest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
<?php
2+
/**
3+
* w-vision
4+
*
5+
* LICENSE
6+
*
7+
* This source file is subject to the GNU General Public License version 3 (GPLv3)
8+
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9+
* files that are distributed with this source code.
10+
*
11+
* @copyright Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12+
* @license GNU General Public License version 3 (GPLv3)
13+
*/
214

315
namespace Omnipay\Datatrans\Message;
416

src/Message/CompletePurchaseRequest.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
<?php
2+
/**
3+
* w-vision
4+
*
5+
* LICENSE
6+
*
7+
* This source file is subject to the GNU General Public License version 3 (GPLv3)
8+
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9+
* files that are distributed with this source code.
10+
*
11+
* @copyright Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12+
* @license GNU General Public License version 3 (GPLv3)
13+
*/
214

315
namespace Omnipay\Datatrans\Message;
416

5-
use Omnipay\Common\Exception\InvalidResponseException;
6-
717
class CompletePurchaseRequest extends AbstractRequest
818
{
19+
/**
20+
* @return array
21+
*/
922
public function getData()
1023
{
1124
return $this->httpRequest->request->all();
1225
}
1326

14-
// Sending the 1.x way
27+
/**
28+
* @return ResponseInterface
29+
*/
1530
public function send()
1631
{
1732
return $this->sendData($this->getData());

src/Message/CompletePurchaseResponse.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
<?php
2+
/**
3+
* w-vision
4+
*
5+
* LICENSE
6+
*
7+
* This source file is subject to the GNU General Public License version 3 (GPLv3)
8+
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9+
* files that are distributed with this source code.
10+
*
11+
* @copyright Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12+
* @license GNU General Public License version 3 (GPLv3)
13+
*/
214

315
namespace Omnipay\Datatrans\Message;
416

@@ -9,13 +21,19 @@
921
*/
1022
class CompletePurchaseResponse extends AbstractResponse
1123
{
24+
/**
25+
* @return bool
26+
*/
1227
public function isSuccessful()
1328
{
1429
$status = $this->getStatus();
1530

1631
return $status === 'success';
1732
}
1833

34+
/**
35+
* @return string
36+
*/
1937
public function getMessage()
2038
{
2139
if (!$this->isSuccessful()) {
@@ -25,13 +43,19 @@ public function getMessage()
2543
return '';
2644
}
2745

28-
46+
/**
47+
* @return string
48+
*/
2949
public function getTransactionReference()
3050
{
3151
return isset($this->data['refno']) ? $this->data['refno'] : '';
3252
}
3353

34-
public function getStatus() {
54+
/**
55+
* @return mixed
56+
*/
57+
public function getStatus()
58+
{
3559
return $this->data['status'];
3660
}
3761
}

src/Message/PurchaseRequest.php

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
<?php
2+
/**
3+
* w-vision
4+
*
5+
* LICENSE
6+
*
7+
* This source file is subject to the GNU General Public License version 3 (GPLv3)
8+
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9+
* files that are distributed with this source code.
10+
*
11+
* @copyright Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12+
* @license GNU General Public License version 3 (GPLv3)
13+
*/
214

315
namespace Omnipay\Datatrans\Message;
416

5-
use Omnipay\Common\CreditCard;
17+
use Omnipay\Common\Message\ResponseInterface;
618

719
class PurchaseRequest extends AbstractRequest
820
{
21+
/**
22+
* @var array
23+
*/
924
protected $optionalParams = array(
1025

1126
);
1227

28+
/**
29+
* @return array
30+
*/
1331
public function getData()
1432
{
1533
$this->validate('merchantId', 'transactionId', 'sign');
@@ -40,20 +58,24 @@ public function getData()
4058

4159
/**
4260
* @param $value
43-
* @return $this
61+
* @return string
4462
*/
45-
public function setErrorUrl($value) {
63+
public function setErrorUrl($value)
64+
{
4665
return $this->setParameter('errorUrl', $value);
4766
}
4867

4968
/**
5069
* @return string
5170
*/
52-
public function getErrorUrl() {
71+
public function getErrorUrl()
72+
{
5373
return $this->getParameter('errorUrl');
5474
}
5575

56-
// Send request the 1.x way
76+
/**
77+
* @return ResponseInterface
78+
*/
5779
public function send()
5880
{
5981
return $this->sendData($this->getData());

src/Message/PurchaseResponse.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
<?php
2+
/**
3+
* w-vision
4+
*
5+
* LICENSE
6+
*
7+
* This source file is subject to the GNU General Public License version 3 (GPLv3)
8+
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9+
* files that are distributed with this source code.
10+
*
11+
* @copyright Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12+
* @license GNU General Public License version 3 (GPLv3)
13+
*/
214

315
namespace Omnipay\Datatrans\Message;
416

@@ -74,7 +86,7 @@ protected function getCheckoutEndpoint()
7486
{
7587
$req = $this->getRequest();
7688

77-
if($req->getTestMode()) {
89+
if ($req->getTestMode()) {
7890
return $this->testEndpoint;
7991
}
8092

0 commit comments

Comments
 (0)