Permalink
Browse files

Rename $options to $context, as it makes the intent much more clear.

  • Loading branch information...
1 parent 7e2de10 commit 6fc3d3dc23e3830e3e857f56c4dde5bbdc7c83fc @beberlei beberlei committed with dlsniper Aug 6, 2012
Showing with 15 additions and 15 deletions.
  1. +3 −3 Encoder/XmlEncoder.php
  2. +7 −7 Serializer.php
  3. +5 −5 SerializerInterface.php
View
6 Encoder/XmlEncoder.php
@@ -409,10 +409,10 @@ private function getRealRootNodeName()
return $this->rootNodeName;
}
- $options = $this->serializer->getOptions();
+ $context = $this->serializer->getContext();
- return isset($options['xml_root_node_name'])
- ? $options['xml_root_node_name']
+ return isset($context['xml_root_node_name'])
+ ? $context['xml_root_node_name']
: $this->rootNodeName;
}
View
14 Serializer.php
@@ -42,7 +42,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
protected $normalizers = array();
protected $normalizerCache = array();
protected $denormalizerCache = array();
- protected $options;
+ protected $context;
public function __construct(array $normalizers = array(), array $encoders = array())
{
@@ -73,13 +73,13 @@ public function __construct(array $normalizers = array(), array $encoders = arra
/**
* {@inheritdoc}
*/
- final public function serialize($data, $format, array $options = array())
+ final public function serialize($data, $format, array $context = array())
{
if (!$this->supportsEncoding($format)) {
throw new UnexpectedValueException('Serialization for the format '.$format.' is not supported');
}
- $this->options = $options;
+ $this->context = $context;
if ($this->encoder->needsNormalization($format)) {
$data = $this->normalize($data, $format);
@@ -91,13 +91,13 @@ public function __construct(array $normalizers = array(), array $encoders = arra
/**
* {@inheritdoc}
*/
- final public function deserialize($data, $type, $format, array $options = array())
+ final public function deserialize($data, $type, $format, array $context = array())
{
if (!$this->supportsDecoding($format)) {
throw new UnexpectedValueException('Deserialization for the format '.$format.' is not supported');
}
- $this->options = $options;
+ $this->context = $context;
$data = $this->decode($data, $format);
@@ -305,8 +305,8 @@ public function supportsDecoding($format)
/**
* {@inheritdoc}
*/
- public function getOptions()
+ public function getContext()
{
- return $this->options;
+ return $this->context;
}
}
View
10 SerializerInterface.php
@@ -23,28 +23,28 @@
*
* @param mixed $data any data
* @param string $format format name
- * @param array $options options normalizers/encoders have access to
+ * @param array $context options normalizers/encoders have access to
*
* @return string
*/
- public function serialize($data, $format, array $options = array());
+ public function serialize($data, $format, array $context = array());
/**
* Deserializes data into the given type.
*
* @param mixed $data
* @param string $type
* @param string $format
- * @param array $options
+ * @param array $context
*
* @return object
*/
- public function deserialize($data, $type, $format, array $options = array());
+ public function deserialize($data, $type, $format, array $context = array());
/**
* Get current options of the serializer
*
* @return array
*/
- public function getOptions();
+ public function getContext();
}

0 comments on commit 6fc3d3d

Please sign in to comment.