scope = "/users"; } } /** * Returns a new user object. If arguments * is specified the user will be "created". * * The arguments can be left out to "create" the * user through the user object iteself. * * @param ...$args User->create arguments * @return \User */ public function create(...$args) { $user = new User($this->url, $this->token, "-"); if (count($args) != 0) $user->create(...$args); return $user; } public function get(string $s = "") { if ($this->by_key($s)) return $this->by_key($s); $user = (new User($this->url, $this->token, $s))->load(); $this->add($user, $user->ulogin); return $user; } public function search(array $params = array()) { if (!isset($params["name"]) && !isset($params['q'])) throw new SearchParamException("Missing param |"); if (isset($params["name"])) { $params["q"] = $params["name"]; unset($params["name"]); } $jenc = $this->method_get("/search", $params); $this->json_set_property($this->json_decode($jenc)); return $this; } protected function json_set_property($obj) { if (isset($obj->data)) { foreach($obj->data as $key => $val) { $user = new User($this->url, $this->token, $val->login); $user->json_set_property($val); $this->add($user, $user->ulogin); } } } }