Skip to content
This repository was archived by the owner on Jan 6, 2020. It is now read-only.

Create timed cache (#60) #63

Merged
merged 3 commits into from
Oct 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,310 changes: 3,310 additions & 0 deletions composer.lock

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions scripts/generate-manifest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use Illuminate\Support\Collection;
use RiotQuest\Codegen\Result;

$m = new Collection();

$g = new RiotQuest\Codegen\Codegen();
$g->createAll(function (Result $r) use ($m) {
$m->put($r->toArray()['name'], $r->toArray());
});

file_put_contents(__DIR__ . "/../src/RiotQuest/Codegen/assets/manifest.json", $m->toArray());
8 changes: 8 additions & 0 deletions scripts/generate-templates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

use RiotQuest\Codegen\Result;

$g = new RiotQuest\Codegen\Codegen();
$g->createAll(function (Result $r) {
$r->pipe(__DIR__ . "\\..\\src\storage\\templates\\" . $r->toArray()['name'] . ".json");
});
51 changes: 38 additions & 13 deletions src/RiotQuest/Codegen/assets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
"returns": [
"Summoner"
],
"params": []
"params": {
"$ttl": "int"
}
},
"getChampionIcon": {
"name": "getChampionIcon",
Expand Down Expand Up @@ -291,7 +293,9 @@
"returns": [
"Summoner"
],
"params": []
"params": {
"$ttl": "int"
}
},
"getSummonerIcon": {
"name": "getSummonerIcon",
Expand Down Expand Up @@ -593,7 +597,9 @@
"returns": [
"Summoner"
],
"params": []
"params": {
"$ttl": "int"
}
},
"isInMiniSeries": {
"name": "isInMiniSeries",
Expand Down Expand Up @@ -671,7 +677,9 @@
"returns": [
"Summoner"
],
"params": []
"params": {
"$ttl": "int"
}
},
"getWinrate": {
"name": "getWinrate",
Expand Down Expand Up @@ -1102,6 +1110,7 @@
"props": {
"$severity": "string",
"$author": "string",
"$heading": "string",
"$created_at": "string",
"$translations": "TranslationList",
"$updated_at": "string",
Expand Down Expand Up @@ -1207,7 +1216,9 @@
"returns": [
"Summoner"
],
"params": []
"params": {
"$ttl": "int"
}
},
"getProfileIcon": {
"name": "getProfileIcon",
Expand Down Expand Up @@ -1538,7 +1549,9 @@
"returns": [
"Summoner"
],
"params": []
"params": {
"$ttl": "int"
}
}
},
"name": "Player",
Expand Down Expand Up @@ -1667,14 +1680,17 @@
"returns": [
"LeagueEntryList"
],
"params": []
"params": {
"$ttl": "int"
}
},
"getMatchlist": {
"name": "getMatchlist",
"returns": [
"MatchHistory"
],
"params": {
"$ttl": "int",
"$filters": "array"
}
},
Expand All @@ -1683,21 +1699,27 @@
"returns": [
"int"
],
"params": []
"params": {
"$ttl": "int"
}
},
"getMasteryList": {
"name": "getMasteryList",
"returns": [
"ChampionMasteryList"
],
"params": []
"params": {
"$ttl": "int"
}
},
"getCurrentGame": {
"name": "getCurrentGame",
"returns": [
"CurrentGameInfo"
],
"params": []
"params": {
"$ttl": "int"
}
},
"getThirdPartyCode": {
"name": "getThirdPartyCode",
Expand All @@ -1711,7 +1733,9 @@
"returns": [
"bool"
],
"params": []
"params": {
"$ttl": "int"
}
},
"isAboveNewPlayerThreshold": {
"name": "isAboveNewPlayerThreshold",
Expand Down Expand Up @@ -1816,7 +1840,8 @@
"props": {
"$locale": "string",
"$content": "string",
"$heading": "string"
"$heading": "string",
"$updated_at": "string"
},
"sees": [
"https:\/\/developer.riotgames.com\/api-methods\/#lol-status-v3\/GET_getShardData"
Expand All @@ -1838,4 +1863,4 @@
"name": "TranslationList",
"class": "RiotQuest\\Components\\Collections\\TranslationList"
}
}
}

This file was deleted.

2 changes: 1 addition & 1 deletion src/RiotQuest/Codegen/out/ChampionMastery.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This page describes the methods for the ChampionMastery Collection.
### Method <code>ChampionMastery::getSummoner => Summoner</code>

```php
public function getSummoner( void ): Summoner
public function getSummoner( int $ttl ): Summoner
```

### Method <code>ChampionMastery::getChampionIcon => string</code>
Expand Down
2 changes: 1 addition & 1 deletion src/RiotQuest/Codegen/out/CurrentGameParticipant.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function getChampionIcon( void ): string
### Method <code>CurrentGameParticipant::getSummoner => Summoner</code>

```php
public function getSummoner( void ): Summoner
public function getSummoner( int $ttl ): Summoner
```

### Method <code>CurrentGameParticipant::getSummonerIcon => string</code>
Expand Down
2 changes: 1 addition & 1 deletion src/RiotQuest/Codegen/out/LeagueEntry.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getGamesPlayed( void ): int
### Method <code>LeagueEntry::getSummoner => Summoner</code>

