XRL  latest
Simple XML-RPC Library (both client and server)
NativeDecoder.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;
13 
22 {
24  protected $decoder;
25 
33  {
34  $this->decoder = $decoder;
35  }
36 
38  public function decodeRequest($URI)
39  {
40  $request = $this->decoder->decodeRequest($URI);
41  $closure = function ($p) {
42  return $p->get();
43  };
44  $params = array_map($closure, $request->getParams());
45  return new \fpoirotte\XRL\Request($request->getProcedure(), $params);
46  }
47 
49  public function decodeResponse($URI)
50  {
51  return $this->decoder->decodeResponse($URI)->get();
52  }
53 }
Interface for an XML-RPC decoder.
A decoder that transparently converts XML-RPC types to native PHP types.
__construct(\fpoirotte\XRL\DecoderInterface $decoder)