Ejemplo n.º 1
0
 /**
  * Get waiter configuration data, taking __default__ and extensions into account
  *
  * @param string $name Waiter name
  *
  * @return WaiterConfig
  * @throws InvalidArgumentException
  */
 protected function getWaiterConfig($name)
 {
     if (!$this->canBuild($name)) {
         throw new InvalidArgumentException('No waiter found matching "' . $name . '"');
     }
     // inflect the name if needed
     $name = isset($this->config[$name]) ? $name : $this->inflector->camel($name);
     $waiter = new WaiterConfig($this->config[$name]);
     $waiter['name'] = $name;
     // Always use __default__ as the basis if it's set
     if (isset($this->config['__default__'])) {
         $parentWaiter = new WaiterConfig($this->config['__default__']);
         $waiter = $parentWaiter->overwriteWith($waiter);
     }
     // Allow for configuration extensions
     if (isset($this->config[$name]['extends'])) {
         $waiter = $this->getWaiterConfig($this->config[$name]['extends'])->overwriteWith($waiter);
     }
     return $waiter;
 }
Ejemplo n.º 2
0
 /**
  * @param WaiterConfig $waiterConfig Waiter configuration
  */
 public function __construct(WaiterConfig $waiterConfig)
 {
     $this->waiterConfig = $waiterConfig;
     $this->setInterval($waiterConfig->get(WaiterConfig::INTERVAL));
     $this->setMaxAttempts($waiterConfig->get(WaiterConfig::MAX_ATTEMPTS));
 }