public static function cookie() { if (static::$cookie instanceof Cookie) { return static::$cookie; } return static::$cookie = new Cookie(); }
private static final function init() { if (is_null(static::$cookie)) { static::$cookie = defined('BBRPC_COOKIE') ? BBRPC_COOKIE : getcwd() . '/bb.rpc.cookie'; } if (is_null(static::$rpc_url)) { static::$rpc_url = BBRPC_URL; } if (is_null(static::$client)) { static::$client = curl_init(); static::setOpt(CURLOPT_SSL_VERIFYPEER, FALSE); static::setOpt(CURLOPT_RETURNTRANSFER, TRUE); static::setOpt(CURLOPT_TIMEOUT, 300); static::setOpt(CURLOPT_HEADER, FALSE); static::setOpt(CURLOPT_FORBID_REUSE, FALSE); static::setOpt(CURLOPT_VERBOSE, FALSE); static::setOpt(CURLOPT_COOKIEFILE, static::$cookie); static::setOpt(CURLOPT_COOKIEJAR, static::$cookie); static::setOpt(CURLOPT_HTTPHEADER, array('Connection: keep-alive', 'Keep-Alive: 300', 'Expect: ')); return 1; } return 0; }
/** * Create Cookie manager and store or access cookie * information * */ public function __construct() { static::$cookie = CookieManager::create(); }