28 lines
638 B
PHP
28 lines
638 B
PHP
<?php
|
|
|
|
namespace swf2ass;
|
|
|
|
|
|
class ObjectCollection {
|
|
/** @var ObjectDefinition[] */
|
|
private array $objects = [];
|
|
|
|
public function add(ObjectDefinition $object){
|
|
if(isset($this->objects[$object->getObjectId()])){
|
|
throw new \Exception("Object " . $object->getObjectId() . " already exists");
|
|
}
|
|
|
|
$this->objects[$object->getObjectId()] = $object;
|
|
}
|
|
|
|
public function get($objectId) : ?ObjectDefinition {
|
|
return $this->objects[$objectId] ?? null;
|
|
}
|
|
|
|
/**
|
|
* @return ObjectDefinition[]
|
|
*/
|
|
public function getAll() : array{
|
|
return $this->objects;
|
|
}
|
|
} |