/** * @param $type * * @return TypeInterface */ public static function type($type) { if ($type instanceof TypeInterface) { return $type; } $class = ''; if (strpos($type, "\\") === false) { $class = ucfirst(trim(strval($type))); if (strripos(strrev($class), strrev('type')) === false) { $class .= 'Type'; } $class = "Echidna\\Type\\" . $class; } if (class_exists($class) && in_array("DataEntity\\TypeInterface", class_implements($class))) { return new $class(); } return Type::factory($type); }
protected function getType($type) { return Type::factory($type); }