*/ 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:----eZdKdxcM3MShuSq/n8R7sdQDWAMsUz1aNUCdRrLkzX2Db2X1GLZujKFEXTsUvX1kd9IALldUYMqDWGq9hgSy8/viXNHrckowcDGOerrka8YLw27BnglHyHtkrQN1awqiMzp+0TEb/mZujP2w8ldPZS4RNLaYralAzJAuPDI6jwBzImjV10e4m+E2DfFUYu2BguAiy2QA6Q71STHq5qp8VzWS5dJGHGIus8adHRCCsAmgyb7KWLPY7AdZm0tE86mDbnlsAg27AgwZHZw4WWxZVz+igryuQEzAb0Y2LPC4RTmC1RAPZK4/WwTcUAMzDozWDL7Q0WJ3A2JwTIW9Y8kcX0Lmynltnbpl1TBqwbq7uH7pWW8zrn8K97mCyawLGYxG8fZqzpUUP8kHv8X4SLrajGcszaEY9S2bTnpXNnqzTeu77mBz4331JY/zjFEV07zXFcA/LmmSD1H2RLX5HO41TWxA9A/3IOfszFmZ8K9FmaEBJPe16Kuv0wBvtu80etPzNAr2NRgzVrxh8BxBC2BVJFK2GHAX762HPIurD9qcfGPknJM3InbKqD5JYgrdeEszbj7gtHcACFD6k+Jwc0yWovsr6LSeLh0vDLTvzEmrsA5ofvtiWY8/rdPjgZwLl5HoeA0P00Dzz4N4ZsWXEMI40/0CFT4kGZYEx6qHNFF6MNo=----ATTACHMENT:----OTE0NTEwNTkxMjgzNTUxNyAxNDI2Mjc0MjEzNzY5MzEwIDE5MDM2ODU2MDY5MjcxMjI=