ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

Definition at line 32 of file Util.php.

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

33  {
34  while ($retries--) {
35  if (curl_exec($ch) === false) {
36 
37  if (false === in_array(curl_errno($ch), self::$retriableErrorCodes, true) || !$retries) {
38  if ($closeAfterDone) {
39  curl_close($ch);
40  }
41 
42  throw new \RuntimeException(sprintf('Curl error (code %s): %s', curl_errno($ch), curl_error($ch)));
43  }
44 
45  continue;
46  }
47 
48  if ($closeAfterDone) {
49  curl_close($ch);
50  }
51  break;
52  }
53  }
+ 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: