Subscribe the provided email to a list.
@param Array|Garp_Util_Configuration $options
@return StdClass
779833
public function listSubscribe($options) {
        if (!$options instanceof Garp_Util_Configuration) {
            $options = new Garp_Util_Configuration($options);
        }
        $options->obligate('email_address')
                ->obligate('id')
                ->setDefault('merge_vars', array('LNAME' => '', 'FNAME' => ''))
                ;
        $options['method'] = 'listSubscribe';
        return $this->_send((array)$options);
    }
134664
public function subscribe($requestParams)
    {
        $requiredParams = array("event","url");
        return $this->client->request($requestParams, $this->_endpoint . "/" . self::SUBSCRIBE, "post", $requiredParams, $options = NULL);
    }
1037353
public function setAdapter($options = null)
    {
        if (is_string($options)) {
            $adapter = $options;
        } elseif (isset($options['adapter'])) {
            $adapter = $options['adapter'];
            unset($options['adapter']);
        } else {
            $adapter = 'BlockCipher';
        }

        if (!is_array($options)) {
            $options = [];
        }

        if (class_exists('Zend\Filter\Encrypt\\' . ucfirst($adapter))) {
            $adapter = 'Zend\Filter\Encrypt\\' . ucfirst($adapter);
        } elseif (!class_exists($adapter)) {
            throw new Exception\DomainException(
                sprintf(
                    '%s expects a valid registry class name; received "%s", which did not resolve',
                    __METHOD__,
                    $adapter
                )
            );
        }

        $this->adapter = new $adapter($options);
        if (!$this->adapter instanceof Encrypt\EncryptionAlgorithmInterface) {
            throw new Exception\InvalidArgumentException(
                "Encoding adapter '" . $adapter
                . "' does not implement Zend\\Filter\\Encrypt\\EncryptionAlgorithmInterface"
            );
        }

        return $this;
    }
908431
public function setOptions(array $options)
    {
        foreach ($options as $index=>$val) {
            if (property_exists($this, $index)) {
                $this->{$index} = $val;
            }
        }
        return $this;
    }
525956
public function notify($exception, $options = array()) {
		$this->_checkConfig();

		$config = array_merge($this->_config, $options);

		$sock = fsockopen(
			$this->_buildTcpScheme($config),
			$config['port'],
			$errno, $errstr,
			$config['connect_timeout']
		);

		if ($sock) {
			stream_set_timeout($sock, $config['write_timeout']);
			fwrite($sock, $this->_buildHttpPayload($exception, $config));
			fclose($sock);
		}

		foreach ($this->_observers as $observer) {
			$observer($exception, $config);
		}

		return $this;
	}
345454
public function listBuckets($options = array())
    {
        list($config) = $this->parseOptions($options, BosOptions::CONFIG);

        return $this->sendRequest(
            HttpMethod::GET,
            array(
                BosOptions::CONFIG => $config
            )
        );
    }
1206564
public function getAMQPConnection(array $options)
    {
        if (!class_exists(AMQPStreamConnection::class)) {
            throw new \DomainException('Please install php-amqplib/php-amqplib first.');
        }

        $defaultOptions = [
            'host' => 'localhost',
            'port' => 5672,
            'user' => 'guest',
            'password' => 'guest',
        ];

        $options = array_merge($defaultOptions, $options);

        return new AMQPStreamConnection(
            $options['host'],
            $options['port'],
            $options['user'],
            $options['password']
        );
    }
648504
public function execute($options = array())
    {
        $message = $options['message'];
        $receivers = $message->getReceivers();

        $options['provide_link'] = true;
        foreach ($receivers as $receiver) {
            if ($email = $this->extractEmailFromReceiver($receiver))
                $this->sendMail($message, $email, $options);
        }
    }
