XRL  2.0.0
Simple XML-RPC Library (both client and server)
Output.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 
21 class Output
22 {
24  protected $stream;
25 
33  public function __construct($stream)
34  {
35  $this->stream = $stream;
36  }
37 
55  public function write($format /* , ... */)
56  {
57  $args = func_get_args();
58  array_shift($args);
59  // Protection against format attacks.
60  if (!count($args)) {
61  $args[] = $format;
62  $format = "%s";
63  }
64  vfprintf($this->stream, $format . PHP_EOL, $args);
65  }
66 }
$stream
Stream to send the messages to.
Definition: Output.php:24
__construct($stream)
Definition: Output.php:33
write($format)
Definition: Output.php:55
A class that formats messages before sending them to a stream.
Definition: Output.php:21