Checks the server for messages and returns their results.

@param array $options

@return array
335266
public function checkMessages(array $options = [])
    {
        $start = array_key_exists('start', $options) ? $options['start'] : 0;
        $end = array_key_exists('end', $options) ? $options['end'] : 25;

        $rawMessages = $this->plivo->get_messages([
            'offset' => $start,
            'limit'  => $end,
        ]);

        $incomingMessages = [];

        foreach ($rawMessages['objects'] as $rawMessage) {
            $incomingMessage = $this->createIncomingMessage();
            $this->processReceive($incomingMessage, $rawMessage);
            $incomingMessages[] = $incomingMessage;
        }

        return $incomingMessages;
    }
893833
private function getOptions($options)
    {
        $conf = [
            CURLOPT_HEADER => false,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_FOLLOWLOCATION => true
        ];

        if (isset($options['timeout'])) {
            $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000;
        }
        if (isset($options['connect_timeout'])) {
            $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000;
        }

        return $conf;
    }
463892
public function getServiceAccount(array $options = [])
    {
        $resp = $this->connection->getServiceAccount($options + ['projectId' => $this->projectId]);
        return $resp['email'];
    }
1266550
protected function parseOptions(array $options): array
    {
        $this->setTransformer(new IntegerToLocalizedStringTransformer($this->getLocale(), $this));

        return parent::parseOptions($options);
    }
1181617
public function dump(array $options = array())
    {
        return array(
            'listeners'       => $this->raw_listeners,
            'has_application' => null !== $this->application,
            'has_container'   => null !== $this->container,
        );
    }
951765
public function read(array $opts) {
        return [array_merge(parent::read($opts)[0], [
            'recipe' => 'discussion_viewed',
            'discussion_url' => $opts['discussion']->url,
            'discussion_name' => $opts['discussion']->name,
            'discussion_description' => 'A Moodle discussion.',
            'discussion_type' => static::$xapiType.$opts['discussion']->type,
            'discussion_ext' => $opts['discussion'],
            'discussion_ext_key' => 'http://lrs.learninglocker.net/define/extensions/moodle_discussion',
        ])];
    }
714881
public function export($options = [])
    {
        $this->_setContentLength();
        return [
            'status'  => $this->status(),
            'version' => $this->version(),
            'headers' => $this->headers(),
            'body'    => $this->stream()
        ];
    }
471475
public function getCommentsBefore(array $options = array()) {
		$options['wheres'][] = "
			e.time_created < {$this->comment->time_created}
		";
		$options['order_by'] = 'e.time_created ASC';
		$comments = elgg_get_entities_from_metadata($this->getFilterOptions($options));
		if (is_array($comments)) {
			return array_reverse($comments);
		}
		return $comments;
	}
70399
private function getContentTypes(Options $options): array
    {
        $allContentTypes = [];

        $groups = $this->contentTypeService->loadContentTypeGroups();
        $configuredGroups = $options['types'];

        foreach ($groups as $group) {
            $configuredGroups += [$group->identifier => true];
            if ($configuredGroups[$group->identifier] === false) {
                continue;
            }

            $contentTypes = $this->contentTypeService->loadContentTypes($group);
            foreach ($contentTypes as $contentType) {
                if (
                    is_array($configuredGroups[$group->identifier]) &&
                    !in_array($contentType->identifier, $configuredGroups[$group->identifier], true)
                ) {
                    continue;
                }

                $contentTypeName = $contentType->getName() ?? $contentType->identifier;
                $allContentTypes[$group->identifier][$contentTypeName] = $contentType->identifier;
            }
        }

        return $allContentTypes;
    }
327469
private function getLanguageOptions(array $options): array
    {
        $languageOptions = [
            'label' => false,
            'multiple' => false,
            'expanded' => true,
            'choice_loader' => $options['choice_loader'],
        ];

        if ($options['choice_loader'] instanceof LanguageChoiceLoader && is_array($options['language_codes'])) {
            $languageOptions['choice_loader'] = new CallbackChoiceLoader(function () use ($options) {
                return array_map([$this->languageService, 'loadLanguage'], $options['language_codes']);
            });
        }

        return $languageOptions;
    }
