Deliver the packet

@return void
486338
final public function deliver()
    {
        $action_ns = 'Moxl\Xec\Action';
        if(get_parent_class($this) == $action_ns
        || get_parent_class(get_parent_class($this)) == $action_ns) {
            $class = str_replace([$action_ns, '\\'], ['', '_'], get_class($this));
            $key = strtolower(substr($class, 1));
        } else {
            $class = strtolower(get_class($this));
            $pos = strrpos($class, '\\');
            $key = substr($class, $pos + 1);
        }
        if($this->method)
            $key = $key . '_' . $this->method;

        if(!empty($this->packet->from)) {
            Utils::log('Package : "'.$key.'" from "'.$this->packet->from.'" fired');
        } else {
            Utils::log('Package : "'.$key);
        }

        $this->event($key, $this->packet);
    }
297292
public function send()
    {
        $buffered_content = $this->returnAllOutputBuffers();
        if (!empty($buffered_content) && is_string($this->content)) {
            $this->content = $buffered_content . $this->content;
        }

        $this->content = $this->output->prepare($this);

        if (!is_string($this->content) && $this->content !== null) {
            $output = get_class($this->output);
            throw new \Parable\Http\Exception("Output class '{$output}' did not result in string or null content.");
        }

        if (!headers_sent()) {
            // @codeCoverageIgnoreStart
            header("{$this->request->getProtocol()} {$this->getHttpCode()} {$this->getHttpCodeText()}");
            header("Content-type: {$this->getContentType()}");
            foreach ($this->getHeaders() as $key => $value) {
                header("{$key}: {$value}");
            }
            // @codeCoverageIgnoreEnd
        }

        if ($this->isHeaderAndFooterContentEnabled()) {
            echo $this->getHeaderContent();
        }

        echo $this->getContent();

        if ($this->isHeaderAndFooterContentEnabled()) {
            echo $this->getFooterContent();
        }

        $this->terminate();
    }
813615
public function send()
    {
        $providers = $this->providers;
        $messages = $this->messages;
        $this->unsetMessages();
        foreach ($messages as &$message) {
            foreach ($providers as $provider) {
                $message->using($provider)->send();
                if ($message->getStatus() == MessageStatus::STATUS_SENT) {
                    break;
                } else {
                    $this->addError($message->getError());
                }
            }
        }

        return $messages;
    }
414435
public function send()
    {
        $data = $this->parseDataToString($this->data);
        $format = $this->allowedFormats[$this->format];

        // Send status header
        header($this->getStatus(), true, $this->getStatus());

        foreach(self::$headers as $key => $value) {
            header($key.": ".$value);
        }

        // Send content type header
        header("Content-Type: ".$format['mimetype']."; charset=utf-8");

		// Set content length header
		header("Content-Length: ".strlen($data));

        if(function_exists("ginger_log")) {
            ginger_log($this);
        }

        echo $data;

        die();
    }
424768
public function send()
    {
        // Send headers
        if (headers_sent() === false) {
            if (strpos(PHP_SAPI, 'cgi') === 0) {
                header(sprintf('Status: %s', $this->getReasonPhrase()));
            } else {
                header(sprintf('%s %s', $this->getProtocolVersion(), $this->getReasonPhrase()));
            }

            foreach ($this->headers as $name => $value) {
                foreach ($value as $hVal) {
                    header("$name: $hVal", false);
                }
            }
        }

        // Send body
        $this->body->seek(0);
        while ($this->body->feof() === false) {
            echo $this->body->read(1024);
        }

        return $this;
    }
1035846
public function send() {
        header("HTTP/1.0 {$this->code} {$this->get_reason()}");
        foreach ($this->additionalheaders as $header) {
            header($header);
        }
        if (($this->code >= 200) && ($this->code < 300)) {
            if (!empty($this->contenttype)) {
                header("Content-Type: {$this->contenttype};charset=UTF-8");
            }
            if (!empty($this->body)) {
                echo $this->body;
            }
        }
    }
