Skip to content
Browse files

Fix the factories (broken by e4594d1).

  • Loading branch information...
1 parent e50e353 commit 28fea392f5dc463f272805b3d421fa171f119c7f @fpoirotte committed Apr 13, 2012
View
17 src/XRL/CompactEncoderFactory.php
@@ -28,10 +28,25 @@
class XRL_CompactEncoderFactory
implements XRL_EncoderFactoryInterface
{
+ /// Timezone used to encode date/times.
+ protected $_timezone;
+
+ /**
+ * Creates a new factory for compact encoders.
+ *
+ * \param DateTimeZone $timezone
+ * Information on the timezone for which
+ * date/times should be encoded.
+ */
+ public function __construct(DateTimeZone $timezone)
+ {
+ $this->_timezone = $timezone;
+ }
+
/// \copydoc XRL_EncoderFactoryInterface::createEncoder()
public function createEncoder()
{
- return new XRL_Encoder(FALSE);
+ return new XRL_Encoder($this->_timezone, FALSE);
}
}
View
18 src/XRL/NonValidatingDecoderFactory.php
@@ -24,10 +24,26 @@
class XRL_NonValidatingDecoderFactory
implements XRL_DecoderFactoryInterface
{
+ /// Timezone used to decode date/times.
+ protected $_timezone;
+
+ /**
+ * Creates a new factory for a decoder that
+ * does not validate its input.
+ *
+ * \param DateTimeZone $timezone
+ * Information on the timezone incoming
+ * date/times come from.
+ */
+ public function __construct(DateTimeZone $timezone)
+ {
+ $this->_timezone = $timezone;
+ }
+
/// \copydoc XRL_DecoderFactoryInterface::createDecoder()
public function createDecoder()
{
- return new XRL_Decoder(FALSE);
+ return new XRL_Decoder($this->_timezone, FALSE);
}
}
View
17 src/XRL/PrettyEncoderFactory.php
@@ -26,10 +26,25 @@
class XRL_PrettyEncoderFactory
implements XRL_EncoderFactoryInterface
{
+ /// Timezone used to encode date/times.
+ protected $_timezone;
+
+ /**
+ * Creates a new factory for pretty encoders.
+ *
+ * \param DateTimeZone $timezone
+ * Information on the timezone for which
+ * date/times should be encoded.
+ */
+ public function __construct(DateTimeZone $timezone)
+ {
+ $this->_timezone = $timezone;
+ }
+
/// \copydoc XRL_EncoderFactoryInterface::createEncoder()
public function createEncoder()
{
- return new XRL_Encoder(TRUE);
+ return new XRL_Encoder($this->_timezone, TRUE);
}
}
View
18 src/XRL/ValidatingDecoderFactory.php
@@ -24,10 +24,26 @@
class XRL_ValidatingDecoderFactory
implements XRL_DecoderFactoryInterface
{
+ /// Timezone used to decode date/times.
+ protected $_timezone;
+
+ /**
+ * Creates a new factory for a decoder that
+ * validates its input.
+ *
+ * \param DateTimeZone $timezone
+ * Information on the timezone incoming
+ * date/times come from.
+ */
+ public function __construct(DateTimeZone $timezone)
+ {
+ $this->_timezone = $timezone;
+ }
+
/// \copydoc XRL_DecoderFactoryInterface::createDecoder()
public function createDecoder()
{
- return new XRL_Decoder(TRUE);
+ return new XRL_Decoder($this->_timezone, TRUE);
}
}

0 comments on commit 28fea39

Please sign in to comment.
Something went wrong with that request. Please try again.