Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit 4fa5e46

Browse files
committed
Add Xbox and Playstation support
1 parent 8264cea commit 4fa5e46

File tree

6 files changed

+25
-8
lines changed

6 files changed

+25
-8
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "curse/smite-api",
2+
"name": "team-reflex/smite-api",
33
"type": "library",
44
"description": "Easy access to the Hi-Rez Studios API for Smite",
55
"homepage": "https://github.com/CurseStaff/SmitePHP",
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"autoload": {
21-
"psr-4": {"Curse\\Smite\\": "src/"}
21+
"psr-4": {"Reflex\\Smite\\": "src/"}
2222
},
2323
"require": {
2424
"php": ">=5.4.0",

src/API.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* View the LICENSE file distributed with the source code
55
* for copyright information and available license.
66
*/
7-
namespace Curse\Smite;
7+
namespace Reflex\Smite;
88

99
use GuzzleHttp\Client;
1010
use Onoi\Cache\Cache;
@@ -51,6 +51,12 @@ class API {
5151
*/
5252
private $authKey;
5353

54+
/**
55+
* Platform URL to query.
56+
* @var string
57+
*/
58+
private $platform;
59+
5460
/**
5561
* How long a session with the API is valid. Default: 15 minutes.
5662
* Issue a request to getdataused to find out what your limits are.
@@ -122,7 +128,7 @@ public function getSession() {
122128
* @param GuzzleHttp\Client $guzzle [optional]
123129
* @throws InvalidArgumentException
124130
*/
125-
public function __construct ($devId, $authKey, Client $guzzle = null){
131+
public function __construct ($devId, $authKey, $platform, Client $guzzle = null){
126132
if (!$devId) {
127133
throw new InvalidArgumentException("You need to pass a Dev Id");
128134
}
@@ -132,6 +138,7 @@ public function __construct ($devId, $authKey, Client $guzzle = null){
132138

133139
$this->devId = $devId;
134140
$this->authKey = $authKey;
141+
$this->platform = $platform;
135142
if (is_null($guzzle)) {
136143
$this->guzzleClient = new Client();
137144
} else {

src/ApiException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* View the LICENSE file distributed with the source code
55
* for copyright information and available license.
66
*/
7-
namespace Curse\Smite;
7+
namespace Reflex\Smite;
88
use Exception;
99

1010
class ApiException extends Exception {

src/Platform.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Reflex\Smite;
4+
5+
abstract class Platform
6+
{
7+
const PC = 'http://api.smitegame.com/smiteapi.svc';
8+
const XBOX = 'http://api.xbox.smitegame.com/smiteapi.svc';
9+
const PS = 'http://api.ps4.smitegame.com/smiteapi.svc';
10+
}

src/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* View the LICENSE file distributed with the source code
55
* for copyright information and available license.
66
*/
7-
namespace Curse\Smite;
7+
namespace Reflex\Smite;
88

99
use GuzzleHttp\Client;
1010
use GuzzleHttp\Exception\TransferException;
@@ -212,7 +212,7 @@ private function buildRequestUrl() {
212212
}
213213

214214
// base url for api endpoint, always json data
215-
$url = self::$smiteAPIUrl . $this->method . 'json';
215+
$url = $this->api->platform . $this->method . 'json';
216216

217217
// put the main URL at the beginning of our args
218218
array_unshift($this->args, $url);

src/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* View the LICENSE file distributed with the source code
55
* for copyright information and available license.
66
*/
7-
namespace Curse\Smite;
7+
namespace Reflex\Smite;
88

99
class Session {
1010
/**

0 commit comments

Comments
 (0)