Tries to connect and load feedback data

@return $this
@throws RuntimeException
@throws \Exception
973034
public function loadFeedback()
    {
        $serviceName = NotificationServices::APPLE_PUSH_NOTIFICATIONS_SERVICE;

        try {
            $this->logger->info(sprintf("Querying the feedback service '%s'", $serviceName));

            $connection = $this->initFeedbackConnection($serviceName);

            $this
                ->responseHandler
                ->addResponse(
                    $connection->sendRequest()
                );

        } catch (RuntimeException $e) {
            $this->logger->error(
                sprintf("Runtime error while acquiring feedback: %s", $e->getMessage())
            );

        } catch (\Exception $e) {
            $this->logger->error(
                sprintf("Error occurs while acquiring feedback: %s", $e->getMessage())
            );
        }

        return $this;
    }
84823
public function start(): self
    {
        if (!$this->url) {
            throw new \RuntimeException("Please the property 'url' and 'saveAs'.", -1);
        }

        // default save to current dir.
        if (!$save = $this->saveAs) {
            $save = \getcwd() . '/' . \basename($this->url);
            // reset
            $this->saveAs = $save;
        }

        $ctx = \stream_context_create();

        // register stream notification callback
        \stream_context_set_params($ctx, [
            'notification' => [$this, 'progressShow']
        ]);

        Cli::write("Download: {$this->url}\nSave As: {$save}\n");

        $fp = \fopen($this->url, 'rb', false, $ctx);

        if (\is_resource($fp) && \file_put_contents($save, $fp)) {
            Cli::write("\nDone!");
        } else {
            $err = \error_get_last();
            Cli::stderr("\nErr.rrr..orr...\n {$err['message']}\n", true, -1);
        }

        // close resource
        if (\is_resource($fp)) {
            \fclose($fp);
        }

        $this->fileSize = null;
        return $this;
    }
693162
public function getAdapter()
    {
        if (!$this->adapter) {
            throw new Exception\RuntimeException(sprintf(
                '"%s" unable to load adapter; adapter not found',
                __METHOD__
            ));
        }
        if (method_exists($this->adapter, 'setOptions')) {
            $this->adapter->setOptions($this->getAdapterOptions());
        }

        return $this->adapter;
    }
718494
public function indexAction()
    {
        $request = $this->getRequest();
        $type    = $request->getParam( 'type' );

        if ( ! $request instanceof ConsoleRequest )
        {
            throw new \RuntimeException( sprintf(
                '%s can only be used from a console.',
                __METHOD__
            ) );
        }

        $phpSelf = realpath( static::PHP_SELF );

        if ( empty( $phpSelf ) || ! is_file( $phpSelf ) )
        {
            throw new \RuntimeException( sprintf(
                '%s: php not found at "%s" (in "%s").',
                __METHOD__,
                static::PHP_SELF,
                getcwd()
            ) );
        }

        $result = 'Running ' . $type . ' cron(s) ...' . PHP_EOL . PHP_EOL;

        foreach ( $this->mimicSiteInfos() as $siteInfo )
        {
            $domain  = $siteInfo->getDomain();
            $process = new Process( array(
                'command'   => 'php',
                'arguments' => array(
                    $phpSelf,
                    'cron',
                    $domain,
                    $type,
                ),
                'environmentVariables'  => array(
                    'GRIDGUYZ_HOST'     => $domain,
                    'HTTP_HOST'         => $domain,
                ),
            ) );

            $result .= 'Calling process ...' . PHP_EOL .
                       $process->getRunCommand() . PHP_EOL;

            $output = tempnam( './data/', $domain );
            $descr  = array( Process::TYPE_FILE, $output, Process::MODE_APPEND );
            file_put_contents( $output, '' );

            $process->open( array(
                Process::STREAM_STDOUT => $descr,
                Process::STREAM_STDERR => $descr,
            ) );

            $return     = $process->close();
            $messages   = rtrim( file_get_contents( $output ), PHP_EOL );
            unlink( $output );

            if ( $messages )
            {
                $result .= static::PADDING . preg_replace(
                    '/[' . PHP_EOL . ']+/',
                    '$0' . static::PADDING,
                    $messages
                ) . PHP_EOL;
            }

            $result .= sprintf(
                'Process returned with #%d: %s' . PHP_EOL . PHP_EOL,
                $return,
                $return ? 'error!' : 'success.'
            );
        }

        $result .= 'Done.' . PHP_EOL;
        return $result;
    }