297569
public function getArray(array $options = array()): array
    {
        $content = $this->getContent();

        if (is_null($content)) {
            return (array)$content;
        }

        return json_decode($this->content, true);
    }
676749
final public function check(array $options) {
        foreach ($options as $property => $value) {
            if ((is_array($value) && !in_array($this->$property, $value)) ||
                    (!is_array($value) && $this->$property !== $value))
                return false;
        }

        return true;
    }
1001423
public function searchChannels($options)
    {
        $availableOptions = ['query', 'limit', 'offset'];

        $parameters = [];

        //  Filter the available options
        foreach ($availableOptions as $option) {

            if (isset($options[ $option ])) {

                $parameters[ $option ] = $options[ $option ];
            }
        }

        $response = $this->client->get('/kraken/search/channels', ['query' => $parameters]);

        return $response->json();
    }
248374
public static function parse($options)
    {
        if ($options instanceof self) {
            return $options;
        }

        if (is_null($options)) {
            return new RequestOptions(null, array());
        }

        if (is_string($options)) {
            return new RequestOptions($options, array());
        }

        if (is_array($options)) {
            $headers = array();
            $key = null;
            $signOpts = array();
            if (array_key_exists('api_key', $options)) {
                $key = $options['api_key'];
            }
            if (array_key_exists('pingpp_version', $options)) {
                $headers['Pingpp-Version'] = $options['pingpp_version'];
            }
            if (array_key_exists('sign_opts', $options)) {
                $signOpts = $options['sign_opts'];
            }
            return new RequestOptions($key, $headers, $signOpts);
        }

        $message = 'The second argument to Pingpp API method calls is an '
           . 'optional per-request apiKey, which must be a string, or '
           . 'per-request options, which must be an array. (HINT: you can set '
           . 'a global apiKey by "Pingpp::setApiKey(<apiKey>)")';
        throw new Error\Api($message);
    }
669536
public function execute($options = array())
    {
        $message = $options['message'];
        $receivers = $message->getReceivers();

        $options['provide_link'] = true;
        foreach ($receivers as $receiver) {
            if ($number = $receiver->getMobilePhoneNumber())
                $this->sendSms($message, $number, $options);
            if ($email = $this->extractEmailFromReceiver($receiver))
                $this->sendMail($message, $email, $options);
            $this->sendNotification($receiver, $message->getBody(), array('message_type' => 'PM'));
        }
    }
1038086
public function getEvents(array $options = null)
    {
        $url = ThisData::ENDPOINT_EVENTS;
        if (!is_null($options)) {
            $url .= '?' . http_build_query($options);
        }
        $response = $this->synchronousExecute('GET', $url);
        return json_decode($response->getBody(), TRUE);
    }
276447
private function validate(array $options)
    {
        if (array_key_exists('mandatorId', $options)) {
            $options['mandatorId'] = (int) $options['mandatorId'];
        }

        list($customerId, $licenseKey) =
            $this->siteAccessHelper->getRecommendationServiceCredentials($options['mandatorId'], $options['siteaccess']);

        $options = array_filter($options, function ($val) {
            return $val !== null;
        });

        $resolver = new OptionsResolver();
        $resolver->setRequired(['contentTypeIdList', 'host', 'webHook', 'transaction']);
        $resolver->setDefined(array_keys($options));
        $resolver->setDefaults([
            'transaction' => (new \DateTime())->format('YmdHis') . rand(111, 999),
            'customerId' => $customerId,
            'licenseKey' => $licenseKey,
            'mandatorId' => null,
            'siteaccess' => null,
            'lang' => null,
        ]);

        return $resolver->resolve($options);
    }