Get the url for the API request

@param \Phergie\Irc\Plugin\React\Command\CommandEvent $event
@return string
556382
public function getApiRequestUrl(Event $event)
    {
        $params = $event->getCustomParams();
        $query = trim(implode(" ", $params));

        $querystringParams = [
            'v' => '1.0',
            'q' => $query
        ];

        return sprintf("%s?%s", $this->apiUrl, http_build_query($querystringParams));
    }
1106622
public function get(EventInterface $event) {
        $request = $event->getRequest();
        $response = $event->getResponse();

        $redirectUrl = $event->getConfig()['indexRedirect'];

        if ($redirectUrl) {
            $response->setStatusCode(307);
            $response->headers->set('Location', $redirectUrl);
            return;
        }

        $response->setStatusCode(200, 'Hell Yeah');

        $baseUrl = $request->getSchemeAndHttpHost() . $request->getBaseUrl();

        $model = new Model\ArrayModel();
        $model->setData([
            'site' => 'http://imbo.io',
            'source' => 'https://github.com/imbo/imbo',
            'issues' => 'https://github.com/imbo/imbo/issues',
            'docs' => 'http://docs.imbo.io',
        ]);

        $response->setModel($model);

        // Prevent caching
        $response->setMaxAge(0)
                 ->setPrivate();
        $response->headers->addCacheControlDirective('no-store');
    }
109659
public function processEvent($event)
    {
        // Pass thread control to Inbox if Page Administrators move from Done to Inbox
        if (isset($event['request_thread_control'])) {
            return $this->passToInbox();
        }

        // Handle Account Linking and Unlinking
        if (isset($event['account_linking'])) {
            return AccountLinking::process($event);
        }

        // Handle message and postback
        if (!isset($event['message']) && !isset($event['postback'])) {
            return null;
        }

        if (isset($event['message'])) {
            $this->message = $event['message'];

            // Enabling NLP
            $this->initNlp($event['message']);
        }

        if (isset($event['postback'])) {
            $this->postback = $event['postback'];
        }

        // If current message is sent from Page
        if (isset($event['message']['is_echo'])) {
            $this->conversation->set('lead_id', $event['recipient']['id']);
            $this->conversation->set('page_id', $event['sender']['id']);
        }

        $this->conversation->set('received_input', $this->getReceivedInput());

        $this->setConfigData();

        // Save lead data if not exists.
        if (!isset($event['message']['is_echo'])) {
            $lead = $this->storage->pull();
        } else {
            $lead = Lead::withTrashed()->where('user_id', $this->getLeadId())->first();
        }

        $this->conversation->set('lead', $lead);
        
        // Message was sent by page, we don't need to response.
        if (isset($event['message']) && isset($event['message']['is_echo']) && $event['message']['is_echo'] == true) {
            return null;
        }

        DynamicParser::support([
            'type' => 'callback',
            'callback' => function ($content) use ($lead) {
                return $this->resolver->bind([
                    'bot' => $this,
                    'lead' => $lead,
                    'input' => $this->getReceivedInput(),
                ])->resolve($content);
            },
        ]);

        $type_pattern = $this->request->getTypeAndPattern($event);

        // We'll check to response intended action first
        if ($this->responseIntendedAction()) {
            return;
        }

        $nodes = $this->findNodes($type_pattern['type'], $type_pattern['pattern']);

        $this->response($nodes);
    }
913931
public function urlSecret(Event $event)
    {
        $query = $event['request']->getQuery();

        $query->set('client_id', $this->auth['client_id']);
        $query->set('client_secret', $this->auth['client_secret']);
    }
1327050
public function wantToExecute($event)
    {
        return parent::wantToExecute($event)
            && (empty($this->operationName)
                || ($this->operationName === $event->getKey())
            );
    }
869664
public function beforeCommand(Event $event, Command $command)
    {
        $parameters = $command->parseParameters([], ['h' => 'help']);

        if (
            count($parameters) < ($command->getRequiredParams() + 1) ||
            $command->isReceivedOption(['help', 'h', '?']) ||
            in_array($command->getOption(1), ['help', 'h', '?'])
        ) {
            $command->getHelp();

            return false;
        }

        if( !defined('BASE_PATH') ) {
            throw new CommandsException('Commands need a BASE_PATH constant defined.');
        }

        if ($command->canBeExternal() == false) {
            $path = $command->getOption('directory');
            if (!file_exists($path.'.phalcon')) {
                throw new CommandsException('This command should be invoked inside a Phalcon project directory.');
            }
        }

        return true;
    }
346414
public function handle(GetUrlCommand $command): string
    {
        return $this->s3Client->getObjectUrl($command->getBucket(), $command->getFilename());
    }
1186913
public function renderEvent(Event $event)
    {
        $parts = array_map('ucfirst', array_filter(preg_split('/_|\./', $event->name)));
        $name = 'on'.implode($parts);

        if (is_callable(array($this, $name))) {
            return call_user_func(array($this, $name), $event);
        } else {
            return null;
        }
    }
109272
public function col_ip($event) {
        // Get extra event data for origin and realuserid.
        $logextra = $event->get_logextra();
        $ip = $logextra['ip'];

        if (empty($this->download)) {
            $url = new moodle_url("/iplookup/index.php?ip={$ip}&user={$event->userid}");
            $ip = $this->action_link($url, $ip, 'ip');
        }
        return $ip;
    }
304213
public function routeEvent(MvcEvent $event)
    {
        $this->doLogout($event);

        /** @var \Rcm\EventListener\RouteListener $routeListener */
        $routeListener = $this->serviceLocator->get(
            \Rcm\EventListener\RouteListener::class
        );

        $return = $routeListener->checkRedirect($event);

        if (!empty($return)) {
            return $return;
        }

        $return = $routeListener->checkDomain($event);

        if (!empty($return)) {
            return $return;
        }

        $return = $routeListener->addLocale($event);

        if (!empty($return)) {
            return $return;
        }

        return null;
    }
873391
protected function getValue($event)
    {
        if ($this->value === null && Yii::$app instanceof Application) {
            $ip = Yii::$app->request->userIP;
            if ($ip === null) {
                return $this->getDefaultValue($event);
            }
            return $ip;
        }
        return parent::getValue($event);
    }
176316
protected function getEventLogDetails(Event $event, ResolverCommand $command)
    {
        $details = $command->resolve($event);

        return empty($details) ? $this->default : $details;
    }
32050
public function getEvent($event = [])
    {
        if (!$this->event) {
            $this->event = $event;
            if (isset($event['config'])
                && (empty($event['integration'])
                    || (
                        !empty($event['integration'])
                        && $event['integration'] == $this->getName()
                    )
                )
            ) {
                $this->event['config'] = array_merge($this->settings->getFeatureSettings(), $event['config']);
            }

            if (isset($this->event['campaignEvent']) && !empty($this->event['campaignEvent'])) {
                $campaignEvent             = $this->event['campaignEvent'];
                $this->event['id']         = $campaignEvent['id'];
                $this->event['campaignId'] = $campaignEvent['campaign']['id'];
            }

            // If the campaign event ID is missing, backfill it.
            if (!isset($this->event['id']) || !is_numeric($this->event['id'])) {
                try {
                    $identityMap = $this->em->getUnitOfWork()->getIdentityMap();
                    if (isset($identityMap['Mautic\CampaignBundle\Entity\Event'])) {
                        if (isset($identityMap['Mautic\CampaignBundle\Entity\Campaign']) && !empty($identityMap['Mautic\CampaignBundle\Entity\Campaign'])) {
                            $memoryCampaign = end($identityMap['Mautic\CampaignBundle\Entity\Campaign']);
                            $campaignId     = $memoryCampaign->getId();

                            /** @var \Mautic\CampaignBundle\Entity\Event $leadEvent */
                            foreach ($identityMap['Mautic\CampaignBundle\Entity\Event'] as $leadEvent) {
                                $properties = $leadEvent->getProperties();
                                $campaign   = $leadEvent->getCampaign();
                                if (
                                    $properties['_token'] === $this->event['_token']
                                    && $campaignId == $campaign->getId()
                                ) {
                                    $this->event['id']         = $leadEvent->getId();
                                    $this->event['name']       = $leadEvent->getName();
                                    $this->event['campaignId'] = $campaign->getId();
                                    break;
                                }
                            }
                        }
                    }
                } catch (\Exception $e) {
                }
            }
        }

        return $this->event;
    }
889794
function url($request, $api = "core") {
		if ($request == "RequestToken") {
			$this->config ['host'] = $this->config ['site'] . '/oauth/';
		} elseif ($request == "Authorize") {
			$this->config ['host'] = $this->config ['authorize_url'];
			$request = "";
		} elseif ($request == "AccessToken") {
			$this->config ['host'] = $this->config ['site'] . '/oauth/';
		} else {
			if (isset ( $api )) {
				if ($api == "core") {
					$api_stem = "api.xro";
					$api_version = $this->config ['core_version'];
				}
				if ($api == "payroll") {
					$api_stem = "payroll.xro";
					$api_version = $this->config ['payroll_version'];
				}
			}
			$this->config ['host'] = $this->config ['xero_url'] . $api_stem . '/' . $api_version . '/';
		}

		return implode ( array (
				$this->config ['host'],
				$request
		) );
	}
751995
protected function ensureCorrectUser(Event $event, $command)
    {
        return $event->user && ! windows_os() ? 'sudo -u '.$event->user.' -- sh -c \''.$command.'\'' : $command;
    }
1122552
private function getStatusUrl($queueEvent)
    {
        // this has to be checked after cause we should not call getSubscribedWorkerIds() if above is true
        $workerIds = $this->getSubscribedWorkerIds($queueEvent);
        if (empty($workerIds)) {
            return '';
        }

        // we have subscribers; create the EventStatus entry
        /** @var EventStatus $eventStatus **/
        $eventStatus = new $this->eventStatusClassname();
        $eventStatus->setCreatedate(new \DateTime());
        $eventStatus->setEventname($queueEvent->getEvent());

        // if available, transport the ref document to the eventStatus instance
        if (!empty($queueEvent->getDocumenturl())) {
            $eventStatusResource = new $this->eventStatusEventResourceClassname();
            $eventStatusResource->setRef($this->extRefConverter->getExtReference($queueEvent->getDocumenturl()));
            $eventStatus->setEventresource($eventStatusResource);
        }

        foreach ($workerIds as $workerId) {
            /** @var \GravitonDyn\EventStatusBundle\Document\EventStatusStatus $eventStatusStatus **/
            $eventStatusStatus = new $this->eventStatusStatusClassname();
            $eventStatusStatus->setWorkerid($workerId);
            $eventStatusStatus->setStatus('opened');
            $eventStatus->addStatus($eventStatusStatus);
        }

        // Set username to Event
        $eventStatus->setUserid($this->getSecurityUsername());

        $this->documentManager->persist($eventStatus);
        $this->documentManager->flush();

        // get the url..
        $url = $this->router->generate(
            $this->eventStatusRouteName,
            [
                'id' => $eventStatus->getId()
            ],
            UrlGeneratorInterface::ABSOLUTE_URL
        );

        return $url;
    }
1367199
protected function formatTask($event)
    {
        if ($event instanceof CallbackEvent) {
            return [
                'type' => 'closure',
                'name' => 'Closure',
            ];
        }

        if (Str::contains($event->command, '\'artisan\'')) {
            $exploded = explode(' ', $event->command);

            return [
                'type' => 'artisan',
                'name' => 'artisan '.implode(' ', array_slice($exploded, 2)),
            ];
        }

        return [
            'type' => 'command',
            'name' => $event->command,
        ];
    }