/** * @return Prototype */ public static function prototype() { $implementer = get_called_class(); if (PrototypeRegistry::hasPrototype($implementer)) { return PrototypeRegistry::getPrototype($implementer); } return new Prototype(get_called_class(), static::buildDescription(), array()); }
/** * @param string $relatedTypeClass * @param Description $descriptionOfType * @param PrototypeProperty[] $typeProperties */ public function __construct($relatedTypeClass, Description $descriptionOfType, array $typeProperties) { Assertion::implementsInterface($relatedTypeClass, 'Prooph\\Processing\\Type\\Type'); foreach ($typeProperties as $propertyOfType) { Assertion::isInstanceOf($propertyOfType, 'Prooph\\Processing\\Type\\PrototypeProperty'); } $this->relatedTypeClass = $relatedTypeClass; $this->descriptionOfType = $descriptionOfType; $this->typeProperties = $typeProperties; PrototypeRegistry::registerPrototype($this); }
/** * Provides access to a prototype of the Prooph\ProcessingType\Type (empty Object, with a Description and PrototypeProperties) * * @return Prototype */ public static function prototype() { $implementer = get_called_class(); if (PrototypeRegistry::hasPrototype($implementer)) { return PrototypeRegistry::getPrototype($implementer); } $propertyPrototypes = static::getPropertyPrototypes(); $propertyMap = array(); foreach ($propertyPrototypes as $propertyName => $propertyPrototype) { $propertyMap[$propertyName] = new PrototypeProperty($propertyName, $propertyPrototype); } return new Prototype($implementer, static::buildDescription(), $propertyMap); }