RMS\PushNotificationsBundle\Service\OS\AppleNotification::getApnStream PHP Метод

getApnStream() защищенный Метод

Get an apn stream associated with the given apn URL, create one if necessary
protected getApnStream ( string $apnURL ) : resource
$apnURL string
Результат resource
    protected function getApnStream($apnURL)
    {
        if (!isset($this->apnStreams[$apnURL])) {
            // No stream found, setup a new stream
            $ctx = $this->getStreamContext();
            $this->apnStreams[$apnURL] = stream_socket_client($apnURL, $err, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $ctx);
            if (!$this->apnStreams[$apnURL]) {
                throw new \RuntimeException("Couldn't connect to APN server. Error no {$err}: {$errstr}");
            }
            // Reduce buffering and blocking
            if (function_exists("stream_set_read_buffer")) {
                stream_set_read_buffer($this->apnStreams[$apnURL], 6);
            }
            stream_set_write_buffer($this->apnStreams[$apnURL], 0);
            stream_set_blocking($this->apnStreams[$apnURL], 0);
        }
        return $this->apnStreams[$apnURL];
    }