|
Revision 279, 0.5 kB
(checked in by indeyets, 14 months ago)
|
|
- changed naming of tags to php/(object|array|hash)::ClassName?
- added ability to emit Serializable objects
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | class SyckTestSomeClass {} |
|---|
| 4 | |
|---|
| 5 | class MySerializable implements Serializable |
|---|
| 6 | { |
|---|
| 7 | private $string = null; |
|---|
| 8 | |
|---|
| 9 | public function __construct($string = null) |
|---|
| 10 | { |
|---|
| 11 | if (null === $string) |
|---|
| 12 | throw new Exception('This is not supposed to be called implicitly'); |
|---|
| 13 | |
|---|
| 14 | $this->string = $string; |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | public function serialize() |
|---|
| 18 | { |
|---|
| 19 | return $this->string; |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | public function unserialize($string) |
|---|
| 23 | { |
|---|
| 24 | $this->string = $string; |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | public function test() |
|---|
| 28 | { |
|---|
| 29 | return $this->string; |
|---|
| 30 | } |
|---|
| 31 | } |
|---|