```php
public function getSummoner( void ): Summoner
public function getSummoner( int $ttl ): Summoner
```

### Method <code>LeagueEntry::isInMiniSeries => bool</code>
Expand Down
2 changes: 1 addition & 1 deletion src/RiotQuest/Codegen/out/LeagueItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This page describes the methods for the LeagueItem Collection.
### Method <code>LeagueItem::getSummoner => Summoner</code>

```php
public function getSummoner( void ): Summoner
public function getSummoner( int $ttl ): Summoner
```

### Method <code>LeagueItem::getWinrate => float|int</code>
Expand Down
2 changes: 1 addition & 1 deletion src/RiotQuest/Codegen/out/Participant.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This page describes the methods for the Participant Collection.
### Method <code>Participant::getSummoner => Summoner</code>

```php
public function getSummoner( void ): Summoner
public function getSummoner( int $ttl ): Summoner
```

### Method <code>Participant::getProfileIcon => string</code>
Expand Down
2 changes: 1 addition & 1 deletion src/RiotQuest/Codegen/out/Player.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public function getSummonerIcon( void ): string
### Method <code>Player::getSummoner => Summoner</code>

```php
public function getSummoner( void ): Summoner
public function getSummoner( int $ttl ): Summoner
```

12 changes: 6 additions & 6 deletions src/RiotQuest/Codegen/out/Summoner.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ public function getSummonerIcon( void ): string
### Method <code>Summoner::getRanked => LeagueEntryList</code>

```php
public function getRanked( void ): LeagueEntryList
public function getRanked( int $ttl ): LeagueEntryList
```

### Method <code>Summoner::getMatchlist => MatchHistory</code>

```php
public function getMatchlist( array $filters ): MatchHistory
public function getMatchlist( int $ttl, array $filters ): MatchHistory
```

### Method <code>Summoner::getMasteryScore => int</code>

```php
public function getMasteryScore( void ): int
public function getMasteryScore( int $ttl ): int
```

### Method <code>Summoner::getMasteryList => ChampionMasteryList</code>

```php
public function getMasteryList( void ): ChampionMasteryList
public function getMasteryList( int $ttl ): ChampionMasteryList
```

### Method <code>Summoner::getCurrentGame => CurrentGameInfo</code>

```php
public function getCurrentGame( void ): CurrentGameInfo
public function getCurrentGame( int $ttl ): CurrentGameInfo
```

### Method <code>Summoner::getThirdPartyCode => string</code>
Expand All @@ -55,7 +55,7 @@ public function getThirdPartyCode( void ): string
### Method <code>Summoner::isUnranked => bool</code>

```php
public function isUnranked( void ): bool
public function isUnranked( int $ttl ): bool
```

### Method <code>Summoner::isAboveNewPlayerThreshold => bool</code>
Expand Down
7 changes: 4 additions & 3 deletions src/RiotQuest/Components/Collections/ChampionMastery.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ class ChampionMastery extends Collection
/**
* Gets the summoner which holds this mastery
*
* @param int $ttl
* @return Summoner
* @throws LeagueException
* @throws InvalidArgumentException
* @throws LeagueException
*/
public function getSummoner()
public function getSummoner($ttl = 3600)
{
return Client::summoner($this->region)->id($this->summonerId);
return Client::summoner($this->region, $ttl)->id($this->summonerId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ public function getChampionIcon()
/**
* Get summoner object
*
* @param int $ttl
* @return Summoner
* @throws LeagueException
* @throws InvalidArgumentException
* @throws LeagueException
*/
public function getSummoner()
public function getSummoner($ttl = 3600)
{
return Client::summoner($this->region)->id($this->summonerId);
return Client::summoner($this->region, $ttl)->id($this->summonerId);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/RiotQuest/Components/Collections/LeagueEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ public function getGamesPlayed()
/**
* Get the summoner object of this player
*
* @param int $ttl
* @return Summoner
* @throws LeagueException
* @throws InvalidArgumentException
* @throws LeagueException
*/
public function getSummoner()
public function getSummoner($ttl = 3600)
{
return Client::summoner($this->region)->id($this->summonerId);
return Client::summoner($this->region, $ttl)->id($this->summonerId);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/RiotQuest/Components/Collections/LeagueItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ class LeagueItem extends Collection
/**
* Get the summoner object for this league item
*
* @param int $ttl
* @return Summoner
* @throws LeagueException
* @throws InvalidArgumentException
* @throws LeagueException
*/
public function getSummoner()
public function getSummoner($ttl = 3600)
{
return Client::summoner($this->region)->id($this->summonerId);
return Client::summoner($this->region, $ttl)->id($this->summonerId);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/RiotQuest/Components/Collections/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ class Participant extends Collection
/**
* Get the summoner object of this participant
*
* @param int $ttl
* @return Summoner
* @throws LeagueException
* @throws InvalidArgumentException
* @throws LeagueException
*/
public function getSummoner()
public function getSummoner($ttl = 3600)
{
return Client::summoner($this->region)->name($this->summonerName);
return Client::summoner($this->region, $ttl)->name($this->summonerName);
}

/**
Expand Down
Loading