1372380
public function execute($options = array())
    {
        $message = $options['message'];

        // First, check subject, no error, return.
        if (!preg_match("/error/i", $message->getSubject())) return true;

        // Find who to send this to.
        $first = $message->getFirstPost();

        $receivers = isset($options['attributes']) 
            ? $options['attributes'] : array();

        // I'm not ready for validating a mail address. this is just a simple.
        if ($first->getFrom())
            $receivers[] = $first->getFrom();

        $options['provide_link'] = true;
        foreach ($receivers as $receiver) {
            $this->sendMail($message, $receiver, $options);
        }
        // Message is handled, put in the archive
        $message->setState('ARCHIVED');
    }
1023168
public function setOptions($options)
        {
            if(!is_array($options)) {
                throw new \Thin\Exception(get_class() . ": " . __METHOD__ . " expects an array as parametre, " . gettype($options) . " given.");
            }

            foreach($options as $option => $value) {
                $this->setOption($option, $value);
            }

            return $this;
        }
1120942
public function setSubscriber($email, $is_confirmed = true, $fields = [])
	{
		$subscriber = [
			'emailaddress' => $email,
			'fields' => $fields,
		];

		if (!$is_confirmed) {
			$subscriber = array_merge($subscriber, [
				'confirmed' => false,
				'confirmdate' => null,
				'confirmip' => null,
			]);
		}

		$result = $this->iconneqt->putListSubscriber($this->id, $subscriber);

		return $this->iconneqt->getListSubscriber($this->id, $result->subscriberid);
	}
321613
public function sendSignal($options)
    {
        $this->outputTitle($options->title);

        $force = $this->input->getOption('force')->value;
        $all = $this->input->getOption('all')->value;

        if ($force) {
            $this->debug("'FORCE' option detected");
        }

        if ($all) {
            $this->debug("'ALL' option detected");
        }

        if (!isset($options->formatListItem)) {
            $resqueStats = $this->ResqueStats;
            $ResqueStatus = $this->ResqueStatus;
            $fresque = $this;
            $listFormatter = function ($worker) use ($resqueStats, $ResqueStatus, $fresque) {
                return sprintf(
                    '%s, started %s ago',
                    $ResqueStatus->isSchedulerWorker($worker) ? '**Scheduler Worker**' : $worker,
                    $fresque->formatDateDiff(call_user_func_array(array($resqueStats, 'getWorkerStartDate'), array($worker)))
                );
            };
        } else {
            $listFormatter = $option->formatListItem;
        }

        if (empty($options->workers)) {
            $this->output->outputLine($options->noWorkersMessage, 'failure');
        } else {
            sort($options->workers);
            $this->debug('Found ' . $options->getWorkersCount() . ' workers');

            $workerIndex = array();
            if (!$all && $options->getWorkersCount() > 1) {
                $i = 1;
                $menuItems = array();
                foreach ($options->workers as $worker) {
                    $menuItems[$i++] = $listFormatter($worker);
                }

                $menuItems['all'] = $options->allOption;

                $index = $this->getUserChoice(
                    $options->listTitle,
                    $options->selectMessage . ':',
                    $menuItems
                );

                if ($index === 'all') {
                    $workerIndex = range(1, $options->getWorkersCount());
                } else {
                    $workerIndex[] = $index;
                }

            } else {
                $workerIndex = range(1, $options->getWorkersCount());
            }

            foreach ($workerIndex as $index) {
                $worker = $options->workers[$index - 1];

                list($hostname, $pid, $queue) = explode(':', (string)$worker);

                $this->debug('Sending -' . $options->signal . ' signal to process ID ' . $pid);

                if ($this->runtime['Scheduler']['enabled'] === true && $this->ResqueStatus->isSchedulerWorker($worker)) {
                    if (isset($options->schedulerWorkerAction)) {
                        $f = $options->schedulerWorkerAction;
                        $f($worker);
                    }
                    $this->output->outputText($options->schedulerWorkerActionMessage . ' ... ');
                } else {
                    $this->output->outputText($options->actionMessage . ' ' . $pid . ' ... ');
                }



                $killResponse = $this->kill($options->signal, $pid);
                $options->onSuccess($pid, (string)$worker);

                if ($killResponse['code'] === 0) {
                    $this->output->outputLine('Done', 'success');
                } else {
                    $this->output->outputLine($killResponse['message'], 'failure');
                }
            }
        }

        $this->output->outputLine();
    }
