public function getEmbedCode(EmbeddedAsset $embeddedAsset)
	{
		$dom = null;

		if ($embeddedAsset->code)
		{
			$errors = libxml_use_internal_errors(true);
			$entities = libxml_disable_entity_loader(true);

			try
			{
				$dom = new DOMDocument();
				$code = "<div>$embeddedAsset->code</div>";
				$isHtml = $dom->loadHTML($code, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);

				if (!$isHtml)
				{
					throw new ErrorException();
				}
			}
			catch (ErrorException $e)
			{
				// Corrupted code property, like due to invalid HTML.
				$dom = null;
			}
			finally
			{
				libxml_use_internal_errors($errors);
				libxml_disable_entity_loader($entities);
			}
		}

		return $dom;
	}