@@ -366,6 +366,12 @@ class FlexiBeeRO extends \Ease\Sand
366366 * @var boolean
367367 */
368368 public $ offline = false ;
369+
370+ /**
371+ * Override cURL timeout
372+ * @var int seconds
373+ */
374+ public $ timeout = null ;
369375
370376 /**
371377 * Class for read only interaction with FlexiBee.
@@ -392,6 +398,7 @@ public function __construct($init = null, $options = [])
392398 * company,url,evidence,
393399 * prefix,defaultUrlParams,debug,
394400 * detail,offline,filter,ignore404
401+ * timeout
395402 */
396403 public function setUp ($ options = [])
397404 {
@@ -400,6 +407,7 @@ public function setUp($options = [])
400407 $ this ->setupProperty ($ options , 'user ' , 'FLEXIBEE_LOGIN ' );
401408 $ this ->setupProperty ($ options , 'password ' , 'FLEXIBEE_PASSWORD ' );
402409 $ this ->setupProperty ($ options , 'authSessionId ' , 'FLEXIBEE_AUTHSESSID ' );
410+ $ this ->setupProperty ($ options , 'timeout ' , 'FLEXIBEE_TIMEOUT ' );
403411 if (!empty ($ this ->authSessionId )) {
404412 $ this ->defaultHttpHeaders ['X-authSessionId ' ] = $ this ->authSessionId ;
405413 }
@@ -462,6 +470,9 @@ public function getConnectionOptions()
462470 if (!empty ($ company )) {
463471 $ conOpts ['company ' ] = $ company ;
464472 }
473+ if (!is_null ($ this ->timeout )){
474+ $ conOpts ['timeout ' ] = $ this ->timeout ;
475+ }
465476 return $ conOpts ;
466477 }
467478
@@ -484,6 +495,9 @@ public function curlInit()
484495 curl_setopt ($ this ->curl , CURLOPT_USERPWD ,
485496 $ this ->user .': ' .$ this ->password ); // set username and password
486497 }
498+ if (!is_null ($ this ->timeout )){
499+ curl_setopt ($ this ->curl , CURLOPT_TIMEOUT , $ this ->timeout );
500+ }
487501 }
488502 return !$ this ->offline ;
489503 }
0 commit comments