/**
* Returns the global Document object, only creating it
* if it doesn't already exist.
*
* @param string $type The document type to instantiate
* @param array $attributes Array of attributes
*
* @return static The document object.
*
* @since 1.7.0
* @deprecated 5.0 Use the \Joomla\CMS\Document\FactoryInterface instead
*/
public static function getInstance($type = 'html', $attributes = array())
{
$signature = serialize(array($type, $attributes));
if (empty(self::$instances[$signature])) {
self::$instances[$signature] = CmsFactory::getContainer()->get(FactoryInterface::class)->createDocument($type, $attributes);
}
return self::$instances[$signature];
}