chore: linter

This commit is contained in:
德华 刘 2023-12-14 04:51:36 +00:00
parent 1307f73c31
commit dc89501012
3 changed files with 77 additions and 55 deletions

View file

@ -512,19 +512,19 @@ App::get('/v1/functions/:functionId/usage')
'1d' => 'Y-m-d\T00:00:00.000P', '1d' => 'Y-m-d\T00:00:00.000P',
}; };
foreach ($metrics as $metric) { foreach ($metrics as $metric) {
$usage[$metric]['total'] = $stats[$metric]['total']; $usage[$metric]['total'] = $stats[$metric]['total'];
$usage[$metric]['data'] = []; $usage[$metric]['data'] = [];
$leap = time() - ($days['limit'] * $days['factor']); $leap = time() - ($days['limit'] * $days['factor']);
while ($leap < time()) { while ($leap < time()) {
$leap += $days['factor']; $leap += $days['factor'];
$formatDate = date($format, $leap); $formatDate = date($format, $leap);
$usage[$metric]['data'][] = [ $usage[$metric]['data'][] = [
'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0,
'date' => $formatDate, 'date' => $formatDate,
]; ];
}
} }
}
$response->dynamic(new Document([ $response->dynamic(new Document([
'range' => $range, 'range' => $range,
@ -604,19 +604,19 @@ App::get('/v1/functions/usage')
'1d' => 'Y-m-d\T00:00:00.000P', '1d' => 'Y-m-d\T00:00:00.000P',
}; };
foreach ($metrics as $metric) { foreach ($metrics as $metric) {
$usage[$metric]['total'] = $stats[$metric]['total']; $usage[$metric]['total'] = $stats[$metric]['total'];
$usage[$metric]['data'] = []; $usage[$metric]['data'] = [];
$leap = time() - ($days['limit'] * $days['factor']); $leap = time() - ($days['limit'] * $days['factor']);
while ($leap < time()) { while ($leap < time()) {
$leap += $days['factor']; $leap += $days['factor'];
$formatDate = date($format, $leap); $formatDate = date($format, $leap);
$usage[$metric]['data'][] = [ $usage[$metric]['data'][] = [
'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0,
'date' => $formatDate, 'date' => $formatDate,
]; ];
}
} }
}
$response->dynamic(new Document([ $response->dynamic(new Document([
'range' => $range, 'range' => $range,
'functionsTotal' => $usage[$metrics[0]]['total'], 'functionsTotal' => $usage[$metrics[0]]['total'],

82
composer.lock generated
View file

@ -2768,16 +2768,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.17.1", "version": "v4.18.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2818,9 +2818,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/PHP-Parser/issues", "issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0"
}, },
"time": "2023-08-13T19:53:39+00:00" "time": "2023-12-10T21:03:43+00:00"
}, },
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
@ -3103,29 +3103,29 @@
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
"version": "v1.17.0", "version": "v1.18.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpspec/prophecy.git",
"reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2" "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/15873c65b207b07765dbc3c95d20fdf4a320cbe2", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d4f454f7e1193933f04e6500de3e79191648ed0c",
"reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2", "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.2 || ^2.0", "doctrine/instantiator": "^1.2 || ^2.0",
"php": "^7.2 || 8.0.* || 8.1.* || 8.2.*", "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*",
"phpdocumentor/reflection-docblock": "^5.2", "phpdocumentor/reflection-docblock": "^5.2",
"sebastian/comparator": "^3.0 || ^4.0", "sebastian/comparator": "^3.0 || ^4.0 || ^5.0",
"sebastian/recursion-context": "^3.0 || ^4.0" "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0"
}, },
"require-dev": { "require-dev": {
"phpspec/phpspec": "^6.0 || ^7.0", "phpspec/phpspec": "^6.0 || ^7.0",
"phpstan/phpstan": "^1.9", "phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^8.0 || ^9.0" "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -3158,6 +3158,7 @@
"keywords": [ "keywords": [
"Double", "Double",
"Dummy", "Dummy",
"dev",
"fake", "fake",
"mock", "mock",
"spy", "spy",
@ -3165,9 +3166,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpspec/prophecy/issues", "issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.17.0" "source": "https://github.com/phpspec/prophecy/tree/v1.18.0"
}, },
"time": "2023-02-02T15:41:36+00:00" "time": "2023-12-07T16:22:33+00:00"
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
@ -4654,16 +4655,16 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "3.7.2", "version": "3.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7",
"reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4673,7 +4674,7 @@
"php": ">=5.4.0" "php": ">=5.4.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
}, },
"bin": [ "bin": [
"bin/phpcs", "bin/phpcs",
@ -4692,22 +4693,45 @@
"authors": [ "authors": [
{ {
"name": "Greg Sherwood", "name": "Greg Sherwood",
"role": "lead" "role": "Former lead"
},
{
"name": "Juliette Reinders Folmer",
"role": "Current lead"
},
{
"name": "Contributors",
"homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors"
} }
], ],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
"keywords": [ "keywords": [
"phpcs", "phpcs",
"standards", "standards",
"static analysis" "static analysis"
], ],
"support": { "support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer", "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
"wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki"
}, },
"time": "2023-02-22T23:07:41+00:00" "funding": [
{
"url": "https://github.com/PHPCSStandards",
"type": "github"
},
{
"url": "https://github.com/jrfnl",
"type": "github"
},
{
"url": "https://opencollective.com/php_codesniffer",
"type": "open_collective"
}
],
"time": "2023-12-08T12:32:31+00:00"
}, },
{ {
"name": "swoole/ide-helper", "name": "swoole/ide-helper",
@ -5104,5 +5128,5 @@
"platform-overrides": { "platform-overrides": {
"php": "8.0" "php": "8.0"
}, },
"plugin-api-version": "2.2.0" "plugin-api-version": "2.6.0"
} }

View file

@ -372,8 +372,6 @@ class Functions extends Action
]); ]);
/** Execute function */ /** Execute function */
try { try {
$version = $function->getAttribute('version', 'v2'); $version = $function->getAttribute('version', 'v2');
$command = $runtime['startCommand']; $command = $runtime['startCommand'];