Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

(no description)

File Size: 595 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

CurlFactory:: (15 methods):
  __construct()
  create()
  release()
  finish()
  invokeStats()
  finishError()
  createRejection()
  getDefaultConf()
  applyMethod()
  applyBody()
  applyHeaders()
  removeHeader()
  applyHandlerOptions()
  retryFailedRewind()
  createHeaderFn()


Class: CurlFactory  - X-Ref

Creates curl resources from a request

__construct(int $maxHandles)   X-Ref

param: int $maxHandles Maximum number of idle handles.

create(RequestInterface $request, array $options)   X-Ref
No description

release(EasyHandle $easy)   X-Ref
No description

finish(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory)   X-Ref
Completes a cURL transaction, either returning a response promise or a
rejected promise.

param: callable(RequestInterface, array): PromiseInterface $handler
param: CurlFactoryInterface                                $factory Dictates how the handle is released

invokeStats(EasyHandle $easy)   X-Ref
No description

finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory)   X-Ref

param: callable(RequestInterface, array): PromiseInterface $handler

createRejection(EasyHandle $easy, array $ctx)   X-Ref
No description

getDefaultConf(EasyHandle $easy)   X-Ref

return: array<int|string, mixed>

applyMethod(EasyHandle $easy, array &$conf)   X-Ref
No description

applyBody(RequestInterface $request, array $options, array &$conf)   X-Ref
No description

applyHeaders(EasyHandle $easy, array &$conf)   X-Ref
No description

removeHeader(string $name, array &$options)   X-Ref
Remove a header from the options array.

param: string $name    Case-insensitive header to remove
param: array  $options Array of options to modify

applyHandlerOptions(EasyHandle $easy, array &$conf)   X-Ref
No description

retryFailedRewind(callable $handler, EasyHandle $easy, array $ctx)   X-Ref
This function ensures that a response was set on a transaction. If one
was not set, then the request is retried if possible. This error
typically means you are sending a payload, curl encountered a
"Connection died, retrying a fresh connect" error, tried to rewind the
stream, and then encountered a "necessary data rewind wasn't possible"
error, causing the request to be sent through curl_multi_info_read()
without an error status.

param: callable(RequestInterface, array): PromiseInterface $handler

createHeaderFn(EasyHandle $easy)   X-Ref
No description