451779
public function fetch(array $options = null) {
        try {
            $this->_checkAcl('fetch');
        } catch (Garp_Auth_Exception $e) {
            $this->_checkAcl('fetch_own');
        }

        if ($this->_model instanceof Garp_Model_Db) {
            $options = $options instanceof Garp_Util_Configuration
                ? $options
                : new Garp_Util_Configuration($options);
            $options
                ->setDefault('sort', array())
                ->setDefault('start', null)
                ->setDefault('limit', null)
                ->setDefault('fields', null)
                ->setDefault('query', false)
                ->setDefault('group', array())
                ->setDefault('rule', null)
                ->setDefault('bindingModel', null)
                ->setDefault('bidirectional', false)
                ->setDefault('filterForeignKeys', false);
            $options['sort']   = (array)$options['sort'];
            $options['fields'] = (array)$options['fields'];
            $tableName         = $this->_getTableName($this->_model);
            $options           = (array)$options;
            $modelInfo         = $this->_model->info();
            $referenceMap      = $modelInfo['referenceMap'];
            // SELECT
            // ============================================================
            $select = $this->_model->select();
            $select->setIntegrityCheck(false);

            // FILTER WHERES AND JOINS
            // ============================================================
            $related = array();
            if ($options['query'] && !empty($options['query'])) {
                /**
                 * Check for other model names in the conditions.
                 * These are indicated by a dot (".") in the name.
                 * If available, add these models as joins to the Select object.
                 * The format is <related-model-name>.<primary-key> => <value>.
                 */
                foreach ($options['query'] as $column => $value) {
                    if (strpos($column, '.') !== false) {
                        $related[$column] = $value;
                        unset($options['query'][$column]);
                    }
                }
            }

            // FROM
            // ============================================================
            if ($options['fields']) {
                $fields = $options['fields'];
            } elseif (count($related)) {
                // When using a join filter (used for the relationpanel), it's more performant to
                // specify only a model's list fields, otherwise the query can get pretty heavy for
                // tables with 100.000+ records.
                $primary = array_values($this->_model->info(Zend_Db_Table_Abstract::PRIMARY));
                $fields = array_merge($this->_model->getListFields(), $primary);
            } else {
                $fields = Zend_Db_Table_Select::SQL_WILDCARD;
            }
            // If filterForeignKeys is true, filter out the foreign keys
            if ($options['filterForeignKeys']) {
                $fields = $this->_filterForeignKeyColumns($fields, $referenceMap);
            }
            $select->from($tableName, $fields);

            // JOIN
            // ============================================================
            if (count($related)) {
                $this->_addJoinClause(
                    $select,
                    $related,
                    $options['rule'],
                    $options['bindingModel'],
                    $options['bidirectional']
                );
            }

            if (array_get($options, 'joinMultilingualModel')) {
                /**
                 * Note that this join is meant just to provide a table with its extended columns to
                 * allow, for instance, sorting.
                 * If you want to sort by `name`, which is often a multilingual field,
                 * you're gonna need this. MySQL would otherwise complain about unknown columns.
                 * Note that this replicates the behavior of the MySQL joint views.
                 */
                $i18nModel = $this->_model->getObserver('Translatable')
                    ->getI18nModel($this->_model);
                $lang = Garp_I18n::getDefaultLocale();
                $select->join(
                    $i18nModel->getName(),
                    $i18nModel->refmapToOnClause(get_class($this->_model)) . " AND lang = '$lang'",
                    array_map(
                        array_get('name'),
                        array_filter(
                            $this->_model->getFieldConfiguration(), array_get('multilingual')
                        )
                    )
                );
            }

            // WHERE
            // Add WHERE clause if there still remains something after
            // filtering.
            // ============================================================
            if ($options['query']) {
                $select->where($this->_createWhereClause($options['query']));
            }

            // GROUP
            // ============================================================
            $select->group($options['group']);

            // ORDER
            // ============================================================
            // Prefix native columns with the table name (e.g. "id" becomes
            // "Thing.id")
            // Note that we create a mock table object based on the joint view
            // to collect column info.
            // This should be more accurate than reading that info from the table.
            $mockTable = new Zend_Db_Table(
                array(
                Zend_Db_Table_Abstract::NAME => $tableName,
                Zend_Db_Table_Abstract::PRIMARY => $this->_model->info(
                    Zend_Db_Table_Abstract::PRIMARY
                ))
            );
            $nativeColumns = $mockTable->info(Zend_Db_Table_Abstract::COLS);

            $select->order(
                array_map(
                    function ($s) use ($tableName, $nativeColumns) {
                        $nativeColTest = preg_replace('/(ASC|DESC)$/', '', $s);
                        $nativeColTest = trim($nativeColTest);

                        if (in_array($nativeColTest, $nativeColumns) && strpos($s, '.') === false) {
                            $s = $tableName . '.' . $s;
                        }
                        return $s;
                    }, $options['sort']
                )
            );

            // LIMIT
            // ============================================================
            // Do not limit when a COUNT(*) is performed, this skews results.
            $isCountQuery = count($fields) == 1
                && !empty($fields[0])
                && strtolower($fields[0]) == 'count(*)';
            if (!$isCountQuery) {
                $select->limit($options['limit'], $options['start']);
            }
            $results = $this->_model->fetchAll($select)->toArray();
        } else {
            $results = $this->_model->fetchAll();
        }

        foreach ($results as &$result) {
            foreach ($result as $column => $value) {
                if (strpos($column, '.') !== false) {
                    $keyParts = explode('.', $column, 2);
                    $newKey = $keyParts[1];
                    $relModelKey = Garp_Util_String::strReplaceOnce(
                        $this->_model->getNameWithoutNamespace(), '', $keyParts[0]
                    );
                    $result['relationMetadata'][$relModelKey][$newKey] = $value;
                    unset($result[$column]);
                }
            }
        }
        return $results;
    }
