XRL  latest
Simple XML-RPC Library (both client and server)
AbstractType.php
1 <?php
2 /*
3  * This file is part of XRL, a simple XML-RPC Library for PHP.
4  *
5  * Copyright (c) 2012, XRL Team. All rights reserved.
6  * XRL is licensed under the 3-clause BSD License.
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace fpoirotte\XRL\Types;
13 
20 abstract class AbstractType
21 {
23  protected $value;
24 
36  public function __construct($value)
37  {
38  $this->set($value);
39  }
40 
47  public function get()
48  {
49  return $this->value;
50  }
51 
69  final public static function read($value, \DateTimeZone $timezone = null)
70  {
71  return new static(static::parse($value, $timezone));
72  }
73 
81  public function __toString()
82  {
83  return (string) $this->get();
84  }
85 
99  protected static function parse($value, \DateTimeZone $timezone = null)
100  {
101  return $value;
102  }
103 
118  abstract public function set($value);
119 
136  abstract public function write(\XMLWriter $writer, \DateTimeZone $timezone, $stringTag);
137 }
write(\XMLWriter $writer,\DateTimeZone $timezone, $stringTag)
static read($value,\DateTimeZone $timezone=null)
$value
Current value associated with this object.
A class representing an abstract XML-RPC type.
static parse($value,\DateTimeZone $timezone=null)