Notify clients that there is active PHP Console on server & check if there is request from client with active PHP Console
@throws \Exception
974610
private function initConnection() {
		if($this->isCliMode()) {
			return;
		}

		$this->initServerCookie();
		$this->client = $this->initClient();

		if($this->client) {
			ob_start();
			$this->isActiveClient = true;
			$this->registerFlushOnShutDown();
			$this->setHeadersLimit(isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false
				? 4096 // default headers limit for Nginx
				: 8192 // default headers limit for all other web-servers
			);
			$this->listenGetPostponedResponse();
			$this->postponeResponseId = $this->setPostponeHeader();
		}
	}
349013
protected function checkRequest()
    {
        if (preg_match(CKFINDER_REGEX_INVALID_PATH, $this->_currentFolder->getClientPath())) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
        }

        $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();

        if (is_null($_resourceTypeConfig)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_TYPE);
        }

        $_clientPath = $this->_currentFolder->getClientPath();
        $_clientPathParts = explode("/", trim($_clientPath, "/"));
        if ($_clientPathParts) {
            foreach ($_clientPathParts as $_part) {
                if ($_resourceTypeConfig->checkIsHiddenFolder($_part)) {
                    $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
                }
            }
        }

        if (!is_dir($this->_currentFolder->getServerPath())) {
            if ($_clientPath == "/") {
                if (!CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($this->_currentFolder->getServerPath())) {
                    /**
                     * @todo handle error
                     */
                }
            }
            else {
                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
            }
        }
    }
1263782
protected function perform()
    {
        if (!$this->requests) {
            return;
        }

        // Initialize the handles with a very quick select timeout
        $active = $mrc = null;
        $this->executeHandles($active, $mrc, 0.001);
        $event = new Event(array('curl_multi' => $this));
        $this->processMessages();

        while ($this->requests) {

            // Notify each request as polling
            $blocking = $total = 0;
            foreach ($this->requests as $request) {
                ++$total;
                $event['request'] = $request;
                $request->getEventDispatcher()->dispatch(self::POLLING_REQUEST, $event);
                // The blocking variable just has to be non-falsey to block the loop
                if ($request->getParams()->hasKey(self::BLOCKING)) {
                    ++$blocking;
                }
            }

            if ($blocking == $total) {
                // Sleep to prevent eating CPU because no requests are actually pending a select call
                usleep(500);
            } else {
                do {
                    $this->executeHandles($active, $mrc, 1);
                } while ($active);
            }
            $this->processMessages();
        }
    }
1371945
public function launch()
    {
        foreach($this->getServers() as $server)
        {
            $server = $this->getContainer()->get($server);
            if (!$server)
            {
                throw new \Exception("Unable to find Server Service.");
            }

            if (!($server instanceof ServerTypeInterface))
            {
                throw new \Exception("Server Service must implement ServerTypeInterface");
            }

            if ($this->getOutput())
            {
                $this->getOutput()->writeln("Launching " . $server->getName() . " on: " . $server->getAddress());
            }
            //launch server into background process?
            $server->launch();
        }
    }
390458
public function detect()
    {
        $result = null;
        if ($result === null && $this->request->server->has('SERVER_SOFTWARE')) {
            $result = $this->detectFromServer($this->request->server->get('SERVER_SOFTWARE'));
        }
        if ($result === null && function_exists('apache_get_version')) {
            $result = $this->detectFromSPL(@apache_get_version());
        }
        if ($result === null) {
            ob_start();
            phpinfo(INFO_MODULES);
            $info = ob_get_contents();
            ob_end_clean();
            $result = $this->detectFromPHPInfo($info);
        }

        return $result;
    }
1099291
protected function checkParam()
    {
        if (empty($this->getHost()) && empty($this->getUnixSocket())) {
            $sErrorMessage = 'Connexion to Mysql must have an host or an unix socket defined';
            throw new \Exception($sErrorMessage);
            return false;
        } else {
            return true;
        }
    }
392497
private function checkProperties()
    {
        if (!isset($this->listId)) {
            throw new \Exception('[listId] is not set', 1);
        }

        if (!isset($this->installationUrl)) {
            throw new \Exception('[installationUrl] is not set', 1);
        }

        if (!isset($this->apiKey)) {
            throw new \Exception('[apiKey] is not set', 1);
        }
    }
