123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace Client\Request {
- class User extends RequestBase {
- public $uid;
- public $ulogin;
- public $ufull_name;
- public $uemail;
- public $uavatar_url;
- public $uusername;
- protected $_scope = "/user";
- public function __construct($api_url, $api_token, $user) {
- if (strlen($user) != 0)
- $this->_scope .= "s/" . $user;
- parent::__construct($api_url, $api_token);
- }
- protected function set_scope() {
- $this->url .= $this->_scope;
- }
- public function load($force = true) {
- $ret = parent::load($force);
- //$this->url = API_URL . "/users/" . $this->ulogin;
- return $ret;
- }
- public function get($scope) {
- switch ($scope) {
- case "/repos":
- return new User\Repos($this->url, $this->token);
- case "/tokens":
- return new User\Tokens($this->url, $this->token);
- }
- }
- protected function json_set_property($obj) {
- foreach ($obj as $key => $value) {
- $key = 'u' . $key;
- if (property_exists($this, $key))
- $this->{$key} = $value;
- }
- }
- }
- }
- ?>
|