1 | <?php |
||
7 | class Auth extends BaseApi |
||
8 | { |
||
9 | /** |
||
10 | * Betfair API endpoint for authentication requests |
||
11 | */ |
||
12 | const ENDPOINT = 'https://identitysso.betfair.com/api/'; |
||
13 | |||
14 | /** |
||
15 | * 4 hours, expressed in seconds |
||
16 | */ |
||
17 | const SESSION_LENGTH = 4 * 60 * 60; |
||
18 | |||
19 | /** |
||
20 | * API fail status |
||
21 | */ |
||
22 | const API_STATUS_FAIL = 'FAIL'; |
||
23 | |||
24 | /** |
||
25 | * Application key, provided by Betfair on registration |
||
26 | */ |
||
27 | public static $appKey = null; |
||
28 | |||
29 | /** |
||
30 | * Session token, provided by Betfair at login |
||
31 | */ |
||
32 | public static $sessionToken = null; |
||
33 | |||
34 | /** |
||
35 | * Time of last login, expressed in seconds since the Unix Epoch |
||
36 | */ |
||
37 | public static $lastLogin = null; |
||
38 | |||
39 | /** |
||
40 | * Wrapper method for other methods to initiate and manage a Betfair session |
||
41 | * |
||
42 | * @param string $appKey |
||
43 | * @param string $username |
||
44 | * @param string $password |
||
45 | */ |
||
46 | public function init($appKey, $username, $password) |
||
55 | |||
56 | /** |
||
57 | * Accept app key and session token and extend session |
||
58 | * |
||
59 | * @param string $appKey |
||
60 | * @param string $sessionToken |
||
61 | * @return string |
||
62 | */ |
||
63 | public function persist($appKey, $sessionToken) |
||
74 | |||
75 | /** |
||
76 | * Method to directly execute Betfair login request. |
||
77 | * For use only when the init() method isn't appropriate |
||
78 | * |
||
79 | * @param string $appKey |
||
80 | * @param string $username |
||
81 | * @param string $password |
||
82 | * @return string |
||
83 | * @throws Exception |
||
84 | */ |
||
85 | public function login($appKey, $username, $password) |
||
100 | |||
101 | /** |
||
102 | * Execute Betfair API call to extend the current session |
||
103 | * |
||
104 | * @return string |
||
105 | * @throws Exception |
||
106 | */ |
||
107 | public function keepAlive() |
||
115 | |||
116 | /** |
||
117 | * Execute Betfair API call to logout from their system. |
||
118 | * Clear all local references to the session. |
||
119 | * |
||
120 | * @throws Exception |
||
121 | */ |
||
122 | public function logout() |
||
130 | |||
131 | /** |
||
132 | * Calculate and provide the time remaining until the current session token expires |
||
133 | * |
||
134 | * @return integer |
||
135 | */ |
||
136 | public function sessionRemaining() |
||
144 | |||
145 | public function execute($request) |
||
155 | } |
||
156 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.