diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 3bfac2f..cbe90f2 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,16 +1,3 @@ -build: - environment: - php: - version: 5.6 - - tests: - override: - - - command: 'phpunit --coverage-clover=some-file' - coverage: - file: 'some-file' - format: 'php-clover' - checks: php: code_rating: true diff --git a/.travis.yml b/.travis.yml index abec8f0..0453f7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,11 @@ language: php +dist: trusty +sudo: false + php: - 5.6 - - hhvm - - nightly + - 7.0 + - 7.1 before_script: - composer install diff --git a/README.md b/README.md index b9df0e8..43265da 100644 --- a/README.md +++ b/README.md @@ -40,45 +40,47 @@ To get the result you can call the method **getResult()** on the ApiResult objec ```php $apiClient = new \LoLApi\ApiClient(\LoLApi\ApiClient::REGION_EUW, 'my-key'); -$apiClient->getMatchListApi()->getMatchListBySummonerId(2); +$apiClient->getMatchApi()->getMatchListBySummonerId(2); $apiClient->getMatchApi()->getMatchByMatchId(2, true); -$apiClient->getSummonerApi()->getSummonersBySummonerNames(['MySummonerName']); -$apiClient->getSummonerApi()->getSummonersBySummonerIds([2]); -$apiClient->getSummonerApi()->getSummonersMasteriesBySummonerIds([2]); -$apiClient->getSummonerApi()->getSummonersNamesBySummonerIds([2]); -$apiClient->getSummonerApi()->getSummonersRunesBySummonerIds([2]); +$apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName'); +$apiClient->getSummonerApi()->getSummonerBySummonerId(2); +$apiClient->getMasteriesApi()->getMasteriesBySummonerId(2); +$apiClient->getRunesApi()->getRunesBySummonerId(2); +$apiClient->getSummonerApi()->getSummonerNameBySummonerId(2); $apiClient->getChampionApi()->getChampionById(20); $apiClient->getFeaturedGamesApi()->getFeaturedGames(); $apiClient->getStatsApi()->getRankedStatsBySummonerId(2); -$apiClient->getTeamApi()->getTeamsBySummonersIds([2]); -$apiClient->getTeamApi()->getTeamsByTeamsIds(['T1']); $apiClient->getGameApi()->getRecentGamesBySummonerId(2); -$apiClient->getCurrentGameApi()->getCurrentGameByPlatformIdAndSummonerId('EUW1', 2); +$apiClient->getSpectatorApi()->getCurrentGameByPlatformIdAndSummonerId('EUW1', 2); ``` #### Use cache -By default Doctrine's VoidCache provider is implemented. You can specify another Cache provider (implementing doctrine CacheProvider abstract class) to the ApiClient. +By default Symfony NullAdapter cache is used. You can specify another Cache Adapter (implementing PSR6 Adapters) to the ApiClient. Example with Predis : ```php +use Symfony\Component\Cache\Adapter\RedisAdapter; + $client = new \Predis\Client([ 'scheme' => 'tcp', 'host' => '127.0.0.1', 'port' => 6379, ]); -$apiClient->setCacheProvider(new \Doctrine\Common\Cache\PredisCache($client)); +$redisAdapter = new RedisAdapter($client); + +$apiClient->setCacheProvider($redisAdapter); // This will call the API and return to you an ApiResult object -$result = $apiClient->getSummonerApi()->getSummonersBySummonerNames(['MySummonerName']); +$result = $apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName'); // Let's cache this result for 60 seconds into Redis $apiClient->cacheApiResult($result, 60); // This will fetch the data from Redis and return to you an ApiResult object -$result = $apiClient->getSummonerApi()->getSummonersBySummonerNames(['MySummonerName']); +$result = $apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName'); ``` The default ttl value **cacheApiResult()** method is 60 seconds. @@ -94,7 +96,7 @@ $apiClient = new \LoLApi\ApiClient(\LoLApi\ApiClient::REGION_EUW, 'my-key'); for ($i = 0; $i < 100; $i++) { try { - $apiClient->getMatchListApi()->getMatchListBySummonerId(2); + $apiClient->getMatchApi()->getMatchListByAccountId(2); } catch (AbstractRateLimitException $e) { sleep($e->getRetryAfter()); } @@ -105,19 +107,16 @@ for ($i = 0; $i < 100; $i++) { | API | Version | | ------------- |-------------| -| [Summoner API](https://developer.riotgames.com/api/methods#) | ![v1.4](https://img.shields.io/badge/v1.4-latest-green.svg)| -| [MatchList API](https://developer.riotgames.com/api/methods#) | ![v2.2](https://img.shields.io/badge/v2.2-latest-green.svg)| -| [Match API](https://developer.riotgames.com/api/methods#) | ![v2.2](https://img.shields.io/badge/v2.2-latest-green.svg)| -| [Champion API](https://developer.riotgames.com/api/methods#) | ![v1.2](https://img.shields.io/badge/v1.2-latest-green.svg)| -| [Featured games API](https://developer.riotgames.com/api/methods#) | ![v*.*](https://img.shields.io/badge/v1.0-latest-green.svg)| -| [Stats API](https://developer.riotgames.com/api/methods#) | ![v1.3](https://img.shields.io/badge/v1.3-latest-green.svg)| -| [Team API](https://developer.riotgames.com/api/methods#) | ![v2.4](https://img.shields.io/badge/v2.4-latest-green.svg)| -| [Game API](https://developer.riotgames.com/api/methods#) | ![v1.3](https://img.shields.io/badge/v1.3-latest-green.svg)| -| [Current game API](https://developer.riotgames.com/api/methods#) | ![v*.*](https://img.shields.io/badge/v1.0-latest-green.svg)| -| [Static Data API](https://developer.riotgames.com/api/methods#) | ![v1.2](https://img.shields.io/badge/v1.2-latest-green.svg)| -| [League API](https://developer.riotgames.com/api/methods#) | ![v2.5](https://img.shields.io/badge/v2.5-latest-green.svg)| -| [Status API](https://developer.riotgames.com/api/methods#) | ![v*.*](https://img.shields.io/badge/v1.0-latest-green.svg)| -| [Champion Mastery API](https://developer.riotgames.com/api/methods#) | ![v*.*](https://img.shields.io/badge/v*.*-latest-green.svg)| +| [Summoner API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| +| [Match API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-missing_methods-orange.svg)| +| [Champion API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| +| [Spetactor API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| +| [Static Data API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| +| [League API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| +| [Status API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| +| [Champion Mastery API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| +| [Masteries API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| +| [Runes API](https://developer.riotgames.com/api-methods/) | ![v3](https://img.shields.io/badge/v3-latest-green.svg)| ### Contributing diff --git a/composer.json b/composer.json index 7fead3d..a8ebc87 100644 --- a/composer.json +++ b/composer.json @@ -3,14 +3,14 @@ "description": "Wrapper for League of Legends API", "require": { "guzzlehttp/guzzle": "^6.0", - "doctrine/cache": "^1.6", - "predis/predis": "~1.0" + "symfony/cache": "^3.2" }, "keywords": [ "lol", "api" , "league of legends", "lol api", "library" ], "require-dev": { - "phpunit/phpunit": "^5.2" + "phpunit/phpunit": "^5.2", + "predis/predis": "~1.0" }, "autoload": { "psr-0": { "LoLApi": "src/" } diff --git a/composer.lock b/composer.lock index 2410b82..129f22c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,107 +4,37 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f7d42f9bba1a2df1347ee465fa4a19b7", - "content-hash": "e0ca06191acbd35fc59f689482635650", + "hash": "9c2a428b720d9fdfeaace890f369ef45", + "content-hash": "7aeac186d56f3be53d88d831db193d09", "packages": [ - { - "name": "doctrine/cache", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6", - "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6", - "shasum": "" - }, - "require": { - "php": "~5.5|~7.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "phpunit/phpunit": "~4.8|~5.0", - "predis/predis": "~1.0", - "satooshi/php-coveralls": "~0.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "cache", - "caching" - ], - "time": "2015-12-31 16:37:02" - }, { "name": "guzzlehttp/guzzle", - "version": "6.1.1", + "version": "6.2.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "c6851d6e48f63b69357cbfa55bca116448140e0c" + "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/c6851d6e48f63b69357cbfa55bca116448140e0c", - "reference": "c6851d6e48f63b69357cbfa55bca116448140e0c", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", + "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", "shasum": "" }, "require": { - "guzzlehttp/promises": "~1.0", - "guzzlehttp/psr7": "~1.1", - "php": ">=5.5.0" + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "~4.0", - "psr/log": "~1.0" + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "6.2-dev" } }, "autoload": { @@ -137,32 +67,32 @@ "rest", "web service" ], - "time": "2015-11-23 00:47:50" + "time": "2017-02-28 22:50:30" }, { "name": "guzzlehttp/promises", - "version": "1.0.3", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea" + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea", - "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", "shasum": "" }, "require": { "php": ">=5.5.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -188,20 +118,20 @@ "keywords": [ "promise" ], - "time": "2015-10-15 22:28:00" + "time": "2016-12-20 10:07:11" }, { "name": "guzzlehttp/psr7", - "version": "1.2.3", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b" + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b", - "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", "shasum": "" }, "require": { @@ -217,7 +147,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -237,45 +167,50 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" } ], - "description": "PSR-7 message implementation", + "description": "PSR-7 message implementation that also provides common utility methods", "keywords": [ "http", "message", + "request", + "response", "stream", - "uri" + "uri", + "url" ], - "time": "2016-02-18 21:54:00" + "time": "2017-03-20 17:10:46" }, { - "name": "predis/predis", - "version": "v1.0.3", + "name": "psr/cache", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/nrk/predis.git", - "reference": "84060b9034d756b4d79641667d7f9efe1aeb8e04" + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nrk/predis/zipball/84060b9034d756b4d79641667d7f9efe1aeb8e04", - "reference": "84060b9034d756b4d79641667d7f9efe1aeb8e04", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", "shasum": "" }, "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "ext-curl": "Allows access to Webdis when paired with phpiredis", - "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" + "php": ">=5.3.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-4": { - "Predis\\": "src/" + "Psr\\Cache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -284,32 +219,30 @@ ], "authors": [ { - "name": "Daniele Alessandri", - "email": "suppakilla@gmail.com", - "homepage": "http://clorophilla.net" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Flexible and feature-complete PHP client library for Redis", - "homepage": "http://github.com/nrk/predis", + "description": "Common interface for caching libraries", "keywords": [ - "nosql", - "predis", - "redis" + "cache", + "psr", + "psr-6" ], - "time": "2015-07-30 18:34:15" + "time": "2016-08-06 20:24:11" }, { "name": "psr/http-message", - "version": "1.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298" + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", - "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", "shasum": "" }, "require": { @@ -337,6 +270,7 @@ } ], "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", "keywords": [ "http", "http-message", @@ -345,7 +279,121 @@ "request", "response" ], - "time": "2015-05-04 20:22:00" + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10 12:19:37" + }, + { + "name": "symfony/cache", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache.git", + "reference": "ce81ce67baa387c556d03f389fb3c9efc11286aa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache/zipball/ce81ce67baa387c556d03f389fb3c9efc11286aa", + "reference": "ce81ce67baa387c556d03f389fb3c9efc11286aa", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/cache": "~1.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/cache-implementation": "1.0" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/cache": "~1.6", + "doctrine/dbal": "~2.4", + "predis/predis": "~1.0" + }, + "suggest": { + "symfony/polyfill-apcu": "For using ApcuAdapter on HHVM" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Cache\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony implementation of PSR-6", + "homepage": "https://symfony.com", + "keywords": [ + "caching", + "psr6" + ], + "time": "2017-04-12 14:14:23" } ], "packages-dev": [ @@ -405,16 +453,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.5.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "e3abefcd7f106677fd352cd7c187d6c969aa9ddc" + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e3abefcd7f106677fd352cd7c187d6c969aa9ddc", - "reference": "e3abefcd7f106677fd352cd7c187d6c969aa9ddc", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", "shasum": "" }, "require": { @@ -443,41 +491,138 @@ "object", "object graph" ], - "time": "2015-11-07 22:20:37" + "time": "2017-04-12 18:52:22" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30 07:12:33" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ + "psr-4": { + "phpDocumentor\\Reflection\\": [ "src/" ] } @@ -489,39 +634,40 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2016-11-25 06:54:22" }, { "name": "phpspec/prophecy", - "version": "v1.6.0", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972" + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1", - "sebastian/recursion-context": "~1.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -554,44 +700,44 @@ "spy", "stub" ], - "time": "2016-02-15 07:46:21" + "time": "2017-03-02 20:05:34" }, { "name": "phpunit/php-code-coverage", - "version": "3.2.1", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "a58f95ae76fe201b571fad3e8370a50c4368678c" + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/a58f95ae76fe201b571fad3e8370a50c4368678c", - "reference": "a58f95ae76fe201b571fad3e8370a50c4368678c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", "shasum": "" }, "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "^1.4.2", - "sebastian/code-unit-reverse-lookup": "~1.0", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0|~2.0" + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "^1.0 || ^2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~5" + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -617,20 +763,20 @@ "testing", "xunit" ], - "time": "2016-02-18 07:31:12" + "time": "2017-04-02 07:44:40" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", "shasum": "" }, "require": { @@ -664,7 +810,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2016-10-03 07:40:28" }, { "name": "phpunit/php-text-template", @@ -709,22 +855,30 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -746,20 +900,20 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2017-02-26 11:10:40" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", "shasum": "" }, "require": { @@ -795,46 +949,54 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2017-02-27 10:12:30" }, { "name": "phpunit/phpunit", - "version": "5.2.9", + "version": "5.7.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b12b9c37e382c096b93c3f26e7395775f59a5eea" + "reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b12b9c37e382c096b93c3f26e7395775f59a5eea", - "reference": "b12b9c37e382c096b93c3f26e7395775f59a5eea", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3cb94a5f8c07a03c8b7527ed7468a2926203f58b", + "reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", "myclabs/deep-copy": "~1.3", "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "^3.2.1", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^4.0.4", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", - "phpunit/phpunit-mock-objects": ">=3.0.5", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "^1.4.3", + "sebastian/environment": "^1.3.4 || ^2.0", + "sebastian/exporter": "~2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "~2.0", "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", + "sebastian/version": "~1.0.3|~2.0", "symfony/yaml": "~2.1|~3.0" }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2" + }, + "require-dev": { + "ext-pdo": "*" + }, "suggest": { + "ext-xdebug": "*", "phpunit/php-invoker": "~1.1" }, "bin": [ @@ -843,7 +1005,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2.x-dev" + "dev-master": "5.7.x-dev" } }, "autoload": { @@ -869,30 +1031,33 @@ "testing", "xunit" ], - "time": "2016-02-19 11:43:07" + "time": "2017-05-22 07:42:55" }, { "name": "phpunit/phpunit-mock-objects", - "version": "3.0.6", + "version": "3.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "49bc700750196c04dd6bc2c4c99cb632b893836b" + "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/49bc700750196c04dd6bc2c4c99cb632b893836b", - "reference": "49bc700750196c04dd6bc2c4c99cb632b893836b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", + "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "php": ">=5.6", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.4" }, "suggest": { "ext-soap": "*" @@ -900,7 +1065,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "3.2.x-dev" } }, "autoload": { @@ -925,27 +1090,77 @@ "mock", "xunit" ], - "time": "2015-12-08 08:47:06" + "time": "2016-12-08 20:27:08" + }, + { + "name": "predis/predis", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/nrk/predis.git", + "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1", + "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "suggest": { + "ext-curl": "Allows access to Webdis when paired with phpiredis", + "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" + }, + "type": "library", + "autoload": { + "psr-4": { + "Predis\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniele Alessandri", + "email": "suppakilla@gmail.com", + "homepage": "http://clorophilla.net" + } + ], + "description": "Flexible and feature-complete Redis client for PHP and HHVM", + "homepage": "http://github.com/nrk/predis", + "keywords": [ + "nosql", + "predis", + "redis" + ], + "time": "2016-06-16 16:22:20" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { @@ -970,26 +1185,26 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13 06:45:14" + "time": "2017-03-04 06:30:41" }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -1034,27 +1249,27 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-01-29 09:50:25" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1086,32 +1301,32 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-05-22 07:24:03" }, { "name": "sebastian/environment", - "version": "1.3.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e7133793a8e5a5714a551a8324337374be209df" + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", - "reference": "6e7133793a8e5a5714a551a8324337374be209df", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1136,33 +1351,34 @@ "environment", "hhvm" ], - "time": "2015-12-02 08:37:27" + "time": "2016-11-26 07:53:53" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", "shasum": "" }, "require": { "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "sebastian/recursion-context": "~2.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1202,7 +1418,7 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2016-11-19 08:54:04" }, { "name": "sebastian/global-state", @@ -1255,18 +1471,64 @@ ], "time": "2015-10-12 03:26:01" }, + { + "name": "sebastian/object-enumerator", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-02-18 15:18:39" + }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", "shasum": "" }, "require": { @@ -1278,7 +1540,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1306,7 +1568,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2016-11-19 07:33:16" }, { "name": "sebastian/resource-operations", @@ -1352,16 +1614,16 @@ }, { "name": "sebastian/version", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5" + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", - "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { @@ -1391,29 +1653,35 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-02-04 12:56:52" + "time": "2016-10-03 07:35:21" }, { "name": "symfony/yaml", - "version": "v3.0.2", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "3cf0709d7fe936e97bee9e954382e449003f1d9a" + "reference": "acec26fcf7f3031e094e910b94b002fa53d4e4d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/3cf0709d7fe936e97bee9e954382e449003f1d9a", - "reference": "3cf0709d7fe936e97bee9e954382e449003f1d9a", + "url": "https://api.github.com/repos/symfony/yaml/zipball/acec26fcf7f3031e094e910b94b002fa53d4e4d6", + "reference": "acec26fcf7f3031e094e910b94b002fa53d4e4d6", "shasum": "" }, "require": { "php": ">=5.5.9" }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1440,7 +1708,57 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-02-02 13:44:19" + "time": "2017-05-01 14:55:58" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23 20:04:58" } ], "aliases": [], diff --git a/src/LoLApi/Api/BaseApi.php b/src/LoLApi/Api/BaseApi.php index d56a11e..43a4832 100644 --- a/src/LoLApi/Api/BaseApi.php +++ b/src/LoLApi/Api/BaseApi.php @@ -3,10 +3,10 @@ namespace LoLApi\Api; use GuzzleHttp\Exception\ClientException; +use Psr\Http\Message\ResponseInterface; use LoLApi\ApiClient; use LoLApi\Handler\ClientExceptionHandler; use LoLApi\Result\ApiResult; -use Psr\Http\Message\ResponseInterface; /** * Class BaseApi @@ -31,25 +31,24 @@ public function __construct(ApiClient $apiClient) /** * @param string $url * @param array $queryParameters - * @param bool $global - * @param bool $status * - * @return BaseApi + * @return ApiResult * @throws \LoLApi\Exception\AbstractRateLimitException */ - protected function callApiUrl($url, array $queryParameters = [], $global = false, $status = false) + protected function callApiUrl($url, array $queryParameters = []) { - $baseUrl = $global ? $this->apiClient->getGlobalUrl() : ($status ? $this->apiClient->getStatusUrl() : ''); - $url = $baseUrl . str_replace('{region}', $this->apiClient->getRegion(), $url); $queryParameters = array_merge(['api_key' => $this->apiClient->getApiKey()], $queryParameters); $fullUrl = $this->buildUri($url, $queryParameters); - if ($this->apiClient->getCacheProvider()->contains($fullUrl)) { - return $this->buildApiResult($fullUrl, json_decode($this->apiClient->getCacheProvider()->fetch($fullUrl), true), true); + $cacheKey = md5($fullUrl); + $item = $this->apiClient->getCacheProvider()->getItem($cacheKey); + + if ($item->isHit()) { + return $this->buildApiResult($fullUrl, json_decode($item->get(), true), true); } try { - $response = $this->apiClient->getHttpClient()->get($url, ['query' => $queryParameters]); + $response = $this->apiClient->getHttpClient()->get($fullUrl); return $this->buildApiResult($fullUrl, json_decode((string) $response->getBody(), true), false, $response); } catch (ClientException $e) { @@ -60,15 +59,14 @@ protected function callApiUrl($url, array $queryParameters = [], $global = false /** * @param string $url * @param array $queryParameters - * @param bool $global * * @return string */ - protected function buildUri($url, array $queryParameters, $global = false) + protected function buildUri($url, array $queryParameters) { - $baseUrl = $global ? $this->apiClient->getGlobalUrl() : $this->apiClient->getBaseUrlWithRegion(); + $baseUrl = $this->apiClient->getBaseUrl(); - return $baseUrl . $url . '?' . http_build_query($queryParameters); + return $baseUrl.$url.'?'.http_build_query($queryParameters); } /** @@ -77,7 +75,7 @@ protected function buildUri($url, array $queryParameters, $global = false) * @param bool $fetchedFromCache * @param ResponseInterface|null $response * - * @return $this + * @return ApiResult */ protected function buildApiResult($fullUrl, $result, $fetchedFromCache, ResponseInterface $response = null) { @@ -85,6 +83,7 @@ protected function buildApiResult($fullUrl, $result, $fetchedFromCache, Response ->setResult($result) ->setUrl($fullUrl) ->setHttpResponse($response) - ->setFetchedFromCache($fetchedFromCache); + ->setFetchedFromCache($fetchedFromCache) + ; } } diff --git a/src/LoLApi/Api/ChampionApi.php b/src/LoLApi/Api/ChampionApi.php index 71f22d3..cb6e7f4 100644 --- a/src/LoLApi/Api/ChampionApi.php +++ b/src/LoLApi/Api/ChampionApi.php @@ -8,12 +8,12 @@ * Class ChampionApi * * @package LoLApi\Api - * @see https://developer.riotgames.com/api/methods + * @see https://developer.riotgames.com/api-methods/ */ class ChampionApi extends BaseApi { - const API_URL_CHAMPIONS_ALL = '/api/lol/{region}/v1.2/champion'; - const API_URL_CHAMPION_BY_ID = '/api/lol/{region}/v1.2/champion/{championId}'; + const API_URL_CHAMPIONS_ALL = '/lol/platform/v3/champions'; + const API_URL_CHAMPION_BY_ID = '/lol/platform/v3/champions/{id}'; /** * @param bool $onlyFreeToPlay @@ -33,7 +33,7 @@ public function getAllChampions($onlyFreeToPlay = false) */ public function getChampionById($championId) { - $url = str_replace('{championId}', $championId, self::API_URL_CHAMPION_BY_ID); + $url = str_replace('{id}', $championId, self::API_URL_CHAMPION_BY_ID); return $this->callApiUrl($url, []); } diff --git a/src/LoLApi/Api/ChampionMasteryApi.php b/src/LoLApi/Api/ChampionMasteryApi.php index 63a018f..41e7d4d 100644 --- a/src/LoLApi/Api/ChampionMasteryApi.php +++ b/src/LoLApi/Api/ChampionMasteryApi.php @@ -8,75 +8,53 @@ * Class ChampionMasteryApi * * @package LoLApi\Api - * @see https://developer.riotgames.com/api/methods + * @see https://developer.riotgames.com/api-methods/ */ class ChampionMasteryApi extends BaseApi { - const API_URL_CHAMPION_MASTERY_BY_ID = '/championmastery/location/{platformId}/player/{playerId}/champion/{championId}'; - const API_URL_CHAMPION_MASTERY_ALL = '/championmastery/location/{platformId}/player/{playerId}/champions'; - const API_URL_CHAMPION_MASTERY_SCORE = '/championmastery/location/{platformId}/player/{playerId}/score'; - const API_URL_CHAMPION_MASTERY_TOP = '/championmastery/location/{platformId}/player/{playerId}/topchampions'; + const API_URL_CHAMPION_MASTERY_BY_ID = '/lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}'; + const API_URL_CHAMPION_MASTERY_BY_CHAMPION_ID = '/lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}/by-champion/{championId}'; + const API_URL_CHAMPION_MASTERY_SCORE = '/lol/champion-mastery/v3/scores/by-summoner/{summonerId}'; /** - * @param int $platformId - * @param int $championId - * @param int $playerId + * Get all champion mastery entries sorted by number of champion points descending, * - * @return ApiResult - */ - public function getChampionMastery($platformId, $championId, $playerId) - { - $url = str_replace('{championId}', $championId, self::API_URL_CHAMPION_MASTERY_BY_ID); - $url = str_replace('{playerId}', $playerId, $url); - $url = str_replace('{platformId}', $platformId, $url); - - return $this->callApiUrl($url, []); - } - - /** - * @param int $platformId - * @param int $playerId + * @param int $summonerId * * @return ApiResult */ - public function getChampionsMasteries($platformId, $playerId) + public function getChampionsMasteries($summonerId) { - $url = str_replace('{playerId}', $playerId, self::API_URL_CHAMPION_MASTERY_ALL); - $url = str_replace('{platformId}', $platformId, $url); + $url = str_replace('{summonerId}', $summonerId, self::API_URL_CHAMPION_MASTERY_BY_ID); return $this->callApiUrl($url, []); } /** - * @param int $platformId - * @param int $playerId + * @param int $summonerId + * @param int $championId * * @return ApiResult */ - public function getChampionsMasteriesScore($platformId, $playerId) + public function getChampionMastery($summonerId, $championId) { - $url = str_replace('{playerId}', $playerId, self::API_URL_CHAMPION_MASTERY_SCORE); - $url = str_replace('{platformId}', $platformId, $url); + $url = str_replace('{summonerId}', $summonerId, self::API_URL_CHAMPION_MASTERY_BY_CHAMPION_ID); + $url = str_replace('{championId}', $championId, $url); return $this->callApiUrl($url, []); } /** - * @param int $platformId - * @param int $playerId - * @param int $limit + * Get a player's total champion mastery score, which is the sum of individual champion mastery levels + * + * @param int $summonerId * * @return ApiResult */ - public function getTopChampionsMasteries($platformId, $playerId, $limit = 3) + public function getChampionsMasteriesScore($summonerId) { - $url = str_replace('{playerId}', $playerId, self::API_URL_CHAMPION_MASTERY_TOP); - $url = str_replace('{platformId}', $platformId, $url); + $url = str_replace('{playerId}', $summonerId, self::API_URL_CHAMPION_MASTERY_SCORE); - $queryParameters = []; - - $queryParameters['count'] = (int) $limit; - - return $this->callApiUrl($url, array_filter($queryParameters)); + return $this->callApiUrl($url, []); } } diff --git a/src/LoLApi/Api/CurrentGameApi.php b/src/LoLApi/Api/CurrentGameApi.php deleted file mode 100644 index eccdbc9..0000000 --- a/src/LoLApi/Api/CurrentGameApi.php +++ /dev/null @@ -1,30 +0,0 @@ -callApiUrl($url, []); - } -} diff --git a/src/LoLApi/Api/FeaturedGamesApi.php b/src/LoLApi/Api/FeaturedGamesApi.php deleted file mode 100644 index df77d53..0000000 --- a/src/LoLApi/Api/FeaturedGamesApi.php +++ /dev/null @@ -1,24 +0,0 @@ -callApiUrl(self::API_URL_FEATURED, []); - } -} diff --git a/src/LoLApi/Api/GameApi.php b/src/LoLApi/Api/GameApi.php deleted file mode 100644 index b6e11b5..0000000 --- a/src/LoLApi/Api/GameApi.php +++ /dev/null @@ -1,28 +0,0 @@ -callApiUrl($url, []); - } -} diff --git a/src/LoLApi/Api/LeagueApi.php b/src/LoLApi/Api/LeagueApi.php index 6c1bbe7..ebff742 100644 --- a/src/LoLApi/Api/LeagueApi.php +++ b/src/LoLApi/Api/LeagueApi.php @@ -8,61 +8,35 @@ * Class LeagueApi * * @package LoLApi\Api - * @see https://developer.riotgames.com/api/methods + * @see https://developer.riotgames.com/api-methods/ */ class LeagueApi extends BaseApi { - const API_URL_LEAGUE_BY_SUMMONERS_IDS = '/api/lol/{region}/v2.5/league/by-summoner/{summonerIds}'; - const API_URL_LEAGUE_ENTRIES_BY_SUMMONERS_IDS = '/api/lol/{region}/v2.5/league/by-summoner/{summonerIds}/entry'; - const API_URL_LEAGUE_BY_TEAMS_IDS = '/api/lol/{region}/v2.5/league/by-team/{teamIds}'; - const API_URL_LEAGUE_ENTRIES_BY_TEAMS_IDS = '/api/lol/{region}/v2.5/league/by-team/{teamIds}/entry'; - const API_URL_LEAGUE_CHALLENGER = '/api/lol/{region}/v2.5/league/challenger'; - const API_URL_LEAGUE_MASTER = '/api/lol/{region}/v2.5/league/master'; + const API_URL_LEAGUE_BY_SUMMONER_ID = '/lol/league/v3/leagues/by-summoner/{summonerId}'; + const API_URL_LEAGUE_POSITION_BY_SUMMONER_ID = '/lol/league/v3/positions/by-summoner/{summonerId}'; + const API_URL_LEAGUE_CHALLENGER = '/lol/league/v3/challengerleagues/by-queue/{queue}'; + const API_URL_LEAGUE_MASTER = '/lol/league/v3/masterleagues/by-queue/{queue}'; /** - * @param array $summonerIds + * @param int $summonerId * * @return ApiResult */ - public function getLeagueBySummonersIds(array $summonerIds = []) + public function getLeagueBySummonerId($summonerId) { - $url = str_replace('{summonerIds}', implode(',', $summonerIds), self::API_URL_LEAGUE_BY_SUMMONERS_IDS); + $url = str_replace('{summonerId}', $summonerId, self::API_URL_LEAGUE_BY_SUMMONER_ID); return $this->callApiUrl($url, []); } /** - * @param array $summonerIds + * @param int $summonerId * * @return ApiResult */ - public function getLeagueEntriesBySummonersIds(array $summonerIds = []) + public function getLeaguePositionsBySummonerId($summonerId) { - $url = str_replace('{summonerIds}', implode(',', $summonerIds), self::API_URL_LEAGUE_ENTRIES_BY_SUMMONERS_IDS); - - return $this->callApiUrl($url, []); - } - - /** - * @param array $teamIds - * - * @return ApiResult - */ - public function getLeagueByTeamsIds(array $teamIds = []) - { - $url = str_replace('{teamIds}', implode(',', $teamIds), self::API_URL_LEAGUE_BY_TEAMS_IDS); - - return $this->callApiUrl($url, []); - } - - /** - * @param array $teamIds - * - * @return ApiResult - */ - public function getLeagueEntriesByTeamsIds(array $teamIds = []) - { - $url = str_replace('{teamIds}', implode(',', $teamIds), self::API_URL_LEAGUE_ENTRIES_BY_TEAMS_IDS); + $url = str_replace('{summonerId}', $summonerId, self::API_URL_LEAGUE_POSITION_BY_SUMMONER_ID); return $this->callApiUrl($url, []); } @@ -74,7 +48,9 @@ public function getLeagueEntriesByTeamsIds(array $teamIds = []) */ public function getChallengerLeagues($gameQueueType) { - return $this->callApiUrl(self::API_URL_LEAGUE_CHALLENGER, ['type' => $gameQueueType]); + $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_CHALLENGER); + + return $this->callApiUrl($url, []); } /** @@ -84,6 +60,8 @@ public function getChallengerLeagues($gameQueueType) */ public function getMasterLeagues($gameQueueType) { - return $this->callApiUrl(self::API_URL_LEAGUE_MASTER, ['type' => $gameQueueType]); + $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_MASTER); + + return $this->callApiUrl($url, []); } } diff --git a/src/LoLApi/Api/MasteryApi.php b/src/LoLApi/Api/MasteryApi.php new file mode 100644 index 0000000..e14779f --- /dev/null +++ b/src/LoLApi/Api/MasteryApi.php @@ -0,0 +1,28 @@ +callApiUrl($url, []); + } +} diff --git a/src/LoLApi/Api/MatchApi.php b/src/LoLApi/Api/MatchApi.php index 57a6b2f..5c4a3cf 100644 --- a/src/LoLApi/Api/MatchApi.php +++ b/src/LoLApi/Api/MatchApi.php @@ -8,25 +8,100 @@ * Class MatchApi * * @package LoLApi\Api - * @see https://developer.riotgames.com/api/methods + * @see https://developer.riotgames.com/api-methods/ */ class MatchApi extends BaseApi { - const API_URL_MATCH_BY_ID = '/api/lol/{region}/v2.2/match/{matchId}'; + const API_URL_MATCH_BY_ID = '/lol/match/v3/matches/{matchId}'; + const API_URL_MATCH_LIST_BY_ACCOUNT = '/lol/match/v3/matchlists/by-account/{accountId}'; + const API_URL_RECENT_MATCH_LIST_BY_ACCOUNT = '/lol/match/v3/matchlists/by-account/{accountId}/recent'; + const API_URL_TIMELINES_BY_MATCH_ID = '/lol/match/v3/timelines/by-match/{matchId}'; + const API_URL_MATCH_ID_BY_TOURNAMENT_CODE = '/lol/match/v3/matches/by-tournament-code/{tournamentCode}/ids'; + const API_URL_MATCH_BY_MATCH_ID_AND_TOURNAMENT_CODE = '/lol/match/v3/matches/{matchId}/by-tournament-code/{tournamentCode}'; /** - * @param int $matchId - * @param bool|false $includeTimeline + * @param int $matchId * * @return ApiResult */ - public function getMatchByMatchId($matchId, $includeTimeline = false) + public function getMatchByMatchId($matchId) { - $url = str_replace('{matchId}', $matchId, self::API_URL_MATCH_BY_ID); + $url = str_replace('{matchId}', $matchId, self::API_URL_MATCH_BY_ID); + + return $this->callApiUrl($url, []); + } + + /** + * @param int $accountId + * @param array $championIds + * @param array $rankedQueues + * @param array $seasons + * @param int $beginTime + * @param int $endTime + * @param int $beginIndex + * @param int $endIndex + * + * @return ApiResult + */ + public function getMatchListByAccountId($accountId, array $championIds = [], array $rankedQueues = [], array $seasons = [], $beginTime = null, $endTime = null, $beginIndex = null, $endIndex = null) + { + $url = str_replace('{accountId}', $accountId, self::API_URL_MATCH_LIST_BY_ACCOUNT); $queryParameters = []; - $queryParameters['includeTimeline'] = (int) $includeTimeline; + $queryParameters['championIds'] = implode(',', $championIds); + $queryParameters['rankedQueues'] = implode(',', $rankedQueues); + $queryParameters['seasons'] = implode(',', $seasons); + $queryParameters['beginTime'] = $beginTime; + $queryParameters['endTime'] = $endTime; + $queryParameters['beginIndex'] = $beginIndex; + $queryParameters['endIndex'] = $endIndex; return $this->callApiUrl($url, array_filter($queryParameters)); } + + + /** + * Get matchlist for last 20 matches played on given account ID and platform ID. + * + * @throws \Exception + */ + public function getLastMatchlistByAccountId() + { + throw new \Exception("Method not implemented yet"); + } + + /** + * Get match timeline by match ID. + * + * @throws \Exception + */ + public function getTimelineByMatchId() + { + throw new \Exception("Method not implemented yet"); + } + + /** + * Get match IDs by tournament code. + * + * @param string $tournamentCode + * + * @throws \Exception + */ + public function getMatchIdByTournamentCode($tournamentCode) + { + throw new \Exception("Method not implemented yet"); + } + + /** + * Get match by match ID and tournament code. + * + * @param int $matchId + * @param string $tournamentCode + * + * @throws \Exception + */ + public function getMatchByMatchIdAndTournamentCode($matchId, $tournamentCode) + { + throw new \Exception("Method not implemented yet"); + } } diff --git a/src/LoLApi/Api/MatchListApi.php b/src/LoLApi/Api/MatchListApi.php deleted file mode 100644 index 600eaa6..0000000 --- a/src/LoLApi/Api/MatchListApi.php +++ /dev/null @@ -1,44 +0,0 @@ -callApiUrl($url, array_filter($queryParameters)); - } -} diff --git a/src/LoLApi/Api/RuneApi.php b/src/LoLApi/Api/RuneApi.php new file mode 100644 index 0000000..6135480 --- /dev/null +++ b/src/LoLApi/Api/RuneApi.php @@ -0,0 +1,28 @@ +callApiUrl($url, []); + } +} diff --git a/src/LoLApi/Api/SpectatorApi.php b/src/LoLApi/Api/SpectatorApi.php new file mode 100644 index 0000000..8f854ad --- /dev/null +++ b/src/LoLApi/Api/SpectatorApi.php @@ -0,0 +1,37 @@ +callApiUrl(self::API_URL_SPECTATOR_FEATURED, []); + } + + /** + * @param string $summonerId + * + * @return ApiResult + */ + public function getCurrentGameByPlatformIdAndSummonerId($summonerId) + { + $url = str_replace('{summonerId}', $summonerId, self::API_URL_CURRENT_GAME_BY_SUMMONER_ID); + + return $this->callApiUrl($url, []); + } +} diff --git a/src/LoLApi/Api/StaticDataApi.php b/src/LoLApi/Api/StaticDataApi.php index 9accd75..4630cfe 100644 --- a/src/LoLApi/Api/StaticDataApi.php +++ b/src/LoLApi/Api/StaticDataApi.php @@ -8,25 +8,25 @@ * Class StaticDataApi * * @package LoLApi\Api - * @see https://developer.riotgames.com/api/methods + * @see https://developer.riotgames.com/api-methods/ */ class StaticDataApi extends BaseApi { - const API_URL_STATIC_DATA_CHAMPIONS = '/api/lol/static-data/{region}/v1.2/champion'; - const API_URL_STATIC_DATA_CHAMPION_BY_ID = '/api/lol/static-data/{region}/v1.2/champion/{championId}'; - const API_URL_STATIC_DATA_ITEMS = '/api/lol/static-data/{region}/v1.2/item'; - const API_URL_STATIC_DATA_ITEM_BY_ID = '/api/lol/static-data/{region}/v1.2/item/{itemId}'; - const API_URL_STATIC_DATA_LANGUAGE_STRINGS = '/api/lol/static-data/{region}/v1.2/language-strings'; - const API_URL_STATIC_DATA_LANGUAGES = '/api/lol/static-data/{region}/v1.2/language'; - const API_URL_STATIC_DATA_MAP = '/api/lol/static-data/{region}/v1.2/map'; - const API_URL_STATIC_DATA_MASTERIES = '/api/lol/static-data/{region}/v1.2/mastery'; - const API_URL_STATIC_DATA_MASTERY_BY_ID = '/api/lol/static-data/{region}/v1.2/mastery/{masteryId}'; - const API_URL_STATIC_DATA_REALM = '/api/lol/static-data/{region}/v1.2/realm'; - const API_URL_STATIC_DATA_RUNES = '/api/lol/static-data/{region}/v1.2/rune'; - const API_URL_STATIC_DATA_RUNE_BY_ID = '/api/lol/static-data/{region}/v1.2/rune/{runeId}'; - const API_URL_STATIC_DATA_SUMMONER_SPELLS = '/api/lol/static-data/{region}/v1.2/summoner-spell'; - const API_URL_STATIC_DATA_SUMMONER_SPELL_BY_ID = '/api/lol/static-data/{region}/v1.2/summoner-spell/{summonerSpellId}'; - const API_URL_STATIC_DATA_VERSIONS = '/api/lol/static-data/{region}/v1.2/versions'; + const API_URL_STATIC_DATA_CHAMPIONS = '/lol/static-data/v3/champions'; + const API_URL_STATIC_DATA_CHAMPION_BY_ID = '/lol/static-data/v3/champions/{id}'; + const API_URL_STATIC_DATA_ITEMS = '/lol/static-data/v3/items'; + const API_URL_STATIC_DATA_ITEM_BY_ID = '/lol/static-data/v3/items/{id}'; + const API_URL_STATIC_DATA_LANGUAGE_STRINGS = '/lol/static-data/v3/language-strings'; + const API_URL_STATIC_DATA_LANGUAGES = '/lol/static-data/v3/languages'; + const API_URL_STATIC_DATA_MAP = '/lol/static-data/v3/maps'; + const API_URL_STATIC_DATA_MASTERIES = '/lol/static-data/v3/masteries'; + const API_URL_STATIC_DATA_MASTERY_BY_ID = '/lol/static-data/v3/masteries/{id}'; + const API_URL_STATIC_DATA_REALM = '/lol/static-data/v3/realms'; + const API_URL_STATIC_DATA_RUNES = '/lol/static-data/v3/runes'; + const API_URL_STATIC_DATA_RUNE_BY_ID = '/lol/static-data/v3/runes/{id}'; + const API_URL_STATIC_DATA_SUMMONER_SPELLS = '/lol/static-data/v3/summoner-spells'; + const API_URL_STATIC_DATA_SUMMONER_SPELL_BY_ID = '/lol/static-data/v3/summoner-spells/{id}'; + const API_URL_STATIC_DATA_VERSIONS = '/lol/static-data/v3/versions'; /** * @param string $locale @@ -40,7 +40,7 @@ public function getChampions($locale = null, $version = null, $dataById = false, { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['dataById' => (string) $dataById, 'champData' => implode(',', $champData)]); - return $this->callApiUrl(self::API_URL_STATIC_DATA_CHAMPIONS, array_filter($queryParameters), true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_CHAMPIONS, array_filter($queryParameters)); } /** @@ -55,7 +55,7 @@ public function getChampionById($championId, $locale = null, $version = null, ar { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['champData' => implode(',', $champData)]); - return $this->callApiUrl(str_replace('{championId}', $championId, self::API_URL_STATIC_DATA_CHAMPION_BY_ID), array_filter($queryParameters), true); + return $this->callApiUrl(str_replace('{id}', $championId, self::API_URL_STATIC_DATA_CHAMPION_BY_ID), array_filter($queryParameters)); } /** @@ -68,7 +68,7 @@ public function getItems($locale = null, $version = null) { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version); - return $this->callApiUrl(self::API_URL_STATIC_DATA_ITEMS, array_filter($queryParameters), true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_ITEMS, array_filter($queryParameters)); } /** @@ -83,7 +83,7 @@ public function getItemById($itemId, $locale = null, $version = null, array $ite { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['itemData' => implode(',', $itemData)]); - return $this->callApiUrl(str_replace('{itemId}', $itemId, self::API_URL_STATIC_DATA_ITEM_BY_ID), array_filter($queryParameters), true); + return $this->callApiUrl(str_replace('{id}', $itemId, self::API_URL_STATIC_DATA_ITEM_BY_ID), array_filter($queryParameters)); } /** @@ -96,7 +96,7 @@ public function getLanguageStrings($locale = null, $version = null) { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version); - return $this->callApiUrl(self::API_URL_STATIC_DATA_LANGUAGE_STRINGS, array_filter($queryParameters), true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_LANGUAGE_STRINGS, array_filter($queryParameters)); } /** @@ -104,7 +104,7 @@ public function getLanguageStrings($locale = null, $version = null) */ public function getLanguages() { - return $this->callApiUrl(self::API_URL_STATIC_DATA_LANGUAGES, [], true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_LANGUAGES, []); } /** @@ -117,7 +117,7 @@ public function getMap($locale = null, $version = null) { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version); - return $this->callApiUrl(self::API_URL_STATIC_DATA_MAP, array_filter($queryParameters), true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_MAP, array_filter($queryParameters)); } /** @@ -131,7 +131,7 @@ public function getMasteries($locale = null, $version = null, array $masteryList { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['masteryListData' => implode(',', $masteryListData)]); - return $this->callApiUrl(self::API_URL_STATIC_DATA_MASTERIES, array_filter($queryParameters), true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_MASTERIES, array_filter($queryParameters)); } /** @@ -146,7 +146,7 @@ public function getMasteryById($masteryId, $locale = null, $version = null, arra { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['masteryData' => implode(',', $masteryData)]); - return $this->callApiUrl(str_replace('{masteryId}', $masteryId, self::API_URL_STATIC_DATA_MASTERY_BY_ID), array_filter($queryParameters), true); + return $this->callApiUrl(str_replace('{id}', $masteryId, self::API_URL_STATIC_DATA_MASTERY_BY_ID), array_filter($queryParameters)); } /** @@ -154,7 +154,7 @@ public function getMasteryById($masteryId, $locale = null, $version = null, arra */ public function getRealms() { - return $this->callApiUrl(self::API_URL_STATIC_DATA_REALM, [], true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_REALM, []); } /** @@ -168,7 +168,7 @@ public function getRunes($locale = null, $version = null, array $runeListData = { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['runeListData' => implode(',', $runeListData)]); - return $this->callApiUrl(self::API_URL_STATIC_DATA_RUNES, array_filter($queryParameters), true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_RUNES, array_filter($queryParameters)); } /** @@ -183,7 +183,7 @@ public function getRuneById($runeId, $locale = null, $version = null, array $run { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['runeData' => implode(',', $runeData)]); - return $this->callApiUrl(str_replace('{runeId}', $runeId, self::API_URL_STATIC_DATA_RUNE_BY_ID), array_filter($queryParameters), true); + return $this->callApiUrl(str_replace('{id}', $runeId, self::API_URL_STATIC_DATA_RUNE_BY_ID), array_filter($queryParameters)); } /** @@ -198,7 +198,7 @@ public function getSummonerSpells($locale = null, $version = null, $dataById = f { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['dataById' => (string) $dataById, 'spellData' => implode(',', $spellData)]); - return $this->callApiUrl(self::API_URL_STATIC_DATA_SUMMONER_SPELLS, array_filter($queryParameters), true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_SUMMONER_SPELLS, array_filter($queryParameters)); } /** @@ -213,7 +213,7 @@ public function getSummonerSpellById($summonerSpellId, $locale = null, $version { $queryParameters = $this->handleQueryParametersForLocaleAndVersion($locale, $version, ['spellData' => implode(',', $spellData)]); - return $this->callApiUrl(str_replace('{summonerSpellId}', $summonerSpellId, self::API_URL_STATIC_DATA_SUMMONER_SPELL_BY_ID), array_filter($queryParameters), true); + return $this->callApiUrl(str_replace('{id}', $summonerSpellId, self::API_URL_STATIC_DATA_SUMMONER_SPELL_BY_ID), array_filter($queryParameters)); } /** @@ -221,7 +221,7 @@ public function getSummonerSpellById($summonerSpellId, $locale = null, $version */ public function getVersions() { - return $this->callApiUrl(self::API_URL_STATIC_DATA_VERSIONS, [], true); + return $this->callApiUrl(self::API_URL_STATIC_DATA_VERSIONS, []); } /** diff --git a/src/LoLApi/Api/StatsApi.php b/src/LoLApi/Api/StatsApi.php deleted file mode 100644 index d1e7111..0000000 --- a/src/LoLApi/Api/StatsApi.php +++ /dev/null @@ -1,61 +0,0 @@ -callApiUrl($url, $this->handleQueryParametersForSeason($season)); - } - - /** - * @param string $summonerId - * @param string $season - * @param string $season - * - * @return ApiResult - */ - public function getRankedSummaryBySummonerId($summonerId, $season = null) - { - $url = str_replace('{summonerId}', $summonerId, self::API_URL_STATS_SUMMARY_BY_SUMMONER_ID); - - return $this->callApiUrl($url, $this->handleQueryParametersForSeason($season)); - } - - /** - * @param string $season - * - * @return array - */ - protected function handleQueryParametersForSeason($season = null) - { - $queryParameters = []; - - if ($season !== null) { - $queryParameters['season'] = (string) $season; - } - - return $queryParameters; - } -} diff --git a/src/LoLApi/Api/StatusApi.php b/src/LoLApi/Api/StatusApi.php index b8082c5..b286ad2 100644 --- a/src/LoLApi/Api/StatusApi.php +++ b/src/LoLApi/Api/StatusApi.php @@ -8,30 +8,19 @@ * Class StatusApi * * @package LoLApi\Api - * @see https://developer.riotgames.com/api/methods + * @see https://developer.riotgames.com/api-methods/ */ class StatusApi extends BaseApi { - const API_URL_SHARDS = '/shards'; - const API_URL_SHARDS_REGION = '/shards/{region}'; + const API_URL_SHARDS = '/lol/status/v3/shard-data'; /** - * @return ApiResult - */ - public function getShards() - { - return $this->callApiUrl(self::API_URL_SHARDS, [], false, true); - } - - /** - * @param string $region + * Requests to this API are not counted against the application Rate Limits. * * @return ApiResult */ - public function getShardsByRegion($region) + public function getShards() { - $url = str_replace('{region}', $region, self::API_URL_SHARDS_REGION); - - return $this->callApiUrl($url, [], false, true); + return $this->callApiUrl(self::API_URL_SHARDS, []); } } diff --git a/src/LoLApi/Api/SummonerApi.php b/src/LoLApi/Api/SummonerApi.php index b418223..dbe85d7 100644 --- a/src/LoLApi/Api/SummonerApi.php +++ b/src/LoLApi/Api/SummonerApi.php @@ -8,72 +8,46 @@ * Class SummonerApi * * @package LoLApi\Api - * @see https://developer.riotgames.com/api/methods + * @see https://developer.riotgames.com/api-methods/ */ class SummonerApi extends BaseApi { - const API_URL_SUMMONERS_BY_NAMES = '/api/lol/{region}/v1.4/summoner/by-name/{summonerNames}'; - const API_URL_SUMMONERS_BY_IDS = '/api/lol/{region}/v1.4/summoner/{summonerIds}'; - const API_URL_SUMMONERS_MASTERIES_BY_IDS = '/api/lol/{region}/v1.4/summoner/{summonerIds}/masteries'; - const API_URL_SUMMONERS_NAMES_BY_IDS = '/api/lol/{region}/v1.4/summoner/{summonerIds}/name'; - const API_URL_SUMMONERS_RUNES_BY_IDS = '/api/lol/{region}/v1.4/summoner/{summonerIds}/runes'; + const API_URL_SUMMONER_BY_NAME = '/lol/summoner/v3/summoners/by-name/{summonerName}'; + const API_URL_SUMMONER_BY_ID = '/lol/summoner/v3/summoners/{summonerId}'; + const API_URL_SUMMONER_BY_ACCOUNT_ID = '/lol/summoner/v3/summoners/by-account/{accountId}'; /** - * @param array $summonerNames + * @param string $summonerName * * @return ApiResult */ - public function getSummonersBySummonerNames(array $summonerNames = []) + public function getSummonerBySummonerName($summonerName) { - $url = str_replace('{summonerNames}', implode(',', $summonerNames), self::API_URL_SUMMONERS_BY_NAMES); + $url = str_replace('{summonerName}', $summonerName, self::API_URL_SUMMONER_BY_NAME); return $this->callApiUrl($url, []); } /** - * @param array $summonerIds + * @param string $summonerId * * @return ApiResult */ - public function getSummonersBySummonerIds(array $summonerIds = []) + public function getSummonerBySummonerId($summonerId) { - $url = str_replace('{summonerIds}', implode(',', $summonerIds), self::API_URL_SUMMONERS_BY_IDS); + $url = str_replace('{summonerId}', $summonerId, self::API_URL_SUMMONER_BY_ID); return $this->callApiUrl($url, []); } /** - * @param array $summonerIds + * @param string $accountId * * @return ApiResult */ - public function getSummonersMasteriesBySummonerIds(array $summonerIds = []) + public function getSummonerByAccountId($accountId) { - $url = str_replace('{summonerIds}', implode(',', $summonerIds), self::API_URL_SUMMONERS_MASTERIES_BY_IDS); - - return $this->callApiUrl($url, []); - } - - /** - * @param array $summonerIds - * - * @return ApiResult - */ - public function getSummonersNamesBySummonerIds(array $summonerIds = []) - { - $url = str_replace('{summonerIds}', implode(',', $summonerIds), self::API_URL_SUMMONERS_NAMES_BY_IDS); - - return $this->callApiUrl($url, []); - } - - /** - * @param array $summonerIds - * - * @return ApiResult - */ - public function getSummonersRunesBySummonerIds(array $summonerIds = []) - { - $url = str_replace('{summonerIds}', implode(',', $summonerIds), self::API_URL_SUMMONERS_RUNES_BY_IDS); + $url = str_replace('{accountId}', $accountId, self::API_URL_SUMMONER_BY_ACCOUNT_ID); return $this->callApiUrl($url, []); } diff --git a/src/LoLApi/Api/TeamApi.php b/src/LoLApi/Api/TeamApi.php deleted file mode 100644 index 0f836bd..0000000 --- a/src/LoLApi/Api/TeamApi.php +++ /dev/null @@ -1,41 +0,0 @@ -callApiUrl($url, []); - } - - /** - * @param array $teamsIds - * - * @return ApiResult - */ - public function getTeamsByTeamsIds(array $teamsIds = []) - { - $url = str_replace('{teamIds}', implode(',', $teamsIds), self::API_URL_TEAM_BY_TEAMS_IDS); - - return $this->callApiUrl($url, []); - } -} diff --git a/src/LoLApi/ApiClient.php b/src/LoLApi/ApiClient.php index 66bf539..4e2cf56 100644 --- a/src/LoLApi/ApiClient.php +++ b/src/LoLApi/ApiClient.php @@ -2,24 +2,22 @@ namespace LoLApi; -use Doctrine\Common\Cache\CacheProvider; -use Doctrine\Common\Cache\VoidCache; use GuzzleHttp\Client; use LoLApi\Api\ChampionApi; use LoLApi\Api\ChampionMasteryApi; -use LoLApi\Api\CurrentGameApi; -use LoLApi\Api\FeaturedGamesApi; -use LoLApi\Api\GameApi; +use LoLApi\Api\SpectatorApi; use LoLApi\Api\LeagueApi; +use LoLApi\Api\MasteryApi; use LoLApi\Api\MatchApi; -use LoLApi\Api\MatchListApi; +use LoLApi\Api\RuneApi; use LoLApi\Api\StaticDataApi; -use LoLApi\Api\StatsApi; use LoLApi\Api\StatusApi; use LoLApi\Api\SummonerApi; -use LoLApi\Api\TeamApi; use LoLApi\Exception\InvalidRegionException; use LoLApi\Result\ApiResult; +use Symfony\Component\Cache\Adapter\AdapterInterface; +use Symfony\Component\Cache\Adapter\ArrayAdapter; +use Symfony\Component\Cache\Adapter\NullAdapter; /** * Class ApiClient @@ -28,16 +26,29 @@ */ class ApiClient { - const REGION_BR = 'br'; + const REGION_BR = 'br'; const REGION_EUNE = 'eune'; - const REGION_EUW = 'euw'; - const REGION_KR = 'kr'; - const REGION_LAN = 'lan'; - const REGION_LAS = 'las'; - const REGION_NA = 'na'; - const REGION_OCE = 'oce'; - const REGION_RU = 'ru'; - const REGION_TR = 'tr'; + const REGION_EUW = 'euw'; + const REGION_JP = 'jp'; + const REGION_KR = 'kr'; + const REGION_LAN = 'lan'; + const REGION_LAS = 'las'; + const REGION_NA = 'na'; + const REGION_OCE = 'oce'; + const REGION_TR = 'tr'; + const REGION_RU = 'ru'; + + const REGION_BR_ID = 'br1'; + const REGION_EUNE_ID = 'eun1'; + const REGION_EUW_ID = 'euw1'; + const REGION_JP_ID = 'jp1'; + const REGION_KR_ID = 'kr'; + const REGION_LAN_ID = 'la1'; + const REGION_LAS_ID = 'la2'; + const REGION_NA_ID = 'na1'; + const REGION_OCE_ID = 'oc1'; + const REGION_TR_ID = 'tr1'; + const REGION_RU_ID = 'ru'; /** * @var array @@ -52,7 +63,20 @@ class ApiClient self::REGION_NA, self::REGION_OCE, self::REGION_RU, - self::REGION_TR + self::REGION_TR, + ]; + + public static $regionsWithIds = [ + self::REGION_BR => self::REGION_BR_ID, + self::REGION_EUNE => self::REGION_EUNE_ID, + self::REGION_EUW => self::REGION_EUW_ID, + self::REGION_KR => self::REGION_KR_ID, + self::REGION_LAN => self::REGION_LAN_ID, + self::REGION_LAS => self::REGION_LAS_ID, + self::REGION_NA => self::REGION_NA_ID, + self::REGION_OCE => self::REGION_OCE_ID, + self::REGION_RU => self::REGION_RU_ID, + self::REGION_TR => self::REGION_TR_ID, ]; /** @@ -71,44 +95,44 @@ class ApiClient protected $httpClient; /** - * @var CacheProvider + * @var AdapterInterface */ protected $cacheProvider; /** - * @param string $region - * @param string $apiKey - * @param CacheProvider $cacheProvider - * @param Client $client + * @param string $region + * @param string $apiKey + * @param AdapterInterface $cache + * @param Client $client * * @throws InvalidRegionException */ - public function __construct($region, $apiKey, CacheProvider $cacheProvider = null, Client $client = null) + public function __construct($region, $apiKey, AdapterInterface $cache = null, Client $client = null) { if (!in_array($region, self::$availableRegions)) { throw new InvalidRegionException(sprintf('Invalid region %s', $region)); } - $this->region = $region; - $this->httpClient = $client ? $client : new Client(['base_uri' => $this->getBaseUrlWithRegion()]); - $this->apiKey = $apiKey; - $this->cacheProvider = $cacheProvider ? $cacheProvider : new VoidCache(); + $this->region = $region; + $this->httpClient = $client ? $client : new Client(); + $this->apiKey = $apiKey; + $this->cache = $cache ? $cache : new NullAdapter(); } /** - * @param CacheProvider $cacheProvider + * @param AdapterInterface $cache */ - public function setCacheProvider(CacheProvider $cacheProvider) + public function setCacheProvider(AdapterInterface $cache) { - $this->cacheProvider = $cacheProvider; + $this->cache = $cache; } /** - * @return CacheProvider + * @return AdapterInterface */ public function getCacheProvider() { - return $this->cacheProvider; + return $this->cache; } /** @@ -135,14 +159,6 @@ public function getApiKey() return $this->apiKey; } - /** - * @return MatchListApi - */ - public function getMatchListApi() - { - return new MatchListApi($this); - } - /** * @return MatchApi */ @@ -168,43 +184,35 @@ public function getChampionApi() } /** - * @return FeaturedGamesApi + * @return SpectatorApi */ public function getFeaturedGamesApi() { - return new FeaturedGamesApi($this); + return new SpectatorApi($this); } /** - * @return StatsApi + * @return MasteryApi */ - public function getStatsApi() + public function getMasteriesApi() { - return new StatsApi($this); + return new MasteryApi($this); } /** - * @return TeamApi + * @return RuneApi */ - public function getTeamApi() + public function getRunesApi() { - return new TeamApi($this); + return new RuneApi($this); } /** - * @return GameApi + * @return SpectatorApi */ - public function getGameApi() + public function getSpectatorApi() { - return new GameApi($this); - } - - /** - * @return CurrentGameApi - */ - public function getCurrentGameApi() - { - return new CurrentGameApi($this); + return new SpectatorApi($this); } /** @@ -242,25 +250,9 @@ public function getChampionMasteryApi() /** * @return string */ - public function getBaseUrlWithRegion() + public function getBaseUrl() { - return 'https://' . $this->region . '.api.pvp.net'; - } - - /** - * @return string - */ - public function getGlobalUrl() - { - return 'https://global.api.pvp.net'; - } - - /** - * @return string - */ - public function getStatusUrl() - { - return 'http://status.leagueoflegends.com'; + return 'https://'.self::$regionsWithIds[$this->region].'.api.riotgames.com'; } /** @@ -269,6 +261,14 @@ public function getStatusUrl() */ public function cacheApiResult(ApiResult $apiResult, $ttl = 60) { - $this->cacheProvider->save($apiResult->getUrl(), json_encode($apiResult->getResult()), $ttl); + $cacheKey = md5($apiResult->getUrl()); + + $item = $this->cache->getItem($cacheKey); + + if (!$item->isHit()) { + $item->set(json_encode($apiResult->getResult())); + $item->expiresAfter($ttl); + $this->cache->save($item); + } } } diff --git a/src/LoLApi/Tests/Api/AbstractApiTest.php b/src/LoLApi/Tests/Api/AbstractApiTest.php index 7c463df..f02a6e6 100644 --- a/src/LoLApi/Tests/Api/AbstractApiTest.php +++ b/src/LoLApi/Tests/Api/AbstractApiTest.php @@ -2,14 +2,14 @@ namespace LoLApi\Tests; -use Doctrine\Common\Cache\CacheProvider; -use Doctrine\Common\Cache\VoidCache; use GuzzleHttp\Client; use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\HandlerStack; use GuzzleHttp\Psr7\Response; use LoLApi\ApiClient; use LoLApi\Handler\ClientExceptionHandler; +use Symfony\Component\Cache\Adapter\AdapterInterface; +use Symfony\Component\Cache\Adapter\ArrayAdapter; /** * Class AbstractApiTest @@ -31,18 +31,18 @@ abstract class AbstractApiTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->apiClient = $this->getApiClient(new VoidCache(), $this->getSuccessfulHttpClient()); + $this->apiClient = $this->getApiClient(new ArrayAdapter(), $this->getSuccessfulHttpClient()); } /** - * @param CacheProvider $cacheProvider - * @param Client $httpClient + * @param AdapterInterface $cache + * @param Client $httpClient * * @return ApiClient */ - protected function getApiClient(CacheProvider $cacheProvider, Client $httpClient) + protected function getApiClient(AdapterInterface $cache, Client $httpClient) { - return new ApiClient(self::REGION, self::API_KEY, $cacheProvider, $httpClient); + return new ApiClient(self::REGION, self::API_KEY, $cache, $httpClient); } /** diff --git a/src/LoLApi/Tests/Api/BaseApiTest.php b/src/LoLApi/Tests/Api/BaseApiTest.php index 478e592..576f8bf 100644 --- a/src/LoLApi/Tests/Api/BaseApiTest.php +++ b/src/LoLApi/Tests/Api/BaseApiTest.php @@ -2,8 +2,8 @@ namespace LoLApi\Tests\Api; -use Doctrine\Common\Cache\VoidCache; use LoLApi\Tests\AbstractApiTest; +use Symfony\Component\Cache\Adapter\ArrayAdapter; /** * Class BaseApiTest @@ -26,7 +26,6 @@ class BaseApiTest extends AbstractApiTest * @covers LoLApi\Api\MatchListApi * @covers LoLApi\Api\SummonerApi * @covers LoLApi\Api\TeamApi - * @covers LoLApi\Api\GameApi * @covers LoLApi\Api\CurrentGameApi * @covers LoLApi\Api\StatsApi * @covers LoLApi\Api\StaticDataApi @@ -46,13 +45,19 @@ public function testAll($api, $method, array $options = []) */ public function testWithCachedResult() { - $arrayCache = $this->getMockBuilder('Doctrine\Common\Cache\ArrayCache')->disableOriginalConstructor()->getMock(); - $arrayCache->expects($this->once())->method('contains')->willReturn(true); - $arrayCache->expects($this->once())->method('fetch')->willReturn('{}'); + $arrayCache = new ArrayAdapter(); + + $item = $arrayCache->getItem('foo'); + $item->set('{}'); + $arrayCache->save($item); + + $fooItem = $arrayCache->getItem('foo'); + $this->assertTrue($fooItem->isHit()); + $this->assertEquals('{}', $fooItem->get()); $apiClient = $this->getApiClient($arrayCache, $this->getSuccessfulHttpClient()); - $apiClient->getCurrentGameApi()->getCurrentGameByPlatformIdAndSummonerId('EUW1', 5); + $apiClient->getSpectatorApi()->getCurrentGameByPlatformIdAndSummonerId(5); } /** @@ -62,9 +67,9 @@ public function testWithCachedResult() */ public function testWithRateLimitException() { - $apiClient = $this->getApiClient(new VoidCache(), $this->getRateLimitHttpClient()); + $apiClient = $this->getApiClient(new ArrayAdapter(), $this->getRateLimitHttpClient()); - $apiClient->getCurrentGameApi()->getCurrentGameByPlatformIdAndSummonerId('EUW1', 5); + $apiClient->getSpectatorApi()->getCurrentGameByPlatformIdAndSummonerId(5); } /** @@ -82,64 +87,12 @@ protected function getDataProvider1() { return [ [ - 'getCurrentGameApi', + 'getSpectatorApi', 'getCurrentGameByPlatformIdAndSummonerId', - [ - 'EUW1', - 5 - ] - ], - [ - 'getGameApi', - 'getRecentGamesBySummonerId', - [ - 5 - ] - ], - [ - 'getStatsApi', - 'getRankedStatsBySummonerId', [ 5 ] ], - [ - 'getStatsApi', - 'getRankedSummaryBySummonerId', - [ - 5 - ] - ], - [ - 'getStatsApi', - 'getRankedStatsBySummonerId', - [ - 5, - 'SEASON2015' - ] - ], - [ - 'getStatsApi', - 'getRankedSummaryBySummonerId', - [ - 5, - 'SEASON2015' - ] - ], - [ - 'getTeamApi', - 'getTeamsBySummonersIds', - [ - [5] - ] - ], - [ - 'getTeamApi', - 'getTeamsByTeamsIds', - [ - [5] - ] - ], ]; } @@ -150,8 +103,8 @@ protected function getDataProvider2() { return [ [ - 'getMatchListApi', - 'getMatchListBySummonerId', + 'getMatchApi', + 'getMatchListByAccountId', [ 5 ] @@ -180,39 +133,25 @@ protected function getDataProvider2() ], [ 'getSummonerApi', - 'getSummonersBySummonerNames', + 'getSummonerBySummonerName', [ - ['test'] + 'test' ] ], [ 'getSummonerApi', - 'getSummonersBySummonerIds', + 'getSummonerBySummonerId', [ - [5] - ] - ], - [ - 'getSummonerApi', - 'getSummonersMasteriesBySummonerIds', - [ - [5] + 5 ] ], [ 'getSummonerApi', - 'getSummonersNamesBySummonerIds', + 'getSummonerByAccountId', [ - [5] + 5 ] ], - [ - 'getSummonerApi', - 'getSummonersRunesBySummonerIds', - [ - [5] - ] - ] ]; } @@ -326,38 +265,16 @@ protected function getDataProvider5() return [ [ 'getLeagueApi', - 'getLeagueBySummonersIds', + 'getLeagueBySummonerId', [ - [ - 5 - ] - ] - ], - [ - 'getLeagueApi', - 'getLeagueEntriesBySummonersIds', - [ - [ - 5 - ] - ] - ], - [ - 'getLeagueApi', - 'getLeagueByTeamsIds', - [ - [ - 5 - ] + 5 ] ], [ 'getLeagueApi', - 'getLeagueEntriesByTeamsIds', + 'getLeaguePositionsBySummonerId', [ - [ - 5 - ] + 5 ] ], [ @@ -387,18 +304,10 @@ protected function getDataProvider6() 'getStatusApi', 'getShards' ], - [ - 'getStatusApi', - 'getShardsByRegion', - [ - 'euw' - ] - ], [ 'getChampionMasteryApi', 'getChampionMastery', [ - 'EUW1', 5, 5 ] @@ -407,7 +316,6 @@ protected function getDataProvider6() 'getChampionMasteryApi', 'getChampionsMasteries', [ - 'EUW1', 5 ] ], @@ -415,19 +323,9 @@ protected function getDataProvider6() 'getChampionMasteryApi', 'getChampionsMasteriesScore', [ - 'EUW1', 5 ] ], - [ - 'getChampionMasteryApi', - 'getTopChampionsMasteries', - [ - 'EUW1', - 5, - 4 - ] - ] ]; } } diff --git a/src/LoLApi/Tests/ApiClientTest.php b/src/LoLApi/Tests/ApiClientTest.php index 5a7ac1a..ce32772 100644 --- a/src/LoLApi/Tests/ApiClientTest.php +++ b/src/LoLApi/Tests/ApiClientTest.php @@ -2,11 +2,11 @@ namespace LoLApi\Tests; -use Doctrine\Common\Cache\ArrayCache; -use Doctrine\Common\Cache\VoidCache; use GuzzleHttp\Client; use LoLApi\ApiClient; use LoLApi\Result\ApiResult; +use Symfony\Component\Cache\Adapter\ArrayAdapter; +use Symfony\Component\Cache\Adapter\NullAdapter; /** * Class ApiClientTest @@ -19,15 +19,11 @@ class ApiClientTest extends \PHPUnit_Framework_TestCase const API_KEY = 'test'; /** - * @covers LoLApi\ApiClient::getMatchListApi * @covers LoLApi\ApiClient::getMatchApi * @covers LoLApi\ApiClient::getSummonerApi * @covers LoLApi\ApiClient::getChampionApi * @covers LoLApi\ApiClient::getFeaturedGamesApi - * @covers LoLApi\ApiClient::getGameApi - * @covers LoLApi\ApiClient::getStatsApi - * @covers LoLApi\ApiClient::getCurrentGameApi - * @covers LoLApi\ApiClient::getTeamApi + * @covers LoLApi\ApiClient::getSpectatorApi * @covers LoLApi\ApiClient::getStaticDataApi * @covers LoLApi\ApiClient::getLeagueApi * @covers LoLApi\ApiClient::getStatusApi @@ -37,15 +33,12 @@ public function testApiGetters() { $apiClient = new ApiClient(ApiClient::REGION_EUW, 'test'); - $this->assertInstanceOf('LoLApi\Api\MatchListApi', $apiClient->getMatchListApi()); $this->assertInstanceOf('LoLApi\Api\MatchApi', $apiClient->getMatchApi()); $this->assertInstanceOf('LoLApi\Api\SummonerApi', $apiClient->getSummonerApi()); $this->assertInstanceOf('LoLApi\Api\ChampionApi', $apiClient->getChampionApi()); - $this->assertInstanceOf('LoLApi\Api\FeaturedGamesApi', $apiClient->getFeaturedGamesApi()); - $this->assertInstanceOf('LoLApi\Api\GameApi', $apiClient->getGameApi()); - $this->assertInstanceOf('LoLApi\Api\StatsApi', $apiClient->getStatsApi()); - $this->assertInstanceOf('LoLApi\Api\CurrentGameApi', $apiClient->getCurrentGameApi()); - $this->assertInstanceOf('LoLApi\Api\TeamApi', $apiClient->getTeamApi()); + $this->assertInstanceOf('LoLApi\Api\SpectatorApi', $apiClient->getSpectatorApi()); + $this->assertInstanceOf('LoLApi\Api\MasteryApi', $apiClient->getMasteriesApi()); + $this->assertInstanceOf('LoLApi\Api\RuneApi', $apiClient->getRunesApi()); $this->assertInstanceOf('LoLApi\Api\StaticDataApi', $apiClient->getStaticDataApi()); $this->assertInstanceOf('LoLApi\Api\LeagueApi', $apiClient->getLeagueApi()); $this->assertInstanceOf('LoLApi\Api\StatusApi', $apiClient->getStatusApi()); @@ -57,7 +50,6 @@ public function testApiGetters() * @covers LoLApi\ApiClient::getApiKey * @covers LoLApi\ApiClient::getHttpClient * @covers LoLApi\ApiClient::getGlobalUrl - * @covers LoLApi\ApiClient::getStatusUrl */ public function testOtherGetters() { @@ -66,8 +58,6 @@ public function testOtherGetters() $this->assertEquals(self::REGION, $apiClient->getRegion()); $this->assertEquals(self::API_KEY, $apiClient->getApiKey()); $this->assertInstanceOf('GuzzleHttp\Client', $apiClient->getHttpClient()); - $this->assertSame('https://global.api.pvp.net', $apiClient->getGlobalUrl()); - $this->assertSame('http://status.leagueoflegends.com', $apiClient->getStatusUrl()); } /** @@ -78,11 +68,11 @@ public function testCacheProvider() { $apiClient = new ApiClient(ApiClient::REGION_EUW, 'test'); - $this->assertInstanceOf('Doctrine\Common\Cache\VoidCache', $apiClient->getCacheProvider()); + $apiClient->setCacheProvider(new NullAdapter()); + $this->assertInstanceOf(NullAdapter::class, $apiClient->getCacheProvider()); - $apiClient->setCacheProvider(new ArrayCache()); - - $this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $apiClient->getCacheProvider()); + $apiClient->setCacheProvider(new ArrayAdapter()); + $this->assertInstanceOf(ArrayAdapter::class, $apiClient->getCacheProvider()); } /** @@ -91,8 +81,7 @@ public function testCacheProvider() public function testCacheApiResult() { $apiResult = new ApiResult(); - $arrayCache = $this->getMockBuilder('Doctrine\Common\Cache\ArrayCache')->disableOriginalConstructor()->getMock(); - $arrayCache->expects($this->once())->method('save')->willReturn($this->equalTo($apiResult)); + $arrayCache = new ArrayAdapter(); $client = new ApiClient(ApiClient::REGION_EUW, 'test', $arrayCache); @@ -100,16 +89,16 @@ public function testCacheApiResult() } /** - * @covers LoLApi\ApiClient::getBaseUrlWithRegion + * @covers LoLApi\ApiClient::getBaseUrlWithPlatformId */ - public function testGetBaseUrlWithRegion() + public function testGetBaseUrlWithPlatformId() { - $apiClient = new ApiClient(ApiClient::REGION_EUW, 'test'); + $apiClient = new ApiClient(ApiClient::REGION_EUW, 'test', null, null); $class = new \ReflectionClass('LoLApi\ApiClient'); - $method = $class->getMethod('getBaseUrlWithRegion'); + $method = $class->getMethod('getBaseUrl'); $method->setAccessible(true); - $this->assertEquals('https://euw.api.pvp.net', $method->invoke($apiClient)); + $this->assertEquals('https://euw1.api.riotgames.com', $method->invoke($apiClient, true)); } /** @@ -128,7 +117,7 @@ public function testInvalidRegion() public function testConstructWithClient() { $httpClient = new Client(); - $apiClient = new ApiClient(ApiClient::REGION_EUW, 'test', new VoidCache(), $httpClient); + $apiClient = new ApiClient(ApiClient::REGION_EUW, 'test', new NullAdapter(), $httpClient); $this->assertSame($httpClient, $apiClient->getHttpClient()); } @@ -138,7 +127,7 @@ public function testConstructWithClient() */ public function testConstruct() { - $apiClient = new ApiClient(ApiClient::REGION_EUW, 'test', new VoidCache()); + $apiClient = new ApiClient(ApiClient::REGION_EUW, 'test', new NullAdapter()); $this->assertInstanceOf('GuzzleHttp\Client', $apiClient->getHttpClient()); }