Check if string is a JSON Mercure
@param string $string string methods request
@return int If it's a json mercure or not
194912
private function isJsonMercureFormat(string $string):int
    {
        $len =  strlen($string);

        if ($len > 3 && ($string[0] == "{" && $string[$len - 1] == "}")) {
            $string = str_replace("{", "", $string);
            $string = str_replace("}", "", $string);
            $r = explode(',', $string);
            return (!in_array(" ", $r))? 1 : 0;
        }
        return (0);
    }
370375
protected function nativeJsonDecode($string)
    {
        $result = @json_decode($string, \true);

        if (!$result || JSON_ERROR_NONE !== json_last_error()) {
            $result = \null;
        }

        return $result;
    }
2037
public static function isSerialized(string $string): bool {
        $data = @unserialize($string);
        if (false === $data) {
            return false;
        } else {
            return true;
        }
    }
386486
public function compare($string)
    {
        foreach ($this->tokens as $token) {
            if (strcasecmp($token, $string) === 0) {
                $this->found = true;
            }
        }
    }
256815
private function isJsonString($string)
    {
        if (! is_string($string)) {
            return false;
        }
        
        $firstChar = substr($string, 0, 1);
        
        // If it starts the way a JSON object or array would, and parsing it as
        // JSON returns no errors, consider it a JSON string.
        if (($firstChar === '{') || ($firstChar === '[')) {
            json_decode($string);
            return (json_last_error() == JSON_ERROR_NONE);
        }
        
        return false;
    }
984171
public static function isApplicable($string)
    {
        static $token = "\r\n\t";
        /** @noinspection UnusedFunctionResultInspection */
        strtok($string, $token);
        $secondline = strtok($token);
        return strpos($secondline, ':25:TRIODOSBANK') !== false;
    }
889566
public static function isMaybeOpenWallPasswordHash($string) : bool
    {
        if (!is_string($string)
            || ! in_array(($length = strlen($string)), [20, 34, 60])
            || preg_match('/[^a-zA-Z0-9\.\/\$\_]/', $string)
        ) {
            return false;
        }

        switch ((string) $length) {
            case '20':
                return !($string[0] != '_'
                         || strpos($string, '$') !== false
                         || strpos($string, '.') === false
                );
            case '34':
                return !(substr_count($string, '$') <> 2
                         || !in_array(substr($string, 0, 3), ['$P$', '$H$'])
                );
        }

        return !(
            substr($string, 0, 4) != '$2a$'
            || substr($string, 6, 1) != '$'
            || ! is_numeric(substr($string, 4, 2))
            || substr_count($string, '$') <> 3
        );
    }
214481
public static boolean mayBeJSON( String string ) {
      return string != null
            && ("null".equals( string )
                  || (string.startsWith( "[" ) && string.endsWith( "]" )) || (string.startsWith( "{" ) && string.endsWith( "}" )));
   }
710541
private function checkResponse ($string) {
    if (substr($string, 0, 3) !== '+OK') {
      $this->error = array(
        'error' => "Server reported an error: $string",
        'errno' => 0,
        'errstr' => ''
      );

      if ($this->do_debug >= 1) {
        $this->displayErrors();
      }

      return false;
    } else {
      return true;
    }

  }
893365
public static function checkUtf8Encoding($string)
    {
        if (!mb_check_encoding($string, 'UTF-8') ||
            !$string == mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32')
        ) {
            return false;
        }

        return true;
    }
435583
public static function isPoint($string)
    {
        if (gettype($string) === 'string') {
            $parts = explode("\x20", $string);
            if (count($parts) == 2) {
                if (self::isInteger($parts[0]) && self::isInteger($parts[1])) {
                    return true;
                }
            }
        }

        return false;
    }
1034082
public static function decode($string)
    {
        if (! is_string($string)) {
            throw new JsonException('Json decode parameter must be a string');
        }

        $result = json_decode($string, true);

        if ($result === null) {
            throw new JsonException('Json decode error');
        }
        return $result;
    }
328594
public function isValidJson(string $data) : bool {
    json_decode($data);
    
    if (json_last_error() !== JSON_ERROR_NONE) {
      return false;
    }
    
    return true;
  }
1155129
public static function getJSONResponseToArray($string) {
    $json = json_decode($string,true);
    if($json !== NULL) {
      return $json;
    }
    else {
      throw new \Exception('Response is not a valid json string.');
    }
  }
865299
public static function validate($string)
    {
        try {
            if (is_numeric($string) && (int)$string == $string) {
                $date = new DateTime('@' . $string);
            } else {
                $date = self::parse($string);
            }
        } catch (Exception $ex) {
            return false;
        }

        // String is empty or not a valid date
        if (empty($string) || $date === false) {
            return false;

            // String is a valid date
        } else {
            return true;
        }
    }
1196539
public function loadString($string)
    {
        $this->string = htmlspecialchars_decode($string);

        if ($this->config[ 'allowPhpScripts' ] === false) {
            $this->string = preg_replace(
                '/<\\?.*(\\?>|$)/Us',
                '',
                str_replace('<?=', '<?php echo ', $this->string)
            );
        }

        return (bool)empty($this->string);
    }
88675
public static function isMultibyte($string)
    {
        $length = strlen($string);

        for ($i = 0; $i < $length; $i++) {
            $value = ord($string[$i]);
            if ($value > 128) {
                return true;
            }
        }

        return false;
    }