private function scalar($var)
    {
        if (($this->flags & self::ESCAPE) && is_string($var)) {
            return htmlentities($var, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
        }

        return ($this->flags & self::TOSTRING) && ! is_string($var)
            ? $this->scalar((string) $var)
            : $var;
    }
private function scalar($var)
    {
        if (($this->flags & self::ESCAPE) && is_string($var)) {
            return htmlentities($var, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
        }

        return ($this->flags & self::TOSTRING) && ! is_string($var)
            ? $this->scalar((string) $var)
            : $var;
    }
private function scalar ( $ var ) { if ( ( $ this -> flags & self :: ESCAPE ) && is_string ( $ var ) ) { return htmlentities ( $ var , ENT_QUOTES | ENT_SUBSTITUTE , 'UTF-8' ) ; } return ( $ this -> flags & self :: TOSTRING ) && ! is_string ( $ var ) ? $ this -> scalar ( ( string ) $ var ) : $ var ; }
Run on every scalar items, optionally convert them to string and optionally escape strings
for HTML entities according to settings.

@param  mixed $var
@return mixed
Run on every scalar items optionally convert them to string and optionally escape strings for HTML entities according to settings .