You are here

protected function VarbaseMediaRemoteVideo::toString in Varbase Media 9.0.x

Same name and namespace in other branches
  1. 8.7 src/Plugin/media/Source/VarbaseMediaRemoteVideo.php \Drupal\varbase_media\Plugin\media\Source\VarbaseMediaRemoteVideo::toString()
  2. 8.6 src/Plugin/media/Source/VarbaseMediaRemoteVideo.php \Drupal\varbase_media\Plugin\media\Source\VarbaseMediaRemoteVideo::toString()

Safely converts a value to a string.

The value is converted if it is either scalar, or an object with a __toString() method.

Parameters

mixed $value: The value to convert.

Return value

string|null The string representation of the value, or NULL if the value cannot be converted to a string.

1 call to VarbaseMediaRemoteVideo::toString()
VarbaseMediaRemoteVideo::appliesTo in src/Plugin/media/Source/VarbaseMediaRemoteVideo.php
Checks if this media type can handle a given input value.

File

src/Plugin/media/Source/VarbaseMediaRemoteVideo.php, line 69

Class

VarbaseMediaRemoteVideo
Input-matching version of the Varbase Media Remote Video media source.

Namespace

Drupal\varbase_media\Plugin\media\Source

Code

protected function toString($value) {
  return is_scalar($value) || is_object($value) && method_exists($value, '__toString') ? (string) $value : NULL;
}