File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -39,10 +39,18 @@ class Client
3939 * API authorization pass
4040 *
4141 * @var string $pass
42- * @access protected
42+ * @access protected
4343 */
4444 protected $ pass ;
4545
46+ /**
47+ * API authorization pass
48+ *
49+ * @var int $timeout [= 5]
50+ * @access protected
51+ */
52+ protected $ timeout = 5 ;
53+
4654/**
4755 * Instance of DatingVIP\cURL\Request lib
4856 *
@@ -81,6 +89,21 @@ public function setAuth($user, $pass)
8189 return $ this ->hasAuth ();
8290 }
8391
92+ /**
93+ * Set request timeout value (in seconds)
94+ *
95+ * @param int $timeout
96+ * @access public
97+ * @return int
98+ */
99+ public function setTimeout ($ timeout )
100+ {
101+ $ timeout = is_scalar ($ timeout ) ? (int ) $ timeout : 0 ;
102+ return $ timeout < 1
103+ ? $ this ->timeout
104+ : $ this ->timeout = $ timeout ;
105+ }
106+
84107/**
85108 * Execute API command
86109 *
@@ -119,7 +142,7 @@ private function curl()
119142 $ this ->curl ->setCredentials ($ this ->user , $ this ->pass );
120143 }
121144
122- return $ this ->curl ;
145+ return $ this ->curl -> setTimeout ( $ this -> timeout ) ;
123146 }
124147
125148/**
You can’t perform that action at this time.
0 commit comments