/** * 通过授权获取用户. * * @param string $to * @param string $state * @param string $scope * * @return array | null */ public function authorize($to = null, $scope = 'snsapi_base', $state = 'STATE') { if (!$this->input->get('state') && !$this->input->get('code')) { $this->redirect($to, $scope, $state); } return $this->user(); }
/** * 魔术调用 * * @param string $method * @param array $args * * @return mixed */ public function __call($method, $args) { if (in_array($method, $this->events, true)) { $callback = array_shift($args); is_callable($callback) && $this->listeners->set($method, $callback); return; } }
/** * 图片素材总数. * * @param string $type * @param int 应用id * * @return array|int */ public function stats($type = null, $agentId) { $response = $this->http->get(self::API_FOREVER_COUNT . '?agentid=' . $agentId); $response = new Bag($response); return $type ? $response->get($type) : $response; }
/** * constructor. */ public function __construct() { parent::__construct(array_merge($_GET, $_POST)); }