⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.177
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
ctaacademy
/
www
/
vendor
/
aws
/
aws-sdk-php
/
src
/
View File Name :
CommandPool.php
getBefore($config); $mapFn = function ($commands) use ($client, $before, $config) { foreach ($commands as $key => $command) { if (!($command instanceof CommandInterface)) { throw new \InvalidArgumentException('Each value yielded by ' . 'the iterator must be an Aws\CommandInterface.'); } if ($before) { $before($command, $key); } if (!empty($config['preserve_iterator_keys'])) { yield $key => $client->executeAsync($command); } else { yield $client->executeAsync($command); } } }; $this->each = new EachPromise($mapFn($commands), $config); } /** * @return PromiseInterface */ public function promise(): PromiseInterface { return $this->each->promise(); } /** * Executes a pool synchronously and aggregates the results of the pool * into an indexed array in the same order as the passed in array. * * @param AwsClientInterface $client Client used to execute commands. * @param mixed $commands Iterable that yields commands. * @param array $config Configuration options. * * @return array * @see \Aws\CommandPool::__construct for available configuration options. */ public static function batch( AwsClientInterface $client, $commands, array $config = [] ) { $results = []; self::cmpCallback($config, 'fulfilled', $results); self::cmpCallback($config, 'rejected', $results); return (new self($client, $commands, $config)) ->promise() ->then(static function () use (&$results) { ksort($results); return $results; }) ->wait(); } /** * @return callable */ private function getBefore(array $config) { if (!isset($config['before'])) { return null; } if (is_callable($config['before'])) { return $config['before']; } throw new \InvalidArgumentException('before must be callable'); } /** * Adds an onFulfilled or onRejected callback that aggregates results into * an array. If a callback is already present, it is replaced with the * composed function. * * @param array $config * @param $name * @param array $results */ private static function cmpCallback(array &$config, $name, array &$results) { if (!isset($config[$name])) { $config[$name] = function ($v, $k) use (&$results) { $results[$k] = $v; }; } else { $currentFn = $config[$name]; $config[$name] = function ($v, $k) use (&$results, $currentFn) { $currentFn($v, $k); $results[$k] = $v; }; } } }