/** * @param bool $permanent */ public function __construct($permanent = true) { static $mh_cache, $ch_cache; if (!$permanent || !$mh_cache) { $mh_cache = curl_multi_init(); $ch_cache = array(); for ($i = 0; $i < self::MAX_CONNECTIONS; ++$i) { $ch = curl_init(); Share::setup($ch); $ch_cache[] = $ch; } } $this->mh = $mh_cache; $this->unused = $ch_cache; $this->permanent = $permanent; // for PHP<5.5 @see getFinishedResults() $this->blackhole = fopen('php://temp', 'wb'); }
public function testSetup() { $ch = curl_init(); Share::setup($ch); self::assertInternalType('resource', $ch); }