From 1ed8196a00b9861c83ac2273152caaca3f74c9d1 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 6 Nov 2023 08:21:09 +0000 Subject: [PATCH] chore: improves code --- src/Plugin.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index 969e48f..6f879d2 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -45,11 +45,11 @@ public function handleArguments(array $arguments): array $domain = $arguments[2]; - $duration = 10; + $run = stress($domain); foreach ($arguments as $argument) { if (str_starts_with($argument, '--duration=')) { - $duration = (int) str_replace('--duration=', '', $argument); + $run->duration((int) str_replace('--duration=', '', $argument)); } } @@ -57,14 +57,10 @@ public function handleArguments(array $arguments): array foreach ($arguments as $argument) { if (str_starts_with($argument, '--concurrency=')) { - $concurrency = (int) str_replace('--concurrency=', '', $argument); + $run->concurrently((int) str_replace('--concurrency=', '', $argument)); } } - stress($domain) - ->concurrently($concurrency) - ->for($duration) - ->seconds() - ->dd(); + $run->dd(); } }