src/mako/cli/output/formatter/Formatter.php
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;
	}
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;
	}
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 ; }
Returns ANSI SGR escape sequence for style reset and
ANSI SGR escape sequence for parent style if the closed tag was nested.

@param  string                                        $tag Tag name
@throws \mako\cli\output\formatter\FormatterException
@return string
Returns ANSI SGR escape sequence for style reset and ANSI SGR escape sequence for parent style if the closed tag was nested .