31707
public function print_notice_when_no_notifiers_active() {
		if (
			'settings_page_soter' !== get_current_screen()->base
			|| $this->options->email_enabled
			|| $this->options->slack_enabled
		) {
			return;
		}

		echo $this->template->render( 'admin-notice.php', [ // WPCS: XSS OK.
			'type' => 'error',
			'message' => 'All notification channels are currently disabled. Please enable one or more below.',
		] );
	}
871714
private function handleRequest()
    {
        //check if it's a legal webservice class
        if (!in_array($this->name, $this->classNameArr)) {
            throw new Exception('No valid webservice class.');
        }

        //check cache
        if (!file_exists($this->wsdlfile)) {
            $this->createWSDL();
        }

        $options = array('soap_version' => SOAP_1_1,
                         'actor' => $this->actor,
                         'classmap' => $this->structureMap, );

        header('Content-type: text/xml');
        $this->server = new SoapServer($this->wsdlfile, $options);
        $this->server->setClass($this->name);
        $this->server->setPersistence($this->persistence);

        use_soap_error_handler(true);
        $this->server->handle();
    }
856023
public function isSuccess()
    {
        $statuscode = $this->response->getStatusCode();

        if(!in_array($statuscode, [200, 204], true))
        {
            throw new Exception('HTTP Code ' . $statuscode . ' ' . $this->response->getBody());
        }

        return true;
    }
663305
public function validateAndParseWebhookNotificationFromCurrentRequest() {
        // read the JSON input
        $json_string = file_get_contents('php://input');

        $json_data = json_decode($json_string, true);

        // make sure the message is signed properly
        //   throws an exception if invalid
        $this->validateWebhookNotification($json_data);

        // return the payload
        return $this->parseWebhookNotificationData($json_data);
    }
1264507
public function process()
    {
        // try to read input
        try {
            $json = file_get_contents($this->input);
        } catch (\Exception $e) {
            $message = "Server unable to read request body.";
            $message .= PHP_EOL . $e->getMessage();
            throw new Serverside\Exception($message);
        }

        // handle communication errors
        if ($json === false) {
            throw new Serverside\Exception("Server unable to read request body.");
        }

        // create request object
        $request = $this->makeRequest($json);

        // set content type to json if not testing
        if (!(defined('ENV') && ENV == 'TEST')) {
            header('Content-type: application/json');
        }

        // handle json parse error and empty batch
        if ($request->error_code && $request->error_message) {
            echo $request->toResponseJSON();
            return;
        }

        // respond with json
        echo $this->handleRequest($request);
    }
772627
public function handleCallbackStatus() {
    // Read the body of the request
    $body = @file_get_contents('php://input');

    if ($body != null && strlen(trim($body)) > 0) {
      $status = json_decode(trim($body), false);

      if ($status != null && is_object($status)) {
        $this->initStatus($status);

        return true;
      }
    }

    return false;
  }
391939
public function check()
	{
		// Check if the db connector has been set.
		if (!($this->db instanceof PgsqlDriver))
		{
			throw new \Exception('Database connection wrong type.');
		}

		// Check if the tables have been specified.
		if (empty($this->from))
		{
			throw new \Exception('ERROR: No Tables Specified');
		}

		return $this;
	}
95623
public function getStatusCode()
    {
        $headers = $this->getHeaders();
        if ($headers->has('http-code')) {
            // take into account possible 'follow location'
            $statusCodeHeaders = $headers->get('http-code', null, false);
            return empty($statusCodeHeaders) ? null : end($statusCodeHeaders);
        }
        throw new Exception('Unable to get status code: referred header information is missing.');
    }
837226
public function connect()
    {
        list($host, $port) = explode(':', $this->getServer());
        if ($this->stream->open($host, $port, $this->getTimeout()) === false) {
            throw new Exception(sprintf('Cannot connect to server %s', $this->getServer()), Exception::SERVER_OFFLINE);
        }

        return true;
    }
702072
public function execute()
    {
        if (! $this->ch) {
            throw new Exception('Curl request not initiated');
        }

        $statusCode = (int) isset($this->lushOptions['return_status']) ? $this->lushOptions['return_status'] : 200;
        $contentType = isset($this->lushOptions['return_content_type']) ? $this->lushOptions['return_content_type'] : 'text';

        $this->headers['url'] = $this->ch;
        $this->headers['http_code'] = $statusCode;

        $this->executed = true;

        return $this->createResponse($statusCode, $contentType);
    }