Send a string down the open socket connection to the POP3 server
@access private
@param string $string
@return integer
976643
private function sendString ($string) {
    $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));

    return $bytes_sent;
  }
262130
public function encodeHashOfString($string)
    {

        $salt = $this->getServiceContainer()->getParameter('secret');

        $key = substr(base64_encode($salt), 0, 30);

        $options = array(
            'cost' => 13,
            'salt' => $key
        );

        $hash = hash('sha512', password_hash($string, PASSWORD_BCRYPT, $options));

        return $hash;
    }
1353458
public function escape($string)
    {
        if(!$this->isConnected())
        {
            $this->connect();
            if(!$this->isConnected()) return false;
        }

        return $this->_escape($string);
    }
609130
public static function fromString($string)
    {
        $stream = fopen('php://temp', 'r+');
        if ($string !== '') {
            fwrite($stream, $string);
            rewind($stream);
        }

        return new static($stream);
    }
545595
public static function strToBool($string)
    {
        if(is_bool($string))
            return $string;

        if (in_array(strtolower((string)$string), array('1', 'true', 'on', '+', 'yes', 'y')))
            return true;
        elseif (in_array(strtolower((string)$string), array('', '0','false', 'off', '-', 'no', 'n')))
            return false;

        return false;
    }
927949
public static function ucFirst($string)
    {
        $ucFirst = static::sub($string, 0, 1);
        $ucFirst = static::upp($ucFirst);

        return $ucFirst . static::sub($string, 1);
    }
919175
public static function stringToKey(string $string): int {
        $key = 0;
        for ($i = 0; $i < \strlen($string); $i++) {
            $char = $string[$i];
            $key += \ord($char);
        }
        return $key;
    }
512807
protected function send($msg)
    {
        $msg .= PHP_EOL;

        return socket_write($this->socket, $msg, strlen($msg));
    }
341895
function sendPOSTRequest( $server, $port, $serverMethod, $request, $timeout=30)
    {
        $pos = strpos($server, '://');
        if( $pos !== false )
            $server = substr($server, $pos+3);

        $fp = fsockopen( $server, $port, $errno, $errstr, $timeout );

        if( $fp )
        {
            $theCall    =   "POST $serverMethod HTTP/1.0\r\n"                       .
                            "Host: $server\r\n"                                   .
                            "Content-Type: application/x-www-form-urlencoded\r\n"   .
                            "Content-Length: ".strlen( $request )."\r\n\r\n"     .
                            $request."\r\n\r\n";

            if ( !fputs( $fp, "$theCall", strlen( $theCall ) ) )
            {
                $this->logger->writeTimedString( "Could not write to server socket: $server:$port", 'sendPOSTRequest failed' );
                return null;
            }

            return $this->handleResponse( $fp );
        }

        $this->logger->writeTimedString( "Unable to open socket on $server:$port. errno = $errno, errstr = $errstr", 'sendPOSTRequest failed' );
        return null;
    }
205940
protected function getSubstringBetweenParentheses(string $string): string
    {
        $startingPosition = 0;
        $openParentheses = 0;
        $substring = '';

        $length = strlen($string);
        for ($i = $startingPosition; $i < $length; $i++) {
            if ($string[$i] === ')') {
                $openParentheses--;
            }
            if ($openParentheses > 0) {
                $substring .= $string{$i};
            }
            if ($string[$i] === '(') {
                $openParentheses++;
            }
        }
        if ($openParentheses < 0) {
            throw new InvalidPointcutExpressionException('Pointcut expression is in excess of ' . abs($openParentheses) . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966689);
        }
        if ($openParentheses > 0) {
            throw new InvalidPointcutExpressionException('Pointcut expression lacks of ' . $openParentheses . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966690);
        }
        return $substring;
    }
415874
protected function convertToStringOrBoolean($string)
    {
        $result = (string) $string;
        $lowerString = strtolower($result);

        if('true' === $lowerString)
        {
            $result = true;
        }
        elseif('false' === $lowerString)
        {
            $result = false;
        }

        return $result;
    }
336731
public function loadString($string)
    {
        $this->string = htmlspecialchars_decode($string);

        return (bool)empty($this->string);
    }
103082
public static function bin2str($string)
    {
        if (is_array($string) || is_object($string)) {
            $caller =  next(debug_backtrace());
            $error['line']  = $caller['line'];
            $error['file']  = strip_tags($caller['file']);
            trigger_error(
                "bin2str() expects parameter 1 to be string, "
                . gettype($string)
                . " given in <b>{$error['file']}</b> on line <b>{$error['line']}</b><br />\n",
                E_USER_ERROR
            );

            return '';
        }

        if (strlen($string) <= 0) {
            return '';
        }

        $string = str_split($string, 8); // NOTE: this function is PHP5 only
        for ($i = 0, $n = count($string); $i < $n; ++$i) {
            $string[$i] = chr(bindec($string[$i]));
        }

        return implode('', $string);
    }
809089
private function strEndsWith($string, $niddle)
    {
        return mb_substr($string, mb_strlen($string) - mb_strlen($niddle), mb_strlen($niddle)) == $niddle;
    }
862391
protected function openCloseTag($string)
    {
        if( $this->tag === true )
        {
            $script = $this->getScriptClass();

            $string = $script->open() . $string . $script->close();
        }

        $this->tag = false;

        return $string;
    }
962772
public function setString($string)
    {
        $this->string = $string;
        $this->hash = sha1($this->string);
        return $this;
    }
1076115
public function parseString($string)
    {

        $stringHelper = $this->container->get('opifer.content.string_helper');

        $string = $stringHelper->replaceLinks($string);

        return $string;
    }