public static function rqlEncode($query) { $parser = new self(); $result = $parser->encode($query); unset($parser); return $result; }
/** * Encode a value into a bencode entity * * @param mixed $data The value to be encoded. * @return string Returns the bencoded entity. */ public static function encodeData($data) { if (is_object($data)) { if (method_exists($data, 'toArray')) { $data = $data->toArray(); } else { $data = (array) $data; } } $encoder = new self($data); return $encoder->encode(); }
/** * Helper function to encode coordinates when there is no required to configure the encoder * * @param LatLng[] $coords * * @return string */ public static function encodeCoordinates($coords) { static $encoder; if ($encoder == null) { $encoder = new self(); } $points = []; foreach ($coords as $coord) { $points[] = explode(',', $coord); } return "enc:{$encoder->encode($points)}"; }
/** * Generate a version 5 UUID based on the SHA-1 hash of a namespace * identifier (which is a UUID) and a name (which is a string) and shorten it. * * @param string $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * * @return string */ public static function uuid5($ns, $name) { $uuid = Uuid::uuid5($ns, $name); $shortUuid = new self(); return $shortUuid->encode($uuid); }