Skip to content

Commit

Permalink
Merge pull request #31 from bookboon/feature/phpstan
Browse files Browse the repository at this point in the history
Feature/phpstan
  • Loading branch information
lkm authored Jan 30, 2019
2 parents 88900c7 + 7faf044 commit e6aed58
Show file tree
Hide file tree
Showing 51 changed files with 1,049 additions and 1,085 deletions.
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ services:
- memcached
- redis-server

jobs:
include:
- stage: "Tests"
name: "Unit Tests"
script: vendor/bin/phpunit -c . --coverage-clover build/logs/clover.xml
- script: vendor/bin/phpstan analyse src/ --level 6 --no-progress
name: "Static Analyser"

before_script:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = igbinary.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
- composer install

script: vendor/bin/phpunit -c . --coverage-clover build/logs/clover.xml

after_script:
- vendor/bin/test-reporter
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
}
],
"require": {
"php": ">=7.1",
"php": "^7.1",
"ext-curl": "*",
"ext-json" : "*",
"league/oauth2-client": "~2.3"
"league/oauth2-client": "~2.3",
"psr/simple-cache": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~5.0",
"codeclimate/php-test-reporter": "~0.2"
"codeclimate/php-test-reporter": "~0.2",
"phpstan/phpstan": "^0.11.1"
},
"autoload": {
"psr-4": {
Expand Down
32 changes: 18 additions & 14 deletions src/Bookboon.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
*
*/

use Bookboon\Api\Cache\Cache;
use Bookboon\Api\Client\BookboonResponse;
use Bookboon\Api\Client\Client;
use Bookboon\Api\Client\ClientInterface;
use Bookboon\Api\Client\Headers;
use Bookboon\Api\Client\OauthClient;
use Psr\Http\Message\ResponseInterface;
use Psr\SimpleCache\CacheInterface;

class Bookboon
{
Expand All @@ -33,9 +33,9 @@ class Bookboon
/**
* Bookboon constructor.
*
* @param Client $client
* @param ClientInterface $client
*/
public function __construct(Client $client)
public function __construct(ClientInterface $client)
{
$this->client = $client;
}
Expand All @@ -47,19 +47,19 @@ public function __construct(Client $client)
* @param array $headers
* @param string|null $appUserId
* @param string|null $redirectUri
* @param Cache|null $cache
* @param CacheInterface|null $cache
* @return Bookboon
* @throws Exception\UsageException
*/
public static function create(
$appId,
$appSecret,
string $appId,
string $appSecret,
array $scopes,
array $headers = [],
$appUserId = null,
$redirectUri = null,
Cache $cache = null
) {
?string $appUserId = null,
?string $redirectUri = null,
CacheInterface $cache = null
) : Bookboon {
$headersObject = new Headers();
foreach ($headers as $key => $value) {
$headersObject->set($key, $value);
Expand All @@ -78,13 +78,17 @@ public static function create(
* @return BookboonResponse
* @throws Exception\UsageException
*/
public function rawRequest($url, array $variables = [], $httpMethod = Client::HTTP_GET, $shouldCache = true)
{
public function rawRequest(
string $url,
array $variables = [],
string $httpMethod = ClientInterface::HTTP_GET,
bool $shouldCache = true
) : BookboonResponse {
return $this->client->makeRequest($url, $variables, $httpMethod, $shouldCache);
}

/**
* @return Client
* @return ClientInterface
*/
public function getClient()
{
Expand Down
68 changes: 0 additions & 68 deletions src/Cache/Cache.php

This file was deleted.

49 changes: 0 additions & 49 deletions src/Cache/HashTrait.php

This file was deleted.

95 changes: 0 additions & 95 deletions src/Cache/MemcachedCache.php

This file was deleted.

Loading

0 comments on commit e6aed58

Please sign in to comment.