XRL  latest
Simple XML-RPC Library (both client and server)
StringType.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 
21 {
23  public function set($value)
24  {
25  if (!is_string($value)) {
26  throw new \InvalidArgumentException('A string value was expected');
27  }
28  $this->value = $value;
29  }
30 
32  public function write(\XMLWriter $writer, \DateTimeZone $timezone, $stringTag)
33  {
34  if ($stringTag) {
35  $writer->writeElement('string', $this->value);
36  } else {
37  $writer->text($this->value);
38  }
39  }
40 }
write(\XMLWriter $writer,\DateTimeZone $timezone, $stringTag)
Definition: StringType.php:32
The XML-RPC "string" type.
Definition: StringType.php:20
$value
Current value associated with this object.
A class representing an abstract XML-RPC type.