1 | <?php |
||
37 | class Guard extends ServerGuard |
||
38 | { |
||
39 | const EVENT_AUTHORIZED = 'authorized'; |
||
40 | const EVENT_UNAUTHORIZED = 'unauthorized'; |
||
41 | const EVENT_UPDATE_AUTHORIZED = 'updateauthorized'; |
||
42 | const EVENT_COMPONENT_VERIFY_TICKET = 'component_verify_ticket'; |
||
43 | |||
44 | /** |
||
45 | * Container in the scope of the open platform authorization. |
||
46 | * |
||
47 | * @var Container |
||
48 | */ |
||
49 | protected $container; |
||
50 | |||
51 | /** |
||
52 | * Guard constructor. |
||
53 | * |
||
54 | * @param string $token |
||
55 | * @param Request $request |
||
56 | */ |
||
57 | public function __construct($token, Request $request = null) |
||
61 | |||
62 | /** |
||
63 | * Sets the container for use of event handlers. |
||
64 | * |
||
65 | * @param Container $container |
||
66 | * |
||
67 | * @see getDefaultHandler() |
||
68 | */ |
||
69 | public function setContainer(Container $container) |
||
73 | |||
74 | /** |
||
75 | * @inheritdoc |
||
76 | */ |
||
77 | public function serve() |
||
92 | |||
93 | /** |
||
94 | * Return for laravel-wechat. |
||
95 | * |
||
96 | * @return array |
||
97 | */ |
||
98 | public function listServe() |
||
109 | |||
110 | /** |
||
111 | * Listen for wechat push event. |
||
112 | * |
||
113 | * @param callable|null $callback |
||
114 | * |
||
115 | * @return mixed |
||
116 | * |
||
117 | * @throws InvalidArgumentException |
||
118 | */ |
||
119 | public function listen($callback = null) |
||
127 | |||
128 | /** |
||
129 | * @inheritdoc |
||
130 | */ |
||
131 | protected function handleMessage($message) |
||
156 | |||
157 | /** |
||
158 | * Gets the default handler by the info type. |
||
159 | * |
||
160 | * @param $type |
||
161 | * |
||
162 | * @return EventHandlers\EventHandler |
||
163 | * @throws InvalidArgumentException |
||
164 | */ |
||
165 | protected function getDefaultHandler($type) |
||
174 | } |
||
175 |