You are here

public function RealisticDummyContentFileGroup::getRadicalExtension in Realistic Dummy Content 7.2

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentFileGroup.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentFileGroup::getRadicalExtension()
  2. 3.x api/src/includes/RealisticDummyContentFileGroup.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentFileGroup::getRadicalExtension()

Returns the extension of the radical filename.

Return value

string An extension, can be empty.

Throws

\Exception

File

api/src/includes/RealisticDummyContentFileGroup.php, line 172

Class

RealisticDummyContentFileGroup
Represents files as groups.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public function getRadicalExtension() {
  $filename = $this
    ->getRadical();
  $extension = pathinfo($filename, PATHINFO_EXTENSION);
  if (!$extension) {
    throw new RealisticDummyContentException('Files require extensions.');
  }
  return $extension;
}