/** * consume * * @param array $options Parameters sent to the processor * * @return void */ public function consume(array $options = array()) { if (null !== $this->logger) { $this->logger->debug(sprintf('Start consuming queue %s.', $this->messageProvider->getQueueName())); } $this->optionsResolver->setDefaults(array('poll_interval' => 50000)); if ($this->processor instanceof ConfigurableInterface) { $this->processor->setDefaultOptions($this->optionsResolver); } $options = $this->optionsResolver->resolve($options); if ($this->processor instanceof InitializableInterface) { $this->processor->initialize($options); } while (true) { while (null !== ($message = $this->messageProvider->get())) { if (false === $this->processor->process($message, $options)) { break 2; } } if ($this->processor instanceof SleepyInterface) { if (false === $this->processor->sleep($options)) { break; } } usleep($options['poll_interval']); } if ($this->processor instanceof TerminableInterface) { $this->processor->terminate($options); } }
/** * @param array $options * * @return array */ protected function resolveOptions(array $options) { if ($this->resolver === null) { $this->resolver = new OptionsResolver(); $this->configureOptions($this->resolver); } return $this->resolver->resolve($options); }
/** * @inheritdoc */ public function resolveOptions(TokenInterface $token) { $accessKey = array($token->getDefinition()->getName(), $token->getInstance()->getState()->getName(), $token->getTransition()->getLabel()); $accessKey = join('.', $accessKey); $options = array(); if ($this->registry && $this->registry->has($accessKey)) { $options = $this->registry->get($accessKey); } return $this->defaultOptions->resolve($options); }
/** * {@inheritdoc} */ public function run(OptionsResolverInterface $resolver) { $records = array(); $localRecords = $this->localSource->execute(); $results = $this->ridicSource->execute(); foreach ($results as $key => $result) { $result = array_change_key_case($result, CASE_LOWER); $mrn = $result['hup_mrn']; try { $result['previous_record'] = $this->provider->getPatientByMRN($mrn); } catch (PatientNotFoundException $e) { unset($result, $results[$key]); continue; } $result['identifier'] = $result['course_ser']; $result['patient'] = $result['hup_mrn']; $result['activity_date'] = $result['first_treatment_dt']; $result['import_description'] = sprintf('%s ridic dose on the %s.', $result['course_ser'], $result['hup_mrn']); $record = $resolver->resolve($result); if ($record['patient'] && !in_array($record['course_ser'], $localRecords)) { $records[] = $record; } unset($results[$key]); } return $records; }
/** * {@inheritdoc} */ public function run(OptionsResolverInterface $resolver) { $records = array(); $localRecords = $this->localSource->execute(); $results = $this->cpdSource->execute(); $cachedMrns = array(); foreach ($results as $key => $result) { $result = array_change_key_case($result, CASE_LOWER); $mrn = $result['patient']; try { if (!isset($cachedMrns[$mrn])) { $result['previous_record'] = $this->provider->getPatientByMRN($mrn); $cachedMrns[$mrn] = $result['previous_record']; } else { $result['previous_record'] = $cachedMrns[$mrn]; } } catch (PatientNotFoundException $e) { unset($result, $results[$key]); continue; } $record['identifier'] = $result['pk_id']; $result['import_description'] = sprintf('%s genetic results on the %s.', $result['cpd_id'], $result['patient']); $record = $resolver->resolve($result); if ($record['patient'] && $record['genetic_test_version_id'] == '2' && !in_array($record['pk_id'], $localRecords)) { $records[] = $record; } unset($results[$key]); } unset($cachedMrns, $localRecords); return $records; }
/** * @param array $options * * @return array */ protected function resolveOptions(array $options) { if (null === $this->resolver) { $this->resolver = new OptionsResolver(); $this->resolver->setDefaults(array('second_class' => 'CalendR\\Period\\Second', 'minute_class' => 'CalendR\\Period\\Minute', 'hour_class' => 'CalendR\\Period\\Hour', 'day_class' => 'CalendR\\Period\\Day', 'week_class' => 'CalendR\\Period\\Week', 'month_class' => 'CalendR\\Period\\Month', 'year_class' => 'CalendR\\Period\\Year', 'range_class' => 'CalendR\\Period\\Range', 'first_weekday' => Day::MONDAY, 'strict_dates' => false)); $this->setDefaultOptions($this->resolver); } return $this->resolver->resolve($options); }
/** * @param \FSi\Component\DataGrid\Column\ColumnTypeInterface $column * @return array */ private function buildBatchActions(ColumnTypeInterface $column) { $batchActions = array('crud.list.batch.empty_choice'); foreach ($column->getOption('actions') as $name => $action) { $actionOptions = $this->actionOptionsResolver->resolve($action); $batchActions[$this->getBatchActionUrl($actionOptions)] = isset($actionOptions['label']) ? $actionOptions['label'] : $name; } return $batchActions; }
/** * {@inheritdoc} */ public function addAttributeFilter(AttributeInterface $attribute, $operator, $value, $locale = null, $scope = null, $options = []) { try { $options = $this->optionsResolver->resolve($options); } catch (\Exception $e) { throw InvalidArgumentException::expectedFromPreviousException($e, $attribute->getCode(), 'filter', 'reference data simple select'); } $this->checkLocaleAndScope($attribute, $locale, $scope, 'reference_data'); if (Operators::IS_EMPTY !== $operator) { $field = $options['field']; $this->checkValue($field, $value); if (FieldFilterHelper::CODE_PROPERTY === FieldFilterHelper::getProperty($field)) { $value = $this->valueCodesToIds($attribute, $value); } $this->addNonEmptyFilter($attribute, $operator, $value, $locale, $scope); } else { $this->addEmptyFilter($attribute, $locale, $scope); } return $this; }
/** * @param array $specs * * @return array */ protected function processSpecs(array $specs) { $specs = $this->specResolver->resolve($specs); foreach (array('from', 'to') as $target) { foreach ($specs[$target] as $key => $state) { if ($state[0] === '-') { $specs['exclude_' . $target][] = substr($state, 1); unset($specs[$target][$key]); } } if (0 === count($specs[$target])) { $specs[$target][] = self::ALL; } } return $specs; }
/** * {@inheritdoc} */ public function run(OptionsResolverInterface $resolver) { $records = array(); $results = $this->pdsSource->execute($this->getCriteria()); foreach ($results as $key => $result) { $result = array_change_key_case($result, CASE_LOWER); try { if ($record = $this->provider->getPatientByMRN($result['mrn'])) { $result['previous_record'] = $record; } } catch (PatientNotFoundException $e) { } $result['identifier'] = $result['mrn']; $result['import_description'] = sprintf('%s ordered on %s.', $result['medication'], $result['medication_date']); unset($result['medication'], $result['medication_date']); $records[] = $resolver->resolve($result); unset($results[$key]); } return $records; }
/** * {@inheritdoc} */ public function run(OptionsResolverInterface $resolver) { $records = array(); if (!$this->criteria->passes()) { return $records; } $results = $this->hmtbSource->execute($this->criteria->retrieve()); $localRecords = $this->localSource->execute(); foreach ($results as $key => $result) { $result = array_change_key_case($result, CASE_LOWER); try { $result['previous_record'] = $this->provider->getPatientByMRN($result['patient']); } catch (PatientNotFoundException $e) { } $record['identifier'] = $result['hmtb_id']; $result['import_description'] = sprintf('%s specimen on the %s.', $result['hmtb_id'], $result['patient']); $record = $resolver->resolve($result); if (!is_null($record['patient']) && $record['restricted'] == 'No' && !in_array($record['identifier'], $localRecords)) { $records[] = $record; } unset($results[$key]); } return $records; }
/** * {@inheritdoc} */ public final function resolveOptions(OptionsResolverInterface $resolver, array $options = null) { return $resolver->resolve((array) $options); }
/** * add Additional Image * * @param array $additionalImage * @param OptionsResolverInterface $resolver * * @return $this */ protected function addAdditionalImage(array $additionalImage, OptionsResolverInterface $resolver) { $image = $resolver->resolve($additionalImage); $this->additionalImages[$image['prefix']] = $image; return $this; }