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

Applied fixes from StyleCI #3

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,4 @@ public function login($path = DATA_DIR . '/cookies.txt') {

return $result;
}

}
}
9 changes: 4 additions & 5 deletions src/JKetelaar/fut/bot/ImprovedEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
use MyCLabs\Enum\Enum;

/**
* Class ImprovedEnum
* Class ImprovedEnum.
* @package JKetelaar\fut\bot
* @method static ImprovedEnum _DEFAULT()
*/
class ImprovedEnum extends Enum {

/**
* @param string $key
*
* @param bool $returnObject
* @param bool $returnObject
*
* @param null $default
* @param null $default
*
* @return null|ImprovedEnum|object
*/
Expand Down Expand Up @@ -64,4 +63,4 @@ public static function findByValue($value, $returnObject = false, $default = nul
public function getName() {
return ucwords(str_replace('_', ' ', strtolower($this->getKey())));
}
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/ResultParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
namespace JKetelaar\fut\bot;

interface ResultParser {

/**
* @param array $result
*
* @return object
*/
public static function toObject($result);
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/config/Comparisons.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace JKetelaar\fut\bot\config;

abstract class Comparisons {

const MAIN_LOGIN_TITLE = 'Log In';
const LOGIN_FORM_TITLE = 'Login Verification';
const NO_AUTHENTICATOR_FORM_TITLE = 'Set Up an App Authenticator';
Expand All @@ -15,4 +14,4 @@ abstract class Comparisons {
const CORRECT_ANSWER = 'Answer is correct.';
const CAPTCHA_BODY_CODE = 459;

}
}
4 changes: 2 additions & 2 deletions src/JKetelaar/fut/bot/config/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ abstract class Configuration {
'locale' => 'en-GB',
'method' => 'authcode',
'priorityLevel' => 4,
'identification' => [ 'authCode' => '' ],
'identification' => ['authCode' => ''],
];

// HTML Classes
const SIGN_OUT_CLASS = 'eas-nav-global_text--login';
}
}
2 changes: 1 addition & 1 deletion src/JKetelaar/fut/bot/config/URL.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ abstract class URL {
const API_STATUS = '/ut/game/fifa17/trade/status?';
const API_ITEM = '/ut/game/fifa17/item';
const API_DEF = '/ut/game/fifa17/defid?type=player&count=35&start=0&defId=%s'; // Replaceable %s
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/errors/CaptchaException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
namespace JKetelaar\fut\bot\errors;

class CaptchaException extends \Exception {

/**
* CaptchaException constructor.
*/
public function __construct() {
parent::__construct('Your account received a captcha, unfortunately a solution is not yet implemented');
}
}
}
7 changes: 2 additions & 5 deletions src/JKetelaar/fut/bot/errors/NonExistingTokenFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
namespace JKetelaar\fut\bot\errors;

class NonExistingTokenFunction extends \Exception {

/**
* NonExistingTokenFunction constructor.
*/
public function __construct() {
parent::__construct("Provided string is not a valid function to provide a token");
parent::__construct('Provided string is not a valid function to provide a token');
}


}
}
5 changes: 2 additions & 3 deletions src/JKetelaar/fut/bot/errors/NulledTokenFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
namespace JKetelaar\fut\bot\errors;

class NulledTokenFunction extends \Exception {

/**
* NulledTokenFunction constructor.
*/
public function __construct() {
parent::__construct("Token function gave a null value");
parent::__construct('Token function gave a null value');
}
}
}
5 changes: 2 additions & 3 deletions src/JKetelaar/fut/bot/errors/UnknownPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
namespace JKetelaar\fut\bot\errors;

