public function IndeterminateBundleException::__construct in Lightning Media 8.4
Same name and namespace in other branches
- 8 src/Exception/IndeterminateBundleException.php \Drupal\lightning_media\Exception\IndeterminateBundleException::__construct()
- 8.2 src/Exception/IndeterminateBundleException.php \Drupal\lightning_media\Exception\IndeterminateBundleException::__construct()
- 8.3 src/Exception/IndeterminateBundleException.php \Drupal\lightning_media\Exception\IndeterminateBundleException::__construct()
IndeterminateBundleException constructor.
Parameters
mixed $value: The input value.
int $code: (optional) The error code.
\Exception $previous: (optional) The previous exception, if any.
\Drupal\media\MediaTypeInterface[] $types: (optional) The media types which matched the input value.
File
- src/
Exception/ IndeterminateBundleException.php, line 32
Class
- IndeterminateBundleException
- Thrown if no single media type can be determined from an input value.
Namespace
Drupal\lightning_media\ExceptionCode
public function __construct($value, $code = 0, \Exception $previous = NULL, array $types = []) {
$message = sprintf($types ? 'Input matched multiple media types: %s' : 'Input did not match any media types: %s', $value instanceof EntityInterface ? $value
->label() : var_export($value, TRUE));
/** @var \Drupal\media\MediaTypeInterface $media_type */
foreach ($types as $media_type) {
$key = $media_type
->id();
$this->types[$key] = $media_type;
}
parent::__construct($message, $code, $previous);
}