1 | <?php |
||
15 | class WrapItPushHelper { |
||
16 | |||
17 | private $access_token = null; |
||
18 | |||
19 | private $client_id = null; |
||
20 | private $client_secret = null; |
||
21 | private $domain = null; |
||
22 | |||
23 | private $requester; |
||
24 | |||
25 | 10 | public function __construct($wi, $access_token = null) { |
|
36 | |||
37 | 10 | private function getAccessToken() { |
|
38 | 10 | if ($this->access_token != null) { |
|
39 | 5 | return $this->access_token; |
|
40 | } |
||
41 | |||
42 | 5 | $apirequester = new WrapItApiRequester($this->domain); |
|
43 | |||
44 | 5 | $data = $apirequester->post("access_token", array( |
|
45 | 5 | "client_id" => $this->client_id, |
|
46 | 5 | "client_secret" => $this->client_secret, |
|
47 | 2 | "grant_type" => "app_token" |
|
48 | 3 | )); |
|
49 | |||
50 | 5 | if (isset($data["access_token"])) { |
|
51 | 5 | $this->access_token = $data["access_token"]; |
|
52 | 5 | return $this->access_token; |
|
53 | } else if (isset($data["error"])) { |
||
54 | throw new WrapItParameterException($data["error"]["message"]); |
||
55 | } |
||
56 | throw new WrapItParameterException("Invalid domain or client credentials"); |
||
57 | } |
||
58 | |||
59 | public function sendPush($userid, $data) { |
||
62 | |||
63 | public function getPushTemplate() { |
||
87 | |||
88 | } |
||
89 |
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.