diff --git a/README.md b/README.md index 7248bb5..662ba57 100644 --- a/README.md +++ b/README.md @@ -24,4 +24,4 @@ Make sure you have made/performed your migrations along with updating your `User Thanks to these libs which led me to make this - https://github.com/Ehesp/Steam-Login (Parts of code used and re-purposed for laravel) -- https://github.com/invisnik/laravel-steam-auth (Getting me to create a laravel steam auth that isn't shit, your code *totally* doesn't look like Ehesp's you cuck. For others reading this compare the code, invisnik can't even give proper credit) +- https://github.com/invisnik/laravel-steam-auth (Getting me to create a laravel steam auth that isn't bad, couldn't bother giving credit to Ehesp after *stealing* his code) diff --git a/src/SteamLogin.php b/src/SteamLogin.php index 12a5a80..4c7abef 100644 --- a/src/SteamLogin.php +++ b/src/SteamLogin.php @@ -105,7 +105,7 @@ public function __construct(Application $app) $this->app = $app; $this->request = $app->request; $this->guzzle = new GuzzleClient(); - $this->https = $this->request->server('HTTP_X_FORWARDED_PROTO') == 'https' ?? isset($_SERVER['https']); + $this->https = $this->request->server('HTTP_X_FORWARDED_PROTO') === 'https' ?? isset($_SERVER['https']); $previousPage = url()->previous(); $this->loginRoute = route(Config::get('steam-login.routes.login')); @@ -150,11 +150,11 @@ public function setReturnUrl(string $return) /** * Build the steam openid login URL. * - * @param null $return + * @param string|null $return * * @return string */ - public function createLoginUrl($return = null): string + public function createLoginUrl(?string $return = null): string { $params = [ 'openid.ns' => self::OPENID_SPECS, @@ -269,7 +269,7 @@ public function validate(): ?string preg_match('#^https?://steamcommunity.com/openid/id/([0-9]{17,25})#', $this->request->input('openid_claimed_id'), $matches); $steamid = is_numeric($matches[1]) ? $matches[1] : 0; - $steamid = preg_match("#is_valid\s*:\s*true#i", $result) == 1 ? $steamid : null; + $steamid = preg_match("#is_valid\s*:\s*true#i", $result) === 1 ? $steamid : null; return $steamid; } @@ -295,6 +295,6 @@ public function loginButton(string $type = 'small'): string */ public static function button(string $type = 'small'): string { - return 'https://steamcommunity-a.akamaihd.net/public/images/signinthroughsteam/sits_0'.($type == 'small' ? 1 : 2).'.png'; + return 'https://steamcommunity-a.akamaihd.net/public/images/signinthroughsteam/sits_0'.($type === 'small' ? 1 : 2).'.png'; } } diff --git a/src/SteamLoginServiceProvider.php b/src/SteamLoginServiceProvider.php index 1fc9fa0..a1447c5 100644 --- a/src/SteamLoginServiceProvider.php +++ b/src/SteamLoginServiceProvider.php @@ -6,13 +6,6 @@ class SteamLoginServiceProvider extends ServiceProvider { - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = false; - /** * Bootstrap any application services. * diff --git a/src/SteamUser.php b/src/SteamUser.php index 0a615d5..0314a98 100644 --- a/src/SteamUser.php +++ b/src/SteamUser.php @@ -115,8 +115,8 @@ public function __construct($steamId, GuzzleClient $guzzle = null) $this->fluent = new Fluent($this->attributes); - $this->method = Config::get('steam-login.method', 'xml') == 'api' ? 'api' : 'xml'; - $this->profileDataUrl = $this->method == 'xml' ? $this->attributes->profileDataUrl : sprintf(self::STEAM_PLAYER_API, Config::get('steam-login.api_key'), $this->attributes->steamId); + $this->method = Config::get('steam-login.method', 'xml') === 'api' ? 'api' : 'xml'; + $this->profileDataUrl = $this->method === 'xml' ? $this->attributes->profileDataUrl : sprintf(self::STEAM_PLAYER_API, Config::get('steam-login.api_key'), $this->attributes->steamId); } /** @@ -186,7 +186,7 @@ public function getUserInfo(): self private function userInfo() { $this->response = $this->guzzle->get($this->profileDataUrl, ['connect_timeout' => Config::get('steam-login.timeout')]); - $data = $this->method == 'xml' ? simplexml_load_string($this->response->getBody(), 'SimpleXMLElement', LIBXML_NOCDATA) : json_decode($this->response->getBody()); + $data = $this->method === 'xml' ? simplexml_load_string($this->response->getBody(), 'SimpleXMLElement', LIBXML_NOCDATA) : json_decode($this->response->getBody()); switch ($this->method) { case 'api': @@ -196,7 +196,7 @@ private function userInfo() $this->attributes->name = $data->personaname; $this->attributes->realName = isset($data->realname) ? $data->realname : null; $this->attributes->profileUrl = $data->profileurl; - $this->attributes->privacyState = $data->communityvisibilitystate == 3 ? 'Public' : 'Private'; + $this->attributes->privacyState = $data->communityvisibilitystate === 3 ? 'Public' : 'Private'; $this->attributes->visibilityState = $data->communityvisibilitystate; $this->attributes->isOnline = $data->personastate != 0; $this->attributes->onlineState = isset($data->gameid) ? 'In-Game' : ($data->personastate != 0 ? 'Online' : 'Offline'); @@ -212,10 +212,10 @@ private function userInfo() $this->attributes->name = (string) $data->steamID; $this->attributes->realName = isset($data->realName) ? $data->realName : null; $this->attributes->profileUrl = isset($data->customURL) ? 'https://steamcommunity.com/id/'.$data->customURL : $this->attributes->accountUrl; - $this->attributes->privacyState = $data->privacyState == 'public' ? 'Public' : 'Private'; + $this->attributes->privacyState = $data->privacyState === 'public' ? 'Public' : 'Private'; $this->attributes->visibilityState = (int) $data->visibilityState; $this->attributes->isOnline = $data->onlineState != 'offline'; - $this->attributes->onlineState = $data->onlineState == 'in-game' ? 'In-Game' : ucfirst($data->onlineState); + $this->attributes->onlineState = $data->onlineState === 'in-game' ? 'In-Game' : ucfirst($data->onlineState); // todo: stateMessage $this->attributes->avatarSmall = $this->attributes->avatarIcon = (string) $data->avatarIcon; $this->attributes->avatarMedium = (string) $data->avatarMedium;