Permalink
Browse files

hiding private members of binary data type

  • Loading branch information...
1 parent 09f320d commit dbe6ce13f889a698062be3953401619642d92702 @icheishvili icheishvili committed Mar 12, 2012
Showing with 27 additions and 5 deletions.
  1. +25 −3 src/Hurricane/Erlang/DataType/Binary.php
  2. +2 −2 src/Hurricane/Erlang/Util.php
@@ -10,7 +10,7 @@ class Binary
/**
* @var string
*/
- public $data;
+ private $_data;
/**
* Set the given data on the object.
@@ -19,6 +19,28 @@ class Binary
*/
public function __construct($data)
{
- $this->data = $data;
+ $this->setData($data);
}
-}
+
+ /**
+ * Getter for data.
+ *
+ * @return string
+ */
+ public function getData()
+ {
+ return $this->_data;
+ }
+
+ /**
+ * Setter for data.
+ *
+ * @param mixed $data
+ *
+ * @return void
+ */
+ public function setData($data)
+ {
+ $this->_data = (string) $data;
+ }
+}
@@ -711,8 +711,8 @@ public static function encode_null(StreamInterface $stream)
public static function encode_binary(DataType\Binary $data, StreamInterface $stream)
{
$stream->write(chr(109));
- $stream->write(pack('N', strlen($data->data)));
- $stream->write($data->data);
+ $stream->write(pack('N', strlen($data->getData())));
+ $stream->write($data->getData());
}
/**

0 comments on commit dbe6ce1

Please sign in to comment.