You are here

protected function AssertMediaTrait::assertIsFileEntity in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 src/AssertMediaTrait.php \Drupal\gutenberg\AssertMediaTrait::assertIsFileEntity()

Assert if provided entity is type of FileInterface.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: Entity instance to check.

Throws

\Exception

2 calls to AssertMediaTrait::assertIsFileEntity()
FileEntityDataProvider::getData in src/DataProvider/FileEntityDataProvider.php
MediaEntityDataProvider::getData in src/DataProvider/MediaEntityDataProvider.php
Returns array data.

File

src/AssertMediaTrait.php, line 24

Class

AssertMediaTrait
Provides utility to assert data.

Namespace

Drupal\gutenberg

Code

protected function assertIsFileEntity(ContentEntityInterface $entity) {
  if (!$entity instanceof FileInterface) {
    throw new \Exception(sprintf('Entity must by type of %s.', FileInterface::class));
  }
}