url = $api_url; $this->token = $api_token; } public function load() { $jenc = $this->mget("", ""); $this->json_set_property($this->json_decode($jenc)); return $this; } public function get($scope) { $s = substr($scope, strrpos($scope, "/") + 1); echo sprintf("Scope: %s\b", $s); switch ($s) { case "repos": return new Repos($this->url . $scope, $this->token); } } private function json_decode($jenc) { $obj = json_decode($jenc); if (($err = json_last_error()) != JSON_ERROR_NONE) throw new RequestErrorException(json_last_error_msg(), $err); return $obj; } abstract protected function json_set_property($obj); } ?>