Skip to content

Commit 6fc3d3d

Browse files
beberleidlsniper
authored andcommitted
Rename $options to $context, as it makes the intent much more clear.
1 parent 7e2de10 commit 6fc3d3d

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

Encoder/XmlEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,10 @@ private function getRealRootNodeName()
409409
return $this->rootNodeName;
410410
}
411411

412-
$options = $this->serializer->getOptions();
412+
$context = $this->serializer->getContext();
413413

414-
return isset($options['xml_root_node_name'])
415-
? $options['xml_root_node_name']
414+
return isset($context['xml_root_node_name'])
415+
? $context['xml_root_node_name']
416416
: $this->rootNodeName;
417417
}
418418

Serializer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
4242
protected $normalizers = array();
4343
protected $normalizerCache = array();
4444
protected $denormalizerCache = array();
45-
protected $options;
45+
protected $context;
4646

4747
public function __construct(array $normalizers = array(), array $encoders = array())
4848
{
@@ -73,13 +73,13 @@ public function __construct(array $normalizers = array(), array $encoders = arra
7373
/**
7474
* {@inheritdoc}
7575
*/
76-
final public function serialize($data, $format, array $options = array())
76+
final public function serialize($data, $format, array $context = array())
7777
{
7878
if (!$this->supportsEncoding($format)) {
7979
throw new UnexpectedValueException('Serialization for the format '.$format.' is not supported');
8080
}
8181

82-
$this->options = $options;
82+
$this->context = $context;
8383

8484
if ($this->encoder->needsNormalization($format)) {
8585
$data = $this->normalize($data, $format);
@@ -91,13 +91,13 @@ final public function serialize($data, $format, array $options = array())
9191
/**
9292
* {@inheritdoc}
9393
*/
94-
final public function deserialize($data, $type, $format, array $options = array())
94+
final public function deserialize($data, $type, $format, array $context = array())
9595
{
9696
if (!$this->supportsDecoding($format)) {
9797
throw new UnexpectedValueException('Deserialization for the format '.$format.' is not supported');
9898
}
9999

100-
$this->options = $options;
100+
$this->context = $context;
101101

102102
$data = $this->decode($data, $format);
103103

@@ -305,8 +305,8 @@ public function supportsDecoding($format)
305305
/**
306306
* {@inheritdoc}
307307
*/
308-
public function getOptions()
308+
public function getContext()
309309
{
310-
return $this->options;
310+
return $this->context;
311311
}
312312
}

SerializerInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@ interface SerializerInterface
2323
*
2424
* @param mixed $data any data
2525
* @param string $format format name
26-
* @param array $options options normalizers/encoders have access to
26+
* @param array $context options normalizers/encoders have access to
2727
*
2828
* @return string
2929
*/
30-
public function serialize($data, $format, array $options = array());
30+
public function serialize($data, $format, array $context = array());
3131

3232
/**
3333
* Deserializes data into the given type.
3434
*
3535
* @param mixed $data
3636
* @param string $type
3737
* @param string $format
38-
* @param array $options
38+
* @param array $context
3939
*
4040
* @return object
4141
*/
42-
public function deserialize($data, $type, $format, array $options = array());
42+
public function deserialize($data, $type, $format, array $context = array());
4343

4444
/**
4545
* Get current options of the serializer
4646
*
4747
* @return array
4848
*/
49-
public function getOptions();
49+
public function getContext();
5050
}

0 commit comments

Comments
 (0)