You are here

public function IndeterminateBundleException::__toString in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.4 src/Exception/IndeterminateBundleException.php \Drupal\lightning_media\Exception\IndeterminateBundleException::__toString()

File

src/Exception/IndeterminateBundleException.php, line 65

Class

IndeterminateBundleException
Thrown if no single media type can be determined from an input value.

Namespace

Drupal\lightning_media\Exception

Code

public function __toString() {
  $count = count($this);
  if ($count > 0) {
    $types = array_map(function (MediaTypeInterface $media_type) {
      return $media_type
        ->id();
    }, $this->types);
    return "Input matched {$count} media types: " . implode(', ', $types);
  }
  return 'Input did not match any media types.';
}