mpyw\Co\Internal\TypeUtils::isCurl PHP Method

isCurl() public static method

Check if value is a valid cURL handle.
public static isCurl ( mixed $value ) : boolean
$value mixed
return boolean
    public static function isCurl($value)
    {
        return is_resource($value) && get_resource_type($value) === 'curl';
    }

Usage Example

Beispiel #1
0
 public function testIsCurl()
 {
     $ch = curl_init();
     $this->assertTrue(TypeUtils::isCurl($ch));
     curl_close($ch);
     $this->assertFalse(TypeUtils::isCurl($ch));
     $this->assertFalse(TypeUtils::isCurl(curl_multi_init()));
     $this->assertFalse(TypeUtils::isCurl([1]));
     $this->assertFalse(TypeUtils::isCurl((object) [1]));
 }
All Usage Examples Of mpyw\Co\Internal\TypeUtils::isCurl