HTTP utility class
Expanded class hierarchy of Utils
class Utils {
/**
* @var string
*/
protected static $userAgent;
/**
* Create an RFC 1123 HTTP-Date from various date values
*
* @param string|int $date Date to convert
*
* @return string
*/
public static function getHttpDate($date) {
if (!is_numeric($date)) {
$date = strtotime($date);
}
return gmdate('D, d M Y H:i:s \\G\\M\\T', $date);
}
/**
* Get the default User-Agent to add to requests sent through the library
*
* @return string
*/
public static function getDefaultUserAgent() {
if (!self::$userAgent) {
self::$userAgent = sprintf('Guzzle/%s curl/%s PHP/%s', Version::VERSION, CurlVersion::getInstance()
->get('version'), PHP_VERSION);
}
return self::$userAgent;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Utils:: |
protected static | property | ||
Utils:: |
public static | function | Get the default User-Agent to add to requests sent through the library | |
Utils:: |
public static | function | Create an RFC 1123 HTTP-Date from various date values |