4 <?php include "skipif.inc"; ?>
8 class Client extends \http\Client\AbstractClient
10 function __construct() {
11 parent::__construct();
12 $this->request = new \http\Client\Request("GET", "http://localhost");
14 function send($request) {
18 $ext = new ReflectionExtension("http");
19 foreach ($ext->getClasses() as $class) {
20 if ($class->isInstantiable()) {
21 #printf("%s\n", $class->getName());
22 $instance = $class->newInstance();
23 $serialized = serialize($instance);
24 $unserialized = unserialize($serialized);
26 foreach (["toString", "toArray"] as $m) {
27 if ($class->hasMethod($m)) {
28 #printf("%s#%s\n", $class->getName(), $m);
32 if ($class->hasMethod("attach") && !$class->implementsInterface("\\SplSubject")) {
33 #printf("%s#%s\n", $class->getName(), "attach");
34 $unserialized->attach((new http\Curl\Client)->setRequest(new http\Client\Request("GET", "http://localhost")));