Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SteamID to WebAPI #14

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Miscellaneous unimportant OS files.
.DS_Store
thumbs.db

# Composer ignores
/vendor/*
composer.lock
59 changes: 59 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Contribution Guidelines
=======================

First of all, each single contribution is appreciated, whether a typo fix,
improved documentation, a fixed bug or a whole new feature.

## Making your changes

1. Fork the repository on GitHub
2. Create a topic branch with a descriptive name, e.g. `fix-issue-123` or
`feature-x`
3. Make your modifications, complying with the
[code conventions](#code-conventions)
4. Commit small logical changes, each with a descriptive commit message.
Please don't mix unrelated changes in a single commit.

## Commit messages

Please format your commit messages as follows:

Short summary of the change (up to 50 characters)

Optionally add a more extensive description of your change after a
blank line. Wrap the lines in this and the following paragraphs after
72 characters.

## Submitting your changes

1. Push your changes to a topic branch in your fork of the repository.
2. [Submit a pull request][pr] to the original repository.
Describe your changes as short as possible, but as detailed as needed for
others to get an overview of your modifications.
3. *Optionally*, [open an issue][issue] in the meta-repository if your change
might be relevant to other implementations of Steam Condenser. Please add a
link to your pull request.

## Code conventions

* White spaces:
* Indent using 4 spaces
* Line endings must be line feeds (\n)
* Add a newline at end of file
* Name conventions:
* `UpperCamelCase` for classes
* `lowerCamelCase` for fields, methods and variables
* `UPPER_CASE` for constants

## Further information

* [General GitHub documentation][gh-help]
* [GitHub pull request documentation][gh-pr]
* [Google group][mail]
* \#steam-condenser on freenode.net

[gh-help]: https://help.github.com
[gh-pr]: https://help.github.com/send-pull-requests
[issue]: https://github.com/koraktor/steam-condenser/issues/new
[mail]: https://groups.google.com/group/steam-condenser
[pr]: https://github.com/koraktor/steam-condenser-php/pull/new
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ included LICENSE file.

## See Also

* [Steam Condenser home](https://koraktor.de/steam-condenser)
* [Steam Condenser home](http://koraktor.de/steam-condenser)
* [GitHub project page](https://github.com/koraktor/steam-condenser)
* [Wiki](https://github.com/koraktor/steam-condenser/wiki)
* [Google group](http://groups.google.com/group/steam-condenser)
* [Ohloh profile](http://www.ohloh.net/projects/steam-condenser)

Follow Steam Condenser on Twitter
[@steamcondenser](http://twitter.com/steamcondenser).
Follow Steam Condenser on Google Plus+ via
[+Steam Condenser](https://plus.google.com/b/109400543549250623875/109400543549250623875)
or on Twitter via [@steamcondenser](https://twitter.com/steamcondenser).
3 changes: 2 additions & 1 deletion lib/exceptions/SocketException.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ class SocketException extends SteamCondenserException {
* extension or with the given message.
*
* @param int|string $errorCode The error code or message
* @see socket_lasterror()s
* @see socket_lasterror()
* @see socket_strerror()
*/
public function __construct($errorCode) {
if (is_string($errorCode)) {
$errorMessage = $errorCode;
$errorCode = null;
} else {
$this->errorCode = $errorCode;
$errorMessage = socket_strerror($errorCode) . " (Code: $errorCode)";
Expand Down
2 changes: 1 addition & 1 deletion lib/exceptions/WebApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct($cause, $statusCode = null, $statusMessage = '') {
$message = 'Your Web API request has been rejected. You most likely did not specify a valid Web API key.';
break;
default:
$message = 'An unexpected error occured while executing a Web API request.';
$message = 'An unexpected error occurred while executing a Web API request.';
}

parent::__construct($message);
Expand Down
4 changes: 2 additions & 2 deletions lib/steam/community/GameStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static function createGameStats($steamId, $gameName) {
}

/**
* Returns the base Steam Communtiy URL for the given player and game IDs
* Returns the base Steam Community URL for the given player and game IDs
*
* @param string $userId The 64bit SteamID or custom URL of the user
* @param mixed $gameId The application ID or short name of the game
Expand Down Expand Up @@ -195,7 +195,7 @@ public function getAchievementsPercentage() {
}

/**
* Returns the base Steam Communtiy URL for the stats contained in this
* Returns the base Steam Community URL for the stats contained in this
* object
*
* @return string The base URL used for queries on these stats
Expand Down
16 changes: 16 additions & 0 deletions lib/steam/community/SteamGame.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,22 @@ public function getPlayerCount() {
return $result->response->player_count;
}

/**
* Returns the schema of this game
*
* @return stdClass The schema for the game.
*/
public function getSchemaForGame() {
if ( empty($this->schema) ) {
$params = array('appid' => $this->appId);
$result = WebApi::getJSON('ISteamUserStats', 'GetSchemaForGame', 2, $params);
$result = json_decode($result);
$this->schema = $result->game;
}

return $this->schema;
}

/**
* Returns the short name of this game (also known as "friendly name")
*
Expand Down
Loading