class UnknownPlatform extends \Exception {

/**
* UnknownPlatform constructor.
*/
public function __construct() {
parent::__construct("Platform provided is unknown");
parent::__construct('Platform provided is unknown');
}
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/errors/login/BaseLoginException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace JKetelaar\fut\bot\errors\login;

class BaseLoginException extends \Exception {

/**
* BaseLoginException constructor.
*
Expand All @@ -16,4 +15,4 @@ class BaseLoginException extends \Exception {
public function __construct($message, $errorCode) {
parent::__construct($message . "\n" . 'With error code: ' . $errorCode);
}
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/errors/login/MainLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace JKetelaar\fut\bot\errors\login;

class MainLogin extends BaseLoginException {

/**
* MainLogin constructor.
*
Expand All @@ -19,4 +18,4 @@ public function __construct($errorCode, $message = null) {
$errorCode
);
}
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/errors/market/IncorrectEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace JKetelaar\fut\bot\errors\market;

class IncorrectEndpoint extends \Exception {

/**
* IncorrectEndpoint constructor.
*
Expand All @@ -15,4 +14,4 @@ class IncorrectEndpoint extends \Exception {
public function __construct($url) {
parent::__construct('Incorrect url given, should be without host. Path only; ' . $url);
}
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/errors/market/IncorrectHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
namespace JKetelaar\fut\bot\errors\market;

class IncorrectHeaders extends \Exception {

/**
* IncorrectHeaders constructor.
*/
public function __construct() {
parent::__construct('Headers parameter should either be null or have associative keys');
}
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/errors/market/MarketError.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace JKetelaar\fut\bot\errors\market;

class MarketError extends \Exception {

/**
* MarketError constructor.
*
Expand All @@ -29,4 +28,4 @@ public function __construct($message = null, $code = null, $response = null) {

parent::__construct($message);
}
}
}
5 changes: 1 addition & 4 deletions src/JKetelaar/fut/bot/errors/market/UnknownEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@

namespace JKetelaar\fut\bot\errors\market;

use Exception;

class UnknownEndpoint extends \Exception {
public function __construct($endpoint) {
parent::__construct(
'Endpoint given is unknown: ' . $endpoint
);
}

}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/errors/market/UnparsableEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
namespace JKetelaar\fut\bot\errors\market;

class UnparsableEndpoint extends \Exception {

/**
* UnparsableEndpoint constructor.
*/
public function __construct($url) {
parent::__construct('Could not parse given path with the host; ' . $url);
}
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/market/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace JKetelaar\fut\bot\market;

class Currency {

const TAG = 'currencies';

/**
Expand Down Expand Up @@ -57,4 +56,4 @@ public function getFinalFunds() {
public function getName() {
return $this->name;
}
}
}
25 changes: 12 additions & 13 deletions src/JKetelaar/fut/bot/market/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use JKetelaar\fut\bot\user\User;

class Handler {

/**
* @var Curl
*/
Expand All @@ -42,7 +41,7 @@ public function __construct(Curl $curl, User $user) {
}

/**
* TODO: Still in development, throws errors
* TODO: Still in development, throws errors.
*
* @deprecated
*
Expand All @@ -51,7 +50,7 @@ public function __construct(Curl $curl, User $user) {
* @return ItemData
*/
public function getDefinition($assetId) {
return ItemData::toObject($this->sendRequest(sprintf(URL::API_DEF, $assetId))[ ItemData::TAG ][ 0 ]);
return ItemData::toObject($this->sendRequest(sprintf(URL::API_DEF, $assetId))[ItemData::TAG][0]);
}

/**
Expand All @@ -60,14 +59,14 @@ public function getDefinition($assetId) {
* @param array $data
* @param null $headers
*
* @param bool $anonymous
* @param bool $anonymous
*
* @return array|bool|null|string
* @throws IncorrectEndpoint
* @throws IncorrectHeaders
* @throws MarketError
* @throws UnknownEndpoint
* @throws UnparsableEndpoint
* @return array|bool|null|string
*/
public function sendRequest($url, Method $method = null, $data = [], $headers = null, $anonymous = false) {
if($method === null) {
Expand All @@ -94,7 +93,7 @@ public function sendRequest($url, Method $method = null, $data = [], $headers =
if(filter_var($url, FILTER_VALIDATE_URL) !== false) {
throw new IncorrectEndpoint($url);
} else {
$url = $this->user->getHeaders()[ Configuration::X_UT_ROUTE_PARAM ] . $url;
$url = $this->user->getHeaders()[Configuration::X_UT_ROUTE_PARAM] . $url;
if(filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new UnparsableEndpoint($url);
}
Expand Down Expand Up @@ -129,7 +128,7 @@ public function sendRequest($url, Method $method = null, $data = [], $headers =
*/
public function getTradepile() {
$auctions = [];
foreach(($request = $this->sendRequest(URL::API_TRADEPILE)[ Trade::TAG ]) as $auction) {
foreach(($request = $this->sendRequest(URL::API_TRADEPILE)[Trade::TAG]) as $auction) {
$auctions[] = Trade::toObject($auction);
}

Expand All @@ -142,21 +141,21 @@ public function getWatchlist() {

public function getCredits() {
$result = $this->sendRequest(URL::API_CREDITS);
if(isset($result[ 'credits' ])) {
return $result[ 'credits' ];
if(isset($result['credits'])) {
return $result['credits'];
}

return null;
}

public function getCurrencies() {
$result = $this->sendRequest(URL::API_CREDITS);
if(isset($result[ Currency::TAG ])) {
if(isset($result[Currency::TAG])) {
$currencies = [];

foreach($result[ Currency::TAG ] as $currency) {
foreach($result[Currency::TAG] as $currency) {
$currencies[] = new Currency(
$currency[ 'name' ], $currency[ 'funds' ], $currency[ 'finalFunds' ]
$currency['name'], $currency['funds'], $currency['finalFunds']
);
}

Expand All @@ -165,4 +164,4 @@ public function getCurrencies() {

return null;
}
}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/market/handler/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
use MyCLabs\Enum\Enum;

class Method extends Enum {

const GET = 'GET';
const POST = 'POST';
const PUT = 'PUT';
const DELETE = 'DELETE';

}
}
3 changes: 1 addition & 2 deletions src/JKetelaar/fut/bot/market/items/AbstractItemType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use JKetelaar\fut\bot\market\items\misc\Formation;

abstract class AbstractItemType {

/**
* @var int
*/
Expand Down Expand Up @@ -106,4 +105,4 @@ public function getMarketDataMaxPrice() {
public function getFormation() {
return $this->formation;
}
}
}
Loading