/** * Create Method * * Returns a type object based on the options given. * @param Frozensheep\Synthesize\Type\SynthesizeOption $objOptions The options object. * return object The object for the type created. */ public static function create(SynthesizeOption $objOptions) { $strType = TypeFactory::getType($objOptions->type); if (!class_exists($strType)) { throw new UnknownTypeException($strType); } $objObject = new $strType(null, $objOptions); return $objObject; }
/** * Create Method * * Used internally to create the object used to store the data type. * @param \Frozensheep\Synthesize\Type\SynthesizeOption $objOption The options about what data object is required. * @return object * */ private function _create(SynthesizeOption $objOption) { return TypeFactory::create($objOption); }
public function testCreateFakeType() { $objSynthesizeOptions = new SynthesizeOption(array('type' => 'fake')); $this->setExpectedException('Frozensheep\\Synthesize\\Exception\\UnknownTypeException'); $objType = TypeFactory::create($objSynthesizeOptions); }