It returns a Model object, always creating it.
public static function getInstance($type, $prefix = '', $config = array())
{
$type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type);
$modelClass = $prefix . ucfirst($type);
if (!class_exists($modelClass))
{
jimport('joomla.filesystem.path');
$path = \JPath::find(self::addIncludePath(null, $prefix), self::_createFileName('model', array('name' => $type)));
if (!$path)
{
$path = \JPath::find(self::addIncludePath(null, ''), self::_createFileName('model', array('name' => $type)));
}
if (!$path)
{
return false;
}
require_once $path;
if (!class_exists($modelClass))
{
\JLog::add(\JText::sprintf('JLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND', $modelClass), \JLog::WARNING, 'jerror');
return false;
}
}
return new $modelClass($config);
}