Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components/options_resolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ value you guess based on the host. You can do that easily by using a
Closure as the default value::

use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

// ...
protected function setDefaultOptions(OptionsResolverInterface $resolver)
Expand All @@ -207,7 +208,7 @@ Closure as the default value::

$resolver->setDefaults(array(
'port' => function (Options $options) {
if (in_array($options['host'], array('127.0.0.1', 'localhost')) {
if (in_array($options['host'], array('127.0.0.1', 'localhost'))) {
return 80;
}

Expand Down Expand Up @@ -305,7 +306,7 @@ need to use the other options for normalizing::

$resolver->setNormalizers(array(
'host' => function (Options $options, $value) {
if (!in_array(substr($value, 0, 7), array('http://', 'https://')) {
if (!in_array(substr($value, 0, 7), array('http://', 'https://'))) {
if ($options['ssl']) {
$value = 'https://'.$value;
} else {
Expand Down