/**
  * Searches Steam for a user and returns their data if successful
  * 
  * @return json
  */
 public function search()
 {
     $id = Input::all()[0];
     // If the id is not fully numeric, assume it's a Steam ID, and convert it to a Community ID
     if (!is_numeric($id)) {
         try {
             $id = SteamId::convertSteamIdToCommunityId($id);
         } catch (Exception $e) {
             return $this->jsonResponse(400, false, $e->getMessage());
         }
     }
     // Grab user details from Steam
     try {
         $steamObject = new SteamId($id);
     } catch (Exception $e) {
         return $this->jsonResponse(400, false, $e->getMessage());
     }
     return $this->jsonResponse(200, true, 'User profile found!', ['community_id' => $steamObject->getSteamId64(), 'nickname' => $steamObject->getNickname(), 'avatar' => $steamObject->getMediumAvatarUrl()]);
 }
 public function testBaseUrlSteamId64()
 {
     $steamId = new SteamId('76561197983311154', false);
     $this->assertEquals('76561197983311154', $steamId->getSteamId64());
     $baseUrl = (new \ReflectionObject($steamId))->getMethod('getBaseUrl');
     $baseUrl->setAccessible(true);
     $this->assertEquals('http://steamcommunity.com/profiles/76561197983311154', $baseUrl->invoke($steamId));
 }
 public function testBaseUrlSteamId64()
 {
     $steamId = new SteamId('76561197983311154', false);
     $this->assertEquals('76561197983311154', $steamId->getSteamId64());
     $this->assertEquals('http://steamcommunity.com/profiles/76561197983311154', $steamId->getBaseUrl());
 }