Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

Commit 7bbd466

Browse files
committed
format all codes
1 parent bfef99c commit 7bbd466

File tree

7 files changed

+68
-68
lines changed

7 files changed

+68
-68
lines changed

src/HtmlHelper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function decode($text): string
3939

4040
/**
4141
* @form yii1
42-
* @param array $data data to be encoded
42+
* @param array $data data to be encoded
4343
* @param string $charset
4444
* @return array the encoded data
4545
* @see http://www.php.net/manual/en/function.htmlspecialchars.php
@@ -74,8 +74,8 @@ public static function encodeArray($data, $charset = 'utf-8'): array
7474
* htmlentities() <--> html_entity_decode() — 将特殊的 HTML 实体转换回普通字符
7575
* htmlspecialchars() <--> htmlspecialchars_decode() — 将特殊的 HTML 实体转换回普通字符
7676
* ENT_COMPAT ENT_QUOTES ENT_NOQUOTES ENT_HTML401 ENT_XML1 ENT_XHTML ENT_HTML5
77-
* @param $data
78-
* @param int $type
77+
* @param $data
78+
* @param int $type
7979
* @param string $encoding
8080
* @return array|mixed|string
8181
*/
@@ -106,8 +106,8 @@ public static function escape($data, int $type = 0, $encoding = 'UTF-8')
106106

107107
/**
108108
* 去掉html转义
109-
* @param $data
110-
* @param int $type
109+
* @param $data
110+
* @param int $type
111111
* @param string $encoding
112112
* @return array|string
113113
*/
@@ -170,7 +170,7 @@ public static function stripStyle(string $string): string
170170
}
171171

172172
/**
173-
* @param string $html
173+
* @param string $html
174174
* @param bool|true $onlySrc
175175
* @return array
176176
*/

src/JsonHelper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static function encode($data): string
3030

3131
/**
3232
* @param string $data
33-
* @param bool $toArray
33+
* @param bool $toArray
3434
* @return array|mixed|null|\stdClass|string
3535
* @throws \InvalidArgumentException
3636
*/
@@ -44,7 +44,7 @@ public static function parse(string $data, $toArray = true)
4444
}
4545

4646
/**
47-
* @param $file
47+
* @param $file
4848
* @param bool|true $toArray
4949
* @return mixed|null|string
5050
* @throws \InvalidArgumentException
@@ -62,7 +62,7 @@ public static function parseFile($file, $toArray = true)
6262

6363
/**
6464
* @param string $string
65-
* @param bool $toArray
65+
* @param bool $toArray
6666
* @return array|mixed|\stdClass
6767
*/
6868
public static function parseString(string $string, bool $toArray = true)
@@ -86,8 +86,8 @@ public static function parseString(string $string, bool $toArray = true)
8686

8787
/**
8888
* @param string $input 文件 或 数据
89-
* @param bool $output 是否输出到文件, 默认返回格式化的数据
90-
* @param array $options 当 $output=true,此选项有效
89+
* @param bool $output 是否输出到文件, 默认返回格式化的数据
90+
* @param array $options 当 $output=true,此选项有效
9191
* $options = [
9292
* 'type' => 'min' // 输出数据类型 min 压缩过的 raw 正常的
9393
* 'file' => 'xx.json' // 输出文件路径;仅是文件名,则会取输入路径
@@ -141,7 +141,7 @@ public static function format($input, $output = false, array $options = [])
141141
/**
142142
* @param string $data
143143
* @param string $output
144-
* @param array $options
144+
* @param array $options
145145
* @return bool|int
146146
*/
147147
public static function saveAs(string $data, string $output, array $options = [])

src/Str.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function optional(string $string, string $prefix = ' ', string $su
3131
}
3232

3333
/**
34-
* @param string $string
34+
* @param string $string
3535
* @param string|array $needle
3636
* @return bool
3737
*/
@@ -41,7 +41,7 @@ public static function contains(string $string, $needle): bool
4141
}
4242

4343
/**
44-
* @param string $string
44+
* @param string $string
4545
* @param string|array $needle
4646
* @return bool
4747
*/

