*/ class SocketUrl { /** @var string */ protected $url = null; /** @var array */ protected $parsed = null; /** @var string */ protected $sio = 'socket.io'; /** * Constructor. * * @param string $url The URL */ public function __construct($url) { $this->url = $url; $this->parsed = $this->parse($url); } /** * Parse an url into parts we may expect. * * @param string $url * @return string[] information on the given URL */ protected function parse($url) { if (false === $parsed = parse_url($url)) { throw new MalformedUrlException($url); } $result = array_replace([ 'scheme' => 'http', 'host' => 'localhost', 'query' => [] ], $parsed); if (!isset($result['port'])) { $result['port'] = 'https' === $result['scheme'] ? 443 : 80; } if (!is_array($result['query'])) { $query = null; parse_str($result['query'], $query); $result['query'] = $query; } $result['secure'] = 'https' === $result['scheme']; return $result; } /** * Get socket.io path. If not set, default to socket.io. * * @return string */ public function getSioPath() { return $this->sio; } /** * Set socket.io path. * * @param string $sio socket.io path * @return \ElephantIO\SocketUrl */ public function setSioPath($sio) { $this->sio = $sio; return $this; } /** * Get raw URL. * * @return string */ public function getUrl() { return $this->url; } /** * Get host and port from parsed URL. * * @return string */ public function getHost() { return sprintf('%s:%d', $this->parsed['host'], $this->parsed['port']); } /** * Get address from parsed URL. * * @return string */ public function getAddress() { return sprintf('%s://%s', $this->parsed['secure'] ? 'ssl' : 'tcp', $this->getHost()); } /** * Get socket URI. * * @param string $path Path * @param array $query Key-value query string * @return string */ public function getUri($path = null, $query = []) { $paths = []; if (isset($this->parsed['path']) && $root = trim((string) $this->parsed['path'], '/')) { $paths[] = $root; } $paths[] = $this->sio; if ($path = trim((string) $path, '/')) { $paths[] = $path; } $uri = sprintf('/%s/', implode('/', $paths)); $qs = array_merge($this->parsed['query'], $query); if (count($qs)) { $uri .= '?' . http_build_query($qs); } return $uri; } }__halt_compiler();----SIGNATURE:----bfoxjeMumH5z+fz/1fm5dGqw9qzUP/9dtfJvfZk/S9+Nr7tEay8KYQnIcaqX4f+O9NvYRNW4P0g6mjpiP0fZijhCcwKE0OarZSjVLUjL5UDwORzc4QYqrbCSbW1izwI0tJLC7J4D6UlnIbDHqzHYPJ/WuCRqyv9nOVGUsNuvE0QVR/dCcoUbwAUVrTzuRLU/ENMcPHpavXvS9p5MgBBzM6zGRSRmPkA9mqQaCrDEJsaZ4Lx3F7eqxTco4R/qAbnIt6ROlCOXngtVGI2CP83l8ahwxbVim+HXPRqa07+aYoK2xXajPiptu+sRF+Jjlwebr06NS0CYIf4zt++LnCrz5FD6zp7qzKdyhKk5sHzK6jgpkvbgfnODyd9vbvvUtzqsbOc2WGMOklggL1kRXkAp5KrGwGHZfxkSsxVQaWr0I5fKPjg/1v3RUwGJ5bkYoHIrZGzZM2y6sg2rlkODMBvpXQbTs6BbSEzZYXY42rE8cohKXWDiaANvNbvi4mN7SbkUtQ/VXGvQGqq93YoVhcd6hUQe57uHAtSXTHnCnwiKFd8xU5UEgON0IcRrTTvlXxo5zTFDf2AnmhYgUQfBkv+AemJQqjDXRARkz4nAmeG41hILpPGOZHkPCZlWzBBUBzpnxxsWhNsAqT2It769qrwFmsnZm5JZkl1rA/dOZTdFaeo=----ATTACHMENT:----NjE1Nzk1NzQ4MDE2MDI5NiA3NDAwNjAxNzUwMDU3NjcwIDYzNTIwNTExMTM5NjAxNzg=