Class Kitab\Compiler\IntermediateRepresentation\File

class File extends ArrayObject
{
    public function __construct(string $name);
    public function offsetSet($name, $value);
}

A file intermediate representation.

A file is one root containing all the other intermediate representations. By design, it extends the ArrayObject class, thus this is a collection of objects.

Examples

This example shows how to create a file and to add intermediate representations in it, here a class.

$file   = new Kitab\Compiler\IntermediateRepresentation\File('example.php');
$file[] = new Kitab\Compiler\IntermediateRepresentation\Class_('C');

Attributes

public $name

Name of the file.

Methods

public function __construct(string $name)

Allocate a file with a name.

public function offsetSet($name, $value)

Automatically propagate this instance onto intermediate representations of kind Kitab\Compiler\IntermediateRepresentation\Entity when setting a new pair into the collection. This is a handy way to ensure all the entities receive this instance.