1254737
public function load() : Persistable
    {
        $data = $this->connector->get($this->key) ?: '';

        $persistable = $this->serializer->unserialize($data);

        if (!$persistable instanceof Persistable) {
            throw new RuntimeException('Persistable could not be'
                . ' reconstituted.');
        }

        return $persistable;
    }
1261737
public function connect()
    {
        parent::connect();
        $this->resource->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT);
        return $this;
    }
850556
public function wait()
    {
        if ($this->process == null) {
            throw new \Exception('You must run `start` before running `wait`');
        }

        // blocks here until process completes
        $this->process->wait();

        if (!$this->process->isSuccessful()) {
            throw new \RuntimeException($this->process->getErrorOutput());
        }

        return $this->process->getOutput();
    }
1192006
public function authenticate()
    {
        if (empty($this->request)) {
            throw new Exception\RuntimeException(
                'Request and Response objects must be set before calling authenticate()'
            );
        }

        if ($this->request->getUri()->getScheme() != 'https') {

            return new Result(
                Result::FAILURE_UNCATEGORIZED,
                array(),
                array('Http authentication must be over https')
            );
        }

        return parent::authenticate();
    }
540503
public function connect()
    {
        if ($this->ssl) {
            $this->connection = ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout());
        } else {
            $this->connection = ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout());
        }

        if ( ! $this->connection) {
            throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort());
        }

        $this->login();
        $this->setUtf8Mode();
        $this->setConnectionPassiveMode();
        $this->setConnectionRoot();
        $this->isPureFtpd = $this->isPureFtpdServer();
    }
437950
public function load()
    {
        $shmid = shm_attach($this->sysvKey);
        if ($shmid === false) {
            throw new \RuntimeException(
                'Failed to attach to the shared memory'
            );
        }
        if (!shm_has_var($shmid, self::VAR_KEY)) {
            $result = [null, []];
        } else {
            $result = shm_get_var($shmid, self::VAR_KEY);
        }
        return $result;
    }
1222194
final public function read() {
        global $DB;

        if ($this->get('id') <= 0) {
            throw new coding_exception('id is required to load');
        }
        $record = $DB->get_record(static::TABLE, array('id' => $this->get('id')), '*', MUST_EXIST);
        $this->from_record($record);

        // Validate the data as it comes from the database.
        $this->validated = true;

        return $this;
    }
662297
private function connect()
    {
        if (is_null($this->connection)) {
            $this->connection = call_user_func($this->connectionFactory, $this->config);
        }

        return $this;
    }
12709
public function send()
    {
        $allowed_status_codes = array_merge(array(200), $this->ignoredStatusCodes);
        $this->ignoredStatusCodes = array();

        try {
            $this->_setupCurl();
            $response = curl_exec($this->curl);

            if (!in_array(curl_getinfo($this->curl, CURLINFO_HTTP_CODE), $allowed_status_codes)) {
                if (curl_errno($this->curl)) {
                    throw new \RuntimeException('The HTTP request failed: ' . curl_error($this->curl));
                }
                throw new \RuntimeException('The HTTP request failed: unknown error.');
            }
            curl_close($this->curl);

            return $this->hasToDecodeResponse ? json_decode($response) : $response;
        } catch (Exception $e) {  }
    }
1059025
public final function getResponse(): ResponseInterface
   {
       if (!$this->response) {
           try {
               $this->send();
           } catch (RuntimeException $e) {
               throw new RuntimeException(
                   "Can't get response: " . $e->getMessage());
           }
       }
       return $this->response;
   }
55986
public function load()
    {
        $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm);
        if ($shmid === false) {
            throw new \RuntimeException(
                'Failed to attach to the shared memory'
            );
        }
        if (! shm_has_var($shmid, self::VAR_KEY)) {
            $result = new JobConfig();
        } else {
            $result = shm_get_var($shmid, self::VAR_KEY);
        }
        shm_detach($shmid);

        if ($result === false) {
            throw new \RuntimeException(
                'Failed to deserialize data from shared memory'
            );
        }
        return $result;
    }
322927
public function check()
	{
		// Check if the db connector has been set.
		if (!($this->db instanceof MysqlDriver))
		{
			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;
	}
477673
public function load()
    {
        if (!$this->isRegistered()) {
            if (!$this->exist()) {
                require_once($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/main/classes/general/update_client_partner.php');

                if (!\CUpdateClientPartner::LoadModuleNoDemand(
                    $this->getName(),
                    $strError,
                    $this->isBeta() ? 'N' : 'Y',
                    LANGUAGE_ID)
                ) {
                    throw new Exception\ModuleLoadException($strError, $this->getName());
                }
            }
        }

        return $this;
    }