You are here

function RealisticDummyContentFileGroup::__construct in Realistic Dummy Content 7

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

RealisticDummyContentException

File

api/includes/RealisticDummyContentFileGroup.inc, line 81
Define RealisticDummyContentFileGroup autoload class.

Class

RealisticDummyContentFileGroup
Represents files as groups.

Code

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