public function waitUntil($name, array $args = [], array $config = []) { // Create the waiter. If async, then waiting begins immediately. $config += $this->api->getWaiterConfig($name); $waiter = new Waiter($this, $name, $args, $config); // If async, return the future, for access to then()/wait()/cancel(). if (!empty($args['@future'])) { return $waiter; } // For synchronous waiting, call wait() and don't return anything. $waiter->wait(); }