Read ligne

@param  string $message
@return bool
194707
private function readline($message)
    {
        echo Color::green("$message y/N >>> ");

        $input = strtolower(trim(readline()));

        if (is_null($input) || strlen($input) == 0) {
            $input = 'n';
        }

        if (!in_array($input, ['y', 'n'])) {
            echo Color::red('Invalid choice')."\n";

            return $this->readline($message);
        }

        if (strtolower($input) == "y") {
            return true;
        }

        return false;
    }
1231128
public function logDebugOrMore($message)
    {
        $this->log($message, Project::MSG_DEBUG);
        if ($this->verbose) {
            $this->log($message);
            return true;
        }
        return false;
    }
206831
public static function decodeMessage(string $message): Message
    {
        $offset = 0;
        $header = self::decodeHeader($message, $offset);
        $messageObject = new Message($header);
        $messageObject->setQuestions(self::decodeResourceRecords($message, $header->getQuestionCount(), $offset, true));
        $messageObject->setAnswers(self::decodeResourceRecords($message, $header->getAnswerCount(), $offset));
        $messageObject->setAuthoritatives(self::decodeResourceRecords($message, $header->getNameServerCount(), $offset));
        $messageObject->setAdditionals(self::decodeResourceRecords($message, $header->getAdditionalRecordsCount(), $offset));

        return $messageObject;
    }
1080415
public function hasExceptionOfMessage($message)
    {
        foreach ($this->_exceptions as $e) {
            if ($message == $e->getMessage()) {
                return true;
            }
        }

        return false;
    }
246116
public function shouldMessageCaptureBeSkipped(string $message): bool
    {
        if (function_exists('fnmatch')) {
            foreach ($this->skipWildcard as $wildcard) {
                if (fnmatch($wildcard, $message)) {
                    return true;
                }
            }
        }
        if (in_array($message, $this->skipCapture, true)) {
            return true;
        }

        if (in_array($message, $this->skipCommand, true)) {
            return true;
        }
        return false;
    }
1295906
public function read_message()
  {
    socket_recv ( $this->socket , $buf , 8 , MSG_WAITALL );
    if ($buf == null)
      return $buf;
    
    $frame_count = unpack("Nserial/Ncount", $buf);
    $frame_count = $frame_count["count"];
    $message = "";
    for ($i = 0; $i < $frame_count; $i++ ) {
      socket_recv ( $this->socket , $buf , 4 , MSG_WAITALL );
      $frame_size = unpack("Nsize", $buf);
      $frame_size = $frame_size["size"];
      if ($frame_size > 0) {
        socket_recv ( $this->socket , $bif , $frame_size , MSG_WAITALL );
        $message .= $bif;
      }
      
    }
    return $message;
  }
713440
public function translate($message)
    {
        if (isset($this->translations[$message])) {
            return $this->translations[$message];
        } else {
            return $message;
        }
    }
105358
private function parseMessage($message)
    {
        $string = $message;

        if (is_array($message)) {
            $format = '"%s" %s';
            $errors = array();

            foreach ($message as $field => $messages) {
                if (is_array($messages)) {
                    $messages = array_unique($messages);
                    foreach ($messages as $error) {
                        $errors[] = sprintf($format, $field, $error);
                    }
                } elseif (is_integer($field)) {
                    $errors[] = $messages;
                } else {
                    $errors[] = sprintf($format, $field, $messages);
                }
            }

            $string = implode(', ', $errors);
        }

        return $string;
    }
298746
private function _decodeBinanceException($message)
    {
        $msg = json_decode($message, true);
        $this->code = isset($msg['code']) ? $msg['code'] : 0;
        $this->message = isset($msg['msg']) ? $msg['msg'] : '';
    }
466874
function checkMessageSignature($message)
    {
        $sig = $message->getArg(Auth_OpenID_OPENID_NS,
                                'sig');

        if (!$sig || Auth_OpenID::isFailure($sig)) {
            return false;
        }

        $calculated_sig = $this->getMessageSignature($message);
        return Auth_OpenID_CryptUtil::constEq($calculated_sig, $sig);
    }
1283961
public function pgettext($context, $message) {
		if ($this->reader === null) {
			return $message;
		}
		return $this->reader->pgettext((string)$context, (string)$message);
	}
504550
public function read($dn)
	{
		if (!$this->isBound || !$this->isConnected())
		{
			return false;
		}

		$base   = substr($dn, strpos($dn, ',') + 1);
		$cn     = substr($dn, 0, strpos($dn, ','));
		$result = ldap_read($this->resource, $base, $cn);

		if ($result === false)
		{
			return false;
		}

		return ldap_get_entries($this->resource, $result);
	}
77331
protected function getDriverForMessage($message)
    {
        $this->loadRegisteredDrivers();
        foreach ($this->drivers as $driver) {
            if ($driver->acceptMessage($message))
                return $driver;
        }

        throw new \Exception('No driver found to decode message of type: ' . get_class($message));
    }
