You are here

function FileGroup::__construct in Realistic Dummy Content 8

Constructor for a file object

Several actual files can reside in the same file object if their names have the same radical, for example:

a.b.c a.c

have the same radical, a.c.

Parameters

$radical: The radical file name, which may or may not exist on the filesystem. For example, if the file is called a.b.c, the radical is a.c, even though a.c does not exist on the filesystem.

$file: The radical drupal file object, or NULL if it does not exist on the file system.

$attributes: An array in the format: array( 'attribute_name' => [file object], ), (where attribute_name can be "b" as in the above example.)

Throws

Exception

File

api/src/environments/FileGroup.php, line 86
Define autoload class.

Class

FileGroup
Represents files as groups.

Namespace

Drupal\realistic_dummy_content_api\environments

Code

function __construct($radical, $file, $attributes) {
  if (!is_string($radical)) {
    throw new Exception('Please use string for radical');
  }
  if ($file && !is_object($file)) {
    throw new Exception('Please use NULL or object for file');
  }
  if (!is_array($attributes)) {
    throw new Exception('Please use array for attributes');
  }
  $this->radical = $radical;
  $this->file = $file;
  $this->attributes = $attributes;
}