XRL  latest
Simple XML-RPC Library (both client and server)
Nil.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 ($value !== null) {
26  throw new \InvalidArgumentException('A null value was expected');
27  }
28  }
29 
31  public function write(\XMLWriter $writer, \DateTimeZone $timezone, $stringTag)
32  {
33  return $writer->writeElementNS(
34  'ex',
35  'nil',
36  'http://ws.apache.org/xmlrpc/namespaces/extensions'
37  );
38  }
39 
41  protected static function parse($value, \DateTimeZone $timezone = null)
42  {
43  if ($value === '' || $value === null) {
44  return null;
45  }
46  return $value;
47  }
48 }
The XML-RPC "nil" type for null values.
Definition: Nil.php:20
static parse($value,\DateTimeZone $timezone=null)
Definition: Nil.php:41
$value
Current value associated with this object.
A class representing an abstract XML-RPC type.
write(\XMLWriter $writer,\DateTimeZone $timezone, $stringTag)
Definition: Nil.php:31