ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Monolog\Handler\Curl\Util Class Reference
+ Collaboration diagram for Monolog\Handler\Curl\Util:

Static Public Member Functions

static execute ($ch, $retries=5, $closeAfterDone=true)
 Executes a CURL request with optional retries and exception on failure. More...
 

Static Private Attributes

static $retriableErrorCodes
 

Detailed Description

Definition at line 14 of file Util.php.

Member Function Documentation

◆ execute()

static Monolog\Handler\Curl\Util::execute (   $ch,
  $retries = 5,
  $closeAfterDone = true 
)
static

Executes a CURL request with optional retries and exception on failure.

Parameters
resource$chcurl handler
Exceptions

RuntimeException

Definition at line 32 of file Util.php.

33 {
34 while ($retries--) {
35 if (curl_exec($ch) === false) {
36 $curlErrno = curl_errno($ch);
37
38 if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) {
39 $curlError = curl_error($ch);
40
41 if ($closeAfterDone) {
42 curl_close($ch);
43 }
44
45 throw new \RuntimeException(sprintf('Curl error (code %s): %s', $curlErrno, $curlError));
46 }
47
48 continue;
49 }
50
51 if ($closeAfterDone) {
52 curl_close($ch);
53 }
54 break;
55 }
56 }
sprintf('%.4f', $callTime)

References sprintf.

Referenced by Monolog\Handler\MandrillHandler\send(), Monolog\Handler\LogglyHandler\send(), Monolog\Handler\IFTTTHandler\write(), and Monolog\Handler\CubeHandler\writeHttp().

+ Here is the caller graph for this function:

Field Documentation

◆ $retriableErrorCodes

Monolog\Handler\Curl\Util::$retriableErrorCodes
staticprivate
Initial value:
= array(
CURLE_COULDNT_RESOLVE_HOST,
CURLE_COULDNT_CONNECT,
CURLE_HTTP_NOT_FOUND,
CURLE_READ_ERROR,
CURLE_OPERATION_TIMEOUTED,
CURLE_HTTP_POST_ERROR,
CURLE_SSL_CONNECT_ERROR,
)

Definition at line 16 of file Util.php.


The documentation for this class was generated from the following file: