Send the tool proxy to the Tool Consumer

@return boolean True if the tool proxy was accepted
960219
public function doToolProxyService()
    {

// Create tool proxy
        $toolProxyService = $this->findService('application/vnd.ims.lti.v2.toolproxy+json', array('POST'));
        $secret = DataConnector::getRandomString(12);
        $toolProxy = new MediaType\ToolProxy($this, $toolProxyService, $secret);
        $http = $this->consumer->doServiceRequest($toolProxyService, 'POST', 'application/vnd.ims.lti.v2.toolproxy+json', json_encode($toolProxy));
        $ok = $http->ok && ($http->status == 201) && isset($http->responseJson->tool_proxy_guid) && (strlen($http->responseJson->tool_proxy_guid) > 0);
        if ($ok) {
            $this->consumer->setKey($http->responseJson->tool_proxy_guid);
            $this->consumer->secret = $toolProxy->security_contract->shared_secret;
            $this->consumer->toolProxy = json_encode($toolProxy);
            $this->consumer->save();
        }

        return $ok;

    }
416071
public function send()
    {
        if (!headers_sent()) {
            foreach ($this->cookies as $cookie) {
                $cookie->send();
            }

            return true;
        }

        return false;
    }
470419
public function connect()
	{
		if ($this->host == '')
		{
			return false;
		}

		$this->resource = @ ldap_connect($this->host, $this->port);

		if ($this->resource)
		{
			if ($this->use_ldapV3)
			{
				if (!@ldap_set_option($this->resource, LDAP_OPT_PROTOCOL_VERSION, 3))
				{
					return false;
				}
			}

			if (!@ldap_set_option($this->resource, LDAP_OPT_REFERRALS, (int) $this->no_referrals))
			{
				return false;
			}

			if ($this->negotiate_tls)
			{
				if (!@ldap_start_tls($this->resource))
				{
					return false;
				}
			}

			return true;
		}
		else
		{
			return false;
		}
	}
1069315
public function send()
    {
        $this->addHeaders();

        $this->meta = call_user_func($this->map, $this->options);

        return $this;
    }
561407
protected function send()
    {
        $userAgent = 'mpay24-php/' . self::VERSION;

        $ch = curl_init($this->getEtpURL());
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_USERPWD,
            'u' . $this->config->getMerchantId() . ':' . $this->config->getSoapPassword());
        curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        if ($this->config->isEnableCurlLog()) {
            $fh = fopen($this->getMpay24CurlLogPath(), 'a+') or $this->permissionError();

            curl_setopt($ch, CURLOPT_VERBOSE, 1);
            curl_setopt($ch, CURLOPT_STDERR, $fh);
        }

        try {
            curl_setopt($ch, CURLOPT_CAINFO, $this->config->getCaCertPath() . $this->config->getCaCertFileName());

            if ($this->config->getProxyHost()) {
                curl_setopt($ch, CURLOPT_PROXY, $this->config->getProxyHost() . ':' . $this->config->getProxyPort());

                if ($this->config->getProxyUser()) {
                    curl_setopt($ch, CURLOPT_PROXYUSERPWD,
                        $this->config->getProxyUser() . ':' . $this->config->getProxyPass());
                }

                if ($this->config->isVerifyPeer() !== true) {
                    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->config->isVerifyPeer());
                }
            }

            $this->response = curl_exec($ch);
            curl_close($ch);

        } catch (\Exception $e) {
            if ($this->config->isTestSystem()) {
                $dieMSG = "Your request couldn't be sent because of the following error:" . "\n" . curl_error(
                        $ch
                    ) . "\n" . $e->getMessage() . ' in ' . $e->getFile() . ', line: ' . $e->getLine() . '.';
            } else {
                $dieMSG = self::LIVE_ERROR_MSG;
            }

            echo $dieMSG;
        }

        if (isset($fh) && $this->config->isEnableCurlLog()) {
            fclose($fh);
        }
    }
1259374
public function send() : bool
    {
        if (headers_sent()) {
            return false;
        }

        header($this->getStartLine());

        foreach ($this->getHeaders() as $name => $values) {
            foreach ($values as $value) {
                header($name . ': ' . $value, false);
            }
        }

        echo (string) $this->body;

        flush();

        return true;
    }
73471
public function send()
    {
        // if no recipients found, skipping sending
        if (count($this->getRecipient()) < 1) {
            return false;
        }

        $myConfig = Registry::getConfig();
        $this->setCharSet();

        if ($this->_getUseInlineImages()) {
            $this->_includeImages(
                $myConfig->getImageUrl(),
                $myConfig->getImageUrl(false, false),
                $myConfig->getPictureUrl(null, false),
                $myConfig->getImageDir(),
                $myConfig->getPictureDir(false)
            );
        }

        $this->_makeOutputProcessing();

        // try to send mail via SMTP
        if ($this->getMailer() == 'smtp') {
            $ret = $this->_sendMail();

            // if sending failed, try to send via mail()
            if (!$ret) {
                // failed sending via SMTP, sending notification to shop owner
                $this->_sendMailErrorMsg();

                // trying to send using standard mailer
                $this->setMailer('mail');
                $ret = $this->_sendMail();
            }
        } else {
            // sending mail via mail()
            $this->setMailer('mail');
            $ret = $this->_sendMail();
        }

        if (!$ret) {
            // failed sending, giving up, trying to send notification to shop owner
            $this->_sendMailErrorMsg();
        }

        return $ret;
    }
803651
public function send()
    {

        // Set some defaults
        $extension = null;
        $returnImage = $this->_absoluteImagePath;

        // If the GD extension is not available
        if (!extension_loaded('gd') && (!function_exists('dl') || !dl('gd.so'))) {
            $this->_addErrorHeader(\Tollwerk\Squeezr\Exception::GD_UNAVAILABLE_MSG,
                \Tollwerk\Squeezr\Exception::GD_UNAVAILABLE);

            // If the cache directory doesn't exist or is not writable: Error
        } elseif ((!@is_dir($this->_absoluteCacheImageDir) && !@mkdir($this->_absoluteCacheImageDir, 0777,
                    true)) || !@is_writable($this->_absoluteCacheImageDir)
        ) {
            $this->_addErrorHeader(\Tollwerk\Squeezr\Exception::INVALID_TARGET_CACHE_DIRECTORY_MSG,
                \Tollwerk\Squeezr\Exception::INVALID_TARGET_CACHE_DIRECTORY);

            // If the squeezr screen cookie is not available or invalid
        } elseif (empty($_COOKIE['squeezr_screen']) || !preg_match("%^(\d+)x(\d+)\@(\d+(?:\.\d+)?)$%",
                $_COOKIE['squeezr_screen'], $squeezr)
        ) {
            $this->_addErrorHeader(\Tollwerk\Squeezr\Exception::MISSING_METRICS_COOKIE_MSG,
                \Tollwerk\Squeezr\Exception::MISSING_METRICS_COOKIE);

            // Copy & resample original image
        } else {
            $errors = array();
            $returnImage = $this->squeeze($this->_absoluteImagePath, $this->_absoluteCacheImagePath, SQUEEZR_BREAKPOINT,
                $errors);
            foreach ($errors as $errNo => $errMsg) {
                $this->_addErrorHeader(sprintf($errMsg, $this->_relativeImagePath), $errNo);
            }
        }

        // Send the image along with it's HTTP headers
        $extension = ($extension === null) ? pathinfo($returnImage, PATHINFO_EXTENSION) : $extension;
        $this->_sendFile($returnImage, 'image/'.((strtolower($extension) == 'jpg') ? 'jpeg' : strtolower($extension)),
            true);
        exit;
    }
455133
public boolean useProxy() {
        try {
            return getSettings().getString(Settings.KEYS.PROXY_SERVER) != null
                    && getSettings().getBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY);
        } catch (InvalidSettingException ise) {
            LOGGER.warn("Failed to parse proxy settings.", ise);
            return false;
        }
    }
888525
public function accept()
    {
        $path = $this->getInnerIterator()->key();
        $result = $this->visitor->isAccepted($path);

        if ($result === PathVisitor::PATH_ACCEPTED) {
            return true;
        }
        if ($result === PathVisitor::FAKE_CONTENT) {
            $this->toFake[] = $path;
        }

        return false;
    }
1351131
public function connect(): bool
    {
        if ($this->isConnected()) {
            return false;
        }

        try {
            $this->socket->connect();
        } catch (\Exception $ex) {
            return false;
        }

        $key = $this->protocol->generateKey();
        $handshake = $this->protocol->getRequestHandshake(
            $this->uri,
            $key,
            $this->origin,
            $this->headers
        );

        $this->socket->send($handshake);
        $response = $this->socket->receive(self::MAX_HANDSHAKE_RESPONSE);
        return ($this->connected =
            $this->protocol->validateResponseHandshake($response, $key));
    }
1148124
protected function proxy() {
        if (!$this->context) {
            $this->context = new WorkerContext(
                $this->version,
                $this->solution['workspaceSid'],
                $this->solution['sid']
            );
        }

        return $this->context;
    }
492595
public function canProceed(Tool $tool)
    {
        if (false === $this->helper->getFilesystem()->isFileAlreadyExist($tool->getFilename())) {
            return true;
        }

        $doReplace = $tool->forceReplace();

        if (true === $this->configuration->isInteractiveMode()) {
            $this->io->write('<comment>Checksums are not equal!</comment>');
            $this->io->write(sprintf(
                '<comment>Do you want to overwrite the existing file "%s"?</comment>',
                $tool->getName()
            ));

            $doReplace = $this->io->askConfirmation('<question>[yes] or [no]?</question>', false);
        }

        return $doReplace;
    }
1038572
public function map_tool_to_consumer() {
        global $DB;

        if (empty($this->consumer)) {
            throw new moodle_exception('invalidtoolconsumer', 'enrol_lti');
        }

        // Map the consumer to the tool.
        $mappingparams = [
            'toolid' => $this->tool->id,
            'consumerid' => $this->consumer->getRecordId()
        ];
        $mappingexists = $DB->record_exists('enrol_lti_tool_consumer_map', $mappingparams);
        if (!$mappingexists) {
            $DB->insert_record('enrol_lti_tool_consumer_map', (object) $mappingparams);
        }
    }
1032133
public function send()
    {
        $arguments = func_get_args();
        $method    = array_shift($arguments);
        $args      = array_shift($arguments);

        foreach ($this as $helper) {
            $class = new ReflectionClass($helper);

            if ($class->hasMethod($method)) {
                return $class->getMethod($method)->invokeArgs($helper, $args);
            }
        }

        return parent::send($method);
    }
726853
public function send()
    {
        $transport = $this->getConnection()->getTransportObject();

        // Refactor: Not full toArray needed in exec?
        return $transport->exec($this, $this->getConnection()->toArray());
    }
393407
protected function proxy() {
        if (!$this->context) {
            $this->context = new TriggerContext(
                $this->version,
                $this->solution['accountSid'],
                $this->solution['sid']
            );
        }

        return $this->context;
    }