diff --git a/.gitignore b/.gitignore index 808f8c5..896e906 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ build composer.lock docs vendor -coverage \ No newline at end of file +coverage +.phpunit.result.cache diff --git a/.phpunit.result.cache b/.phpunit.result.cache deleted file mode 100644 index b17cf45..0000000 --- a/.phpunit.result.cache +++ /dev/null @@ -1 +0,0 @@ -C:37:"PHPUnit\Runner\DefaultTestResultCache":451:{a:2:{s:7:"defects";a:2:{s:64:"Xitox97\LaravelOpendota\Tests\ExampleTest::test_laravel_http_get";i:3;s:76:"Xitox97\LaravelOpendota\Tests\ExampleTest::test_get_players_by_rank_function";i:4;}s:5:"times";a:3:{s:55:"Xitox97\LaravelOpendota\Tests\ExampleTest::true_is_true";d:0.127;s:64:"Xitox97\LaravelOpendota\Tests\ExampleTest::test_laravel_http_get";d:0.092;s:76:"Xitox97\LaravelOpendota\Tests\ExampleTest::test_get_players_by_rank_function";d:0.744;}}} \ No newline at end of file diff --git a/src/LaravelOpendota.php b/src/LaravelOpendota.php index 7875294..ea39fb2 100644 --- a/src/LaravelOpendota.php +++ b/src/LaravelOpendota.php @@ -15,6 +15,7 @@ public function __construct() /** * Get player details based on player dota 2 ID + * @param int $player_id {account_id} */ public function getPlayer($player_id) { @@ -23,6 +24,8 @@ public function getPlayer($player_id) /** * Get player Win/Loss count + * @param int $player_id {account_id} + * @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference) */ public function getPlayerWL($player_id, $params = []) { @@ -31,6 +34,7 @@ public function getPlayerWL($player_id, $params = []) /** * Get player Recent matches played + * @param int $player_id {account_id} */ public function getPlayerRecentMatches($player_id) { @@ -39,6 +43,8 @@ public function getPlayerRecentMatches($player_id) /** * Get player Matches played + * @param int $player_id {account_id} + * @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference) */ public function getPlayerMatches($player_id, $params = []) { @@ -47,6 +53,8 @@ public function getPlayerMatches($player_id, $params = []) /** * Get player Heroes played + * @param int $player_id {account_id} + * @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference) */ public function getPlayerHeroes($player_id, $params = []) { @@ -55,6 +63,8 @@ public function getPlayerHeroes($player_id, $params = []) /** * Get Players played with + * @param int $player_id {account_id} + * @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference) */ public function getPlayerPeers($player_id, $params = []) { @@ -63,6 +73,8 @@ public function getPlayerPeers($player_id, $params = []) /** * Get Pro players played with the player + * @param int $player_id {account_id} + * @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference) */ public function getPlayerPros($player_id, $params = []) { @@ -71,6 +83,8 @@ public function getPlayerPros($player_id, $params = []) /** * Get player's Totals in stats + * @param int $player_id {account_id} + * @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference) */ public function getPlayerTotals($player_id, $params = []) { @@ -79,6 +93,8 @@ public function getPlayerTotals($player_id, $params = []) /** * Get player's Counts in categories + * @param int $player_id {account_id} + * @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference) */ public function getPlayerCounts($player_id, $params = []) { @@ -146,6 +162,7 @@ public function postPlayerRefresh($player_id) /** * Get match details based on match ID + * @param string $match_id {match_id} */ public function getMatch($match_id) { @@ -210,6 +227,7 @@ public function getDistributions() /** * Search players by personaname. + * @param string $personaname */ public function searchPlayers($personaname) { @@ -218,6 +236,7 @@ public function searchPlayers($personaname) /** * Get Top players by hero + * @param int $hero_id */ public function getRankingsByHero($hero_id) { @@ -226,6 +245,7 @@ public function getRankingsByHero($hero_id) /** * Get Benchmarks of average stat values for a hero + * @param int $hero_id */ public function getBenchmarks($hero_id) { @@ -276,6 +296,7 @@ public function getHeroes() /** * Get recent matches with a hero + * @param int $hero_id */ public function getHeroMatches($hero_id) { @@ -284,6 +305,7 @@ public function getHeroMatches($hero_id) /** * Get results against other heroes for a hero + * @param int $hero_id */ public function getHeroMatchups($hero_id) { @@ -292,6 +314,7 @@ public function getHeroMatchups($hero_id) /** * Get hero performance over a range of match durations + * @param int $hero_id */ public function getHeroDurations($hero_id) { @@ -300,6 +323,7 @@ public function getHeroDurations($hero_id) /** * Get players who have played this hero + * @param int $hero_id */ public function getHeroPlayers($hero_id) { @@ -308,6 +332,7 @@ public function getHeroPlayers($hero_id) /** * Get item popularity of hero categoried by start, early, mid and late game, analyzed from professional games + * @param int $hero_id */ public function getHeroItemPopularity($hero_id) { @@ -340,6 +365,7 @@ public function getTeams() /** * Get data for a team + * @param int $team_id {team_id} */ public function getTeam($team_id) { @@ -348,6 +374,7 @@ public function getTeam($team_id) /** * Get matches for a team + * @param int $team_id {team_id} */ public function getTeamMatches($team_id) { @@ -356,6 +383,7 @@ public function getTeamMatches($team_id) /** * Get players who have played for a team + * @param int $team_id {team_id} */ public function getTeamsPlayer($team_id) { @@ -364,6 +392,7 @@ public function getTeamsPlayer($team_id) /** * Get heroes for a team + * @param int $team_id {team_id} */ public function getTeamsHeroes($team_id) { @@ -372,12 +401,22 @@ public function getTeamsHeroes($team_id) /** * Get data to construct a replay URL with + * @param string $match_id {match_id} */ public function getReplays($match_id) { return Http::get($this->api_url . 'replays', ['match_id' => $match_id]); } + /** + * Get top performances in a stat + * @param string $field {match_id} Field name to query + */ + public function getRecords($field) + { + return Http::get($this->api_url . 'records/' . $field); + } + /** * Get top currently ongoing live games */ @@ -386,4 +425,48 @@ public function getLive() return Http::get($this->api_url . 'live'); } + /** + * Get Win rates for certain item timings on a hero for items that cost at least 1400 gold + * @param mixed $params = [] Assoc array of parameters applied to filter matches (see OpenDota docs for reference) + */ + public function getScenariosItemTimings($params = []) + { + return Http::get($this->api_url . 'scenarios/itemTimings' , $params); + } + + /** + * Win rates for heroes in certain lane roles + * @param mixed $params = [] Assoc array of parameters applied to filter matches (see OpenDota docs for reference) + */ + public function getScenariosLaneRoles($params = []) + { + return Http::get($this->api_url . 'scenarios/laneRoles' , $params); + } + + /** + * Win rates for heroes in certain lane roles + * @param mixed $params = [] Assoc array of parameters applied to filter matches (see OpenDota docs for reference) + */ + public function getScenariosMisc($params = []) + { + return Http::get($this->api_url . 'scenarios/misc' , $params); + } + + /** + * Get database schema + */ + public function getSchema() + { + return Http::get($this->api_url . 'schema'); + } + + /** + * Get static game data mirrored from the dotaconstants repository. If no resource is specified, returns an array of available resources. + * Resources: https://github.com/odota/dotaconstants/tree/master/build + */ + public function getConstants($resource = '') + { + return Http::get($this->api_url . 'constants', ['resource' => $resource]); + } + } diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php index 60cd6b0..ecc6501 100644 --- a/tests/ExampleTest.php +++ b/tests/ExampleTest.php @@ -42,12 +42,12 @@ public function test_laravel_http_player() // $this->assertSame(113429216, $player); // } - public function test_get_players_by_rank_function() - { - $openDota = new LaravelOpendota(); + // public function test_get_players_by_rank_function() + // { + // $openDota = new LaravelOpendota(); - $players = $openDota->getLive(); + // $players = $openDota->getLive(); - dd($players->json()); - } + // dd($players->json()); + // } }