本文整理汇总了PHP中Symfony\Component\OptionsResolver\OptionsResolverInterface::resolve方法的典型用法代码示例。如果您正苦于以下问题:PHP OptionsResolverInterface::resolve方法的具体用法?PHP OptionsResolverInterface::resolve怎么用?PHP OptionsResolverInterface::resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\OptionsResolver\OptionsResolverInterface
的用法示例。
在下文中一共展示了OptionsResolverInterface::resolve方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: consume
/**
* 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);
}
}
示例2: resolveOptions
/**
* @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);
}
示例3: resolveOptions
/**
* @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);
}
示例4: run
/**
* {@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;
}
示例5: run
/**
* {@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;
}
示例6: resolveOptions
/**
* @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);
}
示例7: buildBatchActions
/**
* @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;
}
示例8: addAttributeFilter
/**
* {@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;
}
示例9: processSpecs
/**
* @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;
}
示例10: run
/**
* {@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;
}
示例11: run
/**
* {@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;
}
示例12: resolveOptions
/**
* {@inheritdoc}
*/
public final function resolveOptions(OptionsResolverInterface $resolver, array $options = null)
{
return $resolver->resolve((array) $options);
}
示例13: addAdditionalImage
/**
* 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;
}