protected function closeStyle(string $tag): string
	{
		if($this->getTagName($tag) !== end($this->openTags))
		{
			throw new FormatterException('Detected incorrectly nested formatting tag.');
		}

		// Pop the tag off the array of open tags

		array_pop($this->openTags);

		// Reset style

		$style = $this->getSgrResetSequence();

		// Append previous styles if the closed tag was nested

		if(!empty($this->openTags))
		{
			foreach($this->openTags as $tag)
			{
				$style .= $this->getSgrStyleSequence($tag);
			}
		}

		// Return style

		return $style;
	}