1 | <?php |
||
25 | class File extends Rest |
||
26 | { |
||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | protected function registerHttpMiddleware() |
||
36 | |||
37 | /** |
||
38 | * @return \Closure |
||
39 | */ |
||
40 | public function RestrictAccessMiddleware() |
||
55 | |||
56 | /** |
||
57 | * 上传文件. |
||
58 | * |
||
59 | * ~~~ |
||
60 | * [ |
||
61 | * 'uuid' => 'd8329590-c018-11e5-a936-0f89b914ff91', |
||
62 | * 'type' => 'chatfile', |
||
63 | * 'share-secret' => '2DKVmsAYEeWn7wsNJSQy-QxD0mQSSXd6jqC7PpD7_YQuIDr6' |
||
64 | * ] |
||
65 | * ~~~ |
||
66 | * |
||
67 | * @param string $file |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | public function upload($file) |
||
79 | |||
80 | /** |
||
81 | * Return the resource web access url. |
||
82 | * |
||
83 | * @param string $uuid |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function url($uuid) |
||
91 | } |
||
92 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: