1 | <?php |
||
15 | class Utils |
||
16 | { |
||
17 | /** |
||
18 | * @var Filesystem |
||
19 | */ |
||
20 | protected static $filesystem; |
||
21 | |||
22 | /** |
||
23 | * Get filesystem. |
||
24 | * |
||
25 | * @return Filesystem |
||
26 | */ |
||
27 | public static function getFilesystem() |
||
35 | |||
36 | /** |
||
37 | * hash. |
||
38 | * |
||
39 | * @param int $uin |
||
40 | * @param string $ptWebQQ |
||
41 | * |
||
42 | * @return string |
||
43 | */ |
||
44 | public static function hash($uin, $ptWebQQ) |
||
63 | |||
64 | /** |
||
65 | * 生成ptqrtoken的哈希函数. |
||
66 | * |
||
67 | * @param string $string |
||
68 | * |
||
69 | * @return int |
||
70 | */ |
||
71 | public static function hash33($string) |
||
85 | |||
86 | /** |
||
87 | * 入转换为32位无符号整数,若溢出,则只保留低32位. |
||
88 | * |
||
89 | * @see http://outofmemory.cn/code-snippet/18291/out-switch-32-place-sign-integer-spill-maintain-32-place |
||
90 | * |
||
91 | * @param mixed $var |
||
92 | * |
||
93 | * @return float|int|string |
||
94 | */ |
||
95 | public static function toUint32val($var) |
||
116 | |||
117 | /** |
||
118 | * 计算字符的unicode,类似js中charCodeAt |
||
119 | * [Link](http://www.phpjiayuan.com/90/225.html). |
||
120 | * |
||
121 | * @param string $str |
||
122 | * @param int $index |
||
123 | * |
||
124 | * @return null|number |
||
125 | */ |
||
126 | public static function charCodeAt($str, $index) |
||
137 | |||
138 | /** |
||
139 | * 获取当前时间的毫秒数. |
||
140 | * |
||
141 | * @return float |
||
142 | */ |
||
143 | public static function getMillisecond() |
||
149 | |||
150 | /** |
||
151 | * 用于发送消息时生成msg id. |
||
152 | * |
||
153 | * @return int |
||
154 | */ |
||
155 | public static function makeMsgId() |
||
169 | } |
||
170 |