From 4c49b564ef4c1873c1ffc3ef165b86810bd96b3a Mon Sep 17 00:00:00 2001 From: axiosleo Date: Mon, 1 Apr 2024 14:41:23 +0800 Subject: [PATCH] fix: formatting and coding style issues --- .php-cs-fixer.dist.php | 6 ++-- functions.php | 24 +++++++------ src/ArrayMap.php | 18 +++++----- src/BHDConverter.php | 4 +-- src/CDKEYProducer.php | 6 ++-- src/CRC64.php | 6 ++-- src/Files.php | 2 +- src/ForkProcess.php | 6 ++-- src/HMac.php | 8 ++--- src/ListToTree.php | 8 ++--- src/MimeTypes.php | 6 ++-- src/Path.php | 6 ++-- src/PharOperator.php | 4 +-- src/RSACrypt.php | 12 +++---- src/SM3.php | 68 +++++++++++++++++------------------- src/TreeToList.php | 9 ++--- src/UUID.php | 2 +- src/XMLParser.php | 2 +- tests/unit/ArrayMapTest.php | 1 + tests/unit/CDKEYTest.php | 5 +-- tests/unit/CRC64Test.php | 5 +-- tests/unit/DatetimeTest.php | 1 + tests/unit/FilesTest.php | 1 + tests/unit/HMacTest.php | 5 +-- tests/unit/ListTreeTest.php | 1 + tests/unit/MimeTypesTest.php | 1 + tests/unit/PathTest.php | 1 + tests/unit/RSACryptTest.php | 6 ++-- tests/unit/SM3Test.php | 1 + tests/unit/UUIDTest.php | 1 + tests/unit/XMLParserTest.php | 1 + 31 files changed, 119 insertions(+), 108 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 58d7eb7..f749483 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -63,10 +63,10 @@ // 'use', // ], 'binary_operator_spaces' => [ - 'default' => 'align_single_space_by_scope', + 'default' => 'align', 'operators' => [ - '=>' => 'align_single_space_by_scope', - '=' => 'align_single_space_by_scope', + '=>' => 'align', + '=' => 'align', ], ], 'braces' => [ diff --git a/functions.php b/functions.php index 3b3fa51..6d3e41e 100644 --- a/functions.php +++ b/functions.php @@ -3,9 +3,13 @@ declare(strict_types=1); use axios\tools\HMac; +use axios\tools\Path; +use axios\tools\SM3; +use axios\tools\UUID; +use axios\tools\XMLParser; if (!function_exists('render_str')) { - function render_str(string $template, array $params, string $left_tag='${', string $right_tag='}'): string + function render_str(string $template, array $params, string $left_tag = '${', string $right_tag = '}'): string { foreach ($params as $name => $value) { $template = str_replace($left_tag . $name . $right_tag, $value, $template); @@ -55,7 +59,7 @@ function halt(...$args) if (!function_exists('sm3')) { function sm3(string $str, bool $raw_output = false): string { - $sm3 = new \axios\tools\SM3(); + $sm3 = new SM3(); $sm3->encode($str); return $raw_output ? $sm3->getBinary() : $sm3->getHex(); @@ -65,7 +69,7 @@ function sm3(string $str, bool $raw_output = false): string if (!function_exists('sm3_file')) { function sm3_file(string $filepath, bool $raw_output = false): string { - $sm3 = new \axios\tools\SM3(); + $sm3 = new SM3(); $sm3->encodeFile($filepath); return $raw_output ? $sm3->getBinary() : $sm3->getHex(); @@ -75,21 +79,21 @@ function sm3_file(string $filepath, bool $raw_output = false): string if (!function_exists('xml_encode')) { function xml_encode(array $data, $root_node = 'data', $root_attr = [], $item_node = 'item', $item_key = 'id', $encoding = 'utf-8'): string { - return \axios\tools\XMLParser::encode($data, $root_node, $root_attr, $item_node, $item_key, $encoding); + return XMLParser::encode($data, $root_node, $root_attr, $item_node, $item_key, $encoding); } } if (!function_exists('xml_decode')) { function xml_decode(string $xml_string): array { - return \axios\tools\XMLParser::decode($xml_string); + return XMLParser::decode($xml_string); } } if (!function_exists('uuid')) { function uuid(string $salt = ''): string { - $uuid = new \axios\tools\UUID($salt); + $uuid = new UUID($salt); $str = $uuid->v2(); unset($uuid); @@ -100,7 +104,7 @@ function uuid(string $salt = ''): string if (!function_exists('path_join')) { function path_join(string ...$paths): string { - return \axios\tools\Path::join(...$paths); + return Path::join(...$paths); } } @@ -127,7 +131,7 @@ function client_ip(int $type = 0, bool $advance = false) if (false !== $pos) { unset($arr[$pos]); } - $ip = trim($arr[0]); + $ip = trim($arr[0]); } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (isset($_SERVER['REMOTE_ADDR'])) { @@ -137,8 +141,8 @@ function client_ip(int $type = 0, bool $advance = false) $ip = $_SERVER['REMOTE_ADDR']; } // IP address legitimacy verification - $long = sprintf('%u', ip2long((string) $ip)); - $ip = $long ? [$ip, $long] : ['0.0.0.0', 0]; + $long = sprintf('%u', ip2long((string) $ip)); + $ip = $long ? [$ip, $long] : ['0.0.0.0', 0]; return $ip[$type]; } diff --git a/src/ArrayMap.php b/src/ArrayMap.php index 993b6aa..7094275 100644 --- a/src/ArrayMap.php +++ b/src/ArrayMap.php @@ -70,7 +70,7 @@ public function set($key, $value = null): self } } else { $recurArrayChange = function ($array, $keyArr, $value) use (&$recurArrayChange) { - $key = array_shift($keyArr); + $key = array_shift($keyArr); if (null === $key) { return $value; } @@ -93,8 +93,8 @@ public function set($key, $value = null): self return $array; }; - $keyArray = explode($this->separator, trim($key, ' .')); - $this->array = $recurArrayChange($this->array, $keyArray, $value); + $keyArray = explode($this->separator, trim($key, ' .')); + $this->array = $recurArrayChange($this->array, $keyArray, $value); } return $this; @@ -166,7 +166,7 @@ public function getAllToString(array $map = []) return $array; }; - $arr = $this->get(); + $arr = $this->get(); $recurse($arr); return $arr; @@ -200,16 +200,16 @@ public function delete($key): self * * @return $this */ - public function sort(string $key = null, array $sortRule = []): mixed + public function sort(?string $key = null, array $sortRule = []): mixed { - $data = $this->get($key); + $data = $this->get($key); if (!\is_array($data)) { throw new \InvalidArgumentException('Invalid data. Only supported array.'); } if (0 === \count($sortRule)) { throw new \InvalidArgumentException('Invalid sort rule.'); } - $params = []; + $params = []; foreach ($sortRule as $key => $value) { $params[] = $key; @@ -227,14 +227,14 @@ public function sort(string $key = null, array $sortRule = []): mixed foreach ($params as $key => $field) { if (\is_string($field)) { - $item = []; + $item = []; foreach ($data as $k => $value) { $item[$k] = $value[$field]; } $params[$key] = $item; } } - $params[] =&$data; + $params[] = &$data; \call_user_func_array('array_multisort', $params); return array_pop($params); diff --git a/src/BHDConverter.php b/src/BHDConverter.php index c3b2a9a..3613f8a 100644 --- a/src/BHDConverter.php +++ b/src/BHDConverter.php @@ -13,8 +13,8 @@ public function __construct( $dict = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', // len:62 $patch = '0', ) { - $this->dict = $dict; - $this->patch = $patch; + $this->dict = $dict; + $this->patch = $patch; } /** diff --git a/src/CDKEYProducer.php b/src/CDKEYProducer.php index 58451d5..52b9faf 100644 --- a/src/CDKEYProducer.php +++ b/src/CDKEYProducer.php @@ -20,12 +20,12 @@ public function __construct(int $ticket_len, int $mixed_str_len, int $offset = 0 if ($ticket_len > 0) { $this->code_min = (int) $this->converter->anyToDecimal('1' . str_repeat('0', $ticket_len - 1), 62); } - $this->code_max = (int) $this->converter->anyToDecimal(str_repeat('Z', $ticket_len), 62); + $this->code_max = (int) $this->converter->anyToDecimal(str_repeat('Z', $ticket_len), 62); if ($mixed_str_len > 0) { $this->mix_min = (int) $this->converter->anyToDecimal('1' . str_repeat('0', $mixed_str_len - 1), 62); } - $this->mix_max = (int) $this->converter->anyToDecimal(str_repeat('Z', $mixed_str_len), 62); - $this->offset = $offset; + $this->mix_max = (int) $this->converter->anyToDecimal(str_repeat('Z', $mixed_str_len), 62); + $this->offset = $offset; } public function setOffset(int $offset): self diff --git a/src/CRC64.php b/src/CRC64.php index ce0aa00..a2a76d3 100644 --- a/src/CRC64.php +++ b/src/CRC64.php @@ -8,14 +8,14 @@ class CRC64 { private static array $crc64tab = []; - private int $value = 0; + private int $value = 0; public function __construct() { if ([] === self::$crc64tab) { $poly64rev = (0xC96C5795 << 32) | 0xD7870F42; for ($n = 0; $n < 256; ++$n) { - $crc = $n; + $crc = $n; for ($k = 0; $k < 8; ++$k) { if ($crc & true) { $crc = ($crc >> 1) & ~(0x8 << 60) ^ $poly64rev; @@ -53,6 +53,6 @@ public function result(): string private function count($byte, $crc): int { - return self::$crc64tab[($crc ^ $byte) & 0xff] ^ (($crc >> 8) & ~(0xff << 56)); + return self::$crc64tab[($crc ^ $byte) & 0xFF] ^ (($crc >> 8) & ~(0xFF << 56)); } } diff --git a/src/Files.php b/src/Files.php index 33e5575..1718232 100644 --- a/src/Files.php +++ b/src/Files.php @@ -98,7 +98,7 @@ public static function write(string $filename, string $text, string $mode = 'w', if (flock($fp, \LOCK_EX)) { while ($blank > 0) { fwrite($fp, \PHP_EOL); - $blank = $blank - 1; + --$blank; } fwrite($fp, $text . \PHP_EOL); flock($fp, \LOCK_UN); diff --git a/src/ForkProcess.php b/src/ForkProcess.php index ec85ade..9da1132 100644 --- a/src/ForkProcess.php +++ b/src/ForkProcess.php @@ -11,7 +11,7 @@ class ForkProcess use InstanceTrait; private array $work_queue = []; - private ?int $max_process; + private ?int $max_process; public function __construct($max_process = 100) { @@ -42,7 +42,7 @@ public function maxProcess($max_process = null): ?int public function addWork($class, $func, $args = []): self { - $queue = [ + $queue = [ 'class' => $class, 'func' => $func, 'args' => $args, @@ -70,7 +70,7 @@ private function exec($queue): bool if (\is_string($class) && class_exists($class)) { $class = new $class(); } - $fork = $this->fork(); + $fork = $this->fork(); if ($fork) { return true; } diff --git a/src/HMac.php b/src/HMac.php index 5730448..2d368f1 100644 --- a/src/HMac.php +++ b/src/HMac.php @@ -22,10 +22,10 @@ public function count(string $algorithm, $data = null, $secret = null, bool $raw if (\strlen($secret) > $size) { $secret = pack($pack, $callback($secret)); } - $key = str_pad($secret, $size, \chr(0x00)); - $ipad = $key ^ str_repeat(\chr(0x36), $size); - $opad = $key ^ str_repeat(\chr(0x5C), $size); - $hmac = $callback($opad . pack($pack, $callback($ipad . $data))); + $key = str_pad($secret, $size, \chr(0x00)); + $ipad = $key ^ str_repeat(\chr(0x36), $size); + $opad = $key ^ str_repeat(\chr(0x5C), $size); + $hmac = $callback($opad . pack($pack, $callback($ipad . $data))); return $raw_output ? pack($pack, $hmac) : $hmac; } diff --git a/src/ListToTree.php b/src/ListToTree.php index 90931c4..0d0b6d8 100644 --- a/src/ListToTree.php +++ b/src/ListToTree.php @@ -21,9 +21,9 @@ class ListToTree private string $parent_index = 'parent_id'; - private string $node_index = 'id'; + private string $node_index = 'id'; - private string $node_name = 'child'; + private string $node_name = 'child'; public function __construct(array $list = []) { @@ -37,8 +37,8 @@ public function toTree(): array foreach ($data as $d) { $items[$d[$this->node_index]] = $d; } - $tree = []; - $n = 0; + $tree = []; + $n = 0; foreach ($items as $node_index => $item) { if (isset($items[$item[$this->parent_index]])) { $items[$item[$this->parent_index]][$this->node_name][] = &$items[$node_index]; diff --git a/src/MimeTypes.php b/src/MimeTypes.php index 290faf9..036398b 100644 --- a/src/MimeTypes.php +++ b/src/MimeTypes.php @@ -7,7 +7,7 @@ class MimeTypes { // copy from : https://github.com/ralouphie/mimey/blob/develop/mime.types.php - public array $mimes = [ + public array $mimes = [ 'wof' => [ 0 => 'application/font-woff', ], @@ -2979,7 +2979,7 @@ class MimeTypes 0 => 'x-conference/x-cooltalk', ], ]; - public array $extensions = [ + public array $extensions = [ 'application/font-woff' => [ 0 => 'wof', ], @@ -5543,7 +5543,7 @@ class MimeTypes 'extensions' => [], ]; - private array $types = [ + private array $types = [ 'text', 'application', 'video', diff --git a/src/Path.php b/src/Path.php index 70c209b..5519750 100644 --- a/src/Path.php +++ b/src/Path.php @@ -10,16 +10,14 @@ class Path /** * path join. - * - * @param string ...$paths */ public static function join(string ...$paths): string { - $is_win = \PHP_SHLIB_SUFFIX === 'dll'; + $is_win = \PHP_SHLIB_SUFFIX === 'dll'; if (0 === count($paths)) { throw new \InvalidArgumentException('At least one parameter needs to be passed in.'); } - $base = array_shift($paths); + $base = array_shift($paths); if ($is_win && str_contains($base, \DIRECTORY_SEPARATOR)) { $pathResult = explode(\DIRECTORY_SEPARATOR, $base); } else { diff --git a/src/PharOperator.php b/src/PharOperator.php index ad036db..b2be85a 100644 --- a/src/PharOperator.php +++ b/src/PharOperator.php @@ -35,8 +35,6 @@ public function __construct($zip_dir = null, $include = '/\.*$/', $exclude = []) } /** - * @param $index - * * @return $this */ public function setIndex(string $index): self @@ -55,7 +53,7 @@ public function addExclude(string $exclude): self public function zip(string $output_path): void { - $save_path = $output_path; + $save_path = $output_path; if (is_dir($save_path)) { throw new \InvalidArgumentException("{$output_path} must be file path."); } diff --git a/src/RSACrypt.php b/src/RSACrypt.php index 52ea853..61ac2bf 100644 --- a/src/RSACrypt.php +++ b/src/RSACrypt.php @@ -6,15 +6,15 @@ class RSACrypt { - public array $config = [ + public array $config = [ 'digest_alg' => 'sha256', 'private_key_bits' => 2048, 'private_key_type' => \OPENSSL_KEYTYPE_RSA, ]; - private string $private_key = ''; - private string $public_key = ''; - private int $encrypt_block_size = 200; - private int $decrypt_block_size = 256; + private string $private_key = ''; + private string $public_key = ''; + private int $encrypt_block_size = 200; + private int $decrypt_block_size = 256; public function __construct($config = []) { @@ -69,7 +69,7 @@ public function create(array $config = []): self $res = openssl_pkey_new($config); openssl_pkey_export($res, $pri_key); $this->privateKey($pri_key); - $res = openssl_pkey_get_details($res); + $res = openssl_pkey_get_details($res); $this->publicKey($res['key']); return $this; diff --git a/src/SM3.php b/src/SM3.php index 6d6b6f3..9487f9a 100644 --- a/src/SM3.php +++ b/src/SM3.php @@ -11,9 +11,9 @@ */ class SM3 { - public const IV = '7380166f4914b2b9172442d7da8a0600a96f30bc163138aae38dee4db0fb0e4e'; - public const LEN = 512; - public const STR_LEN = 64; + public const IV = '7380166f4914b2b9172442d7da8a0600a96f30bc163138aae38dee4db0fb0e4e'; + public const LEN = 512; + public const STR_LEN = 64; private ?string $hex = null; private ?string $binary = null; @@ -21,14 +21,14 @@ class SM3 public function encode(string $str): self { - $l = strlen($str) * 8; - $k = $this->getK($l); - $bt = $this->getB($k); - $str = $str . $bt . pack('J', $l); - - $count = strlen($str); - $l = $count / self::STR_LEN; - $vr = hex2bin(self::IV); + $l = strlen($str) * 8; + $k = $this->getK($l); + $bt = $this->getB($k); + $str = $str . $bt . pack('J', $l); + + $count = strlen($str); + $l = $count / self::STR_LEN; + $vr = hex2bin(self::IV); for ($i = 0; $i < $l; ++$i) { $vr = $this->cf($vr, substr($str, $i * self::STR_LEN, self::STR_LEN)); } @@ -39,13 +39,13 @@ public function encode(string $str): self public function encodeFile(string $file): self { - $l = filesize($file) * 8; - $k = $this->getK($l); - $bt = $this->getB($k) . pack('J', $l); + $l = filesize($file) * 8; + $k = $this->getK($l); + $bt = $this->getB($k) . pack('J', $l); - $hd = fopen($file, 'r'); - $vr = hex2bin(self::IV); - $str = fread($hd, self::STR_LEN); + $hd = fopen($file, 'r'); + $vr = hex2bin(self::IV); + $str = fread($hd, self::STR_LEN); if ($l > self::LEN - self::STR_LEN - 1) { do { $vr = $this->cf($vr, $str); @@ -53,9 +53,9 @@ public function encodeFile(string $file): self } while (!feof($hd)); } - $str = $str . $bt; - $count = strlen($str) * 8; - $l = $count / self::LEN; + $str .= $bt; + $count = strlen($str) * 8; + $l = $count / self::LEN; for ($i = 0; $i < $l; ++$i) { $vr = $this->cf($vr, substr($str, $i * self::STR_LEN, self::STR_LEN)); } @@ -92,7 +92,7 @@ private function getK($l): int $v = $l % self::LEN; return $v + self::STR_LEN < self::LEN - ? self::LEN - self::STR_LEN - $v - 1 + ? self::LEN - self::STR_LEN - $v - 1 : (self::LEN * 2) - self::STR_LEN - $v - 1; } @@ -110,24 +110,20 @@ private function getB($k): string private function t($i): int { - return $i < 16 ? 0x79cc4519 : 0x7a879d8a; + return $i < 16 ? 0x79CC4519 : 0x7A879D8A; } private function cf($ai, $bi) { - $wr = array_values(unpack('N*', $bi)); + $wr = array_values(unpack('N*', $bi)); for ($i = 16; $i < 68; ++$i) { $wr[$i] = $this->p1($wr[$i - 16] - ^ - $wr[$i - 9] - ^ - $this->lm($wr[$i - 3], 15)) - ^ - $this->lm($wr[$i - 13], 7) - ^ - $wr[$i - 6]; + ^ $wr[$i - 9] + ^ $this->lm($wr[$i - 3], 15)) + ^ $this->lm($wr[$i - 13], 7) + ^ $wr[$i - 6]; } - $wr1 = []; + $wr1 = []; for ($i = 0; $i < 64; ++$i) { $wr1[] = $wr[$i] ^ $wr[$i + 4]; } @@ -136,12 +132,12 @@ private function cf($ai, $bi) for ($i = 0; $i < 64; ++$i) { $ss1 = $this->lm( - ($this->lm($a, 12) + $e + $this->lm($this->t($i), $i % 32) & 0xffffffff), + ($this->lm($a, 12) + $e + $this->lm($this->t($i), $i % 32) & 0xFFFFFFFF), 7 ); $ss2 = $ss1 ^ $this->lm($a, 12); - $tt1 = ($this->ff($i, $a, $b, $c) + $d + $ss2 + $wr1[$i]) & 0xffffffff; - $tt2 = ($this->gg($i, $e, $f, $g) + $h + $ss1 + $wr[$i]) & 0xffffffff; + $tt1 = ($this->ff($i, $a, $b, $c) + $d + $ss2 + $wr1[$i]) & 0xFFFFFFFF; + $tt2 = ($this->gg($i, $e, $f, $g) + $h + $ss1 + $wr[$i]) & 0xFFFFFFFF; $d = $c; $c = $this->lm($b, 9); $b = $a; @@ -167,7 +163,7 @@ private function gg($j, $x, $y, $z): int private function lm($a, $n): int { - return $a >> (32 - $n) | (($a << $n) & 0xffffffff); + return $a >> (32 - $n) | (($a << $n) & 0xFFFFFFFF); } private function p0($x): int diff --git a/src/TreeToList.php b/src/TreeToList.php index 7465aa0..52eb6e1 100644 --- a/src/TreeToList.php +++ b/src/TreeToList.php @@ -22,11 +22,11 @@ class TreeToList private string $parent_index = 'parent_id'; - private string $node_index = 'id'; + private string $node_index = 'id'; - private string $node_name = 'child'; + private string $node_name = 'child'; - private string $layer_name = ''; + private string $layer_name = ''; private int $count; @@ -54,7 +54,8 @@ private function recurse(?array &$data = [], array $tree = [], int $layer = 0, i if ('' !== $this->layer_name) { $node[$this->layer_name] = $layer; } - $data[] = $node; + + $data[] = $node; if (isset($t[$this->node_name]) && !empty($t[$this->node_name])) { $this->recurse($data, $t[$this->node_name], $layer + 1, $this->count); } diff --git a/src/UUID.php b/src/UUID.php index 533e27c..4ffe55d 100644 --- a/src/UUID.php +++ b/src/UUID.php @@ -51,7 +51,7 @@ public function v4($cut = [6, 7, 9, 10], $flavour = '-'): string $cut_val = array_rand($cut); $part = substr($str, 32 - $length, $cut_val); $tmp[] = $part; - $length = $length - $cut_val; + $length -= $cut_val; } return implode($flavour, $tmp); diff --git a/src/XMLParser.php b/src/XMLParser.php index 33323a9..6279255 100644 --- a/src/XMLParser.php +++ b/src/XMLParser.php @@ -31,7 +31,7 @@ public static function encode(array $data, $root_node = 'data', $root_attr = [], foreach ($root_attr as $key => $value) { $array[] = "{$key}=\"{$value}\""; } - $attr = implode(' ', $array); + $attr = implode(' ', $array); } $attr = empty($attr) ? '' : " {trim({$attr})}"; $xml = ""; diff --git a/tests/unit/ArrayMapTest.php b/tests/unit/ArrayMapTest.php index d40c560..48ffaf0 100644 --- a/tests/unit/ArrayMapTest.php +++ b/tests/unit/ArrayMapTest.php @@ -9,6 +9,7 @@ /** * @internal + * * @coversNothing */ class ArrayMapTest extends TestCase diff --git a/tests/unit/CDKEYTest.php b/tests/unit/CDKEYTest.php index 9707b71..e335057 100644 --- a/tests/unit/CDKEYTest.php +++ b/tests/unit/CDKEYTest.php @@ -9,6 +9,7 @@ /** * @internal + * * @coversNothing */ class CDKEYTest extends TestCase @@ -32,7 +33,7 @@ public function testProduceCDKEY() { $producer = new CDKEYProducer(4, 4); $this->assertCount(100, $producer->get(100)); - $this->assertTrue(0 === strpos($producer->getOne(), '101D')); - $this->assertTrue(0 === strpos($producer->getOne(), '101E')); + $this->assertTrue(str_starts_with($producer->getOne(), '101D')); + $this->assertTrue(str_starts_with($producer->getOne(), '101E')); } } diff --git a/tests/unit/CRC64Test.php b/tests/unit/CRC64Test.php index c8ae069..c9e0220 100644 --- a/tests/unit/CRC64Test.php +++ b/tests/unit/CRC64Test.php @@ -9,13 +9,14 @@ /** * @internal + * * @coversNothing */ class CRC64Test extends TestCase { public function testCRC64() { - $crc64 = new CRC64(); + $crc64 = new CRC64(); $crc64->append('t'); $first_val = $crc64->value(); $this->assertEquals('9684896945377528848', $crc64->result()); @@ -33,7 +34,7 @@ public function testCRC64() public function testWithChinese() { - $crc64 = new CRC64(); + $crc64 = new CRC64(); $crc64->append('δΈ­'); $this->assertEquals('5878784518235156503', $crc64->result()); $first_val = $crc64->value(); diff --git a/tests/unit/DatetimeTest.php b/tests/unit/DatetimeTest.php index 495e415..3b3ff94 100644 --- a/tests/unit/DatetimeTest.php +++ b/tests/unit/DatetimeTest.php @@ -9,6 +9,7 @@ /** * @internal + * * @coversNothing */ class DatetimeTest extends TestCase diff --git a/tests/unit/FilesTest.php b/tests/unit/FilesTest.php index 38f146d..3f26075 100644 --- a/tests/unit/FilesTest.php +++ b/tests/unit/FilesTest.php @@ -10,6 +10,7 @@ /** * @internal + * * @coversNothing */ class FilesTest extends TestCase diff --git a/tests/unit/HMacTest.php b/tests/unit/HMacTest.php index 69c489b..89ca7f0 100644 --- a/tests/unit/HMacTest.php +++ b/tests/unit/HMacTest.php @@ -9,6 +9,7 @@ /** * @internal + * * @coversNothing */ class HMacTest extends TestCase @@ -20,10 +21,10 @@ public function testHMacSM3() return hash('sha256', md5($data)); }); - $res = $hmac->count('md5_sha256', 'source', 'secret', false); + $res = $hmac->count('md5_sha256', 'source', 'secret', false); $this->assertEquals('d6a810f338113f9a41995c3c052a834d51ada5f10aab89aa5ae302b2a21db0c2', $res); - $res = $hmac->count('md5_sha256', 'source', 'secret', true); + $res = $hmac->count('md5_sha256', 'source', 'secret', true); $this->assertEquals('d6a810f338113f9a41995c3c052a834d51ada5f10aab89aa5ae302b2a21db0c2', bin2hex($res)); } } diff --git a/tests/unit/ListTreeTest.php b/tests/unit/ListTreeTest.php index 6713854..b8545e1 100644 --- a/tests/unit/ListTreeTest.php +++ b/tests/unit/ListTreeTest.php @@ -10,6 +10,7 @@ /** * @internal + * * @coversNothing */ class ListTreeTest extends TestCase diff --git a/tests/unit/MimeTypesTest.php b/tests/unit/MimeTypesTest.php index ca42d29..61b6b83 100644 --- a/tests/unit/MimeTypesTest.php +++ b/tests/unit/MimeTypesTest.php @@ -9,6 +9,7 @@ /** * @internal + * * @coversNothing */ class MimeTypesTest extends TestCase diff --git a/tests/unit/PathTest.php b/tests/unit/PathTest.php index 1c1732b..bca5d96 100644 --- a/tests/unit/PathTest.php +++ b/tests/unit/PathTest.php @@ -9,6 +9,7 @@ /** * @internal + * * @coversNothing */ class PathTest extends TestCase diff --git a/tests/unit/RSACryptTest.php b/tests/unit/RSACryptTest.php index 5700e6c..516339b 100644 --- a/tests/unit/RSACryptTest.php +++ b/tests/unit/RSACryptTest.php @@ -4,17 +4,19 @@ namespace axios\tools\tests\unit; +use axios\tools\RSACrypt; use PHPUnit\Framework\TestCase; /** * @internal + * * @coversNothing */ class RSACryptTest extends TestCase { public function testRSACrypt1() { - $rsa = new \axios\tools\RSACrypt(); + $rsa = new RSACrypt(); $rsa->create(); $data = 'test'; $encryptStr = $rsa->encryptByPrivateKey($data); @@ -23,7 +25,7 @@ public function testRSACrypt1() public function testRSACrypt2() { - $rsa = new \axios\tools\RSACrypt(); + $rsa = new RSACrypt(); $rsa->create(); $data = 'test'; $encryptStr = $rsa->encryptByPublicKey($data); diff --git a/tests/unit/SM3Test.php b/tests/unit/SM3Test.php index d1b9dbc..ed9acb3 100644 --- a/tests/unit/SM3Test.php +++ b/tests/unit/SM3Test.php @@ -11,6 +11,7 @@ /** * @internal + * * @coversNothing */ class SM3Test extends TestCase diff --git a/tests/unit/UUIDTest.php b/tests/unit/UUIDTest.php index ee015cc..c8b1b1b 100644 --- a/tests/unit/UUIDTest.php +++ b/tests/unit/UUIDTest.php @@ -9,6 +9,7 @@ /** * @internal + * * @coversNothing */ class UUIDTest extends TestCase diff --git a/tests/unit/XMLParserTest.php b/tests/unit/XMLParserTest.php index f823adf..d29ddcb 100644 --- a/tests/unit/XMLParserTest.php +++ b/tests/unit/XMLParserTest.php @@ -9,6 +9,7 @@ /** * @internal + * * @coversNothing */ class XMLParserTest extends TestCase