1321174
public function sendHeaders()
    {
        if (!headers_sent()) {
            header(
                sprintf(
                    'HTTP/%s %s %s',
                    $this->getProtocolVersion(),
                    $this->getStatusCode(),
                    ($this->isOk() ? '' : $this->getReasonPhrase())
                ),
                true,
                $this->getStatusCode()
            );

            foreach ($this->header as $name => $value) {
                $name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $name)));
                header(sprintf('%s: %s', $name, implode(',', $value)), false, $this->statusCode);
            }

            foreach ($this->cookie as $cookie) {
                header(sprintf('Set-Cookie: %s', $cookie->asString()), false, $this->getStatusCode());
            }
        }
    }
831542
public function send()
    {
        if (!$this->hasBeenInitialized())
            $this->_curlPrep();

        $result = curl_exec($this->_ch);

        $response = $this->buildResponse($result);

        curl_close($this->_ch);
        unset($this->_ch);

        return $response;
    }
923905
public function runDeliveryExecution() {
	    $deliveryExecution = $this->getCurrentDeliveryExecution();

        // Sets the deliveryId to session.
        if (!$this->hasSessionAttribute(DeliveryExecution::getDeliveryIdSessionKey($deliveryExecution->getIdentifier()))) {
            $this->setSessionAttribute(
                DeliveryExecution::getDeliveryIdSessionKey($deliveryExecution->getIdentifier()),
                $deliveryExecution->getDelivery()->getUri()
            );
        }

        try {
            $this->verifyDeliveryExecutionAuthorized($deliveryExecution);
        } catch (UnAuthorizedException $e) {
            return $this->redirect($e->getErrorPage());
        }

	    $userUri = common_session_SessionManager::getSession()->getUserUri();
	    if ($deliveryExecution->getUserIdentifier() != $userUri) {
	        throw new common_exception_Error('User '.$userUri.' is not the owner of the execution '.$deliveryExecution->getIdentifier());
	    }
	    
	    $delivery = $deliveryExecution->getDelivery();
        $this->initResultServer($delivery, $deliveryExecution->getIdentifier(), $userUri);

        $deliveryExecutionStateService = $this->getServiceManager()->get(StateServiceInterface::SERVICE_ID);
        $deliveryExecutionStateService->run($deliveryExecution);

        /**
         * Use particular delivery container
         */
        $container = $this->getDeliveryServer()->getDeliveryContainer($deliveryExecution);

	    // Require JS config
        $container->setData('client_config_url', $this->getClientConfigUrl());
        $container->setData('client_timeout', $this->getClientTimeout());
        // Delivery params
        $container->setData('returnUrl', $this->getReturnUrl());
        $container->setData('finishUrl', $this->getfinishDeliveryExecutionUrl($deliveryExecution));

        $this->setData('additional-header', $container->getContainerHeader());
        $this->setData('container-body', $container->getContainerBody());
        
		
		/**
		 * Delivery header & footer info
		 */
	    $this->setData('userLabel', common_session_SessionManager::getSession()->getUserLabel());
	    $this->setData('showControls', $this->showControls());
        $this->setData('returnUrl', $this->getReturnUrl());

        /* @var $urlRouteService DefaultUrlService */
        $urlRouteService = $this->getServiceManager()->get(DefaultUrlService::SERVICE_ID);
        $this->setData('logout', $urlRouteService->getUrl('logoutDelivery' , []));

        /**
         * Layout template + real template inclusion
         */
        $this->setData('content-template', 'DeliveryServer/runDeliveryExecution.tpl');
        $this->setData('content-extension', 'taoDelivery');
        $this->setView('DeliveryServer/layout.tpl', 'taoDelivery');
	}