src/StringHelper.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ abstract class StringHelper
1919
public static function regexVerify($value, $rule): bool
2020
{
2121
$value = trim($value);
22-
$validate = array(
23-
'require' => '/\S+/',
24-
'email' => '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',
22+
$validate = [
23+
'require' => '/\S+/',
24+
'email' => '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',
2525
// 'url' => '/^http(s?):\/\/(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/',
26-
'url' => '/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i',
26+
'url' => '/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i',
2727
'currency' => '/^\d+(\.\d+)?$/',
2828
# 货币
29-
'number' => '/^\d+$/',
30-
'zip' => '/^\d{6}$/',
31-
'integer' => '/^[-\+]?\d+$/',
32-
'double' => '/^[-\+]?\d+(\.\d+)?$/',
33-
'english' => '/^[A-Za-z]+$/',
34-
);
29+
'number' => '/^\d+$/',
30+
'zip' => '/^\d{6}$/',
31+
'integer' => '/^[-\+]?\d+$/',
32+
'double' => '/^[-\+]?\d+(\.\d+)?$/',
33+
'english' => '/^[A-Za-z]+$/',
34+
];
3535

3636
// 检查是否有内置的正则表达式
3737
if (isset($validate[strtolower($rule)])) {
@@ -42,7 +42,7 @@ public static function regexVerify($value, $rule): bool
4242
}
4343

4444
/**
45-
* @param $str
45+
* @param $str
4646
* @param string $encoding
4747
* @return bool|int
4848
*/
@@ -107,8 +107,8 @@ public static function absLen($str): int
107107
* @from web
108108
* utf-8编码下截取中文字符串,参数可以参照substr函数
109109
* @param string $str 要进行截取的字符串
110-
* @param int $start 要进行截取的开始位置,负数为反向截取
111-
* @param int $end 要进行截取的长度
110+
* @param int $start 要进行截取的开始位置,负数为反向截取
111+
* @param int $end 要进行截取的长度
112112
* @return string
113113
*/
114114
public static function utf8SubStr($str, $start = 0, $end = null): string
@@ -147,10 +147,10 @@ public static function utf8SubStr($str, $start = 0, $end = null): string
147147
* @from web
148148
* 中文截取,支持gb2312,gbk,utf-8,big5 *
149149
* @param string $str 要截取的字串
150-
* @param int $start 截取起始位置
151-
* @param int $length 截取长度
150+
* @param int $start 截取起始位置
151+
* @param int $length 截取长度
152152
* @param string $charset utf-8|gb2312|gbk|big5 编码
153-
* @param bool $suffix 是否加尾缀
153+
* @param bool $suffix 是否加尾缀
154154
* @return string
155155
*/
156156
public static function zhSubStr($str, $start = 0, $length, $charset = 'utf-8', $suffix = true): string
@@ -185,7 +185,7 @@ public static function zhSubStr($str, $start = 0, $length, $charset = 'utf-8', $
185185

186186
/**
187187
* ********************** 生成一定长度的随机字符串函数 **********************
188-
* @param $length - 随机字符串长度
188+
* @param $length - 随机字符串长度
189189
* @param array|string $param -
190190
* @internal param string $chars
191191
* @return string
@@ -196,7 +196,7 @@ public static function random($length, array $param = []): string
196196
$param = \array_merge([
197197
'prefix' => '',
198198
'suffix' => '',
199-
'chars' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
199+
'chars' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
200200
], $param);
201201

202202
$chars = $param['chars'];
@@ -238,7 +238,7 @@ public static function genUid(int $length = 7): string
238238

239239
/**
240240
* gen UUID
241-
* @param int $version
241+
* @param int $version
242242
* @param null $node
243243
* @param null $ns
244244
* @return UUID
@@ -290,10 +290,10 @@ public static function strtoupper($str)
290290
}
291291

292292
/**
293-
* @param $str
294-
* @param $start
293+
* @param $str
294+
* @param $start
295295
* @param bool|false $length
296-
* @param string $encoding
296+
* @param string $encoding
297297
* @return bool|string
298298
*/
299299
public static function substr(string $str, int $start, int $length = null, string $encoding = 'utf-8')
@@ -306,9 +306,9 @@ public static function substr(string $str, int $start, int $length = null, strin
306306
}
307307

308308
/**
309-
* @param $str
310-
* @param $find
311-
* @param int $offset
309+
* @param $str
310+
* @param $find
311+
* @param int $offset
312312
* @param string $encoding
313313
* @return bool|int
314314
*/
@@ -322,7 +322,7 @@ public static function strpos(string $str, string $find, int $offset = 0, string
322322
/**
323323
* @param string $str
324324
* @param string $find
325-
* @param int $offset
325+
* @param int $offset
326326
* @param string $encoding
327327
* @return bool|int
328328
*/
@@ -404,7 +404,7 @@ public static function split2Array(string $path, string $separator = '.'): array
404404
/**
405405
* Truncate strings
406406
* @param string $str
407-
* @param int $max_length Max length
407+
* @param int $max_length Max length
408408
* @param string $suffix Suffix optional
409409
* @return string $str truncated
410410
*/
@@ -423,8 +423,8 @@ public static function truncate($str, $max_length, $suffix = '...'): string
423423

424424
/**
425425
* 字符截断输出
426-
* @param string $str
427-
* @param int $start
426+
* @param string $str
427+
* @param int $start
428428
* @param null|int $length
429429
* @return string
430430
*/
@@ -451,16 +451,16 @@ public static function truncate2(string $str, int $start, int $length = null): s
451451
/**
452452
* Copied from CakePHP String utility file
453453
* @param string $text
454-
* @param int $length
455-
* @param array $options
454+
* @param int $length
455+
* @param array $options
456456
* @return bool|string
457457
*/
458-
public static function truncate3(string $text, int $length = 120, array $options = array())
458+
public static function truncate3(string $text, int $length = 120, array $options = [])
459459
{
460460
$default = [
461461
'ellipsis' => '...',
462-
'exact' => true,
463-
'html' => true
462+
'exact' => true,
463+
'html' => true
464464
];
465465

466466
$options = array_merge($default, $options);
@@ -470,8 +470,8 @@ public static function truncate3(string $text, int $length = 120, array $options
470470

471471
/**
472472
* @var string $ellipsis
473-
* @var bool $exact
474-
* @var bool $html
473+
* @var bool $exact
474+
* @var bool $html
475475
*/
476476

477477
if ($html) {
@@ -583,7 +583,7 @@ public static function truncate3(string $text, int $length = 120, array $options
583583
}
584584

585585
/**
586-
* @param $str
586+
* @param $str
587587
* @param bool $upperFirstChar
588588
* @return mixed
589589
*/
@@ -595,7 +595,7 @@ public static function toCamel(string $str, bool $upperFirstChar = false): strin
595595
/**
596596
* Translates a string with underscores into camel case (e.g. first_name -> firstName)
597597
* @prototype string public static function toCamelCase(string $str[, bool $capitalise_first_char = false])
598-
* @param $str
598+
* @param $str
599599
* @param bool $upperFirstChar
600600
* @return mixed
601601
*/
@@ -633,7 +633,7 @@ public static function toSnakeCase(string $str, string $sep = '_'): string
633633
/**
634634
* 驼峰式 <=> 下划线式
635635
* @param string $str [description]
636-
* @param bool $toCamelCase
636+
* @param bool $toCamelCase
637637
* true : 驼峰式 => 下划线式
638638
* false : 驼峰式 <= 下划线式
639639
* @return string
@@ -664,7 +664,7 @@ public static function nameChange(string $str, bool $toCamelCase = true): string
664664

665665
/**
666666
* [format description]
667-
* @param $str
667+
* @param $str
668668
* @param array $replaceParams 用于 str_replace('search','replace',$str )
669669
* @example
670670
* $replaceParams = [
@@ -726,7 +726,7 @@ public static function wordFormat($keyword): string
726726

727727
/**
728728
* 缩进格式化内容,去空白/注释
729-
* @param $fileName
729+
* @param $fileName
730730
* @param int $type
731731
* @return mixed
732732
*/

src/Token.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function uniqueSalt(): string
6262
/**
6363
* @param string $pwd
6464
* @param string $algo
65-
* @param array $opts
65+
* @param array $opts
6666
* @return bool|string
6767
*/
6868
public static function pwdHash(string $pwd, string $algo, array $opts = [])
@@ -108,7 +108,7 @@ public static function verify(string $hash, string $password): bool
108108
/**
109109
* 2 生成
110110
* @todo from php.net
111-
* @param $password
111+
* @param $password
112112
* @param int $cost
113113
* @return string
114114
* @throws \RuntimeException

src/UUID.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
class UUID
3030
{
31-
const MD5 = 3;
31+
const MD5 = 3;
3232
const SHA1 = 5;
3333

3434
/** @var int 00001111 Clears all bits of version byte with AND */
@@ -96,7 +96,7 @@ class UUID
9696
const VALID_UUID_REGEX = '^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$';
9797

9898
/**
99-
* @param int $ver
99+
* @param int $ver
100100
* @param string|null $node
101101
* @param string|null $ns
102102
* @return UUID
@@ -108,7 +108,7 @@ public static function gen(int $ver = 1, string $node = null, string $ns = null)
108108
}
109109

110110
/**
111-
* @param int $ver
111+
* @param int $ver
112112
* @param string $node
113113
* @param string $ns
114114
* @return UUID
@@ -227,7 +227,7 @@ public static function randomBytes($bytes): string
227227
* Returns binary representation, or false on failure.
228228
*
229229
* @param string|self $str
230-
* @param integer $len
230+
* @param integer $len
231231
* @return string|null
232232
*/
233233
protected static function makeBin($str, $len)
@@ -258,8 +258,8 @@ protected static function makeBin($str, $len)
258258
* Generates a Version 3 or Version 5 UUID.
259259
* These are derived from a hash of a name and its namespace, in binary form.
260260
*
261-
* @param int $ver
262-
* @param string $node
261+
* @param int $ver
262+
* @param string $node
263263
* @param string|null $ns
264264
* @return string
265265
* @throws \InvalidArgumentException

0 commit comments

Comments
 (0)