src/Primitive/String/String.php
public function toEntities($flags = ENT_QUOTES, $encoding = 'UTF-8')
    {
        return new static(htmlentities($this->string, $flags, $this->retrieveValue($encoding)));
    }
public function toEntities($flags = ENT_QUOTES, $encoding = 'UTF-8')
    {
        return new static(htmlentities($this->string, $flags, $this->retrieveValue($encoding)));
    }
Convert all applicable characters to HTML entities.

@param int $flags
@param string|StringContract $encoding
@return static