for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace UnicornFail\Emoji;
use UnicornFail\Emoji\Environment\EnvironmentInterface;
use UnicornFail\Emoji\Output\RenderedContentInterface;
use UnicornFail\Emoji\Parser\EmojiParser;
use UnicornFail\Emoji\Parser\EmojiParserInterface;
use UnicornFail\Emoji\Renderer\EmojiRenderer;
use UnicornFail\Emoji\Renderer\EmojiRendererInterface;
class EmojiConverter implements EmojiConverterInterface
{
/** @var EnvironmentInterface */
private $environment;
/** @var EmojiParserInterface */
private $parser;
/** @var EmojiRendererInterface */
private $renderer;
public function __construct(EnvironmentInterface $environment)
$this->environment = $environment;
$this->parser = new EmojiParser($environment);
$this->renderer = new EmojiRenderer($environment);
}
/**
* Converts all HTML entities, shortcodes or emoticons to emojis (unicode).
*
* @see EmojiConverterInterface::convert
* @throws \RuntimeException
*/
public function __invoke(string $input): RenderedContentInterface
return $this->convert($input);
public function convert(string $input): RenderedContentInterface
$document = $this->parser->parse($input);
return $this->renderer->renderDocument($document);
public function getEnvironment(): EnvironmentInterface
return $this->environment;