/
PhpFunc.php
70 lines (67 loc) · 1.45 KB
/
PhpFunc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
*
* This file is part of the Aura project for PHP.
*
* @package Aura.Http
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*/
namespace Aura\Http;
/**
*
* An object-oriented interface to native PHP functions. This allows us to
* override those functions for testing.
*
* @package Aura.Http
*
*/
class PhpFunc
{
/**
*
* Forwards all calls to PHP functions.
*
* @param string $func The PHP function name.
*
* @param array $args The arguments to pass to the function.
*
* @return mixed
*
*/
public function __call($func, $args)
{
return call_user_func_array($func, $args);
}
/**
*
* A replacement function to use instead of `echo` and `print` (since
* they are keywords, not functions per se).
*
* @param string $text The text to echo/print.
*
* @return void
*
*/
public function output($text)
{
echo $text;
}
// FIXME Public method name "PhpFunc::headers_sent" is not in camel caps format
/**
*
* Override for `headers_sent()` since it needs parameter references.
*
* @param string $file The file where headers were sent.
*
* @param int $line The line in that file where headers were sent.
*
* @return bool
*
*/
public function headers_sent(&$file, &$line)
{
return headers_sent($file, $line);
}
}