diff --git a/.scrutinizer.yml b/.scrutinizer.yml
new file mode 100644
index 0000000..18120de
--- /dev/null
+++ b/.scrutinizer.yml
@@ -0,0 +1,15 @@
+build:
+ environment:
+ php:
+ version: 5.6.9 # Common versions: 5.4, 5.5, 5.6, 7.0 or hhvm
+ tests:
+ override:
+ -
+ command: 'phpunit --coverage-clover=clover.xml'
+ coverage:
+ file: 'clover.xml'
+ format: 'php-clover'
+checks:
+ php:
+ custom_coding_standard:
+ ruleset_path: 'ruleset.xml'
diff --git a/.travis.yml b/.travis.yml
index 976e54c..fa5f8bb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,6 @@ language: php
sudo: false
php:
- - 5.4
- 5.5
- 5.6
- 7
@@ -13,5 +12,12 @@ install:
- composer self-update
- composer install --no-interaction
+before_script:
+ - mkdir -p build/logs
+
script:
- - phpunit --bootstrap vendor/autoload.php
+ - phpunit --coverage-clover build/logs/clover.xml ./Tests
+ - vendor/bin/phpcs --runtime-set ignore_warnings_on_exit 1 --standard=ruleset.xml QuickPay
+
+after_script:
+ - php vendor/bin/coveralls -v
diff --git a/QuickPay/API/Exception.php b/QuickPay/API/Exception.php
index 8f1b00e..f69c8de 100644
--- a/QuickPay/API/Exception.php
+++ b/QuickPay/API/Exception.php
@@ -13,13 +13,12 @@
class Exception extends \Exception
{
/**
- * __Construct function.
- *
- * Redefine the exception so message isn't optional
- *
- * @access public
- * @return void
- */
+ * __Construct function.
+ *
+ * Redefine the exception so message isn't optional
+ *
+ * @access public
+ */
public function __construct($message, $code = 0, Exception $previous = null)
{
// Make sure everything is assigned properly
diff --git a/QuickPay/API/Request.php b/QuickPay/API/Request.php
index efb485e..618a41d 100644
--- a/QuickPay/API/Request.php
+++ b/QuickPay/API/Request.php
@@ -27,7 +27,6 @@ class Request
* Instantiates the object
*
* @access public
- * @return object
*/
public function __construct($client)
{
@@ -47,7 +46,7 @@ public function __construct($client)
public function get($path, $query = array())
{
// Add query parameters to $path?
- if ($query) {
+ if (!empty($query)) {
if (strpos($path, '?') === false) {
$path .= '?' . http_build_query($query);
} else {
diff --git a/QuickPay/API/Response.php b/QuickPay/API/Response.php
index 167c195..fe78e2b 100644
--- a/QuickPay/API/Response.php
+++ b/QuickPay/API/Response.php
@@ -113,7 +113,7 @@ public function as_array()
*
* Returns the response body as an array
*
- * @return array
+ * @return \stdClass
*/
public function as_object()
{
diff --git a/QuickPay/Tests/api/ExceptionTest.php b/Tests/api/ExceptionTest.php
similarity index 100%
rename from QuickPay/Tests/api/ExceptionTest.php
rename to Tests/api/ExceptionTest.php
diff --git a/QuickPay/Tests/api/RequestTest.php b/Tests/api/RequestTest.php
similarity index 95%
rename from QuickPay/Tests/api/RequestTest.php
rename to Tests/api/RequestTest.php
index 9e1219c..78b9003 100644
--- a/QuickPay/Tests/api/RequestTest.php
+++ b/Tests/api/RequestTest.php
@@ -8,7 +8,6 @@
class RequestTest extends \PHPUnit_Framework_TestCase
{
- private $responseTestData = '{ "key1": "value1", "key2": "value2" }';
protected $request;
public function setUp()
diff --git a/QuickPay/Tests/api/ResponseTest.php b/Tests/api/ResponseTest.php
similarity index 100%
rename from QuickPay/Tests/api/ResponseTest.php
rename to Tests/api/ResponseTest.php
diff --git a/composer.json b/composer.json
index 50f9729..5e5e839 100644
--- a/composer.json
+++ b/composer.json
@@ -8,13 +8,20 @@
"php": ">=5.3.3",
"lib/curl": "dev-master"
},
- "require-dev" : {
- "phpunit/phpunit": "4.8.*@dev",
- "squizlabs/php_codesniffer": "2.*"
- },
"autoload": {
"psr-4": {
"QuickPay\\": "QuickPay/"
}
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "QuickPay\\Tests\\": "Tests/api/"
+ }
+ },
+ "require-dev" : {
+ "php": ">=5.5.0",
+ "phpunit/phpunit": "4.8.*@dev",
+ "squizlabs/php_codesniffer": "2.*",
+ "satooshi/php-coveralls": "dev-master"
}
}
diff --git a/phpunit.xml b/phpunit.xml
index 0e02004..62a1f21 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,8 +1,21 @@
-
+
-
- ./QuickPay/Tests/
+
+ ./Tests/
-
\ No newline at end of file
+
+
+ ./QuickPay/
+
+
+
diff --git a/ruleset.xml b/ruleset.xml
new file mode 100644
index 0000000..13e8f59
--- /dev/null
+++ b/ruleset.xml
@@ -0,0 +1,12 @@
+
+
+
+ The QuickPay ruleset based on the PSR-2 coding standard.
+
+
+ 0
+
+
+ 0
+
+