911901
protected function _send(array $options) {
        $options['apikey'] = $this->_apiKey;
        $get = array(
            'method' => $options['method'],
            'output' => $this->_outputType
        );
        unset($options['method']);
        
        $uri  = 'http://'.$this->_datacenterId.'.api.mailchimp.com/1.3/?';
        $uri .= http_build_query($get);

        $response = $this->getHttpClient()
                         ->setParameterPost($options)
                         ->setMethod(Zend_Http_Client::POST)
                         ->setUri($uri)
                         ->request()
        ;
        $response = Zend_Json::decode($response->getBody());
        return $response;
    }
566716
public function options($options)
    {
        if (!is_array($options)) {
            throw new InvalidParamException('Array parameter expected, ' . gettype($options) . ' received.');
        }

        $this->options = $options;
        return $this;
    }
732218
public function execute($options = array())
    {
        $sm = $this->container->get('sakonnin.messages');
        $um = $this->container->get('fos_user.user_manager');

        $message = $options['message'];

        // First, check subject, no error, return.
        if (!preg_match("/error/i", $message->getSubject())) return true;

        // Find who to send this to.
        $first = $message->getFirstPost();

        $receivers = isset($options['attributes']) ? $options['attributes'] : array();
        // I'm not ready for validating a mail address. this is just a simple.
        // TODO: Find out where this came from and decide who/what til get it.
        // This is most probably wrong and the From is a username.
        if ($first->getFrom())
            $receivers[] = $first->getFrom();

        $options['provide_link'] = true;
        foreach ($receivers as $receiver) {
            $this->sendNotification($receiver, $message->getBody());
        }

        return true;
    }
524536
public static function getList(array $options = array())
    {
        $api = new Api\GetService();
        $result = $api->doRequest();
        $paymentMethods = self::reorderOutput($result);

        if (isset($options['country'])) {
            $paymentMethods = self::filterCountry($paymentMethods, $options['country']);
        }

        return $paymentMethods;
    }