\Teknoo\CurlOptions

Class Options Class to manage cUrl Options and the valid type(s) for each and define them in a request context.

Summary

Methods
Properties
Constants
__construct()
isValidOption()
checkOptionValue()
setOptionValue()
setOptionsValuesArray()
No public properties found
No constants found
checkType()
$optionValueTypesList
N/A
No private methods found
No private properties found
N/A

Properties

$optionValueTypesList

$optionValueTypesList : array

List of available CURL Option in this execution.

Type

array

Methods

__construct()

__construct() 

Initialize curl options Checks which cURL constants is defined and loads them as valid options.

isValidOption()

isValidOption(integer  $option) : boolean

Determine whether or not the value passed is a valid cURL option.

Parameters

integer $option

An Integer Flag

Returns

boolean —

Whether or not the flag is a valid cURL option

checkOptionValue()

checkOptionValue(integer  $option, mixed  $value,   $throw = true) : boolean

Check whether or not the value is a valid type for the given option.

Parameters

integer $option

An integer flag

mixed $value

the value to be set to the integer flag

$throw

Throws

\InvalidArgumentException

if the $option _isnot a valid cURL option

Returns

boolean —

$throw Whether or not the value is of the correct type

setOptionValue()

setOptionValue(resource  $resource, integer  $option, mixed  $value) : boolean

Alias of the curl_setopt function.

Parameters

resource $resource

cUrl resource

integer $option

Option defined in http://php.net/manual/function.curl-setopt.php

mixed $value

Throws

\InvalidArgumentException

if the option does not exist or if it is invalid

Returns

boolean

setOptionsValuesArray()

setOptionsValuesArray(resource  $resource, array  $options) : boolean

Alias of the curl_setopt_array function.

Parameters

resource $resource

curl resource

array $options

defined in http://php.net/manual/function.curl-setopt-array.php

Returns

boolean

checkType()

checkType(mixed  $value, string  $type) : boolean

Check if the type of $value is the attempted type by the option.

Parameters

mixed $value
string $type

Returns

boolean