├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── src ├── DTO │ ├── DTOInterface.php │ ├── Match.php │ ├── MatchData │ │ ├── Included │ │ │ ├── Asset │ │ │ │ └── AssetAttributes.php │ │ │ ├── Included.php │ │ │ ├── IncludedAsset.php │ │ │ ├── Participant.php │ │ │ ├── Participant │ │ │ │ ├── IncludedParticipantAttributes.php │ │ │ │ └── ParticipantStats.php │ │ │ ├── Roster.php │ │ │ └── Roster │ │ │ │ ├── Attributes │ │ │ │ └── RosterStats.php │ │ │ │ ├── IncludedRelationships.php │ │ │ │ ├── IncludedRosterAttributes.php │ │ │ │ └── Relationships │ │ │ │ ├── Participants.php │ │ │ │ ├── Team.php │ │ │ │ └── Type │ │ │ │ └── ParticipantType.php │ │ ├── Links │ │ │ └── Links.php │ │ ├── Match │ │ │ ├── Data.php │ │ │ ├── MatchAttributes.php │ │ │ ├── MatchLinks.php │ │ │ ├── MatchRelationships.php │ │ │ └── Relationships │ │ │ │ ├── Assets.php │ │ │ │ ├── Rosters.php │ │ │ │ ├── Rounds.php │ │ │ │ ├── Spectators.php │ │ │ │ └── Type │ │ │ │ ├── AssetType.php │ │ │ │ └── RosterType.php │ │ └── Meta │ │ │ └── Meta.php │ ├── Player.php │ ├── PlayerData │ │ ├── Links │ │ │ └── Links.php │ │ ├── Meta │ │ │ └── Meta.php │ │ └── Player │ │ │ ├── Data.php │ │ │ ├── PlayerAttributes.php │ │ │ ├── PlayerLinks.php │ │ │ ├── PlayerRelationships.php │ │ │ └── Relationships │ │ │ ├── Assets.php │ │ │ ├── Match │ │ │ └── MatchData.php │ │ │ └── Matches.php │ ├── Players.php │ ├── Samples.php │ ├── SamplesData │ │ └── Sample │ │ │ ├── Data.php │ │ │ ├── Relationships │ │ │ ├── Matches.php │ │ │ └── Type │ │ │ │ └── MatchType.php │ │ │ ├── SampleAttributes.php │ │ │ ├── SampleLinks.php │ │ │ └── SampleRelationships.php │ ├── Status.php │ ├── StatusData │ │ └── Status │ │ │ ├── Data.php │ │ │ └── StatusAttributes.php │ ├── Telemetry.php │ └── TelemetryData │ │ ├── Events │ │ ├── LogArmorDestroy.php │ │ ├── LogCarePackageLand.php │ │ ├── LogCarePackageSpawn.php │ │ ├── LogGameStatePeriodic.php │ │ ├── LogItemAttach.php │ │ ├── LogItemDetach.php │ │ ├── LogItemDrop.php │ │ ├── LogItemEquip.php │ │ ├── LogItemPickup.php │ │ ├── LogItemUnequip.php │ │ ├── LogItemUse.php │ │ ├── LogMatchDefinition.php │ │ ├── LogMatchEnd.php │ │ ├── LogMatchStart.php │ │ ├── LogPlayerAttack.php │ │ ├── LogPlayerCreate.php │ │ ├── LogPlayerKill.php │ │ ├── LogPlayerLogin.php │ │ ├── LogPlayerLogout.php │ │ ├── LogPlayerMakeGroggy.php │ │ ├── LogPlayerPosition.php │ │ ├── LogPlayerRevive.php │ │ ├── LogPlayerTakeDamage.php │ │ ├── LogSwimEnd.php │ │ ├── LogSwimStart.php │ │ ├── LogVehicleDestroy.php │ │ ├── LogVehicleLeave.php │ │ ├── LogVehicleRide.php │ │ └── LogWheelDestroy.php │ │ └── Objects │ │ ├── BlueZoneCustomOption.php │ │ ├── Character.php │ │ ├── Common.php │ │ ├── GameState.php │ │ ├── Item.php │ │ ├── ItemPackage.php │ │ ├── Location.php │ │ └── Vehicle.php ├── PUBGManager.php ├── PUBGManagerException.php └── Provider │ ├── MatchDTOProvider.php │ ├── PlayerDTOProvider.php │ ├── PlayersDTOProvider.php │ ├── ProviderInterface.php │ ├── SamplesDTOProvider.php │ ├── StatusDTOProvider.php │ └── TelemetryDTOProvider.php └── tests ├── PUBGManagerTest.php └── example ├── leaderboards.json ├── match.json ├── player.json ├── players.json ├── samples.json ├── season_for_player.json ├── seasons.json ├── status.json ├── telemetry.json ├── tournament.json └── tournaments.json /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | vendor/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Serhii Kondratiuk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PHPPUBG - wrapper for PUBG Developer API 2 | ======================= 3 | [![Total Downloads](https://poser.pugx.org/lifeformwp/php-pubg/downloads)](https://packagist.org/packages/lifeformwp/php-pubg) 4 | 5 | Wrapper for PUBG API with DTO (Matches, Player/Players, Status, Telemetry, Samples), full test coverage, PHP 7.1, etc. 6 | 7 | Requirements 8 | ============ 9 | 10 | * PHP >= 7.1 11 | 12 | Installation 13 | ============ 14 | 15 | * run `composer require lifeformwp/php-pubg` 16 | 17 | Basic usage 18 | ============ 19 | 20 | ``` 21 | $client = new GuzzleHttp\Client(); 22 | $class = new \Lifeformwp\PHPPUBG\PUBGManager($client, 'token'); 23 | 24 | $data = $class->getMatch('pc-eu', 'abe08f7e-3add-4fd6-9bcd-4aff88fc7adf'); //returns array 25 | $matchObject = $class->hydrate($data, \Lifeformwp\PHPPUBG\PUBGManager::HYDRATE_MATCH); //returns Lifeformwp\PHPPUBG\DTO\Match object 26 | ``` 27 | 28 | Available methods 29 | ============ 30 | 31 | * getMatch([string, required]shard, [string, required]matchId) - returns array of data about match 32 | * getPlayers([string, required]shard, [array, not required]playerNames, [array, not required]playerIds) - returns array of data about players 33 | * getPlayer([string, required]shard, [string, required]playerId) - returns array of data about player 34 | * getTelemetry([string, required]shard, [string, required]matchId) - returns array of telemetry data from the match 35 | * getStatus() - returns array of data about API status 36 | * getSamples([string, required]shard) - returns array of sample data 37 | * getSeasons([string, required]shard) - returns array of seasons data 38 | * getSeasonDataForPlayer([string, required]shard, [string, required]playerId, [string, required]seasonId) - returns array of season data for player 39 | * getTournaments() - returns array of data about tournaments 40 | * getTournament([string, required]tournamentId) - returns array of data about tournament 41 | * getLeaderboard([string, required]shard, [string, required]gameMode) - returns array of data about leaderboard 42 | 43 | * getMatches([string, required]shard, [array, required]matchesIds) - returns array of arrays about matches 44 | * getTelemetryByMatch([string, required]telemetryUrl) - returns array of data according to given telemetry url 45 | * setClient([ClientInterface, required]client) 46 | * setToken([string, required]token) 47 | 48 | * hydrate([array, required]data, [string, required]type) - returns object from given array, possible values for type parameter are: HYDRATE_MATCH, HYDRATE_PLAYERS, HYDRATE_PLAYER, HYDRATE_STATUS, HYDRATE_TELEMETRY and HYDRATE_SAMPLES 49 | 50 | WIP 51 | ============ 52 | 53 | * Documentation 54 | * More flexible behaviour 55 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lifeformwp/php-pubg", 3 | "description": "PUBG API wrapper written in PHP 7.1", 4 | "keywords": ["pubg", "wrapper", "php7"], 5 | "type": "library", 6 | "require": { 7 | "guzzlehttp/guzzle": "~6.0", 8 | "php" : ">=7.1.0" 9 | }, 10 | "require-dev": { 11 | "phpunit/phpunit" : "^7.0" 12 | }, 13 | "license": "MIT", 14 | "authors": [ 15 | { 16 | "name": "Serhii Kondratiuk", 17 | "email": "vielon.indie@gmail.com" 18 | } 19 | ], 20 | "autoload": { 21 | "psr-4": { 22 | "Lifeformwp\\PHPPUBG\\": "src/" 23 | } 24 | }, 25 | "autoload-dev": { 26 | "psr-4": { 27 | "Lifeformwp\\PHPPUBG\\Tests\\": "tests/" 28 | } 29 | }, 30 | "version": "1.8.0" 31 | } -------------------------------------------------------------------------------- /src/DTO/DTOInterface.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO 10 | * @since 1.1.0 11 | */ 12 | interface DTOInterface 13 | { 14 | /** 15 | * @param array $data 16 | * 17 | * @return mixed 18 | */ 19 | public static function createFromResponse(array $data); 20 | } -------------------------------------------------------------------------------- /src/DTO/Match.php: -------------------------------------------------------------------------------- 1 | 14 | * @package Lifeformwp\PHPPUBG\DTO 15 | * @since 1.1.0 16 | */ 17 | class Match implements DTOInterface 18 | { 19 | /** 20 | * @var Data|null 21 | */ 22 | public $data; 23 | /** 24 | * @var Included|[] 25 | */ 26 | public $included; 27 | /** 28 | * @var Links|null 29 | */ 30 | public $links; 31 | /** 32 | * @var Meta|null 33 | */ 34 | public $meta; 35 | 36 | /** 37 | * Match constructor. 38 | * 39 | * @param Data|null $data 40 | * @param Included|null $included 41 | * @param Links|null $links 42 | * @param Meta|null $meta 43 | */ 44 | public function __construct( 45 | ?Data $data, 46 | ?Included $included, 47 | ?Links $links, 48 | ?Meta $meta 49 | ) { 50 | $this->data = $data; 51 | $this->included = $included; 52 | $this->links = $links; 53 | $this->meta = $meta; 54 | } 55 | 56 | /** 57 | * @param array $data 58 | * 59 | * @return Match 60 | */ 61 | public static function createFromResponse(array $data): self 62 | { 63 | return new self( 64 | $data['data'], 65 | $data['included'], 66 | $data['links'], 67 | $data['meta'] 68 | ); 69 | } 70 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Asset/AssetAttributes.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Asset 10 | * @since 1.1.0 11 | */ 12 | class AssetAttributes 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $URL; 18 | /** 19 | * @var \DateTimeImmutable|null 20 | */ 21 | public $createdAt; 22 | /** 23 | * @var null|string 24 | */ 25 | public $description; 26 | /** 27 | * @var null|string 28 | */ 29 | public $name; 30 | 31 | /** 32 | * AssetAttributes constructor. 33 | * 34 | * @param null|string $URL 35 | * @param \DateTimeImmutable|null $createdAt 36 | * @param null|string $description 37 | * @param null|string $name 38 | */ 39 | public function __construct( 40 | ?string $URL, 41 | ?\DateTimeImmutable $createdAt, 42 | ?string $description, 43 | ?string $name 44 | ) { 45 | $this->URL = $URL; 46 | $this->createdAt = $createdAt; 47 | $this->description = $description; 48 | $this->name = $name; 49 | } 50 | 51 | /** 52 | * @param array $data 53 | * 54 | * @return AssetAttributes 55 | */ 56 | public static function createFromResponse(array $data): self 57 | { 58 | return new self( 59 | $data['URL'], 60 | new \DateTimeImmutable($data['createdAt']), 61 | $data['description'], 62 | $data['name'] 63 | ); 64 | } 65 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Included.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included 10 | * @since 1.1.0 11 | */ 12 | class Included 13 | { 14 | /** 15 | * @var Participant[]|[] 16 | */ 17 | public $rosters; 18 | /** 19 | * @var Roster[]|[] 20 | */ 21 | public $participants; 22 | /** 23 | * @var IncludedAsset|null 24 | */ 25 | public $asset; 26 | 27 | /** 28 | * Included constructor. 29 | * 30 | * @param Participant []|[] $rosters 31 | * @param Roster []|[] $participants 32 | * @param IncludedAsset|null $asset 33 | */ 34 | public function __construct( 35 | ?array $rosters, 36 | ?array $participants, 37 | IncludedAsset $asset 38 | ) { 39 | $this->rosters = $rosters; 40 | $this->participants = $participants; 41 | $this->asset = $asset; 42 | } 43 | 44 | /** 45 | * @param array $data 46 | * 47 | * @return Included 48 | */ 49 | public static function createFromResponse(array $data): self 50 | { 51 | return new self( 52 | $data['rosters'], 53 | $data['participants'], 54 | $data['asset'] 55 | ); 56 | } 57 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/IncludedAsset.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included 12 | * @since 1.1.0 13 | */ 14 | class IncludedAsset 15 | { 16 | /** 17 | * @var string 18 | */ 19 | public $type; 20 | /** 21 | * @var string 22 | */ 23 | public $id; 24 | /** 25 | * @var AssetAttributes 26 | */ 27 | public $attributes; 28 | 29 | /** 30 | * IncludedAsset constructor. 31 | * 32 | * @param string $type 33 | * @param string $id 34 | * @param AssetAttributes $attributes 35 | */ 36 | public function __construct( 37 | string $type, 38 | string $id, 39 | AssetAttributes $attributes 40 | ) { 41 | $this->type = $type; 42 | $this->id = $id; 43 | $this->attributes = $attributes; 44 | } 45 | 46 | /** 47 | * @param array $data 48 | * 49 | * @return IncludedAsset 50 | */ 51 | public static function createFromResponse(array $data): self 52 | { 53 | return new self( 54 | $data['type'], 55 | $data['id'], 56 | $data['attributes'] 57 | ); 58 | } 59 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Participant.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included 12 | * @since 1.1.0 13 | */ 14 | class Participant 15 | { 16 | /** 17 | * @var null|string 18 | */ 19 | public $type; 20 | /** 21 | * @var null|string 22 | */ 23 | public $id; 24 | /** 25 | * @var IncludedParticipantAttributes|null 26 | */ 27 | public $attributes; 28 | 29 | /** 30 | * Participant constructor. 31 | * 32 | * @param null|string $type 33 | * @param null|string $id 34 | * @param IncludedParticipantAttributes|null $attributes 35 | */ 36 | public function __construct( 37 | ?string $type, 38 | ?string $id, 39 | ?IncludedParticipantAttributes $attributes 40 | ) { 41 | $this->type = $type; 42 | $this->id = $id; 43 | $this->attributes = $attributes; 44 | } 45 | 46 | /** 47 | * @param array $data 48 | * 49 | * @return Participant 50 | */ 51 | public static function createFromResponse(array $data): self 52 | { 53 | return new self( 54 | $data['type'], 55 | $data['id'], 56 | $data['attributes'] 57 | ); 58 | } 59 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Participant/IncludedParticipantAttributes.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Participant 10 | * @since 1.1.0 11 | */ 12 | class IncludedParticipantAttributes 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $actor; 18 | /** 19 | * @var null|string 20 | */ 21 | public $shardId; 22 | /** 23 | * @var ParticipantStats|null 24 | */ 25 | public $stats; 26 | 27 | /** 28 | * IncludedParticipantAttributes constructor. 29 | * 30 | * @param null|string $actor 31 | * @param null|string $shardId 32 | * @param ParticipantStats|null $stats 33 | */ 34 | public function __construct( 35 | ?string $actor, 36 | ?string $shardId, 37 | ?ParticipantStats $stats 38 | ) { 39 | $this->actor = $actor; 40 | $this->shardId = $shardId; 41 | $this->stats = $stats; 42 | } 43 | 44 | /** 45 | * @param array $data 46 | * 47 | * @return IncludedParticipantAttributes 48 | */ 49 | public static function createFromResponse(array $data): self 50 | { 51 | return new self( 52 | $data['actor'], 53 | $data['shardId'], 54 | $data['stats'] 55 | ); 56 | } 57 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Participant/ParticipantStats.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Participant 10 | * @since 1.1.0 11 | */ 12 | class ParticipantStats 13 | { 14 | /** 15 | * @var int|null 16 | */ 17 | public $DBNOs; 18 | /** 19 | * @var int|null 20 | */ 21 | public $assists; 22 | /** 23 | * @var int|null 24 | */ 25 | public $boosts; 26 | /** 27 | * @var int|null 28 | */ 29 | public $damageDealt; 30 | /** 31 | * @var null|string 32 | */ 33 | public $deathType; 34 | /** 35 | * @var int|null 36 | */ 37 | public $headshotKills; 38 | /** 39 | * @var int|null 40 | */ 41 | public $heals; 42 | /** 43 | * @var int|null 44 | */ 45 | public $killPlace; 46 | /** 47 | * @var int|null 48 | */ 49 | public $killStreaks; 50 | /** 51 | * @var int|null 52 | */ 53 | public $kills; 54 | /** 55 | * @var int|null 56 | */ 57 | public $lastKillPoints; 58 | /** 59 | * @var int|null 60 | */ 61 | public $lastWinPoints; 62 | /** 63 | * @var int|null 64 | */ 65 | public $longestKill; 66 | /** 67 | * @var int|null 68 | */ 69 | public $mostDamage; 70 | /** 71 | * @var null|string 72 | */ 73 | public $name; 74 | /** 75 | * @var null|string 76 | */ 77 | public $playerId; 78 | /** 79 | * @var int|null 80 | */ 81 | public $revives; 82 | /** 83 | * @var int|null 84 | */ 85 | public $rideDistance; 86 | /** 87 | * @var int|null 88 | */ 89 | public $roadKills; 90 | /** 91 | * @var float|null 92 | */ 93 | public $swimDistance; 94 | /** 95 | * @var int|null 96 | */ 97 | public $teamKills; 98 | /** 99 | * @var int|null 100 | */ 101 | public $timeSurvived; 102 | /** 103 | * @var int|null 104 | */ 105 | public $vehicleDestroys; 106 | /** 107 | * @var float|null 108 | */ 109 | public $walkDistance; 110 | /** 111 | * @var int|null 112 | */ 113 | public $weaponsAcquired; 114 | /** 115 | * @var int|null 116 | */ 117 | public $winPlace; 118 | /** 119 | * @var int|null 120 | */ 121 | public $rankPoints; 122 | 123 | /** 124 | * ParticipantStats constructor. 125 | * 126 | * @param int|null $DBNOs 127 | * @param int|null $assists 128 | * @param int|null $boosts 129 | * @param float|null $damageDealt 130 | * @param null|string $deathType 131 | * @param int|null $headshotKills 132 | * @param int|null $heals 133 | * @param int|null $killPlace 134 | * @param int|null $killStreaks 135 | * @param int|null $kills 136 | * @param int|null $lastKillPoints 137 | * @param int|null $lastWinPoints 138 | * @param float|null $longestKill 139 | * @param int|null $mostDamage 140 | * @param null|string $name 141 | * @param null|string $playerId 142 | * @param int|null $revives 143 | * @param float|null $rideDistance 144 | * @param int|null $roadKills 145 | * @param float|null $swimDistance 146 | * @param int|null $teamKills 147 | * @param float|null $timeSurvived 148 | * @param int|null $vehicleDestroys 149 | * @param float|null $walkDistance 150 | * @param int|null $weaponsAcquired 151 | * @param int|null $winPlace 152 | * @param int|null $rankPoints 153 | */ 154 | public function __construct( 155 | ?int $DBNOs, 156 | ?int $assists, 157 | ?int $boosts, 158 | ?float $damageDealt, 159 | ?string $deathType, 160 | ?int $headshotKills, 161 | ?int $heals, 162 | ?int $killPlace, 163 | ?int $killStreaks, 164 | ?int $kills, 165 | ?int $lastKillPoints, 166 | ?int $lastWinPoints, 167 | ?float $longestKill, 168 | ?int $mostDamage, 169 | ?string $name, 170 | ?string $playerId, 171 | ?int $revives, 172 | ?float $rideDistance, 173 | ?int $roadKills, 174 | ?float $swimDistance, 175 | ?int $teamKills, 176 | ?float $timeSurvived, 177 | ?int $vehicleDestroys, 178 | ?float $walkDistance, 179 | ?int $weaponsAcquired, 180 | ?int $winPlace, 181 | ?int $rankPoints 182 | ) { 183 | $this->DBNOs = $DBNOs; 184 | $this->assists = $assists; 185 | $this->boosts = $boosts; 186 | $this->damageDealt = $damageDealt; 187 | $this->deathType = $deathType; 188 | $this->headshotKills = $headshotKills; 189 | $this->heals = $heals; 190 | $this->killPlace = $killPlace; 191 | $this->killStreaks = $killStreaks; 192 | $this->kills = $kills; 193 | $this->lastKillPoints = $lastKillPoints; 194 | $this->lastWinPoints = $lastWinPoints; 195 | $this->longestKill = $longestKill; 196 | $this->mostDamage = $mostDamage; 197 | $this->name = $name; 198 | $this->playerId = $playerId; 199 | $this->revives = $revives; 200 | $this->rideDistance = $rideDistance; 201 | $this->roadKills = $roadKills; 202 | $this->swimDistance = $swimDistance; 203 | $this->teamKills = $teamKills; 204 | $this->timeSurvived = $timeSurvived; 205 | $this->vehicleDestroys = $vehicleDestroys; 206 | $this->walkDistance = $walkDistance; 207 | $this->weaponsAcquired = $weaponsAcquired; 208 | $this->winPlace = $winPlace; 209 | $this->rankPoints = $rankPoints; 210 | } 211 | 212 | /** 213 | * @param array $data 214 | * 215 | * @return ParticipantStats 216 | */ 217 | public static function createFromResponse(array $data): self 218 | { 219 | return new self( 220 | $data['DBNOs'], 221 | $data['assists'], 222 | $data['boosts'], 223 | $data['damageDealt'], 224 | $data['deathType'], 225 | $data['headshotKills'], 226 | $data['heals'], 227 | $data['killPlace'], 228 | $data['killStreaks'], 229 | $data['kills'], 230 | $data['lastKillPoints'], 231 | $data['lastWinPoints'], 232 | $data['longestKill'], 233 | $data['mostDamage'], 234 | $data['name'], 235 | $data['playerId'], 236 | $data['revives'], 237 | $data['rideDistance'], 238 | $data['roadKills'], 239 | $data['swimDistance'], 240 | $data['teamKills'], 241 | $data['timeSurvived'], 242 | $data['vehicleDestroys'], 243 | $data['walkDistance'], 244 | $data['weaponsAcquired'], 245 | $data['winPlace'], 246 | $data['rankPoints'] 247 | ); 248 | } 249 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Roster.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included 13 | * @since 1.1.0 14 | */ 15 | class Roster 16 | { 17 | /** 18 | * @var null|string 19 | */ 20 | public $type; 21 | /** 22 | * @var null|string 23 | */ 24 | public $id; 25 | /** 26 | * @var IncludedRosterAttributes|null 27 | */ 28 | public $attributes; 29 | /** 30 | * @var IncludedRelationships|null 31 | */ 32 | public $relationships; 33 | 34 | /** 35 | * Roster constructor. 36 | * 37 | * @param null|string $type 38 | * @param null|string $id 39 | * @param IncludedRosterAttributes|null $attributes 40 | * @param IncludedRelationships|null $relationships 41 | */ 42 | public function __construct( 43 | ?string $type, 44 | ?string $id, 45 | ?IncludedRosterAttributes $attributes, 46 | ?IncludedRelationships $relationships 47 | ) { 48 | $this->type = $type; 49 | $this->id = $id; 50 | $this->attributes = $attributes; 51 | $this->relationships = $relationships; 52 | } 53 | 54 | /** 55 | * @param array $data 56 | * 57 | * @return Roster 58 | */ 59 | public static function createFromResponse(array $data): self 60 | { 61 | return new self( 62 | $data['type'], 63 | $data['id'], 64 | $data['attributes'], 65 | $data['relationships'] 66 | ); 67 | } 68 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Roster/Attributes/RosterStats.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Attributes 10 | * @since 1.1.0 11 | */ 12 | class RosterStats 13 | { 14 | /** 15 | * @var int|null 16 | */ 17 | public $rank; 18 | /** 19 | * @var int|null 20 | */ 21 | public $teamId; 22 | 23 | /** 24 | * RosterStats constructor. 25 | * 26 | * @param int|null $rank 27 | * @param int|null $teamId 28 | */ 29 | public function __construct(?int $rank, ?int $teamId) 30 | { 31 | $this->rank = $rank; 32 | $this->teamId = $teamId; 33 | } 34 | 35 | /** 36 | * @param array $data 37 | * 38 | * @return RosterStats 39 | */ 40 | public static function createFromResponse(array $data): self 41 | { 42 | return new self( 43 | $data['rank'], 44 | $data['teamId'] 45 | ); 46 | } 47 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Roster/IncludedRelationships.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Roster 13 | * @since 1.1.0 14 | */ 15 | class IncludedRelationships 16 | { 17 | /** 18 | * @var Participants|null 19 | */ 20 | public $participants; 21 | /** 22 | * @var Team|null 23 | */ 24 | public $team; 25 | 26 | /** 27 | * IncludedRelationships constructor. 28 | * 29 | * @param Participants|null $participants 30 | * @param Team|null $team 31 | */ 32 | public function __construct(?Participants $participants, ?Team $team) 33 | { 34 | $this->participants = $participants; 35 | $this->team = $team; 36 | } 37 | 38 | /** 39 | * @param array $data 40 | * 41 | * @return IncludedRelationships 42 | */ 43 | public static function createFromResponse(array $data): self 44 | { 45 | return new self( 46 | $data['participants'], 47 | $data['team'] 48 | ); 49 | } 50 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Roster/IncludedRosterAttributes.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Roster 12 | * @since 1.1.0 13 | */ 14 | class IncludedRosterAttributes 15 | { 16 | /** 17 | * @var null|string 18 | */ 19 | public $shardId; 20 | /** 21 | * @var RosterStats|null 22 | */ 23 | public $stats; 24 | /** 25 | * @var null|string 26 | */ 27 | public $won; 28 | 29 | /** 30 | * IncludedRosterAttributes constructor. 31 | * 32 | * @param null|string $shardId 33 | * @param RosterStats|null $stats 34 | * @param null|string $won 35 | */ 36 | public function __construct( 37 | ?string $shardId, 38 | ?RosterStats $stats, 39 | ?string $won 40 | ) { 41 | $this->shardId = $shardId; 42 | $this->stats = $stats; 43 | $this->won = $won; 44 | } 45 | 46 | /** 47 | * @param array $data 48 | * 49 | * @return IncludedRosterAttributes 50 | */ 51 | public static function createFromResponse(array $data): self 52 | { 53 | return new self( 54 | $data['shardId'], 55 | $data['stats'], 56 | $data['won'] 57 | ); 58 | } 59 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Roster/Relationships/Participants.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Roster\Relationships 10 | * @since 1.1.0 11 | */ 12 | class Participants 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data; 18 | 19 | /** 20 | * Participants constructor. 21 | * 22 | * @param array|[] $data 23 | */ 24 | public function __construct(array $data) 25 | { 26 | $this->data = $data; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Participants 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['data'] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Roster/Relationships/Team.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Roster\Relationships 10 | * @since 1.1.0 11 | */ 12 | class Team 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data; 18 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Included/Roster/Relationships/Type/ParticipantType.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Included\Roster\Relationships\Type 10 | * @since 1.1.0 11 | */ 12 | class ParticipantType 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | 23 | /** 24 | * ParticipantType constructor. 25 | * 26 | * @param null|string $type 27 | * @param null|string $id 28 | */ 29 | public function __construct(?string $type, ?string $id) 30 | { 31 | $this->type = $type; 32 | $this->id = $id; 33 | } 34 | 35 | /** 36 | * @param array $data 37 | * 38 | * @return ParticipantType 39 | */ 40 | public static function createFromResponse(array $data): self 41 | { 42 | return new self( 43 | $data['type'], 44 | $data['id'] 45 | ); 46 | } 47 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Links/Links.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Links 10 | * @since 1.1.0 11 | */ 12 | class Links 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $self; 18 | 19 | /** 20 | * Links constructor. 21 | * 22 | * @param null|string $self 23 | */ 24 | public function __construct(?string $self) 25 | { 26 | $this->self = $self; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Links 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['self'] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/Data.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match 10 | * @since 1.1.0 11 | */ 12 | class Data 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | /** 23 | * @var MatchAttributes|null 24 | */ 25 | public $attributes; 26 | /** 27 | * @var MatchRelationships|null 28 | */ 29 | public $relationships; 30 | /** 31 | * @var MatchLinks|null 32 | */ 33 | public $links; 34 | 35 | /** 36 | * Data constructor. 37 | * 38 | * @param null|string $type 39 | * @param null|string $id 40 | * @param MatchAttributes|null $attributes 41 | * @param MatchRelationships|null $relationships 42 | * @param MatchLinks|null $links 43 | */ 44 | public function __construct( 45 | ?string $type, 46 | ?string $id, 47 | ?MatchAttributes $attributes, 48 | ?MatchRelationships $relationships, 49 | ?MatchLinks $links 50 | ) { 51 | $this->type = $type; 52 | $this->id = $id; 53 | $this->attributes = $attributes; 54 | $this->relationships = $relationships; 55 | $this->links = $links; 56 | } 57 | 58 | public static function createFromResponse(array $data): self 59 | { 60 | return new self( 61 | $data['type'], 62 | $data['id'], 63 | $data['attributes'], 64 | $data['relationships'], 65 | $data['links'] 66 | ); 67 | } 68 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/MatchAttributes.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match 10 | * @since 1.1.0 11 | */ 12 | class MatchAttributes 13 | { 14 | /** 15 | * @var \DateTimeImmutable|null 16 | */ 17 | public $createdAt; 18 | /** 19 | * @var int|null 20 | */ 21 | public $duration; 22 | /** 23 | * @var null|string 24 | */ 25 | public $gameMode; 26 | /** 27 | * @var null|string 28 | */ 29 | public $mapName; 30 | /** 31 | * @var null|string 32 | */ 33 | public $shardId; 34 | /** 35 | * @var null|string 36 | */ 37 | public $stats; 38 | /** 39 | * @var null|string 40 | */ 41 | public $tags; 42 | /** 43 | * @var null|string 44 | */ 45 | public $titleId; 46 | /** 47 | * @var bool|null 48 | */ 49 | public $isCustomMatch; 50 | /** 51 | * @var null|string 52 | */ 53 | public $seasonState; 54 | 55 | /** 56 | * MatchAttributes constructor. 57 | * 58 | * @param \DateTimeImmutable|null $createdAt 59 | * @param int|null $duration 60 | * @param null|string $gameMode 61 | * @param null|string $mapName 62 | * @param null|string $shardId 63 | * @param null|string $stats 64 | * @param null|string $tags 65 | * @param null|string $titleId 66 | * @param bool|null $isCustomMatch 67 | * @param null|string $seasonState 68 | */ 69 | public function __construct( 70 | ?\DateTimeImmutable $createdAt, 71 | ?int $duration, 72 | ?string $gameMode, 73 | ?string $mapName, 74 | ?string $shardId, 75 | ?string $stats, 76 | ?string $tags, 77 | ?string $titleId, 78 | ?bool $isCustomMatch, 79 | ?string $seasonState 80 | ) { 81 | $this->createdAt = $createdAt; 82 | $this->duration = $duration; 83 | $this->gameMode = $gameMode; 84 | $this->mapName = $mapName; 85 | $this->shardId = $shardId; 86 | $this->stats = $stats; 87 | $this->tags = $tags; 88 | $this->titleId = $titleId; 89 | $this->isCustomMatch = $isCustomMatch; 90 | $this->seasonState = $seasonState; 91 | } 92 | 93 | /** 94 | * @param array $data 95 | * 96 | * @return MatchAttributes 97 | */ 98 | public static function createFromResponse(array $data): self 99 | { 100 | return new self( 101 | new \DateTimeImmutable($data['createdAt']), 102 | $data['duration'], 103 | $data['gameMode'], 104 | $data['mapName'], 105 | $data['shardId'], 106 | $data['stats'], 107 | $data['tags'], 108 | $data['titleId'], 109 | $data['isCustomMatch'], 110 | $data['seasonState'] 111 | ); 112 | } 113 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/MatchLinks.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\MatchData\DTO\Match 10 | * @since 1.1.0 11 | */ 12 | class MatchLinks 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $schema; 18 | /** 19 | * @var null|string 20 | */ 21 | public $self; 22 | 23 | /** 24 | * MatchLinks constructor. 25 | * 26 | * @param null|string $schema 27 | * @param null|string $self 28 | */ 29 | public function __construct( 30 | ?string $schema, 31 | ?string $self 32 | ) { 33 | $this->schema = $schema; 34 | $this->self = $self; 35 | } 36 | 37 | /** 38 | * @param array $data 39 | * 40 | * @return MatchLinks 41 | */ 42 | public static function createFromResponse(array $data): self 43 | { 44 | return new self( 45 | $data['schema'], 46 | $data['self'] 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/MatchRelationships.php: -------------------------------------------------------------------------------- 1 | 14 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match 15 | * @since 1.1.0 16 | */ 17 | class MatchRelationships 18 | { 19 | /** 20 | * @var Assets|null 21 | */ 22 | public $assets; 23 | /** 24 | * @var Rosters|null 25 | */ 26 | public $rosters; 27 | /** 28 | * @var Rounds|null 29 | */ 30 | public $rounds; 31 | /** 32 | * @var Spectators|null 33 | */ 34 | public $spectators; 35 | 36 | /** 37 | * MatchRelationships constructor. 38 | * 39 | * @param Assets|null $assets 40 | * @param Rosters|null $rosters 41 | * @param Rounds|null $rounds 42 | * @param Spectators|null $spectators 43 | */ 44 | public function __construct( 45 | ?Assets $assets, 46 | ?Rosters $rosters, 47 | ?Rounds $rounds, 48 | ?Spectators $spectators 49 | ) { 50 | $this->assets = $assets; 51 | $this->rosters = $rosters; 52 | $this->rounds = $rounds; 53 | $this->spectators = $spectators; 54 | } 55 | 56 | /** 57 | * @param array $data 58 | * 59 | * @return MatchRelationships 60 | */ 61 | public static function createFromResponse(array $data): self 62 | { 63 | return new self( 64 | $data['assets'], 65 | $data['rosters'], 66 | $data['rounds'], 67 | $data['spectators'] 68 | ); 69 | } 70 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/Relationships/Assets.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match\Relationships 10 | * @since 1.1.0 11 | */ 12 | class Assets 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data; 18 | 19 | /** 20 | * Assets constructor. 21 | * 22 | * @param array|null $data 23 | */ 24 | public function __construct(array $data) 25 | { 26 | $this->data = $data; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Assets 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['data'] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/Relationships/Rosters.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match\Relationships 10 | * @since 1.1.0 11 | */ 12 | class Rosters 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data; 18 | 19 | /** 20 | * Rosters constructor. 21 | * 22 | * @param array|null $data 23 | */ 24 | public function __construct(array $data) 25 | { 26 | $this->data = $data; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Rosters 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['data'] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/Relationships/Rounds.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match\Relationships 10 | * @since 1.1.0 11 | */ 12 | class Rounds 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data = []; 18 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/Relationships/Spectators.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match\Relationships 10 | * @since 1.1.0 11 | */ 12 | class Spectators 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data = []; 18 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/Relationships/Type/AssetType.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match\Relationships\Type 10 | * @since 1.1.0 11 | */ 12 | class AssetType 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | 23 | /** 24 | * AssetType constructor. 25 | * 26 | * @param null|string $type 27 | * @param null|string $id 28 | */ 29 | public function __construct(?string $type, ?string $id) 30 | { 31 | $this->type = $type; 32 | $this->id = $id; 33 | } 34 | 35 | /** 36 | * @param array $data 37 | * 38 | * @return AssetType 39 | */ 40 | public static function createFromResponse(array $data): self 41 | { 42 | return new self( 43 | $data['type'], 44 | $data['id'] 45 | ); 46 | } 47 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Match/Relationships/Type/RosterType.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Match\Relationships\Type 10 | * @since 1.1.0 11 | */ 12 | class RosterType 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | 23 | /** 24 | * RosterType constructor. 25 | * 26 | * @param null|string $type 27 | * @param null|string $id 28 | */ 29 | public function __construct(?string $type, ?string $id) 30 | { 31 | $this->type = $type; 32 | $this->id = $id; 33 | } 34 | 35 | /** 36 | * @param array $data 37 | * 38 | * @return RosterType 39 | */ 40 | public static function createFromResponse(array $data): self 41 | { 42 | return new self( 43 | $data['type'], 44 | $data['id'] 45 | ); 46 | } 47 | } -------------------------------------------------------------------------------- /src/DTO/MatchData/Meta/Meta.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchData\Meta 10 | * @since 1.1.0 11 | */ 12 | class Meta 13 | { 14 | 15 | } -------------------------------------------------------------------------------- /src/DTO/Player.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO 14 | * @since 1.1.0 15 | */ 16 | class Player implements DTOInterface 17 | { 18 | /** 19 | * @var Data|null 20 | */ 21 | public $data; 22 | /** 23 | * @var Links|null 24 | */ 25 | public $links; 26 | /** 27 | * @var Meta|null 28 | */ 29 | public $meta; 30 | 31 | /** 32 | * Player constructor. 33 | * 34 | * @param Data|null $data 35 | * @param Links|null $links 36 | * @param Meta|null $meta 37 | */ 38 | public function __construct( 39 | ?Data $data, 40 | ?Links $links, 41 | ?Meta $meta 42 | ) { 43 | $this->data = $data; 44 | $this->links = $links; 45 | $this->meta = $meta; 46 | } 47 | 48 | /** 49 | * @param array $data 50 | * 51 | * @return Player 52 | */ 53 | public static function createFromResponse(array $data): self 54 | { 55 | return new self( 56 | $data['data'], 57 | $data['links'], 58 | $data['meta'] 59 | ); 60 | } 61 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Links/Links.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchEndpoint\Links 10 | * @since 1.1.0 11 | */ 12 | class Links 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $self; 18 | 19 | /** 20 | * Links constructor. 21 | * 22 | * @param null|string $self 23 | */ 24 | public function __construct(?string $self) 25 | { 26 | $this->self = $self; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Links 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['self'] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Meta/Meta.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\MatchEndpoint\Meta 10 | * @since 1.1.0 11 | */ 12 | class Meta 13 | { 14 | 15 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Player/Data.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\PlayerData\Player 10 | * @since 1.1.0 11 | */ 12 | class Data 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | /** 23 | * @var PlayerAttributes|null 24 | */ 25 | public $attributes; 26 | /** 27 | * @var PlayerRelationships|null 28 | */ 29 | public $relationships; 30 | /** 31 | * @var PlayerLinks|null 32 | */ 33 | public $links; 34 | 35 | /** 36 | * Data constructor. 37 | * 38 | * @param null|string $type 39 | * @param null|string $id 40 | * @param PlayerAttributes|null $attributes 41 | * @param PlayerRelationships|null $relationships 42 | * @param PlayerLinks|null $links 43 | */ 44 | public function __construct( 45 | ?string $type, 46 | ?string $id, 47 | ?PlayerAttributes $attributes, 48 | ?PlayerRelationships $relationships, 49 | ?PlayerLinks $links 50 | ) { 51 | $this->type = $type; 52 | $this->id = $id; 53 | $this->attributes = $attributes; 54 | $this->relationships = $relationships; 55 | $this->links = $links; 56 | } 57 | 58 | /** 59 | * @param array $data 60 | * 61 | * @return Data 62 | */ 63 | public static function createFromResponse(array $data): self 64 | { 65 | return new self( 66 | $data['type'], 67 | $data['id'], 68 | $data['attributes'], 69 | $data['relationships'], 70 | $data['links'] 71 | ); 72 | } 73 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Player/PlayerAttributes.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\PlayerData\Player 10 | * @since 1.1.0 11 | */ 12 | class PlayerAttributes 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $name; 18 | /** 19 | * @var null|string 20 | */ 21 | public $patchVersion; 22 | /** 23 | * @var null|string 24 | */ 25 | public $shardId; 26 | /** 27 | * @var array|[] 28 | */ 29 | public $stats; 30 | /** 31 | * @var null|string 32 | */ 33 | public $titleId; 34 | 35 | /** 36 | * PlayerAttributes constructor. 37 | * 38 | * @param null|string $name 39 | * @param null|string $patchVersion 40 | * @param null|string $shardId 41 | * @param array|[] $stats 42 | * @param null|string $titleId 43 | */ 44 | public function __construct( 45 | ?string $name, 46 | ?string $patchVersion, 47 | ?string $shardId, 48 | ?array $stats, 49 | ?string $titleId 50 | ) { 51 | $this->name = $name; 52 | $this->patchVersion = $patchVersion; 53 | $this->shardId = $shardId; 54 | $this->stats = $stats; 55 | $this->titleId = $titleId; 56 | } 57 | 58 | /** 59 | * @param array $data 60 | * 61 | * @return PlayerAttributes 62 | */ 63 | public static function createFromResponse(array $data): self 64 | { 65 | return new self( 66 | $data['name'], 67 | $data['patchVersion'], 68 | $data['shardId'], 69 | $data['stats'], 70 | $data['titleId'] 71 | ); 72 | } 73 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Player/PlayerLinks.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\PlayerData\DTO\Player 10 | * @since 1.1.0 11 | */ 12 | class PlayerLinks 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $schema; 18 | /** 19 | * @var null|string 20 | */ 21 | public $self; 22 | 23 | /** 24 | * PlayerLinks constructor. 25 | * 26 | * @param null|string $schema 27 | * @param null|string $self 28 | */ 29 | public function __construct( 30 | ?string $schema, 31 | ?string $self 32 | ) { 33 | $this->schema = $schema; 34 | $this->self = $self; 35 | } 36 | 37 | /** 38 | * @param array $data 39 | * 40 | * @return PlayerLinks 41 | */ 42 | public static function createFromResponse(array $data): self 43 | { 44 | return new self( 45 | $data['schema'], 46 | $data['self'] 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Player/PlayerRelationships.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\PlayerData\Player 13 | * @since 1.1.0 14 | */ 15 | class PlayerRelationships 16 | { 17 | /** 18 | * @var Assets|null 19 | */ 20 | public $assets; 21 | /** 22 | * @var Matches|null 23 | */ 24 | public $matches; 25 | 26 | /** 27 | * PlayerRelationships constructor. 28 | * 29 | * @param Assets|null $assets 30 | * @param Matches|null $matches 31 | */ 32 | public function __construct( 33 | ?Assets $assets, 34 | ?Matches $matches 35 | ) { 36 | $this->assets = $assets; 37 | $this->matches = $matches; 38 | } 39 | 40 | /** 41 | * @param array $data 42 | * 43 | * @return PlayerRelationships 44 | */ 45 | public static function createFromResponse(array $data): self 46 | { 47 | return new self( 48 | $data['assets'], 49 | $data['matches'] 50 | ); 51 | } 52 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Player/Relationships/Assets.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\PlayerData\Player\Relationships 10 | * @since 1.1.0 11 | */ 12 | class Assets 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data = []; 18 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Player/Relationships/Match/MatchData.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\PlayerData\Player\Relationships\Match 10 | * @since 1.1.0 11 | */ 12 | class MatchData 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | 23 | /** 24 | * MatchData constructor. 25 | * 26 | * @param null|string $type 27 | * @param null|string $id 28 | */ 29 | public function __construct( 30 | ?string $type, 31 | ?string $id 32 | ) { 33 | $this->type = $type; 34 | $this->id = $id; 35 | } 36 | 37 | /** 38 | * @param array $data 39 | * 40 | * @return MatchData 41 | */ 42 | public static function createFromResponse(array $data): self 43 | { 44 | return new self( 45 | $data['type'], 46 | $data['id'] 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /src/DTO/PlayerData/Player/Relationships/Matches.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\PlayerData\Player\Relationships 10 | * @since 1.1.0 11 | */ 12 | class Matches 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data; 18 | 19 | /** 20 | * Matches constructor. 21 | * 22 | * @param array|[] $data 23 | */ 24 | public function __construct(array $data) 25 | { 26 | $this->data = $data; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Matches 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['data'] ?? [] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/Players.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO 14 | * @since 1.1.0 15 | */ 16 | class Players implements DTOInterface 17 | { 18 | /** 19 | * @var Data|[] 20 | */ 21 | public $data; 22 | /** 23 | * @var Links|null 24 | */ 25 | public $links; 26 | /** 27 | * @var Meta|null 28 | */ 29 | public $meta; 30 | 31 | /** 32 | * Players constructor. 33 | * 34 | * @param Data|[] $data 35 | * @param Links|null $links 36 | * @param Meta|null $meta 37 | */ 38 | public function __construct( 39 | ?array $data, 40 | ?Links $links, 41 | ?Meta $meta 42 | ) { 43 | $this->data = $data; 44 | $this->links = $links; 45 | $this->meta = $meta; 46 | } 47 | 48 | /** 49 | * @param array $data 50 | * 51 | * @return Players 52 | */ 53 | public static function createFromResponse(array $data): self 54 | { 55 | return new self( 56 | $data['data'], 57 | $data['links'], 58 | $data['meta'] 59 | ); 60 | } 61 | } -------------------------------------------------------------------------------- /src/DTO/Samples.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\DTO 12 | * @since 1.3.0 13 | */ 14 | class Samples implements DTOInterface 15 | { 16 | /** 17 | * @var Data|null 18 | */ 19 | public $data; 20 | 21 | /** 22 | * Samples constructor. 23 | * 24 | * @param Data|null $data 25 | */ 26 | public function __construct(?Data $data) 27 | { 28 | $this->data = $data; 29 | } 30 | 31 | /** 32 | * @param array $data 33 | * 34 | * @return Samples 35 | */ 36 | public static function createFromResponse(array $data): self 37 | { 38 | return new self( 39 | $data['data'] 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /src/DTO/SamplesData/Sample/Data.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\SamplesData\Sample 10 | * @since 1.3.0 11 | */ 12 | class Data 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | /** 23 | * @var SampleAttributes|null 24 | */ 25 | public $attributes; 26 | /** 27 | * @var SampleRelationships|null 28 | */ 29 | public $relationships; 30 | 31 | /** 32 | * Data constructor. 33 | * 34 | * @param null|string $type 35 | * @param null|string $id 36 | * @param SampleAttributes|null $attributes 37 | * @param SampleRelationships|null $relationships 38 | */ 39 | public function __construct( 40 | ?string $type, 41 | ?string $id, 42 | ?SampleAttributes $attributes, 43 | ?SampleRelationships $relationships 44 | ) { 45 | $this->type = $type; 46 | $this->id = $id; 47 | $this->attributes = $attributes; 48 | $this->relationships = $relationships; 49 | } 50 | 51 | public static function createFromResponse(array $data): self 52 | { 53 | return new self( 54 | $data['type'], 55 | $data['id'], 56 | $data['attributes'], 57 | $data['relationships'] 58 | ); 59 | } 60 | } -------------------------------------------------------------------------------- /src/DTO/SamplesData/Sample/Relationships/Matches.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\SamplesData\Sample\Relationships 10 | * @since 1.3.0 11 | */ 12 | class Matches 13 | { 14 | /** 15 | * @var array|[] 16 | */ 17 | public $data; 18 | 19 | /** 20 | * Matches constructor. 21 | * 22 | * @param array|null $data 23 | */ 24 | public function __construct(array $data) 25 | { 26 | $this->data = $data; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Matches 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['data'] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/SamplesData/Sample/Relationships/Type/MatchType.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\SamplesData\Sample\Relationships\Type 10 | * @since 1.3.0 11 | */ 12 | class MatchType 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | 23 | /** 24 | * MatchType constructor. 25 | * 26 | * @param null|string $type 27 | * @param null|string $id 28 | */ 29 | public function __construct(?string $type, ?string $id) 30 | { 31 | $this->type = $type; 32 | $this->id = $id; 33 | } 34 | 35 | /** 36 | * @param array $data 37 | * 38 | * @return MatchType 39 | */ 40 | public static function createFromResponse(array $data): self 41 | { 42 | return new self( 43 | $data['type'], 44 | $data['id'] 45 | ); 46 | } 47 | } -------------------------------------------------------------------------------- /src/DTO/SamplesData/Sample/SampleAttributes.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\SamplesData\Sample 10 | * @since 1.3.0 11 | */ 12 | class SampleAttributes 13 | { 14 | /** 15 | * @var \DateTimeImmutable|null 16 | */ 17 | public $createdAt; 18 | /** 19 | * @var null|string 20 | */ 21 | public $shardId; 22 | /** 23 | * @var null|string 24 | */ 25 | public $titleId; 26 | 27 | /** 28 | * SampleAttributes constructor. 29 | * 30 | * @param \DateTimeImmutable|null $createdAt 31 | * @param null|string $shardId 32 | * @param null|string $titleId 33 | */ 34 | public function __construct( 35 | ?\DateTimeImmutable $createdAt, 36 | ?string $shardId, 37 | ?string $titleId 38 | ) { 39 | $this->createdAt = $createdAt; 40 | $this->shardId = $shardId; 41 | $this->titleId = $titleId; 42 | } 43 | 44 | /** 45 | * @param array $data 46 | * 47 | * @return SampleAttributes 48 | */ 49 | public static function createFromResponse(array $data): self 50 | { 51 | return new self( 52 | new \DateTimeImmutable($data['createdAt']), 53 | $data['shardId'], 54 | $data['titleId'] 55 | ); 56 | } 57 | } -------------------------------------------------------------------------------- /src/DTO/SamplesData/Sample/SampleLinks.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\SamplesData\Sample 10 | * @since 1.3.0 11 | */ 12 | class SampleLinks 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $schema; 18 | /** 19 | * @var null|string 20 | */ 21 | public $self; 22 | 23 | /** 24 | * SampleLinks constructor. 25 | * 26 | * @param null|string $schema 27 | * @param null|string $self 28 | */ 29 | public function __construct( 30 | ?string $schema, 31 | ?string $self 32 | ) { 33 | $this->schema = $schema; 34 | $this->self = $self; 35 | } 36 | 37 | /** 38 | * @param array $data 39 | * 40 | * @return SampleLinks 41 | */ 42 | public static function createFromResponse(array $data): self 43 | { 44 | return new self( 45 | $data['schema'], 46 | $data['self'] 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /src/DTO/SamplesData/Sample/SampleRelationships.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\DTO\SamplesData\Sample 12 | * @since 1.3.0 13 | */ 14 | class SampleRelationships 15 | { 16 | /** 17 | * @var Matches|null 18 | */ 19 | public $matches; 20 | 21 | /** 22 | * SampleRelationships constructor. 23 | * 24 | * @param Matches|null $matches 25 | */ 26 | public function __construct(?Matches $matches) 27 | { 28 | $this->matches = $matches; 29 | } 30 | 31 | /** 32 | * @param array $data 33 | * 34 | * @return SampleRelationships 35 | */ 36 | public static function createFromResponse(array $data): self 37 | { 38 | return new self( 39 | $data['matches'] 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /src/DTO/Status.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\DTO 12 | * @since 1.2.0 13 | */ 14 | class Status implements DTOInterface 15 | { 16 | /** 17 | * @var Data|null 18 | */ 19 | public $data; 20 | 21 | /** 22 | * Status constructor. 23 | * 24 | * @param Data|null $data 25 | */ 26 | public function __construct(?Data $data) 27 | { 28 | $this->data = $data; 29 | } 30 | 31 | /** 32 | * @param array $data 33 | * 34 | * @return Status 35 | */ 36 | public static function createFromResponse(array $data): self 37 | { 38 | return new self( 39 | $data['data'] 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /src/DTO/StatusData/Status/Data.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\StatusData\Status 10 | * @since 1.2.0 11 | */ 12 | class Data 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $type; 18 | /** 19 | * @var null|string 20 | */ 21 | public $id; 22 | /** 23 | * @var StatusAttributes 24 | */ 25 | public $attributes; 26 | 27 | /** 28 | * Data constructor. 29 | * 30 | * @param null|string $type 31 | * @param null|string $id 32 | * @param StatusAttributes $attributes 33 | */ 34 | public function __construct( 35 | ?string $type, 36 | ?string $id, 37 | StatusAttributes $attributes 38 | ) { 39 | $this->type = $type; 40 | $this->id = $id; 41 | $this->attributes = $attributes; 42 | } 43 | 44 | /** 45 | * @param array $data 46 | * 47 | * @return Data 48 | */ 49 | public static function createFromResponse(array $data): self 50 | { 51 | return new self( 52 | $data['type'], 53 | $data['id'], 54 | $data['attributes'] 55 | ); 56 | } 57 | } -------------------------------------------------------------------------------- /src/DTO/StatusData/Status/StatusAttributes.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\StatusData\Status 10 | * @since 1.2.0 11 | */ 12 | class StatusAttributes 13 | { 14 | /** 15 | * @var \DateTimeImmutable|null 16 | */ 17 | public $releasedAt; 18 | /** 19 | * @var null|string 20 | */ 21 | public $version; 22 | 23 | /** 24 | * StatusAttributes constructor. 25 | * 26 | * @param \DateTimeImmutable|null $releasedAt 27 | * @param null|string $version 28 | */ 29 | public function __construct( 30 | ?\DateTimeImmutable $releasedAt, 31 | ?string $version 32 | ) { 33 | $this->releasedAt = $releasedAt; 34 | $this->version = $version; 35 | } 36 | 37 | /** 38 | * @param array $data 39 | * 40 | * @return StatusAttributes 41 | */ 42 | public static function createFromResponse(array $data): self 43 | { 44 | return new self( 45 | new \DateTimeImmutable($data['releasedAt']), 46 | $data['version'] 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /src/DTO/Telemetry.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO 10 | * @since 1.3.0 11 | */ 12 | class Telemetry implements DTOInterface 13 | { 14 | /** 15 | * @var array|null 16 | */ 17 | public $events; 18 | 19 | /** 20 | * Telemetry constructor. 21 | * 22 | * @param array|null $events 23 | */ 24 | public function __construct(?array $events) 25 | { 26 | $this->events = $events; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Telemetry 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['events'] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogArmorDestroy.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.5.0 15 | */ 16 | class LogArmorDestroy 17 | { 18 | /** 19 | * @var int|null 20 | */ 21 | public $attackId; 22 | /** 23 | * @var Character|null 24 | */ 25 | public $attacker; 26 | /** 27 | * @var Character|null 28 | */ 29 | public $victim; 30 | /** 31 | * @var null|string 32 | */ 33 | public $damageTypeCategory; 34 | /** 35 | * @var null|string 36 | */ 37 | public $damageReason; 38 | /** 39 | * @var null|string 40 | */ 41 | public $damageCauserName; 42 | /** 43 | * @var Item|null 44 | */ 45 | public $item; 46 | /** 47 | * @var float|null 48 | */ 49 | public $distance; 50 | /** 51 | * @var Common|null 52 | */ 53 | public $common; 54 | /** 55 | * @var \DateTimeImmutable|null 56 | */ 57 | public $date; 58 | /** 59 | * @var null|string 60 | */ 61 | public $type; 62 | 63 | /** 64 | * LogArmorDestroy constructor. 65 | * 66 | * @param int|null $attackId 67 | * @param Character|null $attacker 68 | * @param Character|null $victim 69 | * @param null|string $damageTypeCategory 70 | * @param null|string $damageReason 71 | * @param null|string $damageCauserName 72 | * @param Item|null $item 73 | * @param float|null $distance 74 | * @param Common|null $common 75 | * @param \DateTimeImmutable|null $date 76 | * @param null|string $type 77 | */ 78 | public function __construct( 79 | ?int $attackId, 80 | ?Character $attacker, 81 | ?Character $victim, 82 | ?string $damageTypeCategory, 83 | ?string $damageReason, 84 | ?string $damageCauserName, 85 | ?Item $item, 86 | ?float $distance, 87 | ?Common $common, 88 | ?\DateTimeImmutable $date, 89 | ?string $type 90 | ) { 91 | $this->attackId = $attackId; 92 | $this->attacker = $attacker; 93 | $this->victim = $victim; 94 | $this->damageTypeCategory = $damageTypeCategory; 95 | $this->damageReason = $damageReason; 96 | $this->damageCauserName = $damageCauserName; 97 | $this->item = $item; 98 | $this->distance = $distance; 99 | $this->common = $common; 100 | $this->date = $date; 101 | $this->type = $type; 102 | } 103 | 104 | /** 105 | * @param array|null $data 106 | * 107 | * @return LogArmorDestroy 108 | */ 109 | public static function createFromResponse(?array $data): self 110 | { 111 | return new self( 112 | $data['attackId'], 113 | Character::createFromResponse($data['attacker']), 114 | Character::createFromResponse($data['victim']), 115 | $data['damageTypeCategory'], 116 | $data['damageReason'], 117 | $data['damageCauserName'], 118 | Item::createFromResponse($data['item']), 119 | $data['distance'], 120 | Common::createFromResponse($data['common']), 121 | new \DateTimeImmutable($data['_D']), 122 | $data['_T'] 123 | ); 124 | } 125 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogCarePackageLand.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.3.0 14 | */ 15 | class LogCarePackageLand 16 | { 17 | /** 18 | * @var ItemPackage|null 19 | */ 20 | public $itemPackage; 21 | /** 22 | * @var Common|null 23 | */ 24 | public $common; 25 | /** 26 | * @var \DateTimeImmutable|null 27 | */ 28 | public $date; 29 | /** 30 | * @var null|string 31 | */ 32 | public $type; 33 | 34 | /** 35 | * LogCarePackageLand constructor. 36 | * 37 | * @param ItemPackage|null $itemPackage 38 | * @param Common|null $common 39 | * @param \DateTimeImmutable|null $date 40 | * @param null|string $type 41 | */ 42 | public function __construct( 43 | ?ItemPackage $itemPackage, 44 | ?Common $common, 45 | ?\DateTimeImmutable $date, 46 | ?string $type 47 | ) { 48 | $this->itemPackage = $itemPackage; 49 | $this->common = $common; 50 | $this->date = $date; 51 | $this->type = $type; 52 | } 53 | 54 | /** 55 | * @param array $data 56 | * 57 | * @return LogCarePackageLand 58 | */ 59 | public static function createFromResponse(array $data): self 60 | { 61 | return new self( 62 | ItemPackage::createFromResponse($data['itemPackage']), 63 | Common::createFromResponse($data['common']), 64 | new \DateTimeImmutable($data['_D']), 65 | $data['_T'] 66 | ); 67 | } 68 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogCarePackageSpawn.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.3.0 14 | */ 15 | class LogCarePackageSpawn 16 | { 17 | /** 18 | * @var ItemPackage|null 19 | */ 20 | public $itemPackage; 21 | /** 22 | * @var Common|null 23 | */ 24 | public $common; 25 | /** 26 | * @var \DateTimeImmutable|null 27 | */ 28 | public $date; 29 | /** 30 | * @var null|string 31 | */ 32 | public $type; 33 | 34 | /** 35 | * LogCarePackageSpawn constructor. 36 | * 37 | * @param ItemPackage|null $itemPackage 38 | * @param Common|null $common 39 | * @param \DateTimeImmutable|null $date 40 | * @param null|string $type 41 | */ 42 | public function __construct( 43 | ?ItemPackage $itemPackage, 44 | ?Common $common, 45 | ?\DateTimeImmutable $date, 46 | ?string $type 47 | ) { 48 | $this->itemPackage = $itemPackage; 49 | $this->common = $common; 50 | $this->date = $date; 51 | $this->type = $type; 52 | } 53 | 54 | /** 55 | * @param array $data 56 | * 57 | * @return LogCarePackageSpawn 58 | */ 59 | public static function createFromResponse(array $data): self 60 | { 61 | return new self( 62 | ItemPackage::createFromResponse($data['itemPackage']), 63 | Common::createFromResponse($data['common']), 64 | new \DateTimeImmutable($data['_D']), 65 | $data['_T'] 66 | ); 67 | } 68 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogGameStatePeriodic.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.3.0 14 | */ 15 | class LogGameStatePeriodic 16 | { 17 | /** 18 | * @var GameState|null 19 | */ 20 | public $gameState; 21 | /** 22 | * @var Common|null 23 | */ 24 | public $common; 25 | /** 26 | * @var \DateTimeImmutable|null 27 | */ 28 | public $date; 29 | /** 30 | * @var null|string 31 | */ 32 | public $type; 33 | 34 | /** 35 | * LogGameStatePeriodic constructor. 36 | * 37 | * @param GameState|null $gameState 38 | * @param Common|null $common 39 | * @param \DateTimeImmutable|null $date 40 | * @param null|string $type 41 | */ 42 | public function __construct( 43 | ?GameState $gameState, 44 | ?Common $common, 45 | ?\DateTimeImmutable $date, 46 | ?string $type 47 | ) { 48 | $this->gameState = $gameState; 49 | $this->common = $common; 50 | $this->date = $date; 51 | $this->type = $type; 52 | } 53 | 54 | /** 55 | * @param array $data 56 | * 57 | * @return LogGameStatePeriodic 58 | */ 59 | public static function createFromResponse(array $data): self 60 | { 61 | return new self( 62 | GameState::createFromResponse($data['gameState']), 63 | Common::createFromResponse($data['common']), 64 | new \DateTimeImmutable($data['_D']), 65 | $data['_T'] 66 | ); 67 | } 68 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogItemAttach.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogItemAttach 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Item|null 24 | */ 25 | public $parentItem; 26 | /** 27 | * @var Item|null 28 | */ 29 | public $childItem; 30 | /** 31 | * @var Common|null 32 | */ 33 | public $common; 34 | /** 35 | * @var \DateTimeImmutable|null 36 | */ 37 | public $date; 38 | /** 39 | * @var null|string 40 | */ 41 | public $type; 42 | 43 | /** 44 | * LogItemAttach constructor. 45 | * 46 | * @param Character|null $character 47 | * @param Item|null $parentItem 48 | * @param Item|null $childItem 49 | * @param Common|null $common 50 | * @param \DateTimeImmutable|null $date 51 | * @param null|string $type 52 | */ 53 | public function __construct( 54 | ?Character $character, 55 | ?Item $parentItem, 56 | ?Item $childItem, 57 | ?Common $common, 58 | ?\DateTimeImmutable $date, 59 | ?string $type 60 | ) { 61 | $this->character = $character; 62 | $this->parentItem = $parentItem; 63 | $this->childItem = $childItem; 64 | $this->common = $common; 65 | $this->date = $date; 66 | $this->type = $type; 67 | } 68 | 69 | /** 70 | * @param array $data 71 | * 72 | * @return LogItemAttach 73 | */ 74 | public static function createFromResponse(array $data): self 75 | { 76 | return new self( 77 | Character::createFromResponse($data['character']), 78 | Item::createFromResponse($data['parentItem']), 79 | Item::createFromResponse($data['childItem']), 80 | Common::createFromResponse($data['common']), 81 | new \DateTimeImmutable($data['_D']), 82 | $data['_T'] 83 | ); 84 | } 85 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogItemDetach.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogItemDetach 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Item|null 24 | */ 25 | public $parentItem; 26 | /** 27 | * @var Item|null 28 | */ 29 | public $childItem; 30 | /** 31 | * @var Common|null 32 | */ 33 | public $common; 34 | /** 35 | * @var \DateTimeImmutable|null 36 | */ 37 | public $date; 38 | /** 39 | * @var null|string 40 | */ 41 | public $type; 42 | 43 | /** 44 | * LogItemDetach constructor. 45 | * 46 | * @param Character|null $character 47 | * @param Item|null $parentItem 48 | * @param Item|null $childItem 49 | * @param Common|null $common 50 | * @param \DateTimeImmutable|null $date 51 | * @param null|string $type 52 | */ 53 | public function __construct( 54 | ?Character $character, 55 | ?Item $parentItem, 56 | ?Item $childItem, 57 | ?Common $common, 58 | ?\DateTimeImmutable $date, 59 | ?string $type 60 | ) { 61 | $this->character = $character; 62 | $this->parentItem = $parentItem; 63 | $this->childItem = $childItem; 64 | $this->common = $common; 65 | $this->date = $date; 66 | $this->type = $type; 67 | } 68 | 69 | /** 70 | * @param array $data 71 | * 72 | * @return LogItemDetach 73 | */ 74 | public static function createFromResponse(array $data): self 75 | { 76 | return new self( 77 | Character::createFromResponse($data['character']), 78 | Item::createFromResponse($data['parentItem']), 79 | Item::createFromResponse($data['childItem']), 80 | Common::createFromResponse($data['common']), 81 | new \DateTimeImmutable($data['_D']), 82 | $data['_T'] 83 | ); 84 | } 85 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogItemDrop.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogItemDrop 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Item|null 24 | */ 25 | public $item; 26 | /** 27 | * @var Common|null 28 | */ 29 | public $common; 30 | /** 31 | * @var \DateTimeImmutable|null 32 | */ 33 | public $date; 34 | /** 35 | * @var null|string 36 | */ 37 | public $type; 38 | 39 | /** 40 | * LogItemDrop constructor. 41 | * 42 | * @param Character|null $character 43 | * @param Item|null $item 44 | * @param Common|null $common 45 | * @param \DateTimeImmutable|null $date 46 | * @param null|string $type 47 | */ 48 | public function __construct( 49 | ?Character $character, 50 | ?Item $item, 51 | ?Common $common, 52 | ?\DateTimeImmutable $date, 53 | ?string $type 54 | ) { 55 | $this->character = $character; 56 | $this->item = $item; 57 | $this->common = $common; 58 | $this->date = $date; 59 | $this->type = $type; 60 | } 61 | 62 | /** 63 | * @param array $data 64 | * 65 | * @return LogItemDrop 66 | */ 67 | public static function createFromResponse(array $data): self 68 | { 69 | return new self( 70 | Character::createFromResponse($data['character']), 71 | Item::createFromResponse($data['item']), 72 | Common::createFromResponse($data['common']), 73 | new \DateTimeImmutable($data['_D']), 74 | $data['_T'] 75 | ); 76 | } 77 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogItemEquip.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogItemEquip 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Item|null 24 | */ 25 | public $item; 26 | /** 27 | * @var Common|null 28 | */ 29 | public $common; 30 | /** 31 | * @var \DateTimeImmutable|null 32 | */ 33 | public $date; 34 | /** 35 | * @var null|string 36 | */ 37 | public $type; 38 | 39 | /** 40 | * LogItemEquip constructor. 41 | * 42 | * @param Character|null $character 43 | * @param Item|null $item 44 | * @param Common|null $common 45 | * @param \DateTimeImmutable|null $date 46 | * @param null|string $type 47 | */ 48 | public function __construct( 49 | ?Character $character, 50 | ?Item $item, 51 | ?Common $common, 52 | ?\DateTimeImmutable $date, 53 | ?string $type 54 | ) { 55 | $this->character = $character; 56 | $this->item = $item; 57 | $this->common = $common; 58 | $this->date = $date; 59 | $this->type = $type; 60 | } 61 | 62 | /** 63 | * @param array $data 64 | * 65 | * @return LogItemEquip 66 | */ 67 | public static function createFromResponse(array $data): self 68 | { 69 | return new self( 70 | Character::createFromResponse($data['character']), 71 | Item::createFromResponse($data['item']), 72 | Common::createFromResponse($data['common']), 73 | new \DateTimeImmutable($data['_D']), 74 | $data['_T'] 75 | ); 76 | } 77 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogItemPickup.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogItemPickup 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Item|null 24 | */ 25 | public $item; 26 | /** 27 | * @var Common|null 28 | */ 29 | public $common; 30 | /** 31 | * @var \DateTimeImmutable|null 32 | */ 33 | public $date; 34 | /** 35 | * @var null|string 36 | */ 37 | public $type; 38 | 39 | /** 40 | * LogItemPickup constructor. 41 | * 42 | * @param Character|null $character 43 | * @param Item|null $item 44 | * @param Common|null $common 45 | * @param \DateTimeImmutable|null $date 46 | * @param null|string $type 47 | */ 48 | public function __construct( 49 | ?Character $character, 50 | ?Item $item, 51 | ?Common $common, 52 | ?\DateTimeImmutable $date, 53 | ?string $type 54 | ) { 55 | $this->character = $character; 56 | $this->item = $item; 57 | $this->common = $common; 58 | $this->date = $date; 59 | $this->type = $type; 60 | } 61 | 62 | /** 63 | * @param array $data 64 | * 65 | * @return LogItemPickup 66 | */ 67 | public static function createFromResponse(array $data): self 68 | { 69 | return new self( 70 | Character::createFromResponse($data['character']), 71 | Item::createFromResponse($data['item']), 72 | Common::createFromResponse($data['common']), 73 | new \DateTimeImmutable($data['_D']), 74 | $data['_T'] 75 | ); 76 | } 77 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogItemUnequip.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogItemUnequip 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Item|null 24 | */ 25 | public $item; 26 | /** 27 | * @var Common|null 28 | */ 29 | public $common; 30 | /** 31 | * @var \DateTimeImmutable|null 32 | */ 33 | public $date; 34 | /** 35 | * @var null|string 36 | */ 37 | public $type; 38 | 39 | /** 40 | * LogItemUnequip constructor. 41 | * 42 | * @param Character|null $character 43 | * @param Item|null $item 44 | * @param Common|null $common 45 | * @param \DateTimeImmutable|null $date 46 | * @param null|string $type 47 | */ 48 | public function __construct( 49 | ?Character $character, 50 | ?Item $item, 51 | ?Common $common, 52 | ?\DateTimeImmutable $date, 53 | ?string $type 54 | ) { 55 | $this->character = $character; 56 | $this->item = $item; 57 | $this->common = $common; 58 | $this->date = $date; 59 | $this->type = $type; 60 | } 61 | 62 | /** 63 | * @param array $data 64 | * 65 | * @return LogItemUnequip 66 | */ 67 | public static function createFromResponse(array $data): self 68 | { 69 | return new self( 70 | Character::createFromResponse($data['character']), 71 | Item::createFromResponse($data['item']), 72 | Common::createFromResponse($data['common']), 73 | new \DateTimeImmutable($data['_D']), 74 | $data['_T'] 75 | ); 76 | } 77 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogItemUse.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogItemUse 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Item|null 24 | */ 25 | public $item; 26 | /** 27 | * @var Common|null 28 | */ 29 | public $common; 30 | /** 31 | * @var \DateTimeImmutable|null 32 | */ 33 | public $date; 34 | /** 35 | * @var null|string 36 | */ 37 | public $type; 38 | 39 | /** 40 | * LogItemUse constructor. 41 | * 42 | * @param Character|null $character 43 | * @param Item|null $item 44 | * @param Common|null $common 45 | * @param \DateTimeImmutable|null $date 46 | * @param null|string $type 47 | */ 48 | public function __construct( 49 | ?Character $character, 50 | ?Item $item, 51 | ?Common $common, 52 | ?\DateTimeImmutable $date, 53 | ?string $type 54 | ) { 55 | $this->character = $character; 56 | $this->item = $item; 57 | $this->common = $common; 58 | $this->date = $date; 59 | $this->type = $type; 60 | } 61 | 62 | /** 63 | * @param array $data 64 | * 65 | * @return LogItemUse 66 | */ 67 | public static function createFromResponse(array $data): self 68 | { 69 | return new self( 70 | Character::createFromResponse($data['character']), 71 | Item::createFromResponse($data['item']), 72 | Common::createFromResponse($data['common']), 73 | new \DateTimeImmutable($data['_D']), 74 | $data['_T'] 75 | ); 76 | } 77 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogMatchDefinition.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 10 | * @since 1.3.0 11 | */ 12 | class LogMatchDefinition 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $matchId; 18 | /** 19 | * @var null|string 20 | */ 21 | public $pingQuality; 22 | /** 23 | * @var \DateTimeImmutable|null 24 | */ 25 | public $date; 26 | /** 27 | * @var null|string 28 | */ 29 | public $type; 30 | /** 31 | * @var null|string 32 | */ 33 | public $seasonState; 34 | 35 | /** 36 | * LogMatchDefinition constructor. 37 | * 38 | * @param null|string $matchId 39 | * @param null|string $pingQuality 40 | * @param \DateTimeImmutable|null $date 41 | * @param null|string $type 42 | * @param null|string $seasonState 43 | */ 44 | public function __construct( 45 | ?string $matchId, 46 | ?string $pingQuality, 47 | ?\DateTimeImmutable $date, 48 | ?string $type, 49 | ?string $seasonState 50 | ) { 51 | $this->matchId = $matchId; 52 | $this->pingQuality = $pingQuality; 53 | $this->date = $date; 54 | $this->type = $type; 55 | $this->seasonState = $seasonState; 56 | } 57 | 58 | /** 59 | * @param array $data 60 | * 61 | * @return LogMatchDefinition 62 | */ 63 | public static function createFromResponse(array $data): self 64 | { 65 | return new self( 66 | $data['MatchId'], 67 | $data['PingQuality'], 68 | new \DateTimeImmutable($data['_D']), 69 | $data['_T'], 70 | $data['SeasonState'] 71 | ); 72 | } 73 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogMatchEnd.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.3.0 14 | */ 15 | class LogMatchEnd 16 | { 17 | /** 18 | * @var array|null 19 | */ 20 | public $characters; 21 | /** 22 | * @var Common|null 23 | */ 24 | public $common; 25 | /** 26 | * @var \DateTimeImmutable|null 27 | */ 28 | public $date; 29 | /** 30 | * @var null|string 31 | */ 32 | public $type; 33 | 34 | /** 35 | * LogMatchEnd constructor. 36 | * 37 | * @param array|null $characters 38 | * @param Common|null $common 39 | * @param \DateTimeImmutable|null $date 40 | * @param null|string $type 41 | */ 42 | public function __construct( 43 | ?array $characters, 44 | ?Common $common, 45 | ?\DateTimeImmutable $date, 46 | ?string $type 47 | ) { 48 | $this->characters = $characters; 49 | $this->common = $common; 50 | $this->date = $date; 51 | $this->type = $type; 52 | } 53 | 54 | /** 55 | * @param array $data 56 | * 57 | * @return LogMatchEnd 58 | */ 59 | public static function createFromResponse(array $data): self 60 | { 61 | $characters = []; 62 | 63 | foreach ($data['characters'] as $item) { 64 | $characters[] = Character::createFromResponse($item); 65 | } 66 | 67 | return new self( 68 | $characters, 69 | Common::createFromResponse($data['common']), 70 | new \DateTimeImmutable($data['_D']), 71 | $data['_T'] 72 | ); 73 | } 74 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogMatchStart.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogMatchStart 17 | { 18 | /** 19 | * @var null|string 20 | */ 21 | public $mapName; 22 | /** 23 | * @var null|string 24 | */ 25 | public $weatherId; 26 | /** 27 | * @var array|null 28 | */ 29 | public $characters; 30 | /** 31 | * @var null|string 32 | */ 33 | public $cameraViewBehaviour; 34 | /** 35 | * @var int|null 36 | */ 37 | public $teamSize; 38 | /** 39 | * @var bool|null 40 | */ 41 | public $isCustomGame; 42 | /** 43 | * @var bool|null 44 | */ 45 | public $isEventMode; 46 | /** 47 | * @var array|[] 48 | */ 49 | public $blueZoneCustomOptions; 50 | /** 51 | * @var Common|null 52 | */ 53 | public $common; 54 | /** 55 | * @var \DateTimeImmutable|null 56 | */ 57 | public $date; 58 | /** 59 | * @var null|string 60 | */ 61 | public $type; 62 | 63 | /** 64 | * LogMatchStart constructor. 65 | * 66 | * @param null|string $mapName 67 | * @param null|string $weatherId 68 | * @param array|null $characters 69 | * @param null|string $cameraViewBehaviour 70 | * @param int|null $teamSize 71 | * @param bool|null $isCustomGame 72 | * @param bool|null $isEventMode 73 | * @param array|[] $blueZoneCustomOptions 74 | * @param Common|null $common 75 | * @param \DateTimeImmutable|null $date 76 | * @param null|string $type 77 | */ 78 | public function __construct( 79 | ?string $mapName, 80 | ?string $weatherId, 81 | ?array $characters, 82 | ?string $cameraViewBehaviour, 83 | ?int $teamSize, 84 | ?bool $isCustomGame, 85 | ?bool $isEventMode, 86 | ?array $blueZoneCustomOptions, 87 | ?Common $common, 88 | ?\DateTimeImmutable $date, 89 | ?string $type 90 | ) { 91 | $this->mapName = $mapName; 92 | $this->weatherId = $weatherId; 93 | $this->characters = $characters; 94 | $this->cameraViewBehaviour = $cameraViewBehaviour; 95 | $this->teamSize = $teamSize; 96 | $this->isCustomGame = $isCustomGame; 97 | $this->isEventMode = $isEventMode; 98 | $this->blueZoneCustomOptions = $blueZoneCustomOptions; 99 | $this->common = $common; 100 | $this->date = $date; 101 | $this->type = $type; 102 | } 103 | 104 | /** 105 | * @param array $data 106 | * 107 | * @return LogMatchStart 108 | */ 109 | public static function createFromResponse(array $data): self 110 | { 111 | $characters = []; 112 | 113 | foreach ($data['characters'] as $item) { 114 | $characters[] = Character::createFromResponse($item); 115 | } 116 | 117 | $blueZoneCustomOptions = []; 118 | 119 | $options = \json_decode($data['blueZoneCustomOptions'], true); 120 | 121 | foreach ($options as $option) { 122 | $blueZoneCustomOptions[] = BlueZoneCustomOption::createFromResponse($option); 123 | } 124 | 125 | return new self( 126 | $data['mapName'], 127 | $data['weatherId'], 128 | $characters, 129 | $data['cameraViewBehaviour'], 130 | $data['teamSize'], 131 | $data['isCustomGame'] ?? null, 132 | $data['isEventMode'] ?? null, 133 | $blueZoneCustomOptions, 134 | Common::createFromResponse($data['common']), 135 | new \DateTimeImmutable($data['_D']), 136 | $data['_T'] 137 | ); 138 | } 139 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerAttack.php: -------------------------------------------------------------------------------- 1 | 14 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 15 | * @since 1.3.0 16 | */ 17 | class LogPlayerAttack 18 | { 19 | /** 20 | * @var int|null 21 | */ 22 | public $attackId; 23 | /** 24 | * @var Character|null 25 | */ 26 | public $attacker; 27 | /** 28 | * @var null|string 29 | */ 30 | public $attackType; 31 | /** 32 | * @var Item|null 33 | */ 34 | public $weapon; 35 | /** 36 | * @var Vehicle|null 37 | */ 38 | public $vehicle; 39 | /** 40 | * @var Common|null 41 | */ 42 | public $common; 43 | /** 44 | * @var \DateTimeImmutable|null 45 | */ 46 | public $date; 47 | /** 48 | * @var null|string 49 | */ 50 | public $type; 51 | 52 | /** 53 | * LogPlayerAttack constructor. 54 | * 55 | * @param int|null $attackId 56 | * @param Character|null $attacker 57 | * @param null|string $attackType 58 | * @param Item|null $weapon 59 | * @param Vehicle|null $vehicle 60 | * @param Common|null $common 61 | * @param \DateTimeImmutable|null $date 62 | * @param null|string $type 63 | */ 64 | public function __construct( 65 | ?int $attackId, 66 | ?Character $attacker, 67 | ?string $attackType, 68 | ?Item $weapon, 69 | ?Vehicle $vehicle, 70 | ?Common $common, 71 | ?\DateTimeImmutable $date, 72 | ?string $type 73 | ) { 74 | $this->attackId = $attackId; 75 | $this->attacker = $attacker; 76 | $this->attackType = $attackType; 77 | $this->weapon = $weapon; 78 | $this->vehicle = $vehicle; 79 | $this->common = $common; 80 | $this->date = $date; 81 | $this->type = $type; 82 | } 83 | 84 | /** 85 | * @param array $data 86 | * 87 | * @return LogPlayerAttack 88 | */ 89 | public static function createFromResponse(array $data): self 90 | { 91 | return new self( 92 | $data['attackId'], 93 | Character::createFromResponse($data['attacker']), 94 | $data['attackType'], 95 | Item::createFromResponse($data['weapon']), 96 | Vehicle::createFromResponse($data['vehicle']), 97 | Common::createFromResponse($data['common']), 98 | new \DateTimeImmutable($data['_D']), 99 | $data['_T'] 100 | ); 101 | } 102 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerCreate.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.3.0 14 | */ 15 | class LogPlayerCreate 16 | { 17 | /** 18 | * @var Character|null 19 | */ 20 | public $character; 21 | /** 22 | * @var Common|null 23 | */ 24 | public $common; 25 | /** 26 | * @var \DateTimeImmutable|null 27 | */ 28 | public $date; 29 | /** 30 | * @var null|string 31 | */ 32 | public $type; 33 | 34 | /** 35 | * LogPlayerCreate constructor. 36 | * 37 | * @param Character|null $character 38 | * @param Common|null $common 39 | * @param \DateTimeImmutable|null $date 40 | * @param null|string $type 41 | */ 42 | public function __construct( 43 | ?Character $character, 44 | ?Common $common, 45 | ?\DateTimeImmutable $date, 46 | ?string $type 47 | ) { 48 | $this->character = $character; 49 | $this->common = $common; 50 | $this->date = $date; 51 | $this->type = $type; 52 | } 53 | 54 | /** 55 | * @param array $data 56 | * 57 | * @return LogPlayerCreate 58 | */ 59 | public static function createFromResponse(array $data): self 60 | { 61 | return new self( 62 | Character::createFromResponse($data['character']), 63 | Common::createFromResponse($data['common']), 64 | new \DateTimeImmutable($data['_D']), 65 | $data['_T'] 66 | ); 67 | } 68 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerKill.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.3.0 14 | */ 15 | class LogPlayerKill 16 | { 17 | /** 18 | * @var int|null 19 | */ 20 | public $attackId; 21 | /** 22 | * @var Character|null 23 | */ 24 | public $killer; 25 | /** 26 | * @var Character|null 27 | */ 28 | public $victim; 29 | /** 30 | * @var null|string 31 | */ 32 | public $damageTypeCategory; 33 | /** 34 | * @var null|string 35 | */ 36 | public $damageCauserName; 37 | /** 38 | * @var null|string 39 | */ 40 | public $damageReason; 41 | /** 42 | * @var float|null 43 | */ 44 | public $distance; 45 | /** 46 | * @var Common|null 47 | */ 48 | public $common; 49 | /** 50 | * @var \DateTimeImmutable|null 51 | */ 52 | public $date; 53 | /** 54 | * @var null|string 55 | */ 56 | public $type; 57 | 58 | /** 59 | * LogPlayerKill constructor. 60 | * 61 | * @param int|null $attackId 62 | * @param Character|null $killer 63 | * @param Character|null $victim 64 | * @param null|string $damageTypeCategory 65 | * @param null|string $damageCauserName 66 | * @param null|string $damageReason 67 | * @param float|null $distance 68 | * @param Common|null $common 69 | * @param \DateTimeImmutable|null $date 70 | * @param null|string $type 71 | */ 72 | public function __construct( 73 | ?int $attackId, 74 | ?Character $killer, 75 | ?Character $victim, 76 | ?string $damageTypeCategory, 77 | ?string $damageCauserName, 78 | ?string $damageReason, 79 | ?float $distance, 80 | ?Common $common, 81 | ?\DateTimeImmutable $date, 82 | ?string $type 83 | ) { 84 | $this->attackId = $attackId; 85 | $this->killer = $killer; 86 | $this->victim = $victim; 87 | $this->damageTypeCategory = $damageTypeCategory; 88 | $this->damageCauserName = $damageCauserName; 89 | $this->damageReason = $damageReason; 90 | $this->distance = $distance; 91 | $this->common = $common; 92 | $this->date = $date; 93 | $this->type = $type; 94 | } 95 | 96 | /** 97 | * @param array $data 98 | * 99 | * @return LogPlayerKill 100 | */ 101 | public static function createFromResponse(array $data): self 102 | { 103 | return new self( 104 | $data['attackId'], 105 | Character::createFromResponse($data['killer']), 106 | Character::createFromResponse($data['victim']), 107 | $data['damageTypeCategory'], 108 | $data['damageCauserName'], 109 | $data['damageReason'] ?? null, 110 | $data['distance'], 111 | Common::createFromResponse($data['common']), 112 | new \DateTimeImmutable($data['_D']), 113 | $data['_T'] 114 | ); 115 | } 116 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerLogin.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 12 | * @since 1.3.0 13 | */ 14 | class LogPlayerLogin 15 | { 16 | /** 17 | * @var null|string 18 | */ 19 | public $accountId; 20 | /** 21 | * @var Common|null 22 | */ 23 | public $common; 24 | /** 25 | * @var \DateTimeImmutable|null 26 | */ 27 | public $date; 28 | /** 29 | * @var null|string 30 | */ 31 | public $type; 32 | 33 | /** 34 | * LogPlayerLogin constructor. 35 | * 36 | * @param null|string $accountId 37 | * @param Common|null $common 38 | * @param \DateTimeImmutable|null $date 39 | * @param null|string $type 40 | */ 41 | public function __construct( 42 | ?string $accountId, 43 | ?Common $common, 44 | ?\DateTimeImmutable $date, 45 | ?string $type 46 | ) { 47 | $this->accountId = $accountId; 48 | $this->common = $common; 49 | $this->date = $date; 50 | $this->type = $type; 51 | } 52 | 53 | /** 54 | * @param array $data 55 | * 56 | * @return LogPlayerLogin 57 | */ 58 | public static function createFromResponse(array $data): self 59 | { 60 | return new self( 61 | $data['accountId'], 62 | Common::createFromResponse($data['common']), 63 | new \DateTimeImmutable($data['_D']), 64 | $data['_T'] 65 | ); 66 | } 67 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerLogout.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 12 | * @since 1.3.0 13 | */ 14 | class LogPlayerLogout 15 | { 16 | /** 17 | * @var null|string 18 | */ 19 | public $accountId; 20 | /** 21 | * @var Common|null 22 | */ 23 | public $common; 24 | /** 25 | * @var \DateTimeImmutable|null 26 | */ 27 | public $date; 28 | /** 29 | * @var null|string 30 | */ 31 | public $type; 32 | 33 | /** 34 | * LogPlayerLogout constructor. 35 | * 36 | * @param null|string $accountId 37 | * @param Common|null $common 38 | * @param \DateTimeImmutable|null $date 39 | * @param null|string $type 40 | */ 41 | public function __construct( 42 | ?string $accountId, 43 | ?Common $common, 44 | ?\DateTimeImmutable $date, 45 | ?string $type 46 | ) { 47 | $this->accountId = $accountId; 48 | $this->common = $common; 49 | $this->date = $date; 50 | $this->type = $type; 51 | } 52 | 53 | /** 54 | * @param array $data 55 | * 56 | * @return LogPlayerLogout 57 | */ 58 | public static function createFromResponse(array $data): self 59 | { 60 | return new self( 61 | $data['accountId'], 62 | Common::createFromResponse($data['common']), 63 | new \DateTimeImmutable($data['_D']), 64 | $data['_T'] 65 | ); 66 | } 67 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerMakeGroggy.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.5.0 14 | */ 15 | class LogPlayerMakeGroggy 16 | { 17 | /** 18 | * @var int|null 19 | */ 20 | public $attackId; 21 | /** 22 | * @var Character|null 23 | */ 24 | public $attacker; 25 | /** 26 | * @var Character|null 27 | */ 28 | public $victim; 29 | /** 30 | * @var null|string 31 | */ 32 | public $damageTypeCategory; 33 | /** 34 | * @var null|string 35 | */ 36 | public $damageCauserName; 37 | /** 38 | * @var float|null 39 | */ 40 | public $distance; 41 | /** 42 | * @var bool|null 43 | */ 44 | public $isAttackerInVehicle; 45 | /** 46 | * @var int|null 47 | */ 48 | public $dBNOId; 49 | /** 50 | * @var Common|null 51 | */ 52 | public $common; 53 | /** 54 | * @var \DateTimeImmutable|null 55 | */ 56 | public $date; 57 | /** 58 | * @var null|string 59 | */ 60 | public $type; 61 | 62 | /** 63 | * LogPlayerMakeGroggy constructor. 64 | * 65 | * @param int|null $attackId 66 | * @param Character|null $attacker 67 | * @param Character|null $victim 68 | * @param null|string $damageTypeCategory 69 | * @param null|string $damageCauserName 70 | * @param float|null $distance 71 | * @param bool|null $isAttackerInVehicle 72 | * @param int|null $dBNOId 73 | * @param Common|null $common 74 | * @param \DateTimeImmutable|null $date 75 | * @param null|string $type 76 | */ 77 | public function __construct( 78 | ?int $attackId, 79 | ?Character $attacker, 80 | ?Character $victim, 81 | ?string $damageTypeCategory, 82 | ?string $damageCauserName, 83 | ?float $distance, 84 | ?bool $isAttackerInVehicle, 85 | ?int $dBNOId, 86 | ?Common $common, 87 | ?\DateTimeImmutable $date, 88 | ?string $type 89 | ) { 90 | $this->attackId = $attackId; 91 | $this->attacker = $attacker; 92 | $this->victim = $victim; 93 | $this->damageTypeCategory = $damageTypeCategory; 94 | $this->damageCauserName = $damageCauserName; 95 | $this->distance = $distance; 96 | $this->isAttackerInVehicle = $isAttackerInVehicle; 97 | $this->dBNOId = $dBNOId; 98 | $this->common = $common; 99 | $this->date = $date; 100 | $this->type = $type; 101 | } 102 | 103 | /** 104 | * @param array|null $data 105 | * 106 | * @return LogPlayerMakeGroggy 107 | */ 108 | public static function createFromResponse(?array $data): self 109 | { 110 | return new self( 111 | $data['attackId'], 112 | Character::createFromResponse($data['attacker']), 113 | Character::createFromResponse($data['victim']), 114 | $data['damageTypeCategory'], 115 | $data['damageCauserName'], 116 | $data['distance'], 117 | $data['isAttackerInVehicle'], 118 | $data['dBNOId'], 119 | Common::createFromResponse($data['common']), 120 | new \DateTimeImmutable($data['_D']), 121 | $data['_T'] 122 | ); 123 | } 124 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerPosition.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.3.0 14 | */ 15 | class LogPlayerPosition 16 | { 17 | /** 18 | * @var Character|null 19 | */ 20 | public $character; 21 | /** 22 | * @var int|null 23 | */ 24 | public $elapsedTime; 25 | /** 26 | * @var int|null 27 | */ 28 | public $numAlivePlayers; 29 | /** 30 | * @var Common|null 31 | */ 32 | public $common; 33 | /** 34 | * @var \DateTimeImmutable|null 35 | */ 36 | public $date; 37 | /** 38 | * @var null|string 39 | */ 40 | public $type; 41 | 42 | /** 43 | * LogPlayerPosition constructor. 44 | * 45 | * @param Character|null $character 46 | * @param int|null $elapsedTime 47 | * @param int|null $numAlivePlayers 48 | * @param Common|null $common 49 | * @param \DateTimeImmutable|null $date 50 | * @param null|string $type 51 | */ 52 | public function __construct( 53 | ?Character $character, 54 | ?int $elapsedTime, 55 | ?int $numAlivePlayers, 56 | ?Common $common, 57 | ?\DateTimeImmutable $date, 58 | ?string $type 59 | ) { 60 | $this->character = $character; 61 | $this->elapsedTime = $elapsedTime; 62 | $this->numAlivePlayers = $numAlivePlayers; 63 | $this->common = $common; 64 | $this->date = $date; 65 | $this->type = $type; 66 | } 67 | 68 | /** 69 | * @param array $data 70 | * 71 | * @return LogPlayerPosition 72 | */ 73 | public static function createFromResponse(array $data): self 74 | { 75 | return new self( 76 | Character::createFromResponse($data['character']), 77 | $data['elapsedTime'], 78 | $data['numAlivePlayers'], 79 | Common::createFromResponse($data['common']), 80 | new \DateTimeImmutable($data['_D']), 81 | $data['_T'] 82 | ); 83 | } 84 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerRevive.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.5.0 14 | */ 15 | class LogPlayerRevive 16 | { 17 | /** 18 | * @var Character|null 19 | */ 20 | public $reviver; 21 | /** 22 | * @var Character|null 23 | */ 24 | public $victim; 25 | /** 26 | * @var Common|null 27 | */ 28 | public $common; 29 | /** 30 | * @var \DateTimeImmutable|null 31 | */ 32 | public $date; 33 | /** 34 | * @var null|string 35 | */ 36 | public $type; 37 | 38 | /** 39 | * LogPlayerRevive constructor. 40 | * 41 | * @param Character|null $reviver 42 | * @param Character|null $victim 43 | * @param Common|null $common 44 | * @param \DateTimeImmutable|null $date 45 | * @param null|string $type 46 | */ 47 | public function __construct( 48 | ?Character $reviver, 49 | ?Character $victim, 50 | ?Common $common, 51 | ?\DateTimeImmutable $date, 52 | ?string $type 53 | ) { 54 | $this->reviver = $reviver; 55 | $this->victim = $victim; 56 | $this->common = $common; 57 | $this->date = $date; 58 | $this->type = $type; 59 | } 60 | 61 | /** 62 | * @param array|null $data 63 | * 64 | * @return LogPlayerRevive 65 | */ 66 | public static function createFromResponse(?array $data): self 67 | { 68 | return new self( 69 | Character::createFromResponse($data['reviver']), 70 | Character::createFromResponse($data['victim']), 71 | Common::createFromResponse($data['common']), 72 | new \DateTimeImmutable($data['_D']), 73 | $data['_T'] 74 | ); 75 | } 76 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogPlayerTakeDamage.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.3.0 14 | */ 15 | class LogPlayerTakeDamage 16 | { 17 | /** 18 | * @var int|null 19 | */ 20 | public $attackId; 21 | /** 22 | * @var Character|null 23 | */ 24 | public $attacker; 25 | /** 26 | * @var Character|null 27 | */ 28 | public $victim; 29 | /** 30 | * @var null|string 31 | */ 32 | public $damageTypeCategory; 33 | /** 34 | * @var null|string 35 | */ 36 | public $damageReason; 37 | /** 38 | * @var float|null 39 | */ 40 | public $damage; 41 | /** 42 | * @var null|string 43 | */ 44 | public $damageCauserName; 45 | /** 46 | * @var Common|null 47 | */ 48 | public $common; 49 | /** 50 | * @var \DateTimeImmutable|null 51 | */ 52 | public $date; 53 | /** 54 | * @var null|string 55 | */ 56 | public $type; 57 | 58 | /** 59 | * LogPlayerTakeDamage constructor. 60 | * 61 | * @param int|null $attackId 62 | * @param Character|null $attacker 63 | * @param Character|null $victim 64 | * @param null|string $damageTypeCategory 65 | * @param null|string $damageReason 66 | * @param float|null $damage 67 | * @param null|string $damageCauserName 68 | * @param Common|null $common 69 | * @param \DateTimeImmutable|null $date 70 | * @param null|string $type 71 | */ 72 | public function __construct( 73 | ?int $attackId, 74 | ?Character $attacker, 75 | ?Character $victim, 76 | ?string $damageTypeCategory, 77 | ?string $damageReason, 78 | ?float $damage, 79 | ?string $damageCauserName, 80 | ?Common $common, 81 | ?\DateTimeImmutable $date, 82 | ?string $type 83 | ) { 84 | $this->attackId = $attackId; 85 | $this->attacker = $attacker; 86 | $this->victim = $victim; 87 | $this->damageTypeCategory = $damageTypeCategory; 88 | $this->damageReason = $damageReason; 89 | $this->damage = $damage; 90 | $this->damageCauserName = $damageCauserName; 91 | $this->common = $common; 92 | $this->date = $date; 93 | $this->type = $type; 94 | } 95 | 96 | /** 97 | * @param array $data 98 | * 99 | * @return LogPlayerTakeDamage 100 | */ 101 | public static function createFromResponse(array $data): self 102 | { 103 | return new self( 104 | $data['attackId'], 105 | Character::createFromResponse($data['attacker']), 106 | Character::createFromResponse($data['victim']), 107 | $data['damageTypeCategory'], 108 | $data['damageReason'], 109 | $data['damage'], 110 | $data['damageCauserName'], 111 | Common::createFromResponse($data['common']), 112 | new \DateTimeImmutable($data['_D']), 113 | $data['_T'] 114 | ); 115 | } 116 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogSwimEnd.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.5.0 14 | */ 15 | class LogSwimEnd 16 | { 17 | /** 18 | * @var Character|null 19 | */ 20 | public $character; 21 | /** 22 | * @var float|null 23 | */ 24 | public $swimDistance; 25 | /** 26 | * @var Common|null 27 | */ 28 | public $common; 29 | /** 30 | * @var \DateTimeImmutable|null 31 | */ 32 | public $date; 33 | /** 34 | * @var null|string 35 | */ 36 | public $type; 37 | 38 | /** 39 | * LogSwimEnd constructor. 40 | * 41 | * @param Character|null $character 42 | * @param float|null $swimDistance 43 | * @param Common|null $common 44 | * @param \DateTimeImmutable|null $date 45 | * @param null|string $type 46 | */ 47 | public function __construct( 48 | ?Character $character, 49 | ?float $swimDistance, 50 | ?Common $common, 51 | ?\DateTimeImmutable $date, 52 | ?string $type 53 | ) { 54 | $this->character = $character; 55 | $this->swimDistance = $swimDistance; 56 | $this->common = $common; 57 | $this->date = $date; 58 | $this->type = $type; 59 | } 60 | 61 | /** 62 | * @param array|null $data 63 | * 64 | * @return LogSwimEnd 65 | */ 66 | public static function createFromResponse(?array $data): self 67 | { 68 | return new self( 69 | Character::createFromResponse($data['character']), 70 | $data['swimDistance'] ?? null, 71 | Common::createFromResponse($data['common']), 72 | new \DateTimeImmutable($data['_D']), 73 | $data['_T'] 74 | ); 75 | } 76 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogSwimStart.php: -------------------------------------------------------------------------------- 1 | 12 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 13 | * @since 1.5.0 14 | */ 15 | class LogSwimStart 16 | { 17 | /** 18 | * @var Character|null 19 | */ 20 | public $character; 21 | /** 22 | * @var Common|null 23 | */ 24 | public $common; 25 | /** 26 | * @var \DateTimeImmutable|null 27 | */ 28 | public $date; 29 | /** 30 | * @var null|string 31 | */ 32 | public $type; 33 | 34 | public function __construct( 35 | ?Character $character, 36 | ?Common $common, 37 | ?\DateTimeImmutable $date, 38 | ?string $type 39 | ) { 40 | $this->character = $character; 41 | $this->common = $common; 42 | $this->date = $date; 43 | $this->type = $type; 44 | } 45 | 46 | /** 47 | * @param array|null $data 48 | * 49 | * @return LogSwimStart 50 | */ 51 | public static function createFromResponse(?array $data): self 52 | { 53 | return new self( 54 | Character::createFromResponse($data['character']), 55 | Common::createFromResponse($data['common']), 56 | new \DateTimeImmutable($data['_D']), 57 | $data['_T'] 58 | ); 59 | } 60 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogVehicleDestroy.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogVehicleDestroy 17 | { 18 | /** 19 | * @var int|null 20 | */ 21 | public $attackId; 22 | /** 23 | * @var Character|null 24 | */ 25 | public $attacker; 26 | /** 27 | * @var Vehicle|null 28 | */ 29 | public $vehicle; 30 | /** 31 | * @var null|string 32 | */ 33 | public $damageTypeCategory; 34 | /** 35 | * @var null|string 36 | */ 37 | public $damageCauserName; 38 | /** 39 | * @var int|null 40 | */ 41 | public $distance; 42 | /** 43 | * @var Common|null 44 | */ 45 | public $common; 46 | /** 47 | * @var \DateTimeImmutable|null 48 | */ 49 | public $date; 50 | /** 51 | * @var null|string 52 | */ 53 | public $type; 54 | 55 | /** 56 | * LogVehicleDestroy constructor. 57 | * 58 | * @param int|null $attackId 59 | * @param Character|null $attacker 60 | * @param Vehicle|null $vehicle 61 | * @param null|string $damageTypeCategory 62 | * @param null|string $damageCauserName 63 | * @param float|null $distance 64 | * @param Common|null $common 65 | * @param \DateTimeImmutable|null $date 66 | * @param null|string $type 67 | */ 68 | public function __construct( 69 | ?int $attackId, 70 | ?Character $attacker, 71 | ?Vehicle $vehicle, 72 | ?string $damageTypeCategory, 73 | ?string $damageCauserName, 74 | ?float $distance, 75 | ?Common $common, 76 | ?\DateTimeImmutable $date, 77 | ?string $type 78 | ) { 79 | $this->attackId = $attackId; 80 | $this->attacker = $attacker; 81 | $this->vehicle = $vehicle; 82 | $this->damageTypeCategory = $damageTypeCategory; 83 | $this->damageCauserName = $damageCauserName; 84 | $this->distance = $distance; 85 | $this->common = $common; 86 | $this->date = $date; 87 | $this->type = $type; 88 | } 89 | 90 | /** 91 | * @param array $data 92 | * 93 | * @return LogVehicleDestroy 94 | */ 95 | public static function createFromResponse(array $data): self 96 | { 97 | return new self( 98 | $data['attackId'], 99 | Character::createFromResponse($data['attacker']), 100 | Vehicle::createFromResponse($data['vehicle']), 101 | $data['damageTypeCategory'], 102 | $data['damageCauserName'], 103 | $data['distance'], 104 | Common::createFromResponse($data['common']), 105 | new \DateTimeImmutable($data['_D']), 106 | $data['_T'] 107 | ); 108 | } 109 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogVehicleLeave.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogVehicleLeave 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Vehicle|null 24 | */ 25 | public $vehicle; 26 | /** 27 | * @var float|null 28 | */ 29 | public $rideDistance; 30 | /** 31 | * @var int|null 32 | */ 33 | public $seatIndex; 34 | /** 35 | * @var Common|null 36 | */ 37 | public $common; 38 | /** 39 | * @var \DateTimeImmutable|null 40 | */ 41 | public $date; 42 | /** 43 | * @var null|string 44 | */ 45 | public $type; 46 | 47 | /** 48 | * LogVehicleLeave constructor. 49 | * 50 | * @param Character|null $character 51 | * @param Vehicle|null $vehicle 52 | * @param float|null $rideDistance 53 | * @param int|null $seatIndex 54 | * @param Common|null $common 55 | * @param \DateTimeImmutable|null $date 56 | * @param null|string $type 57 | */ 58 | public function __construct( 59 | ?Character $character, 60 | ?Vehicle $vehicle, 61 | ?float $rideDistance, 62 | ?int $seatIndex, 63 | ?Common $common, 64 | ?\DateTimeImmutable $date, 65 | ?string $type 66 | ) { 67 | $this->character = $character; 68 | $this->vehicle = $vehicle; 69 | $this->rideDistance = $rideDistance; 70 | $this->seatIndex = $seatIndex; 71 | $this->common = $common; 72 | $this->date = $date; 73 | $this->type = $type; 74 | } 75 | 76 | /** 77 | * @param array $data 78 | * 79 | * @return LogVehicleLeave 80 | */ 81 | public static function createFromResponse(array $data): self 82 | { 83 | return new self( 84 | Character::createFromResponse($data['character']), 85 | Vehicle::createFromResponse($data['vehicle']), 86 | $data['rideDistance'], 87 | $data['seatIndex'], 88 | Common::createFromResponse($data['common']), 89 | new \DateTimeImmutable($data['_D']), 90 | $data['_T'] 91 | ); 92 | } 93 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogVehicleRide.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.3.0 15 | */ 16 | class LogVehicleRide 17 | { 18 | /** 19 | * @var Character|null 20 | */ 21 | public $character; 22 | /** 23 | * @var Vehicle|null 24 | */ 25 | public $vehicle; 26 | /** 27 | * @var int|null 28 | */ 29 | public $seatIndex; 30 | /** 31 | * @var Common|null 32 | */ 33 | public $common; 34 | /** 35 | * @var \DateTimeImmutable|null 36 | */ 37 | public $date; 38 | /** 39 | * @var null|string 40 | */ 41 | public $type; 42 | 43 | /** 44 | * LogVehicleRide constructor. 45 | * 46 | * @param Character|null $character 47 | * @param Vehicle|null $vehicle 48 | * @param int|null $seatIndex 49 | * @param Common|null $common 50 | * @param \DateTimeImmutable|null $date 51 | * @param null|string $type 52 | */ 53 | public function __construct( 54 | ?Character $character, 55 | ?Vehicle $vehicle, 56 | ?int $seatIndex, 57 | ?Common $common, 58 | ?\DateTimeImmutable $date, 59 | ?string $type 60 | ) { 61 | $this->character = $character; 62 | $this->vehicle = $vehicle; 63 | $this->seatIndex = $seatIndex; 64 | $this->common = $common; 65 | $this->date = $date; 66 | $this->type = $type; 67 | } 68 | 69 | /** 70 | * @param array $data 71 | * 72 | * @return LogVehicleRide 73 | */ 74 | public static function createFromResponse(array $data): self 75 | { 76 | return new self( 77 | Character::createFromResponse($data['character']), 78 | Vehicle::createFromResponse($data['vehicle']), 79 | $data['seatIndex'], 80 | Common::createFromResponse($data['common']), 81 | new \DateTimeImmutable($data['_D']), 82 | $data['_T'] 83 | ); 84 | } 85 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Events/LogWheelDestroy.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Events 14 | * @since 1.5.0 15 | */ 16 | class LogWheelDestroy 17 | { 18 | /** 19 | * @var int|null 20 | */ 21 | public $attackId; 22 | /** 23 | * @var Character|null 24 | */ 25 | public $attacker; 26 | /** 27 | * @var Vehicle|null 28 | */ 29 | public $vehicle; 30 | /** 31 | * @var null|string 32 | */ 33 | public $damageTypeCategory; 34 | /** 35 | * @var null|string 36 | */ 37 | public $damageCauserName; 38 | /** 39 | * @var Common|null 40 | */ 41 | public $common; 42 | /** 43 | * @var \DateTimeImmutable|null 44 | */ 45 | public $date; 46 | /** 47 | * @var null|string 48 | */ 49 | public $type; 50 | 51 | /** 52 | * LogWheelDestroy constructor. 53 | * 54 | * @param int|null $attackId 55 | * @param Character|null $attacker 56 | * @param Vehicle|null $vehicle 57 | * @param null|string $damageTypeCategory 58 | * @param null|string $damageCauserName 59 | * @param Common|null $common 60 | * @param \DateTimeImmutable|null $date 61 | * @param null|string $type 62 | */ 63 | public function __construct( 64 | ?int $attackId, 65 | ?Character $attacker, 66 | ?Vehicle $vehicle, 67 | ?string $damageTypeCategory, 68 | ?string $damageCauserName, 69 | ?Common $common, 70 | ?\DateTimeImmutable $date, 71 | ?string $type 72 | ) { 73 | $this->attackId = $attackId; 74 | $this->attacker = $attacker; 75 | $this->vehicle = $vehicle; 76 | $this->damageTypeCategory = $damageTypeCategory; 77 | $this->damageCauserName = $damageCauserName; 78 | $this->common = $common; 79 | $this->date = $date; 80 | $this->type = $type; 81 | } 82 | 83 | /** 84 | * @param array|null $data 85 | * 86 | * @return LogWheelDestroy 87 | */ 88 | public static function createFromResponse(?array $data): self 89 | { 90 | return new self( 91 | $data['attackId'], 92 | Character::createFromResponse($data['attacker']), 93 | Vehicle::createFromResponse($data['vehicle']), 94 | $data['damageTypeCategory'], 95 | $data['damageCauserName'], 96 | Common::createFromResponse($data['common']), 97 | new \DateTimeImmutable($data['_D']), 98 | $data['_T'] 99 | ); 100 | } 101 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Objects/BlueZoneCustomOption.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Objects 10 | * @since 1.4.0 11 | */ 12 | class BlueZoneCustomOption 13 | { 14 | /** 15 | * @var int|null 16 | */ 17 | public $phaseNum; 18 | /** 19 | * @var int|null 20 | */ 21 | public $startDelay; 22 | /** 23 | * @var int|null 24 | */ 25 | public $warningDuration; 26 | /** 27 | * @var int|null 28 | */ 29 | public $releaseDuration; 30 | /** 31 | * @var float|null 32 | */ 33 | public $poisonGasDamagePerSecond; 34 | /** 35 | * @var float|null 36 | */ 37 | public $radiusRate; 38 | /** 39 | * @var float|null 40 | */ 41 | public $spreadRatio; 42 | /** 43 | * @var float|null 44 | */ 45 | public $landRatio; 46 | /** 47 | * @var int|null 48 | */ 49 | public $circleAlgorithm; 50 | 51 | /** 52 | * BlueZoneCustomOption constructor. 53 | * 54 | * @param int|null $phaseNum 55 | * @param int|null $startDelay 56 | * @param int|null $warningDuration 57 | * @param int|null $releaseDuration 58 | * @param float|null $poisonGasDamagePerSecond 59 | * @param float|null $radiusRate 60 | * @param float|null $spreadRatio 61 | * @param float|null $landRatio 62 | * @param int|null $circleAlgorithm 63 | */ 64 | public function __construct( 65 | ?int $phaseNum, 66 | ?int $startDelay, 67 | ?int $warningDuration, 68 | ?int $releaseDuration, 69 | ?float $poisonGasDamagePerSecond, 70 | ?float $radiusRate, 71 | ?float $spreadRatio, 72 | ?float $landRatio, 73 | ?int $circleAlgorithm 74 | ) { 75 | $this->phaseNum = $phaseNum; 76 | $this->startDelay = $startDelay; 77 | $this->warningDuration = $warningDuration; 78 | $this->releaseDuration = $releaseDuration; 79 | $this->poisonGasDamagePerSecond = $poisonGasDamagePerSecond; 80 | $this->radiusRate = $radiusRate; 81 | $this->spreadRatio = $spreadRatio; 82 | $this->landRatio = $landRatio; 83 | $this->circleAlgorithm = $circleAlgorithm; 84 | } 85 | 86 | /** 87 | * @param array|null $data 88 | * 89 | * @return BlueZoneCustomOption 90 | */ 91 | public static function createFromResponse(?array $data): self 92 | { 93 | return new self( 94 | $data['phaseNum'], 95 | $data['startDelay'], 96 | $data['warningDuration'], 97 | $data['releaseDuration'], 98 | $data['poisonGasDamagePerSecond'], 99 | $data['radiusRate'], 100 | $data['spreadRatio'], 101 | $data['landRatio'], 102 | $data['circleAlgorithm'] 103 | ); 104 | } 105 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Objects/Character.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Objects 10 | * @since 1.3.0 11 | */ 12 | class Character 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $name; 18 | /** 19 | * @var int|null 20 | */ 21 | public $teamId; 22 | /** 23 | * @var float|null 24 | */ 25 | public $health; 26 | /** 27 | * @var Location|null 28 | */ 29 | public $location; 30 | /** 31 | * @var int|null 32 | */ 33 | public $ranking; 34 | /** 35 | * @var null|string 36 | */ 37 | public $accountId; 38 | 39 | /** 40 | * Character constructor. 41 | * 42 | * @param null|string $name 43 | * @param int|null $teamId 44 | * @param float|null $health 45 | * @param Location|null $location 46 | * @param int|null $ranking 47 | * @param null|string $accountId 48 | */ 49 | public function __construct( 50 | ?string $name, 51 | ?int $teamId, 52 | ?float $health, 53 | ?Location $location, 54 | ?int $ranking, 55 | ?string $accountId 56 | ) { 57 | $this->name = $name; 58 | $this->teamId = $teamId; 59 | $this->health = $health; 60 | $this->location = $location; 61 | $this->ranking = $ranking; 62 | $this->accountId = $accountId; 63 | } 64 | 65 | /** 66 | * @param array|null $data 67 | * 68 | * @return Character|null 69 | */ 70 | public static function createFromResponse(?array $data): ?self 71 | { 72 | return $data === null ? $data : new self( 73 | $data['name'], 74 | $data['teamId'], 75 | $data['health'], 76 | Location::createFromResponse($data['location']), 77 | $data['ranking'], 78 | $data['accountId'] 79 | ); 80 | } 81 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Objects/Common.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Objects 10 | * @since 1.3.0 11 | */ 12 | class Common 13 | { 14 | /** 15 | * @var float|null 16 | */ 17 | public $isGame; 18 | 19 | /** 20 | * Common constructor. 21 | * 22 | * @param float|null $isGame 23 | */ 24 | public function __construct(?float $isGame) 25 | { 26 | $this->isGame = $isGame; 27 | } 28 | 29 | /** 30 | * @param array $data 31 | * 32 | * @return Common 33 | */ 34 | public static function createFromResponse(array $data): self 35 | { 36 | return new self( 37 | $data['isGame'] 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Objects/GameState.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Objects 10 | * @since 1.3.0 11 | */ 12 | class GameState 13 | { 14 | /** 15 | * @var int|null 16 | */ 17 | public $elapsedTime; 18 | /** 19 | * @var int|null 20 | */ 21 | public $numAliveTeams; 22 | /** 23 | * @var int|null 24 | */ 25 | public $numJoinPlayers; 26 | /** 27 | * @var int|null 28 | */ 29 | public $numStartPlayers; 30 | /** 31 | * @var int|null 32 | */ 33 | public $numAlivePlayers; 34 | /** 35 | * @var Location|null 36 | */ 37 | public $safetyZonePosition; 38 | /** 39 | * @var float|null 40 | */ 41 | public $safetyZoneRadius; 42 | /** 43 | * @var Location|null 44 | */ 45 | public $poisonGasWarningPosition; 46 | /** 47 | * @var float|null 48 | */ 49 | public $poisonGasWarningRadius; 50 | /** 51 | * @var Location|null 52 | */ 53 | public $redZonePosition; 54 | /** 55 | * @var float|null 56 | */ 57 | public $redZoneRadius; 58 | 59 | /** 60 | * GameState constructor. 61 | * 62 | * @param int|null $elapsedTime 63 | * @param int|null $numAliveTeams 64 | * @param int|null $numJoinPlayers 65 | * @param int|null $numStartPlayers 66 | * @param int|null $numAlivePlayers 67 | * @param Location|null $safetyZonePosition 68 | * @param float|null $safetyZoneRadius 69 | * @param Location|null $poisonGasWarningPosition 70 | * @param float|null $poisonGasWarningRadius 71 | * @param Location|null $redZonePosition 72 | * @param float|null $redZoneRadius 73 | */ 74 | public function __construct( 75 | ?int $elapsedTime, 76 | ?int $numAliveTeams, 77 | ?int $numJoinPlayers, 78 | ?int $numStartPlayers, 79 | ?int $numAlivePlayers, 80 | ?Location $safetyZonePosition, 81 | ?float $safetyZoneRadius, 82 | ?Location $poisonGasWarningPosition, 83 | ?float $poisonGasWarningRadius, 84 | ?Location $redZonePosition, 85 | ?float $redZoneRadius 86 | ) { 87 | $this->elapsedTime = $elapsedTime; 88 | $this->numAliveTeams = $numAliveTeams; 89 | $this->numJoinPlayers = $numJoinPlayers; 90 | $this->numStartPlayers = $numStartPlayers; 91 | $this->numAlivePlayers = $numAlivePlayers; 92 | $this->safetyZonePosition = $safetyZonePosition; 93 | $this->safetyZoneRadius = $safetyZoneRadius; 94 | $this->poisonGasWarningPosition = $poisonGasWarningPosition; 95 | $this->poisonGasWarningRadius = $poisonGasWarningRadius; 96 | $this->redZonePosition = $redZonePosition; 97 | $this->redZoneRadius = $redZoneRadius; 98 | } 99 | 100 | /** 101 | * @param array $data 102 | * 103 | * @return GameState 104 | */ 105 | public static function createFromResponse(array $data): self 106 | { 107 | return new self( 108 | $data['elapsedTime'], 109 | $data['numAliveTeams'], 110 | $data['numJoinPlayers'], 111 | $data['numStartPlayers'], 112 | $data['numAlivePlayers'], 113 | Location::createFromResponse($data['safetyZonePosition']), 114 | $data['safetyZoneRadius'], 115 | Location::createFromResponse($data['poisonGasWarningPosition']), 116 | $data['poisonGasWarningRadius'], 117 | Location::createFromResponse($data['redZonePosition']), 118 | $data['redZoneRadius'] 119 | ); 120 | } 121 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Objects/Item.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Objects 10 | * @since 1.3.0 11 | */ 12 | class Item 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $itemId; 18 | /** 19 | * @var int|null 20 | */ 21 | public $stackCount; 22 | /** 23 | * @var null|string 24 | */ 25 | public $category; 26 | /** 27 | * @var null|string 28 | */ 29 | public $subCategory; 30 | /** 31 | * @var array|null 32 | */ 33 | public $attachedItems; 34 | 35 | /** 36 | * Item constructor. 37 | * 38 | * @param null|string $itemId 39 | * @param int|null $stackCount 40 | * @param null|string $category 41 | * @param null|string $subCategory 42 | * @param array|null $attachedItems 43 | */ 44 | public function __construct( 45 | ?string $itemId, 46 | ?int $stackCount, 47 | ?string $category, 48 | ?string $subCategory, 49 | ?array $attachedItems 50 | ) { 51 | $this->itemId = $itemId; 52 | $this->stackCount = $stackCount; 53 | $this->category = $category; 54 | $this->subCategory = $subCategory; 55 | $this->attachedItems = $attachedItems; 56 | } 57 | 58 | /** 59 | * @param array $data 60 | * 61 | * @return Item 62 | */ 63 | public static function createFromResponse(array $data): self 64 | { 65 | return new self( 66 | $data['itemId'], 67 | $data['stackCount'], 68 | $data['category'], 69 | $data['subCategory'], 70 | $data['attachedItems'] 71 | ); 72 | } 73 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Objects/ItemPackage.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Objects 10 | * @since 1.3.0 11 | */ 12 | class ItemPackage 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $itemPackageId; 18 | /** 19 | * @var Location|null 20 | */ 21 | public $location; 22 | /** 23 | * @var array|null 24 | */ 25 | public $items; 26 | 27 | /** 28 | * ItemPackage constructor. 29 | * 30 | * @param null|string $itemPackageId 31 | * @param Location|null $location 32 | * @param array|null $items 33 | */ 34 | public function __construct( 35 | ?string $itemPackageId, 36 | ?Location $location, 37 | ?array $items 38 | ) { 39 | $this->itemPackageId = $itemPackageId; 40 | $this->location = $location; 41 | $this->items = $items; 42 | } 43 | 44 | /** 45 | * @param array $data 46 | * 47 | * @return ItemPackage 48 | */ 49 | public static function createFromResponse(array $data): self 50 | { 51 | $items = []; 52 | 53 | foreach ($data['items'] as $item) { 54 | $items[] = Item::createFromResponse($item); 55 | } 56 | 57 | return new self( 58 | $data['itemPackageId'], 59 | Location::createFromResponse($data['location']), 60 | $items 61 | ); 62 | } 63 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Objects/Location.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Objects 10 | * @since 1.3.0 11 | */ 12 | class Location 13 | { 14 | /** 15 | * @var float|null 16 | */ 17 | public $posX; 18 | /** 19 | * @var float|null 20 | */ 21 | public $posY; 22 | /** 23 | * @var float|null 24 | */ 25 | public $posZ; 26 | 27 | /** 28 | * Location constructor. 29 | * 30 | * @param float|null $posX 31 | * @param float|null $posY 32 | * @param float|null $posZ 33 | */ 34 | public function __construct( 35 | ?float $posX, 36 | ?float $posY, 37 | ?float $posZ 38 | ) { 39 | $this->posX = $posX; 40 | $this->posY = $posY; 41 | $this->posZ = $posZ; 42 | } 43 | 44 | /** 45 | * @param array $data 46 | * 47 | * @return Location 48 | */ 49 | public static function createFromResponse(array $data): self 50 | { 51 | return new self( 52 | $data['x'], 53 | $data['y'], 54 | $data['z'] 55 | ); 56 | } 57 | } -------------------------------------------------------------------------------- /src/DTO/TelemetryData/Objects/Vehicle.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\DTO\TelemetryData\Objects 10 | * @since 1.3.0 11 | */ 12 | class Vehicle 13 | { 14 | /** 15 | * @var null|string 16 | */ 17 | public $vehicleType; 18 | /** 19 | * @var null|string 20 | */ 21 | public $vehicleId; 22 | /** 23 | * @var float|null 24 | */ 25 | public $healthPercent; 26 | /** 27 | * @var float|null 28 | */ 29 | public $fuelPercent; 30 | 31 | /** 32 | * Vehicle constructor. 33 | * 34 | * @param null|string $vehicleType 35 | * @param null|string $vehicleId 36 | * @param float|null $healthPercent 37 | * @param float|null $fuelPercent 38 | */ 39 | public function __construct( 40 | ?string $vehicleType, 41 | ?string $vehicleId, 42 | ?float $healthPercent, 43 | ?float $fuelPercent 44 | ) { 45 | $this->vehicleType = $vehicleType; 46 | $this->vehicleId = $vehicleId; 47 | $this->healthPercent = $healthPercent; 48 | $this->fuelPercent = $fuelPercent; 49 | } 50 | 51 | /** 52 | * @param array|null $data 53 | * 54 | * @return Vehicle|null 55 | */ 56 | public static function createFromResponse(?array $data): ?self 57 | { 58 | return $data === null ? $data : new self( 59 | $data['vehicleType'], 60 | $data['vehicleId'], 61 | $data['healthPercent'], 62 | $data['feulPercent'] 63 | ); 64 | } 65 | } -------------------------------------------------------------------------------- /src/PUBGManager.php: -------------------------------------------------------------------------------- 1 | 20 | * @package Lifeformwp\PHPPUBG 21 | * @since 1.0.0 22 | */ 23 | final class PUBGManager 24 | { 25 | public const HYDRATE_MATCH = MatchDTOProvider::class; 26 | public const HYDRATE_PLAYERS = PlayersDTOProvider::class; 27 | public const HYDRATE_PLAYER = PlayerDTOProvider::class; 28 | public const HYDRATE_STATUS = StatusDTOProvider::class; 29 | public const HYDRATE_TELEMETRY = TelemetryDTOProvider::class; 30 | public const HYDRATE_SAMPLES = SamplesDTOProvider::class; 31 | 32 | /** 33 | * @var ClientInterface 34 | */ 35 | private $client; 36 | /** 37 | * @var string 38 | */ 39 | private $token; 40 | /** 41 | * @var string 42 | */ 43 | private $baseURL; 44 | 45 | /** 46 | * PUBGManager constructor. 47 | * 48 | * @param ClientInterface $client 49 | * @param string $token 50 | * @param null|string $baseURL 51 | */ 52 | public function __construct( 53 | ClientInterface $client, 54 | string $token, 55 | ?string $baseURL = 'https://api.playbattlegrounds.com/' 56 | ) { 57 | $this->client = $client; 58 | $this->token = $token; 59 | $this->baseURL = $baseURL; 60 | } 61 | 62 | /** 63 | * @param string $shard 64 | * @param string $matchId 65 | * 66 | * @return array 67 | * @throws PUBGManagerException 68 | * @since 1.0.0 69 | */ 70 | public function getMatch(string $shard, string $matchId): array 71 | { 72 | $url = $this->baseURL . 'shards/' . $shard . '/matches/' . $matchId; 73 | 74 | try { 75 | return $this->request('get', $url); 76 | } catch (\Throwable $throwable) { 77 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 78 | } 79 | } 80 | 81 | /** 82 | * @param string $shard 83 | * @param array $matchesIds 84 | * 85 | * @return array 86 | * @since 1.0.0 87 | */ 88 | public function getMatches(string $shard, array $matchesIds): array 89 | { 90 | $matchesData = []; 91 | 92 | foreach ($matchesIds as $id) { 93 | $matchesData[$id] = $this->getMatch($shard, $id); 94 | } 95 | 96 | return $matchesData; 97 | } 98 | 99 | /** 100 | * @param string $shard 101 | * @param string $matchId 102 | * 103 | * @return array 104 | * @since 1.1.0 105 | */ 106 | public function getTelemetryByMatch(string $shard, string $matchId): array 107 | { 108 | $match = $this->getMatch($shard, $matchId); 109 | $telemetryLink = $this->getTelemetryLink($match); 110 | 111 | return $this->getTelemetry($telemetryLink); 112 | } 113 | 114 | /** 115 | * @param array $data 116 | * 117 | * @return string 118 | * @since 1.1.0 119 | */ 120 | private function getTelemetryLink(array $data): string 121 | { 122 | $link = ''; 123 | 124 | foreach ($data['included'] as $item) { 125 | if ($item['type'] === 'asset') { 126 | $link = $item['attributes']['URL']; 127 | break; 128 | } 129 | } 130 | 131 | return $link; 132 | } 133 | 134 | /** 135 | * @param string $shard 136 | * @param array|null $playerNames 137 | * @param array|null $playerIds 138 | * 139 | * @return array 140 | * @throws PUBGManagerException 141 | * @since 1.0.0 142 | */ 143 | public function getPlayers(string $shard, ?array $playerNames = [], ?array $playerIds = []): array 144 | { 145 | $names = ''; 146 | $ids = ''; 147 | $url = $this->baseURL . 'shards/' . $shard . '/players'; 148 | 149 | if (!empty($playerNames)) { 150 | $names = \implode(',', $playerNames); 151 | } 152 | 153 | if (!empty($playerIds)) { 154 | $ids = \implode(',', $playerIds); 155 | } 156 | 157 | $options = [ 158 | 'headers' => [ 159 | 'Authorization' => 'Bearer ' . $this->token, 160 | 'Accept' => 'application/vnd.api+json' 161 | ], 162 | 'query' => [ 163 | 'filter' => [ 164 | 'playerNames' => $names, 165 | 'playerIds' => $ids 166 | ] 167 | ] 168 | ]; 169 | 170 | try { 171 | return $this->request('get', $url, $options); 172 | } catch (\Throwable $throwable) { 173 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 174 | } 175 | } 176 | 177 | /** 178 | * @param string $shard 179 | * @param string $player 180 | * 181 | * @return array 182 | * @throws PUBGManagerException 183 | * @since 1.1.0 184 | */ 185 | public function getPlayer(string $shard, string $player): array 186 | { 187 | $url = $this->baseURL . 'shards/' . $shard . '/players/' . $player; 188 | 189 | try { 190 | return $this->request('get', $url); 191 | } catch (\Throwable $throwable) { 192 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 193 | } 194 | } 195 | 196 | /** 197 | * @param string $telemetryUrl 198 | * 199 | * @return array 200 | * @throws PUBGManagerException 201 | * @since 1.0.0 202 | */ 203 | public function getTelemetry(string $telemetryUrl): array 204 | { 205 | try { 206 | return $this->request('get', $telemetryUrl); 207 | } catch (\Throwable $throwable) { 208 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 209 | } 210 | } 211 | 212 | /** 213 | * @return array 214 | * @throws PUBGManagerException 215 | * @since 1.0.0 216 | */ 217 | public function getStatus(): array 218 | { 219 | $url = $this->baseURL . 'status'; 220 | 221 | try { 222 | return $this->request('get', $url); 223 | } catch (\Throwable $throwable) { 224 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 225 | } 226 | } 227 | 228 | /** 229 | * @param string $shard 230 | * 231 | * @return array 232 | * @throws PUBGManagerException 233 | * @since 1.3.0 234 | */ 235 | public function getSamples(string $shard): array 236 | { 237 | $url = $this->baseURL . 'shards/' . $shard . '/samples'; 238 | 239 | try { 240 | return $this->request('get', $url); 241 | } catch (\Throwable $throwable) { 242 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 243 | } 244 | } 245 | 246 | /** 247 | * @param string $shard 248 | * 249 | * @return array 250 | * @throws PUBGManagerException 251 | * @since 1.4.0 252 | */ 253 | public function getSeasons(string $shard): array 254 | { 255 | $url = $this->baseURL . 'shards/' . $shard . '/seasons'; 256 | 257 | try { 258 | return $this->request('get', $url); 259 | } catch (\Throwable $throwable) { 260 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 261 | } 262 | } 263 | 264 | /** 265 | * @param string $shard 266 | * @param string $playerId 267 | * @param string $seasonId 268 | * 269 | * @return array 270 | * @throws PUBGManagerException 271 | * @since 1.4.0 272 | */ 273 | public function getSeasonDataForPlayer(string $shard, string $playerId, string $seasonId): array 274 | { 275 | $url = $this->baseURL . 'shards/' . $shard . '/players/' . $playerId . '/seasons/' . $seasonId; 276 | 277 | try { 278 | return $this->request('get', $url); 279 | } catch (\Throwable $throwable) { 280 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 281 | } 282 | } 283 | 284 | /** 285 | * @return array 286 | * @throws PUBGManagerException 287 | * @since 1.6.0 288 | */ 289 | public function getTournaments(): array 290 | { 291 | $url = $this->baseURL . 'tournaments'; 292 | try { 293 | return $this->request('get', $url); 294 | } catch (\Throwable $throwable) { 295 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 296 | } 297 | } 298 | 299 | /** 300 | * @param string $tournamentId 301 | * 302 | * @return array 303 | * @throws PUBGManagerException 304 | * @since 1.6.0 305 | */ 306 | public function getTournament(string $tournamentId): array 307 | { 308 | $url = $this->baseURL . 'tournaments/' . $tournamentId; 309 | try { 310 | return $this->request('get', $url); 311 | } catch (\Throwable $throwable) { 312 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 313 | } 314 | } 315 | 316 | /** 317 | * @param string $shard 318 | * @param string $gameMode 319 | * 320 | * @return array 321 | * @throws PUBGManagerException 322 | * @since 1.8.0 323 | */ 324 | public function getLeaderboard(string $shard, string $gameMode): array 325 | { 326 | $url = $this->baseURL . 'shards/' . $shard . '/leaderboards/' . $gameMode; 327 | 328 | try { 329 | return $this->request('get', $url); 330 | } catch (\Throwable $throwable) { 331 | throw new PUBGManagerException($throwable->getMessage(), $throwable->getCode()); 332 | } 333 | } 334 | 335 | /** 336 | * @param string $method 337 | * @param string $url 338 | * @param array|null $options 339 | * 340 | * @return array 341 | * @throws GuzzleException 342 | * @throws PUBGManagerException 343 | * @since 1.4.0 344 | */ 345 | private function request(string $method, string $url, ?array $options = []): array 346 | { 347 | $auth = [ 348 | 'headers' => [ 349 | 'Authorization' => 'Bearer ' . $this->token, 350 | 'Accept' => 'application/vnd.api+json' 351 | ] 352 | ]; 353 | $options = empty($options) ? $auth : $options; 354 | $response = $this->client->request($method, $url, $options); 355 | 356 | return $this->processResponse($response); 357 | } 358 | 359 | /** 360 | * @param array $data 361 | * @param string $type 362 | * 363 | * @return DTOInterface 364 | * @since 1.1.0 365 | */ 366 | public function hydrate(array $data, string $type): DTOInterface 367 | { 368 | $hydration = new $type; 369 | 370 | return $hydration->process($data); 371 | } 372 | 373 | /** 374 | * @param ResponseInterface $response 375 | * 376 | * @return mixed 377 | * @throws PUBGManagerException 378 | * @since 1.0.0 379 | */ 380 | private function processResponse(ResponseInterface $response) 381 | { 382 | if ($response->getStatusCode() === 500) { 383 | throw new PUBGManagerException('PUBG Developer API returned 500 status code', 500); 384 | } 385 | 386 | if (\in_array($response->getStatusCode(), [401, 404, 415])) { 387 | $error = \json_decode($response->getBody()->getContents(), true); 388 | throw new PUBGManagerException($error['errors']); 389 | } 390 | 391 | if ($response->getStatusCode() === 429) { 392 | throw new PUBGManagerException('Too many requests, 429 status code', 429); 393 | } 394 | 395 | return \json_decode($response->getBody()->getContents(), true); 396 | } 397 | } -------------------------------------------------------------------------------- /src/PUBGManagerException.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG 10 | * @since 1.0.0 11 | */ 12 | class PUBGManagerException extends \Exception 13 | { 14 | 15 | } -------------------------------------------------------------------------------- /src/Provider/PlayerDTOProvider.php: -------------------------------------------------------------------------------- 1 | 20 | * @package Lifeformwp\PHPPUBG\Provider 21 | * @since 1.1.0 22 | */ 23 | class PlayerDTOProvider implements ProviderInterface 24 | { 25 | /** 26 | * @param array $player 27 | * 28 | * @return Player 29 | */ 30 | public function process(array $player): Player 31 | { 32 | $player = [ 33 | 'data' => $this->processPlayerData($player['data']), 34 | 'links' => $this->processPlayerLinks($player['links']), 35 | 'meta' => $this->processPlayerMeta($player['meta']) 36 | ]; 37 | 38 | return Player::createFromResponse($player); 39 | } 40 | 41 | /** 42 | * @param array $data 43 | * 44 | * @return Data 45 | */ 46 | private function processPlayerData(array $data): Data 47 | { 48 | $data['attributes'] = $this->processPlayerDataAttributes($data['attributes']); 49 | $data['relationships'] = $this->processPlayerDataRelationships($data['relationships']); 50 | $data['links'] = $this->processPlayerDataLinks($data['links']); 51 | 52 | return Data::createFromResponse($data); 53 | } 54 | 55 | /** 56 | * @param array $attributes 57 | * 58 | * @return PlayerAttributes 59 | */ 60 | private function processPlayerDataAttributes(array $attributes): PlayerAttributes 61 | { 62 | return PlayerAttributes::createFromResponse($attributes); 63 | } 64 | 65 | /** 66 | * @param array $relationships 67 | * 68 | * @return PlayerRelationships 69 | */ 70 | private function processPlayerDataRelationships(array $relationships): PlayerRelationships 71 | { 72 | $relationships['assets'] = $this->processPlayerDataRelationshipsAssets($relationships['assets']); 73 | $relationships['matches'] = $this->processPlayerDataRelationshipsMatches($relationships['matches']); 74 | 75 | return PlayerRelationships::createFromResponse($relationships); 76 | } 77 | 78 | /** 79 | * @param array $assets 80 | * 81 | * @return Assets 82 | */ 83 | private function processPlayerDataRelationshipsAssets(array $assets): Assets 84 | { 85 | return new Assets(); 86 | } 87 | 88 | /** 89 | * @param array $matches 90 | * 91 | * @return Matches 92 | */ 93 | private function processPlayerDataRelationshipsMatches(array $matches): Matches 94 | { 95 | $data = []; 96 | 97 | foreach ($matches['data'] as $match) { 98 | $data['data'][] = $this->processPlayerDataRelationshipsMatchesObject($match); 99 | } 100 | 101 | return Matches::createFromResponse($data); 102 | } 103 | 104 | /** 105 | * @param array $match 106 | * 107 | * @return MatchData 108 | */ 109 | private function processPlayerDataRelationshipsMatchesObject(array $match): MatchData 110 | { 111 | return MatchData::createFromResponse($match); 112 | } 113 | 114 | /** 115 | * @param array $links 116 | * 117 | * @return PlayerLinks 118 | */ 119 | private function processPlayerDataLinks(array $links): PlayerLinks 120 | { 121 | return PlayerLinks::createFromResponse($links); 122 | } 123 | 124 | /** 125 | * @param array $links 126 | * 127 | * @return Links 128 | */ 129 | private function processPlayerLinks(array $links): Links 130 | { 131 | return Links::createFromResponse($links); 132 | } 133 | 134 | /** 135 | * @param array $meta 136 | * 137 | * @return Meta 138 | */ 139 | private function processPlayerMeta(array $meta): Meta 140 | { 141 | return new Meta(); 142 | } 143 | } -------------------------------------------------------------------------------- /src/Provider/PlayersDTOProvider.php: -------------------------------------------------------------------------------- 1 | 20 | * @package Lifeformwp\PHPPUBG\Provider 21 | * @since 1.1.0 22 | */ 23 | class PlayersDTOProvider implements ProviderInterface 24 | { 25 | /** 26 | * @param array $player 27 | * 28 | * @return Players 29 | */ 30 | public function process(array $player): Players 31 | { 32 | $data = []; 33 | 34 | foreach ($player['data'] as $item) { 35 | $data[] = $this->processPlayerData($item); 36 | } 37 | 38 | $player = [ 39 | 'data' => $data, 40 | 'links' => $this->processPlayerLinks($player['links']), 41 | 'meta' => $this->processPlayerMeta($player['meta']) 42 | ]; 43 | 44 | return Players::createFromResponse($player); 45 | } 46 | 47 | /** 48 | * @param array $data 49 | * 50 | * @return Data 51 | */ 52 | private function processPlayerData(array $data): Data 53 | { 54 | $data['attributes'] = $this->processPlayerDataAttributes($data['attributes']); 55 | $data['relationships'] = $this->processPlayerDataRelationships($data['relationships']); 56 | $data['links'] = $this->processPlayerDataLinks($data['links']); 57 | 58 | return Data::createFromResponse($data); 59 | } 60 | 61 | /** 62 | * @param array $attributes 63 | * 64 | * @return PlayerAttributes 65 | */ 66 | private function processPlayerDataAttributes(array $attributes): PlayerAttributes 67 | { 68 | return PlayerAttributes::createFromResponse($attributes); 69 | } 70 | 71 | /** 72 | * @param array $relationships 73 | * 74 | * @return PlayerRelationships 75 | */ 76 | private function processPlayerDataRelationships(array $relationships): PlayerRelationships 77 | { 78 | $relationships['assets'] = $this->processPlayerDataRelationshipsAssets($relationships['assets']); 79 | $relationships['matches'] = $this->processPlayerDataRelationshipsMatches($relationships['matches']); 80 | 81 | return PlayerRelationships::createFromResponse($relationships); 82 | } 83 | 84 | /** 85 | * @param array $assets 86 | * 87 | * @return Assets 88 | */ 89 | private function processPlayerDataRelationshipsAssets(array $assets): Assets 90 | { 91 | return new Assets(); 92 | } 93 | 94 | /** 95 | * @param array $matches 96 | * 97 | * @return Matches 98 | */ 99 | private function processPlayerDataRelationshipsMatches(array $matches): Matches 100 | { 101 | $data = []; 102 | 103 | foreach ($matches['data'] as $match) { 104 | $data['data'][] = $this->processPlayerDataRelationshipsMatchesObject($match); 105 | } 106 | 107 | return Matches::createFromResponse($data); 108 | } 109 | 110 | /** 111 | * @param array $match 112 | * 113 | * @return MatchData 114 | */ 115 | private function processPlayerDataRelationshipsMatchesObject(array $match): MatchData 116 | { 117 | return MatchData::createFromResponse($match); 118 | } 119 | 120 | /** 121 | * @param array $links 122 | * 123 | * @return PlayerLinks 124 | */ 125 | private function processPlayerDataLinks(array $links): PlayerLinks 126 | { 127 | return PlayerLinks::createFromResponse($links); 128 | } 129 | 130 | /** 131 | * @param array $links 132 | * 133 | * @return Links 134 | */ 135 | private function processPlayerLinks(array $links): Links 136 | { 137 | return Links::createFromResponse($links); 138 | } 139 | 140 | /** 141 | * @param array $meta 142 | * 143 | * @return Meta 144 | */ 145 | private function processPlayerMeta(array $meta): Meta 146 | { 147 | return new Meta(); 148 | } 149 | } -------------------------------------------------------------------------------- /src/Provider/ProviderInterface.php: -------------------------------------------------------------------------------- 1 | 9 | * @package Lifeformwp\PHPPUBG\Provider 10 | * @since 1.1.0 11 | */ 12 | interface ProviderInterface 13 | { 14 | /** 15 | * @param array $data 16 | * 17 | * @return mixed 18 | */ 19 | public function process(array $data); 20 | } -------------------------------------------------------------------------------- /src/Provider/SamplesDTOProvider.php: -------------------------------------------------------------------------------- 1 | 16 | * @package Lifeformwp\PHPPUBG\Provider 17 | * @since 1.3.0 18 | */ 19 | class SamplesDTOProvider implements ProviderInterface 20 | { 21 | /** 22 | * @param array $samples 23 | * 24 | * @return Samples 25 | */ 26 | public function process(array $samples): Samples 27 | { 28 | $data = [ 29 | 'data' => $this->processSampleData($samples['data']) 30 | ]; 31 | 32 | return Samples::createFromResponse($data); 33 | } 34 | 35 | /** 36 | * @param array $sampleData 37 | * 38 | * @return Data 39 | */ 40 | private function processSampleData(array $sampleData): Data 41 | { 42 | $sampleData = [ 43 | 'type' => $sampleData['type'], 44 | 'id' => $sampleData['id'], 45 | 'attributes' => $this->processSampleDataAttributes($sampleData['attributes']), 46 | 'relationships' => $this->processSampleDataRelationships($sampleData['relationships']) 47 | ]; 48 | 49 | return Data::createFromResponse($sampleData); 50 | } 51 | 52 | /** 53 | * @param array $attributes 54 | * 55 | * @return SampleAttributes 56 | */ 57 | private function processSampleDataAttributes(array $attributes): SampleAttributes 58 | { 59 | return SampleAttributes::createFromResponse($attributes); 60 | } 61 | 62 | /** 63 | * @param array $relationships 64 | * 65 | * @return SampleRelationships 66 | */ 67 | private function processSampleDataRelationships(array $relationships): SampleRelationships 68 | { 69 | $data = [ 70 | 'matches' => $this->processSampleDataRelationshipsMatches($relationships['matches']) 71 | ]; 72 | 73 | return SampleRelationships::createFromResponse($data); 74 | } 75 | 76 | /** 77 | * @param array $matches 78 | * 79 | * @return Matches 80 | */ 81 | private function processSampleDataRelationshipsMatches(array $matches): Matches 82 | { 83 | $data = []; 84 | 85 | foreach ($matches['data'] as $match) { 86 | $data['data'][] = $this->processSampleDataRelationshipsMatchesObject($match); 87 | 88 | } 89 | 90 | return Matches::createFromResponse($data); 91 | } 92 | 93 | /** 94 | * @param array $match 95 | * 96 | * @return MatchType 97 | */ 98 | private function processSampleDataRelationshipsMatchesObject(array $match): MatchType 99 | { 100 | return MatchType::createFromResponse($match); 101 | } 102 | } -------------------------------------------------------------------------------- /src/Provider/StatusDTOProvider.php: -------------------------------------------------------------------------------- 1 | 13 | * @package Lifeformwp\PHPPUBG\Provider 14 | * @since 1.2.0 15 | */ 16 | class StatusDTOProvider implements ProviderInterface 17 | { 18 | /** 19 | * @param array $status 20 | * 21 | * @return Status 22 | */ 23 | public function process(array $status): Status 24 | { 25 | $data['data'] = $this->processStatusData($status['data']); 26 | 27 | return Status::createFromResponse($data); 28 | } 29 | 30 | /** 31 | * @param array $data 32 | * 33 | * @return Data 34 | */ 35 | private function processStatusData(array $data): Data 36 | { 37 | $data['attributes'] = $this->processStatusDataAttributes($data['attributes']); 38 | 39 | return Data::createFromResponse($data); 40 | } 41 | 42 | /** 43 | * @param array $attributes 44 | * 45 | * @return StatusAttributes 46 | */ 47 | private function processStatusDataAttributes(array $attributes): StatusAttributes 48 | { 49 | return StatusAttributes::createFromResponse($attributes); 50 | } 51 | } -------------------------------------------------------------------------------- /src/Provider/TelemetryDTOProvider.php: -------------------------------------------------------------------------------- 1 | 11 | * @package Lifeformwp\PHPPUBG\Provider 12 | * @since 1.3.0 13 | */ 14 | class TelemetryDTOProvider implements ProviderInterface 15 | { 16 | /** 17 | * @param array $telemetries 18 | * 19 | * @return Telemetry 20 | */ 21 | public function process(array $telemetries): Telemetry 22 | { 23 | $result = []; 24 | 25 | foreach ($telemetries as $telemetry) { 26 | $class = "Lifeformwp\PHPPUBG\DTO\TelemetryData\Events\\" . $telemetry["_T"]; 27 | $result['events'][] = $class::createFromResponse($telemetry); 28 | } 29 | 30 | return Telemetry::createFromResponse($result); 31 | } 32 | } -------------------------------------------------------------------------------- /tests/example/player.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "type": "player", 4 | "id": "account.d50fdc18fcad49c691d38466bed6f8fd", 5 | "attributes": { 6 | "shardId": "pc-na", 7 | "patchVersion": "", 8 | "name": "shroud", 9 | "stats": null, 10 | "titleId": "bluehole-pubg" 11 | }, 12 | "relationships": { 13 | "matches": { 14 | "data": [ 15 | { 16 | "type": "match", 17 | "id": "da6ea12d-486d-4d3b-b27a-657a82bc49cc" 18 | }, 19 | { 20 | "type": "match", 21 | "id": "01ed4357-cfa3-4a97-9a2d-157e58ed2b09" 22 | }, 23 | { 24 | "type": "match", 25 | "id": "4dd633d2-f2f5-48c3-8c18-d347adae16ff" 26 | }, 27 | { 28 | "type": "match", 29 | "id": "38097f29-b0dd-43ec-80c1-aaef1f910085" 30 | }, 31 | { 32 | "type": "match", 33 | "id": "572156f8-ad29-4245-912e-205e69978856" 34 | }, 35 | { 36 | "type": "match", 37 | "id": "73be8c38-283a-4642-a101-22199dccaaf7" 38 | }, 39 | { 40 | "type": "match", 41 | "id": "dc76880f-3fc3-4226-b4d0-34727d3eca16" 42 | }, 43 | { 44 | "type": "match", 45 | "id": "21007e8f-2d22-47aa-b588-4820d212be8d" 46 | }, 47 | { 48 | "type": "match", 49 | "id": "29f21813-5357-4fc3-b6bb-935ae349323a" 50 | }, 51 | { 52 | "type": "match", 53 | "id": "02a88f28-4da4-4b45-b920-b75f2ba54011" 54 | }, 55 | { 56 | "type": "match", 57 | "id": "6f06fdd0-34f9-4401-b6cc-a99e9745806d" 58 | }, 59 | { 60 | "type": "match", 61 | "id": "6158900a-dda0-48d2-b7eb-6ede85ddef7f" 62 | }, 63 | { 64 | "type": "match", 65 | "id": "442af35c-6078-477d-8d47-89c12680725c" 66 | }, 67 | { 68 | "type": "match", 69 | "id": "04425c6b-2d33-44cc-ba60-420a4dcc55ce" 70 | }, 71 | { 72 | "type": "match", 73 | "id": "41480579-68db-4125-9213-4bf946245c01" 74 | }, 75 | { 76 | "type": "match", 77 | "id": "ef4036e5-5486-4fc9-97d9-b68c5defa4f3" 78 | }, 79 | { 80 | "type": "match", 81 | "id": "3de20712-5112-45aa-a958-9749415d2d8a" 82 | }, 83 | { 84 | "type": "match", 85 | "id": "66ddb971-8033-4068-b84e-783b0960e1a7" 86 | }, 87 | { 88 | "type": "match", 89 | "id": "a8eb29d0-b9eb-44bb-88e8-c07ce16426ba" 90 | }, 91 | { 92 | "type": "match", 93 | "id": "0a1ae62c-e263-4a87-a9db-72d14baa4251" 94 | }, 95 | { 96 | "type": "match", 97 | "id": "2c3d7471-9394-4815-af7b-5f2208d5220c" 98 | }, 99 | { 100 | "type": "match", 101 | "id": "6c1aa348-d1b4-4ee5-a0aa-7b7981e878a8" 102 | }, 103 | { 104 | "type": "match", 105 | "id": "659420b1-2f47-413d-93ed-b8eb397f3592" 106 | }, 107 | { 108 | "type": "match", 109 | "id": "13a7f35a-8eea-45c0-873b-f756dc379d79" 110 | }, 111 | { 112 | "type": "match", 113 | "id": "ce8fdae8-8dad-4c02-bbfe-a6f7cd5a5b80" 114 | } 115 | ] 116 | }, 117 | "assets": { 118 | "data": [] 119 | } 120 | }, 121 | "links": { 122 | "self": "https://api.playbattlegrounds.com/shards/pc-na/players/account.d50fdc18fcad49c691d38466bed6f8fd", 123 | "schema": "" 124 | } 125 | }, 126 | "links": { 127 | "self": "https://api.playbattlegrounds.com/shards/pc-na/players/account.d50fdc18fcad49c691d38466bed6f8fd" 128 | }, 129 | "meta": {} 130 | } -------------------------------------------------------------------------------- /tests/example/players.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "type": "player", 5 | "id": "account.d50fdc18fcad49c691d38466bed6f8fd", 6 | "attributes": { 7 | "createdAt": "2018-10-08T13:33:38Z", 8 | "updatedAt": "2018-10-08T13:33:38Z", 9 | "patchVersion": "", 10 | "name": "shroud", 11 | "stats": null, 12 | "titleId": "bluehole-pubg", 13 | "shardId": "pc-na" 14 | }, 15 | "relationships": { 16 | "assets": { 17 | "data": [] 18 | }, 19 | "matches": { 20 | "data": [ 21 | { 22 | "type": "match", 23 | "id": "da6ea12d-486d-4d3b-b27a-657a82bc49cc" 24 | }, 25 | { 26 | "type": "match", 27 | "id": "01ed4357-cfa3-4a97-9a2d-157e58ed2b09" 28 | }, 29 | { 30 | "type": "match", 31 | "id": "4dd633d2-f2f5-48c3-8c18-d347adae16ff" 32 | }, 33 | { 34 | "type": "match", 35 | "id": "38097f29-b0dd-43ec-80c1-aaef1f910085" 36 | }, 37 | { 38 | "type": "match", 39 | "id": "572156f8-ad29-4245-912e-205e69978856" 40 | }, 41 | { 42 | "type": "match", 43 | "id": "73be8c38-283a-4642-a101-22199dccaaf7" 44 | }, 45 | { 46 | "type": "match", 47 | "id": "dc76880f-3fc3-4226-b4d0-34727d3eca16" 48 | }, 49 | { 50 | "type": "match", 51 | "id": "21007e8f-2d22-47aa-b588-4820d212be8d" 52 | }, 53 | { 54 | "type": "match", 55 | "id": "29f21813-5357-4fc3-b6bb-935ae349323a" 56 | }, 57 | { 58 | "type": "match", 59 | "id": "02a88f28-4da4-4b45-b920-b75f2ba54011" 60 | }, 61 | { 62 | "type": "match", 63 | "id": "6f06fdd0-34f9-4401-b6cc-a99e9745806d" 64 | }, 65 | { 66 | "type": "match", 67 | "id": "6158900a-dda0-48d2-b7eb-6ede85ddef7f" 68 | }, 69 | { 70 | "type": "match", 71 | "id": "442af35c-6078-477d-8d47-89c12680725c" 72 | }, 73 | { 74 | "type": "match", 75 | "id": "04425c6b-2d33-44cc-ba60-420a4dcc55ce" 76 | }, 77 | { 78 | "type": "match", 79 | "id": "41480579-68db-4125-9213-4bf946245c01" 80 | }, 81 | { 82 | "type": "match", 83 | "id": "ef4036e5-5486-4fc9-97d9-b68c5defa4f3" 84 | }, 85 | { 86 | "type": "match", 87 | "id": "3de20712-5112-45aa-a958-9749415d2d8a" 88 | }, 89 | { 90 | "type": "match", 91 | "id": "66ddb971-8033-4068-b84e-783b0960e1a7" 92 | }, 93 | { 94 | "type": "match", 95 | "id": "a8eb29d0-b9eb-44bb-88e8-c07ce16426ba" 96 | }, 97 | { 98 | "type": "match", 99 | "id": "0a1ae62c-e263-4a87-a9db-72d14baa4251" 100 | }, 101 | { 102 | "type": "match", 103 | "id": "2c3d7471-9394-4815-af7b-5f2208d5220c" 104 | }, 105 | { 106 | "type": "match", 107 | "id": "6c1aa348-d1b4-4ee5-a0aa-7b7981e878a8" 108 | }, 109 | { 110 | "type": "match", 111 | "id": "659420b1-2f47-413d-93ed-b8eb397f3592" 112 | }, 113 | { 114 | "type": "match", 115 | "id": "13a7f35a-8eea-45c0-873b-f756dc379d79" 116 | }, 117 | { 118 | "type": "match", 119 | "id": "ce8fdae8-8dad-4c02-bbfe-a6f7cd5a5b80" 120 | } 121 | ] 122 | } 123 | }, 124 | "links": { 125 | "self": "https://api.playbattlegrounds.com/shards/pc-na/players/account.d50fdc18fcad49c691d38466bed6f8fd", 126 | "schema": "" 127 | } 128 | } 129 | ], 130 | "links": { 131 | "self": "https://api.playbattlegrounds.com/shards/pc-na/players?filter[playerNames]=shroud" 132 | }, 133 | "meta": {} 134 | } -------------------------------------------------------------------------------- /tests/example/season_for_player.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "type": "playerSeason", 4 | "attributes": { 5 | "gameModeStats": { 6 | "duo": { 7 | "assists": 0, 8 | "boosts": 0, 9 | "dBNOs": 0, 10 | "dailyKills": 0, 11 | "damageDealt": 0, 12 | "days": 0, 13 | "headshotKills": 0, 14 | "heals": 0, 15 | "killPoints": 0, 16 | "kills": 0, 17 | "longestKill": 0, 18 | "longestTimeSurvived": 0, 19 | "losses": 0, 20 | "maxKillStreaks": 0, 21 | "mostSurvivalTime": 0, 22 | "revives": 0, 23 | "rideDistance": 0, 24 | "roadKills": 0, 25 | "roundMostKills": 0, 26 | "roundsPlayed": 0, 27 | "suicides": 0, 28 | "teamKills": 0, 29 | "timeSurvived": 0, 30 | "top10s": 0, 31 | "vehicleDestroys": 0, 32 | "walkDistance": 0, 33 | "weaponsAcquired": 0, 34 | "weeklyKills": 0, 35 | "winPoints": 0, 36 | "wins": 0 37 | }, 38 | "duo-fpp": { 39 | "assists": 0, 40 | "boosts": 0, 41 | "dBNOs": 0, 42 | "dailyKills": 0, 43 | "damageDealt": 0, 44 | "days": 0, 45 | "headshotKills": 0, 46 | "heals": 0, 47 | "killPoints": 0, 48 | "kills": 0, 49 | "longestKill": 0, 50 | "longestTimeSurvived": 0, 51 | "losses": 0, 52 | "maxKillStreaks": 0, 53 | "mostSurvivalTime": 0, 54 | "revives": 0, 55 | "rideDistance": 0, 56 | "roadKills": 0, 57 | "roundMostKills": 0, 58 | "roundsPlayed": 0, 59 | "suicides": 0, 60 | "teamKills": 0, 61 | "timeSurvived": 0, 62 | "top10s": 0, 63 | "vehicleDestroys": 0, 64 | "walkDistance": 0, 65 | "weaponsAcquired": 0, 66 | "weeklyKills": 0, 67 | "winPoints": 0, 68 | "wins": 0 69 | }, 70 | "solo": { 71 | "assists": 0, 72 | "boosts": 0, 73 | "dBNOs": 0, 74 | "dailyKills": 0, 75 | "damageDealt": 0, 76 | "days": 0, 77 | "headshotKills": 0, 78 | "heals": 0, 79 | "killPoints": 0, 80 | "kills": 0, 81 | "longestKill": 0, 82 | "longestTimeSurvived": 0, 83 | "losses": 0, 84 | "maxKillStreaks": 0, 85 | "mostSurvivalTime": 0, 86 | "revives": 0, 87 | "rideDistance": 0, 88 | "roadKills": 0, 89 | "roundMostKills": 0, 90 | "roundsPlayed": 0, 91 | "suicides": 0, 92 | "teamKills": 0, 93 | "timeSurvived": 0, 94 | "top10s": 0, 95 | "vehicleDestroys": 0, 96 | "walkDistance": 0, 97 | "weaponsAcquired": 0, 98 | "weeklyKills": 0, 99 | "winPoints": 0, 100 | "wins": 0 101 | }, 102 | "solo-fpp": { 103 | "assists": 0, 104 | "boosts": 0, 105 | "dBNOs": 0, 106 | "dailyKills": 0, 107 | "damageDealt": 0, 108 | "days": 0, 109 | "headshotKills": 0, 110 | "heals": 0, 111 | "killPoints": 0, 112 | "kills": 0, 113 | "longestKill": 0, 114 | "longestTimeSurvived": 0, 115 | "losses": 0, 116 | "maxKillStreaks": 0, 117 | "mostSurvivalTime": 0, 118 | "revives": 0, 119 | "rideDistance": 0, 120 | "roadKills": 0, 121 | "roundMostKills": 0, 122 | "roundsPlayed": 0, 123 | "suicides": 0, 124 | "teamKills": 0, 125 | "timeSurvived": 0, 126 | "top10s": 0, 127 | "vehicleDestroys": 0, 128 | "walkDistance": 0, 129 | "weaponsAcquired": 0, 130 | "weeklyKills": 0, 131 | "winPoints": 0, 132 | "wins": 0 133 | }, 134 | "squad": { 135 | "assists": 0, 136 | "boosts": 0, 137 | "dBNOs": 0, 138 | "dailyKills": 0, 139 | "damageDealt": 0, 140 | "days": 0, 141 | "headshotKills": 0, 142 | "heals": 0, 143 | "killPoints": 0, 144 | "kills": 0, 145 | "longestKill": 0, 146 | "longestTimeSurvived": 0, 147 | "losses": 0, 148 | "maxKillStreaks": 0, 149 | "mostSurvivalTime": 0, 150 | "revives": 0, 151 | "rideDistance": 0, 152 | "roadKills": 0, 153 | "roundMostKills": 0, 154 | "roundsPlayed": 0, 155 | "suicides": 0, 156 | "teamKills": 0, 157 | "timeSurvived": 0, 158 | "top10s": 0, 159 | "vehicleDestroys": 0, 160 | "walkDistance": 0, 161 | "weaponsAcquired": 0, 162 | "weeklyKills": 0, 163 | "winPoints": 0, 164 | "wins": 0 165 | }, 166 | "squad-fpp": { 167 | "assists": 0, 168 | "boosts": 0, 169 | "dBNOs": 0, 170 | "dailyKills": 0, 171 | "damageDealt": 0, 172 | "days": 0, 173 | "headshotKills": 0, 174 | "heals": 0, 175 | "killPoints": 0, 176 | "kills": 0, 177 | "longestKill": 0, 178 | "longestTimeSurvived": 0, 179 | "losses": 0, 180 | "maxKillStreaks": 0, 181 | "mostSurvivalTime": 0, 182 | "revives": 0, 183 | "rideDistance": 0, 184 | "roadKills": 0, 185 | "roundMostKills": 0, 186 | "roundsPlayed": 0, 187 | "suicides": 0, 188 | "teamKills": 0, 189 | "timeSurvived": 0, 190 | "top10s": 0, 191 | "vehicleDestroys": 0, 192 | "walkDistance": 0, 193 | "weaponsAcquired": 0, 194 | "weeklyKills": 0, 195 | "winPoints": 0, 196 | "wins": 0 197 | } 198 | } 199 | }, 200 | "relationships": { 201 | "player": { 202 | "data": { 203 | "type": "player", 204 | "id": "account.b3982540418d421f8cbf72705e49b1ad" 205 | } 206 | }, 207 | "matchesSolo": { 208 | "data": [] 209 | }, 210 | "matchesSoloFPP": { 211 | "data": [] 212 | }, 213 | "matchesDuo": { 214 | "data": [] 215 | }, 216 | "matchesDuoFPP": { 217 | "data": [] 218 | }, 219 | "matchesSquad": { 220 | "data": [] 221 | }, 222 | "matchesSquadFPP": { 223 | "data": [] 224 | }, 225 | "season": { 226 | "data": { 227 | "type": "season", 228 | "id": "division.bro.official.2017-beta" 229 | } 230 | } 231 | } 232 | }, 233 | "links": { 234 | "self": "https://api.playbattlegrounds.com/shards/pc-eu/players/account.b3982540418d421f8cbf72705e49b1ad/seasons/division.bro.official.2017-beta" 235 | }, 236 | "meta": {} 237 | } -------------------------------------------------------------------------------- /tests/example/seasons.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "type": "season", 5 | "id": "division.bro.official.2017-beta", 6 | "attributes": { 7 | "isCurrentSeason": false, 8 | "isOffseason": false 9 | } 10 | }, 11 | { 12 | "type": "season", 13 | "id": "division.bro.official.2017-pre1", 14 | "attributes": { 15 | "isCurrentSeason": false, 16 | "isOffseason": false 17 | } 18 | }, 19 | { 20 | "type": "season", 21 | "id": "division.bro.official.2017-pre2", 22 | "attributes": { 23 | "isCurrentSeason": false, 24 | "isOffseason": false 25 | } 26 | }, 27 | { 28 | "type": "season", 29 | "id": "division.bro.official.2017-pre3", 30 | "attributes": { 31 | "isCurrentSeason": false, 32 | "isOffseason": false 33 | } 34 | }, 35 | { 36 | "type": "season", 37 | "id": "division.bro.official.2017-pre4", 38 | "attributes": { 39 | "isCurrentSeason": false, 40 | "isOffseason": false 41 | } 42 | }, 43 | { 44 | "type": "season", 45 | "id": "division.bro.official.2017-pre5", 46 | "attributes": { 47 | "isCurrentSeason": false, 48 | "isOffseason": false 49 | } 50 | }, 51 | { 52 | "type": "season", 53 | "id": "division.bro.official.2017-pre6", 54 | "attributes": { 55 | "isCurrentSeason": false, 56 | "isOffseason": false 57 | } 58 | }, 59 | { 60 | "type": "season", 61 | "id": "division.bro.official.2017-pre7", 62 | "attributes": { 63 | "isCurrentSeason": false, 64 | "isOffseason": false 65 | } 66 | }, 67 | { 68 | "type": "season", 69 | "id": "division.bro.official.2017-pre8", 70 | "attributes": { 71 | "isCurrentSeason": false, 72 | "isOffseason": false 73 | } 74 | }, 75 | { 76 | "type": "season", 77 | "id": "division.bro.official.2017-pre9", 78 | "attributes": { 79 | "isCurrentSeason": false, 80 | "isOffseason": false 81 | } 82 | }, 83 | { 84 | "type": "season", 85 | "id": "division.bro.official.2018-01", 86 | "attributes": { 87 | "isCurrentSeason": false, 88 | "isOffseason": false 89 | } 90 | }, 91 | { 92 | "type": "season", 93 | "id": "division.bro.official.2018-02", 94 | "attributes": { 95 | "isCurrentSeason": false, 96 | "isOffseason": false 97 | } 98 | }, 99 | { 100 | "type": "season", 101 | "id": "division.bro.official.2018-03", 102 | "attributes": { 103 | "isOffseason": false, 104 | "isCurrentSeason": false 105 | } 106 | }, 107 | { 108 | "type": "season", 109 | "id": "division.bro.official.2018-04", 110 | "attributes": { 111 | "isCurrentSeason": false, 112 | "isOffseason": false 113 | } 114 | }, 115 | { 116 | "type": "season", 117 | "id": "division.bro.official.2018-05", 118 | "attributes": { 119 | "isCurrentSeason": false, 120 | "isOffseason": false 121 | } 122 | }, 123 | { 124 | "type": "season", 125 | "id": "division.bro.official.2018-06", 126 | "attributes": { 127 | "isOffseason": false, 128 | "isCurrentSeason": false 129 | } 130 | }, 131 | { 132 | "type": "season", 133 | "id": "division.bro.official.2018-07", 134 | "attributes": { 135 | "isCurrentSeason": true, 136 | "isOffseason": false 137 | } 138 | } 139 | ], 140 | "links": { 141 | "self": "https://api.playbattlegrounds.com/shards/pc-eu/seasons" 142 | }, 143 | "meta": {} 144 | } -------------------------------------------------------------------------------- /tests/example/status.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "type": "status", 4 | "id": "pubg-api", 5 | "attributes": { 6 | "releasedAt": "1900-01-01T01:00:00Z", 7 | "version": "DEVELOPMENT" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /tests/example/tournaments.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "type": "tournament", 5 | "id": "eu-pgiq18", 6 | "attributes": { 7 | "createdAt": "2018-06-28T13:17:16Z" 8 | } 9 | }, 10 | { 11 | "type": "tournament", 12 | "id": "sea-pgiq18", 13 | "attributes": { 14 | "createdAt": "2018-06-23T05:42:32Z" 15 | } 16 | }, 17 | { 18 | "type": "tournament", 19 | "id": "oc-pgiq18", 20 | "attributes": { 21 | "createdAt": "2018-06-22T00:00:00Z" 22 | } 23 | }, 24 | { 25 | "type": "tournament", 26 | "id": "sea-th-q18", 27 | "attributes": { 28 | "createdAt": "2018-06-21T09:47:44Z" 29 | } 30 | }, 31 | { 32 | "type": "tournament", 33 | "id": "cis-pgiq18", 34 | "attributes": { 35 | "createdAt": "2018-06-20T16:46:33Z" 36 | } 37 | }, 38 | { 39 | "type": "tournament", 40 | "id": "kr-pss18s2", 41 | "attributes": { 42 | "createdAt": "2018-06-17T03:40:44Z" 43 | } 44 | }, 45 | { 46 | "type": "tournament", 47 | "id": "ct-mpl18s1", 48 | "attributes": { 49 | "createdAt": "2018-06-15T09:29:17Z" 50 | } 51 | }, 52 | { 53 | "type": "tournament", 54 | "id": "kr-apl18s2", 55 | "attributes": { 56 | "createdAt": "2018-06-15T07:21:54Z" 57 | } 58 | }, 59 | { 60 | "type": "tournament", 61 | "id": "jp-pjs18s1", 62 | "attributes": { 63 | "createdAt": "2018-06-14T14:22:21Z" 64 | } 65 | }, 66 | { 67 | "type": "tournament", 68 | "id": "kr-pwm18s1", 69 | "attributes": { 70 | "createdAt": "2018-06-13T15:38:29Z" 71 | } 72 | } 73 | ], 74 | "links": { 75 | "self": "https://api.playbattlegrounds.com/tournaments" 76 | }, 77 | "meta": {} 78 | } --------------------------------------------------------------------------------