VCR\Util\Assertion::isCallable PHP Method

isCallable() public static method

Assert that the value is callable.
public static isCallable ( mixed $value, string $message = null, null $propertyPath = null ) : void
$value mixed Variable to check for a callable.
$message string Exception message to show if value is not a callable.
$propertyPath null
return void
    public static function isCallable($value, $message = null, $propertyPath = null)
    {
        if (!is_callable($value)) {
            throw new VCRException($message, self::INVALID_CALLABLE, $propertyPath);
        }
    }

Usage Example

Example #1
0
 /**
  * @inheritDoc
  */
 public function enable(\Closure $requestCallback)
 {
     Assertion::isCallable($requestCallback, 'No valid callback for handling requests defined.');
     self::$requestCallback = $requestCallback;
     stream_wrapper_unregister('http');
     stream_wrapper_register('http', __CLASS__, STREAM_IS_URL);
     stream_wrapper_unregister('https');
     stream_wrapper_register('https', __CLASS__, STREAM_IS_URL);
     $this->status = self::ENABLED;
 }
All Usage Examples Of VCR\Util\Assertion::isCallable
Assertion