| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Helpers; |
| 4 |
|
| 5 |
/** |
| 6 |
* Helper class for getting information about the installed cURL version. |
| 7 |
*/ |
| 8 |
class Curl_Helper { |
| 9 |
|
| 10 |
/** |
| 11 |
* Checks is cURL is installed. |
| 12 |
* |
| 13 |
* @return bool Returns true if cURL is installed. |
| 14 |
*/ |
| 15 |
public function is_installed() { |
| 16 |
return \function_exists( 'curl_version' ); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Returns the currently installed cURL version. |
| 21 |
* |
| 22 |
* @return string|null Returns a string containing the cURL version, or null if cURL is not installed. |
| 23 |
*/ |
| 24 |
public function get_version() { |
| 25 |
$version = \curl_version(); |
| 26 |
|
| 27 |
if ( ! isset( $version['version'] ) ) { |
| 28 |
return null; |
| 29 |
} |
| 30 |
|
| 31 |
return $version['version']; |
| 32 |
} |
| 33 |
} |
| 34 |
|