1128359
public function onReady()
    {
        $this->setWatermark(2, $this->pool->maxAllowedPacket);
        Crypt::randomString(16, null, function ($string) {
            $this->key = base64_encode($string);
            $this->write('GET /' . $this->path . " HTTP/1.1\r\nHost: " . $this->host . ($this->port != 80 ? ':' . $this->port : '') . "\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: " . $this->key . "\r\nSec-WebSocket-Version: 13\r\n\r\n");
        });
    }
308167
public function serve()
    {
        $request = Request::createFromGlobals();
        $response = $this->handleRequest($request);

        if ($this->liveReload) $this->injectLiveReload($response);

        $response->send();
    }
334963
public function send()
    {
        // We don't want any accidental sending of beacons if the installation has explicitly said no.
        if (!$this->enabled()) {
            return;
        }

        $setting = app(Setting::class);

        if (!$installId = $setting->get('install_id', null)) {
            $installId = sha1(Str::random(20));

            $setting->set('install_id', $installId);
        }

        $payload = [
            'install_id' => $installId,
            'version'    => CACHET_VERSION,
            'docker'     => $this->config->get('cachet.is_docker'),
            'database'   => $this->config->get('database.default'),
            'data'       => [
                'components' => Component::all()->count(),
                'incidents'  => Incident::all()->count(),
                'metrics'    => Metric::all()->count(),
                'users'      => User::all()->count(),
                'actions'    => Action::all()->count(),
                'tags'       => Tag::all()->count(),
                'schedules'  => Schedule::all()->count(),
            ],
        ];

        try {
            $client = new Client();
            $client->post(self::URL, [
                'headers' => ['Accept' => 'application/json', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'],
                'json'    => $payload,
            ]);
        } catch (Exception $e) {
            event(new BeaconFailedToSendEvent());

            return;
        }

        event(new BeaconWasSentEvent());
    }
932653
public function index()
    {
        $this->defaultData();

		$delivery = $this->getCurrentInstance();
		$this->setData('uri', $delivery->getUri());
		$this->setData('classUri', $this->getCurrentClass()->getUri());
		$this->setData("deliveryLabel", $delivery->getLabel());

		//compilation state:
		$compiled = $this->getClassService()->getAssembliesByTemplate($delivery, true);
		$this->setData("isCompiled", !empty($compiled));

		$this->setView("Compilation/index.tpl");
    }
13709
protected function send()
    {
        try {
            $options = $this->getOptions();

            $message = sprintf(
                'Service: %2$s' . PHP_EOL .
                'Host: %3$s' . PHP_EOL .
                'State: %5$s' . PHP_EOL .
                'Message: %7$s',
                $options['type'],
                $options['service'],
                $options['host'],
                $options['address'],
                $options['state'],
                $options['time'],
                $options['output']
            );

            $priority = $this->determinePriority($options['state']);

            // verify API key
            $this->nmaClient->verify();

            // send notification
            $this->nmaClient->notify(
                self::SENDER,
                $options['type'],
                $message,
                $priority,
                'anag://open?updateonreceive=true'
            );

            $this->setMessage('Message was sent');
            $this->setCode(self::STATE_OK);
        } catch (Exception $e) {
            $this->setMessage(
                'Message could not be sent. Error from NMA client: ' .
                $e->getMessage()
            );
            $this->setCode(self::STATE_CRITICAL);
        }

        return $this;
    }
416524
public function send()
    {
        header($this->getStatusStr());

        foreach($this->headers as $header => $value) {
            header(sprintf("%s: %s", $header, implode(',', $value)));
        }

        $body = $this->getBody();

        if ($body->isAttached()) {
            $body->rewind();
            while (!$body->eof()) {
                echo $body->read($this->bodySize);
            }
        }
    }
249138
public function send()
    {
        // $this->provider->getParameters();
        $response = $this->provider->purchase($this->parameters)->send();
        $response->redirect();
        // $response->getRedirectUrl()
    }
1367832
public function send()
    {
        $this->sendHeaders();
        $this->sendContent();

        if (function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        } elseif ('cli' !== PHP_SAPI) {
            static::closeOutputBuffers(0, true);
        }

        return $this;
    }