655588
private function _gzdecode($message)
    {
        $messageLength  = strlen($message);
        $isDebugEnabled = $this->_logger->isHandling(ehough_epilog_Logger::DEBUG);

        /* make sure this is actually gzipped */
        if ($messageLength < 18 || strcmp(substr($message, 0, 2), "\x1f\x8b")) {

            if ($isDebugEnabled) {

                $this->_logger->debug('Not in GZIP format.');
            }

            return false;
        }

        /* grab the compression method and flags */
        $compressionMethod = ord(substr($message, 2, 1));
        $compressionFlags  = ord(substr($message, 3, 1));

        if ($compressionFlags & 31 != $compressionFlags) {

            if ($isDebugEnabled) {

                $this->_logger->debug('Reserved bits not allowed.');
            }

            return false;
        }

        /* NOTE: $mtime may be negative (PHP integer limitations) */
        $mtime        = unpack('V', substr($message, 4, 4));
        $mtime        = $mtime[1];
        $xfl          = substr($message, 8, 1);
        $os           = substr($message, 8, 1);
        $headerLength = 10;
        $extraLength  = 0;
        $extra        = '';

        if ($compressionFlags & 4) {

            /* 2-byte length prefixed EXTRA data in header */
            if ($messageLength - $headerLength - 2 < 8) {

                if ($isDebugEnabled) {

                    $this->_logger->debug('2-byte length prefixed EXTRA data in header');
                }

                return false;
            }

            $extraLength = unpack('v', substr($message, 8, 2));
            $extraLength = $extraLength[1];

            if ($messageLength - $headerLength - 2 - $extraLength < 8) {

                if ($isDebugEnabled) {

                    $this->_logger->debug('Invalid extra length');
                }

                return false;
            }

            $extra         = substr($message, 10, $extraLength);
            $headerLength += 2 + $extraLength;
        }

        $filenameLength = 0;
        $filename       = '';

        /* If FNAME is set, an original file name is present, terminated by a zero byte. */
        if ($compressionFlags & 8) {

            if ($messageLength - $headerLength - 1 < 8) {

                if ($isDebugEnabled) {

                    $this->_logger->debug('C-Style string');
                }

                return false;
            }

            $filenameLength = strpos(substr($message, $headerLength), chr(0));

            if ($filenameLength === false || $messageLength - $headerLength - $filenameLength - 1 < 8) {

                if ($isDebugEnabled) {

                    $this->_logger->debug('Invalid filename length');
                }

                return false;
            }

            $filename      = substr($message, $headerLength, $filenameLength);
            $headerLength += $filenameLength + 1;
        }

        $commentlen = 0;
        $comment    = '';

        /* If FCOMMENT is set, a zero-terminated file comment is present */
        if ($compressionFlags & 16) {

            if ($messageLength - $headerLength - 1 < 8) {

                if ($isDebugEnabled) {

                    $this->_logger->debug('C-Style string COMMENT data in header');
                }

                return false;
            }

            $commentlen = strpos(substr($message, $headerLength), chr(0));

            if ($commentlen === false || $messageLength - $headerLength - $commentlen - 1 < 8) {

                if ($isDebugEnabled) {

                    $this->_logger->debug('Invalid comment length');
                }

                return false;
            }

            $comment       = substr($message, $headerLength, $commentlen);
            $headerLength += $commentlen + 1;
        }

        $headercrc = '';

        /* If FHCRC is set, a CRC16 for the gzip header is present, immediately before the compressed data */
        if ($compressionFlags & 2) {

            if ($messageLength - $headerLength - 2 < 8) {

                if ($isDebugEnabled) {

                    $this->_logger->debug('2-bytes (lowest order) of CRC32 on header present');
                }

                return false;
            }

            $calccrc   = crc32(substr($message, 0, $headerLength)) & 0xffff;
            $headercrc = unpack('v', substr($message, $headerLength, 2));
            $headercrc = $headercrc[1];

            if ($headercrc != $calccrc) {

                if ($isDebugEnabled) {

                    $this->_logger->debug('Header checksum failed.');
                }

            }

            $headerLength += 2;
        }

        $datacrc = unpack('V', substr($message, -8, 4));
        $datacrc = sprintf('%u', $datacrc[1] & 0xFFFFFFFF);
        $isize   = unpack('V', substr($message, -4));
        $isize   = $isize[1];

        $bodyLength = $messageLength - $headerLength - 8;

        if ($bodyLength < 1) {

            if ($isDebugEnabled) {

                $this->_logger->debug('Negative body length');
            }

            return false;
        }

        $compressedBody = substr($message, $headerLength, $bodyLength);
        $decompressed   = '';

        if ($bodyLength > 0) {

            switch ($compressionMethod) {

                case 8:
                    // Currently the only supported compression method:
                    $decompressed = gzinflate($compressedBody, null);
                    break;

                default:

                    if ($isDebugEnabled) {

                        $this->_logger->debug('Unknown compression method.');
                    }

                    return false;
            }
        }

        $crc   = sprintf("%u", crc32($decompressed));
        $crcOK = $crc == $datacrc;
        $lenOK = $isize == strlen($decompressed);

        if (!$lenOK || !$crcOK) {

            return false;
        }

        return $decompressed;
    }
39760
protected function ajaxResponse($message)
    {
        $request = Request::capture();

        // ajax but not pjax
        if ($request->ajax() && !$request->pjax()) {
            return response()->json([
                'status'  => true,
                'message' => $message,
            ]);
        }

        return false;
    }
292300
public function gettext($message) {
		if (strlen($message) === 0) {
			return $message;
		}
		if ($this->reader === null) {
			return $message;
		}
		return $this->reader->translate((string)$message);
	}
457577
public function decrypt($message)
    {
        $data       = \base64_decode($message);

        if ($data === false)
        {
            throw new Exceptions\Invalid('Invalid `message` on decrypt');
        }

        $salt       = substr($data, 0,8);
        $encrypted  = substr($data, 13);
        $data00     = $this->password . $salt;

        $md5Hash    = [];
        $md5Hash[0] = md5($data00, true);
        $result     = $md5Hash[0];

        for ($i = 1; $i < 3; $i++)
        {
            $md5Hash[$i] = md5($md5Hash[$i - 1] . $data00, true);
            $result      .= $md5Hash[$i];
        }

        list($key, $iv) = $this->salted($result);

        return openssl_decrypt($encrypted, $this->method, $key, true, $iv);
    }