text:
<?php

namespace ZendService\ReCaptcha;

use Traversable;
use Zend\Http\Client as HttpClient;
use Zend\Http\Request as HttpRequest;
use Zend\Stdlib\ArrayUtils;

/**
 * Zend_Service_ReCaptcha
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage ReCaptcha
 */
class ReCaptcha
{
    /**
     * URI to the regular API
     *
     * @var string
     */
    const API_SERVER = 'http://www.google.com/recaptcha/api';

    /**
     * URI to the secure API
     *
     * @var string
     */
    const API_SECURE_SERVER = 'https://www.google.com/recaptcha/api';

    /**
     * URI to the verify server
     *
     * @var string
     */
    const VERIFY_SERVER = 'https://www.google.com/recaptcha/api/siteverify';

    /**
     * Public key used when displaying the captcha
     *
     * @var string
     */
    protected $siteKey = null;

    /**
     * Private key used when verifying user input
     *
     * @var string
     */
    protected $secretKey = null;

    /**
     * Ip address used when verifying user input
     *
     * @var string
     */
    protected $ip = null;

    /**
     * Parameters for the object
     *
     * @var array
     */
    protected $params = array(
        'ssl'   => false, /* Use SSL or not when generating the recaptcha */
    );

    /**
     * Options for tailoring reCaptcha
     *
     * See the different options on http://recaptcha.net/apidocs/captcha/client.html
     *
     * @var array
     */
    protected $options = array(
        'callback' => 'recaptchaCallback',
        'lang'     => 'en',
        'render'   => 'onload',
        'theme'    => 'light',
        'type'     => 'image'
    );

    /**
     * @var HttpClient
     */
    protected $httpClient = null;

    /**
     * Response from the verify server
     *
     * @var \ZendService\ReCaptcha\Response
     */
    protected $_response = null;

    /**
     * Class constructor
     *
     * @param string $siteKey
     * @param string $secretKey
     * @param array|Traversable $params
     * @param array|Traversable $options
     * @param string $ip
     */
    public function __construct($siteKey = null, $secretKey = null, $params = null, $options = null, $ip = null, HttpClient $httpClient = null)
    {
        if ($siteKey !== null) {
            $this->setSiteKey($siteKey);
        }

        if ($secretKey !== null) {
            $this->setSecretKey($secretKey);
        }

        if ($ip !== null) {
            $this->setIp($ip);
        } elseif (isset($_SERVER['REMOTE_ADDR'])) {
            $this->setIp($_SERVER['REMOTE_ADDR']);
        }

        if ($params !== null) {
            $this->setParams($params);
        }

        if ($options !== null) {
            $this->setOptions($options);
        }

        $this->setHttpClient($httpClient ?: new HttpClient);
    }

    public function setHttpClient(HttpClient $httpClient)
    {
        $this->httpClient = $httpClient;
        return $this;
    }

    public function getHttpClient()
    {
        return $this->httpClient;
    }

    /**
     * Serialize as string
     *
     * When the instance is used as a string it will display the recaptcha.
     * Since we can't throw exceptions within this method we will trigger
     * a user warning instead.
     *
     * @return string
     */
    public function __toString()
    {
        try {
            $return = $this->getHtml();
        } catch (\Exception $e) {
            $return = '';
            trigger_error($e->getMessage(), E_USER_WARNING);
        }

        return $return;
    }

    /**
     * Set the ip property
     *
     * @param string $ip
     * @return \ZendService\ReCaptcha\ReCaptcha
     */
    public function setIp($ip)
    {
        $this->ip = $ip;

        return $this;
    }

    /**
     * Get the ip property
     *
     * @return string
     */
    public function getIp()
    {
        return $this->ip;
    }

    /**
     * Set a single parameter
     *
     * @param string $key
     * @param string $value
     * @return \ZendService\ReCaptcha\ReCaptcha
     */
    public function setParam($key, $value)
    {
        $this->params[$key] = $value;

        return $this;
    }

    /**
     * Set parameters
     *
     * @param  array|Traversable $params
     * @return \ZendService\ReCaptcha\ReCaptcha
     * @throws \ZendService\ReCaptcha\Exception
     */
    public function setParams($params)
    {
        if ($params instanceof Traversable) {
            $params = ArrayUtils::iteratorToArray($params);
        }

        if (!is_array($params)) {
            throw new Exception(sprintf(
                '%s expects an array or Traversable set of params; received "%s"',
                __METHOD__,
                (is_object($params) ? get_class($params) : gettype($params))
            ));
        }

        foreach ($params as $k => $v) {
            $this->setParam($k, $v);
        }

        return $this;
    }

    /**
     * Get the parameter array
     *
     * @return array
     */
    public function getParams()
    {
        return $this->params;
    }

    /**
     * Get a single parameter
     *
     * @param string $key
     * @return mixed
     */
    public function getParam($key)
    {
        return $this->params[$key];
    }

    /**
     * Set a single option
     *
     * @param string $key
     * @param string $value
     * @return \ZendService\ReCaptcha\ReCaptcha
     */
    public function setOption($key, $value)
    {
        $this->options[$key] = $value;

        return $this;
    }

    /**
     * Set options
     *
     * @param  array|Traversable $options
     * @return \ZendService\ReCaptcha\ReCaptcha
     * @throws \ZendService\ReCaptcha\Exception
     */
    public function setOptions($options)
    {
        if ($options instanceof Traversable) {
            $options = ArrayUtils::iteratorToArray($options);
        }

        if (is_array($options)) {
            foreach ($options as $k => $v) {
                $this->setOption($k, $v);
            }
        } else {
            throw new Exception(
                'Expected array or Traversable object'
            );
        }

        return $this;
    }

    /**
     * Get the options array
     *
     * @return array
     */
    public function getOptions()
    {
        return $this->options;
    }

    /**
     * Get a single option
     *
     * @param string $key
     * @return mixed
     */
    public function getOption($key)
    {
        return $this->options[$key];
    }

    /**
     * Get the public key
     *
     * @return string
     */
    public function getSiteKey()
    {
        return $this->siteKey;
    }

    /**
     * Set the public key
     *
     * @param string $siteKey
     * @return \ZendService\ReCaptcha\ReCaptcha
     */
    public function setSiteKey($siteKey)
    {
        $this->siteKey = $siteKey;

        return $this;
    }

    /**
     * Get the private key
     *
     * @return string
     */
    public function getSecretKey()
    {
        return $this->secretKey;
    }

    /**
     * Set the private key
     *
     * @param string $secretKey
     * @return \ZendService\ReCaptcha\ReCaptcha
     */
    public function setSecretKey($secretKey)
    {
        $this->secretKey = $secretKey;

        return $this;
    }

    /**
     * Get the HTML code for the captcha
     *
     * This method uses the public key to fetch a recaptcha form.
     *
     * @return string
     * @throws \ZendService\ReCaptcha\Exception
     */
    public function getHtml()
    {
        if ($this->siteKey === null) {
            throw new Exception('Missing site key');
        }

        $host = self::API_SERVER;

        if ((bool) $this->params['ssl'] === true) {
            $host = self::API_SECURE_SERVER;
        }

        $jsSrcOptions = '?render=' . $this->options['render']
                      . '&hl=' . $this->options['lang'];
        if ($this->options['render'] == 'explicit') {
            $jsSrcOptions .= '&onload=' . $this->options['callback'];
        }

        return <<options['theme']}" data-type="{$this->options['type']}">

                siteKey}>" frameborder="0" scrolling="no" style="width: 302px; height:352px; border-style: none;">

                <textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 80px; border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;" value=""></textarea>

HTML;
    }

    /**
     * Post a solution to the verify server
     *
     * @param string $challengeField
     * @param string $responseField
     * @return \Zend\Http\Response
     * @throws \ZendService\ReCaptcha\Exception
     */
    protected function post($responseField)
    {
        if ($this->secretKey === null) {
            throw new Exception('Missing secret key');
        }

        if (empty($responseField)) {
            throw new Exception('Missing response field');
        }

        /* Fetch an instance of the http client */
        $httpClient = new HttpClient(
            self::VERIFY_SERVER,
            array(
                'adapter'   => 'Zend\Http\Client\Adapter\Socket',
                'sslcapath' => '/etc/ssl/certs'
            )
        );

        $postParams = array('secret' => $this->secretKey,
                            'response'   => $responseField);

        if ($this->ip !== null) {
            $postParams['remoteip'] = $this->ip;
        }

        $httpClient->setParameterPost($postParams);
        $httpClient->setMethod(HttpRequest::METHOD_POST);
        $httpClient->setEncType($httpClient::ENC_URLENCODED);

        return $httpClient->send();
    }

    /**
     * Verify the user input
     *
     * This method calls up the post method and returns a
     * Zend_Service_ReCaptcha_Response object.
     *
     * @param string $challengeField
     * @param string $responseField
     * @return \ZendService\ReCaptcha\Response
     */
    public function verify($responseField)
    {
        $response = $this->post($responseField);
        return new Response(null, null, $response);
    }
}


text:
<?php
defined('_JEXEC') or die('Restricted access');

$config = JFactory::getConfig();
$juser  = JFactory::getUser();

$this->template = 'sciu';

$lang = JFactory::getLanguage();
$lang->load('tpl_' . $this->template);

$browser = new \Hubzero\Browser\Detector();
$b = $browser->name();
$v = $browser->major();
?>
<!DOCTYPE html>

 <html dir="<?php echo $this->direction; ?>" lang="<?php echo  $this->language; ?>" class="<?php echo $b . ' ' . $b . $v; ?>">

		<meta http-equiv="content-type" content="text/html; charset=utf-8" />

		<title><?php echo $config->getValue('config.sitename') . ' - ' . (in_array($this->error->getCode(), array(404, 403, 500)) ? $this->error->getCode() : 500); ?></title>

		<link rel="stylesheet" type="text/css" media="screen" href="<?php echo \Hubzero\Document\Assets::getSystemStylesheet(array('fontcons', 'reset', 'columns', 'notifications')); /* reset MUST come before all others except fontcons */ ?>" />
		<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/main.css" />
		<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/error.css" />
<?php if (JDEBUG) { ?>
		<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseurl; ?>/media/cms/css/debug.css" />
<?php } ?>
<?php if ($config->getValue('config.application_env', 'production') != 'production') { ?>
		<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseurl; ?>/modules/mod_application_env/mod_application_env.css" />
<?php } ?>
		<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/html/mod_reportproblems/mod_reportproblems.css" />
		<link rel="stylesheet" type="text/css" media="print" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/print.css" />

<?php if (JPluginHelper::isEnabled('system', 'jquery')) { ?>

<?php } else { ?>

<?php } ?>

		<?php \Hubzero\Module\Helper::displayModules('notices'); ?>
		<?php \Hubzero\Module\Helper::displayModules('helppane'); ?>

						<a href="<?php echo empty($this->baseurl) ? "/" : $this->baseurl; ?>" title="<?php echo $config->getValue('config.sitename'); ?>">
							<?php echo $config->getValue('config.sitename'); ?>

					<?php if (!$juser->get('guest')) {
							$profile = \Hubzero\User\Profile::getInstance($juser->get('id'));
					?>
						<ul class="menu <?php echo (!$juser->get('guest')) ? 'loggedin' : 'loggedout'; ?>">

									<img src="<?php echo $profile->getPicture(); ?>" alt="<?php echo $juser->get('name'); ?>" width="30" height="30" />
									<a class="account-details" href="<?php echo JRoute::_('index.php?option=com_members&id=' . $juser->get('id')); ?>">
										<?php echo stripslashes($juser->get('name')); ?>
										<?php echo $juser->get('email'); ?>

										<a href="<?php echo JRoute::_('index.php?option=com_members&id=' . $juser->get('id') . '&active=dashboard'); ?>"><?php echo JText::_('TPL_HUBBASIC_ACCOUNT_DASHBOARD'); ?>

										<a href="<?php echo JRoute::_('index.php?option=com_members&id=' . $juser->get('id') . '&active=profile'); ?>"><?php echo JText::_('TPL_HUBBASIC_ACCOUNT_PROFILE'); ?>

										<a href="<?php echo JRoute::_('index.php?option=com_members&id=' . $juser->get('id') . '&active=messages'); ?>"><?php echo JText::_('TPL_HUBBASIC_ACCOUNT_MESSAGES'); ?>

										<a href="<?php echo JRoute::_('index.php?option=com_logout'); ?>"><?php echo JText::_('TPL_HUBBASIC_LOGOUT'); ?>

					<?php } else { ?>
						<ul class="menu <?php echo (!$juser->get('guest')) ? 'loggedin' : 'loggedout'; ?>">

								<?php $login_route = (version_compare(JVERSION, '2.5', 'ge')) ? 'index.php?option=com_users&view=login' : 'index.php?option=com_user&view=login'; ?>
								<a href="<?php echo JRoute::_($login_route); ?>" title="<?php echo JText::_('TPL_HUBBASIC_LOGIN'); ?>"><?php echo JText::_('TPL_HUBBASIC_LOGIN'); ?>

								<a href="<?php echo JRoute::_('index.php?option=com_register'); ?>" title="<?php echo JText::_('TPL_HUBBASIC_SIGN_UP'); ?>"><?php echo JText::_('TPL_HUBBASIC_REGISTER'); ?>

						<?php /* <jdoc:include type="modules" name="account" /> */ ?>
					<?php } ?>

						<?php \Hubzero\Module\Helper::displayModules('user3'); ?>

				<?php if (\Hubzero\Module\Helper::countModules('helppane')) : ?>

						<a href="<?php echo JRoute::_('index.php?option=com_support'); ?>" title="<?php echo JText::_('TPL_HUBBASIC_NEED_HELP'); ?>">
							<?php echo JText::_('TPL_HUBBASIC_HELP'); ?>

				<?php endif; ?>
					<?php \Hubzero\Module\Helper::displayModules('search'); ?>

						<?php echo JText::_('TPL_HUBBASIC_TAGLINE'); ?>

			<div id="content" class="<?php echo JRequest::getCmd('option', ''); ?> <?php echo 'code' . $this->error->getCode(); ?>" role="main">

										<?php echo (in_array($this->error->getCode(), array(404, 403, 500))) ? $this->error->getCode() : 500; ?>

									<?php
									switch ($this->error->getCode())
									{
										case 404: ?>

<?php echo JText::_('RE: Your Missing Page'); ?>

<?php echo JText::_("We're sorry to report that we couldn't find your page. Search parties were unable to recover any remains. It is our current belief that Hubzilla ate it."); ?>

<?php echo JText::_('In a difficult time like this we recommend seeking guidance from our Home Page or by searching for a new page. We understand that a new page may never fill the void left by your missing page but hope that you can find some consolation in the text of another.'); ?>

<?php echo JText::_('With our deepest sympathies and condolences,'); ?>

—Cpt. Mura, Science Special Search Party (SSSP)

										<?php
										break;
										case 403: ?>

<?php echo JText::_('Access Denied!'); ?>

<?php echo JText::_('It appears you do not have access to this page. You may be detained for further questioning.'); ?>

<?php echo JText::_('Please bear with us during this grueling process of rebuilding in the wake of Hubzilla\'s attack.'); ?>

<?php echo JText::_('Please stay calm,'); ?>

—Cpt. Showa, Security

										<?php
										break;
										case 500:
										default: ?>

<?php echo JText::_('Will Hubzilla\'s reign of terror never cease?!'); ?>

<?php echo JText::_('It seems Hubzilla stomped on this page. Our disaster recovery teams are scouring the wreckage for survivors and our clean-up crews will take over shortly thereafter.'); ?>

<?php echo JText::_('Please bear with us during this grueling process of rebuilding in the wake of Hubzilla\'s attack.'); ?>

<?php echo JText::_('With our sincere apologies,'); ?>

—Cpt. Hayata, Disaster Recovery Team (DRT)

										<?php
										break;
									} ?>

					<?php if ($this->debug) { ?>

							<?php echo $this->error->getMessage(); ?>

					<?php } ?>

				<?php if ($this->debug) { ?>

						<?php echo $this->renderBacktrace(); ?>

				<?php } ?>

				<?php \Hubzero\Module\Helper::displayModules('footer'); ?>

		<?php \Hubzero\Module\Helper::displayModules('endpage'); ?>

redpajama_set_name: RedPajamaGithub


text:
package api

type PKI struct {
	KeyPairs []KeyPairSpec `yaml:"keypairs,omitempty"`
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<streamConfiguration type="csv">
    <file>sms_data.csv</file>
    <streamID>org.wso2.iot.android.sms:1.0.0</streamID>
    <separateChar>,</separateChar>
    <delayBetweenEventsInMilies>1000</delayBetweenEventsInMilies>
</streamConfiguration>


text:
// Copyright (c) 2016-2020 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_PFR_DETAIL_FIELDS_COUNT_HPP
#define BOOST_PFR_DETAIL_FIELDS_COUNT_HPP
#pragma once

#include <boost/pfr/detail/config.hpp>
#include <boost/pfr/detail/make_integer_sequence.hpp>
#include <boost/pfr/detail/size_t_.hpp>
#include <boost/pfr/detail/unsafe_declval.hpp>

#include <climits>      // CHAR_BIT
#include <type_traits>
#include <utility>      // metaprogramming stuff

#ifdef __clang__
#   pragma clang diagnostic push
#   pragma clang diagnostic ignored "-Wmissing-braces"
#   pragma clang diagnostic ignored "-Wundefined-inline"
#   pragma clang diagnostic ignored "-Wundefined-internal"
#   pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif

namespace boost { namespace pfr { namespace detail {

///////////////////// Structure that can be converted to reference to anything
struct ubiq_lref_constructor {
    std::size_t ignore;
    template <class Type> constexpr operator Type&() const && noexcept {  // Allows initialization of reference fields (T& and const T&)
        return detail::unsafe_declval<Type&>();
    };
};

///////////////////// Structure that can be converted to rvalue reference to anything
struct ubiq_rref_constructor {
    std::size_t ignore;
    template <class Type> /*constexpr*/ operator Type&&() const && noexcept {  // Allows initialization of rvalue reference fields and move-only types
        return detail::unsafe_declval<Type&&>();
    };
};

#ifndef __cpp_lib_is_aggregate
///////////////////// Hand-made is_aggregate_initializable_n<T> trait

// Structure that can be converted to reference to anything except reference to T
template <class T, bool IsCopyConstructible>
struct ubiq_constructor_except {
    std::size_t ignore;
    template <class Type> constexpr operator std::enable_if_t<!std::is_same<T, Type>::value, Type&> () const noexcept; // Undefined
};

template <class T>
struct ubiq_constructor_except<T, false> {
    std::size_t ignore;
    template <class Type> constexpr operator std::enable_if_t<!std::is_same<T, Type>::value, Type&&> () const noexcept; // Undefined
};

// `std::is_constructible<T, ubiq_constructor_except<T>>` consumes a lot of time, so we made a separate lazy trait for it.
template <std::size_t N, class T> struct is_single_field_and_aggregate_initializable: std::false_type {};
template <class T> struct is_single_field_and_aggregate_initializable<1, T>: std::integral_constant<
    bool, !std::is_constructible<T, ubiq_constructor_except<T, std::is_copy_constructible<T>::value>>::value
> {};

// Hand-made is_aggregate<T> trait:
// Before C++20 aggregates could be constructed from `decltype(ubiq_?ref_constructor{I})...` but type traits report that
// there's no constructor from `decltype(ubiq_?ref_constructor{I})...`
// Special case for N == 1: `std::is_constructible<T, ubiq_?ref_constructor>` returns true if N == 1 and T is copy/move constructible.
template <class T, std::size_t N>
struct is_aggregate_initializable_n {
    template <std::size_t ...I>
    static constexpr bool is_not_constructible_n(std::index_sequence<I...>) noexcept {
        return (!std::is_constructible<T, decltype(ubiq_lref_constructor{I})...>::value && !std::is_constructible<T, decltype(ubiq_rref_constructor{I})...>::value)
            || is_single_field_and_aggregate_initializable<N, T>::value
        ;
    }

    static constexpr bool value =
           std::is_empty<T>::value
        || std::is_array<T>::value
        || std::is_fundamental<T>::value
        || is_not_constructible_n(detail::make_index_sequence<N>{})
    ;
};

#endif // #ifndef __cpp_lib_is_aggregate

///////////////////// Helper for SFINAE on fields count
template <class T, std::size_t... I, class /*Enable*/ = typename std::enable_if<std::is_copy_constructible<T>::value>::type>
constexpr auto enable_if_constructible_helper(std::index_sequence<I...>) noexcept
    -> typename std::add_pointer<decltype(T{ ubiq_lref_constructor{I}... })>::type;

template <class T, std::size_t... I, class /*Enable*/ = typename std::enable_if<!std::is_copy_constructible<T>::value>::type>
constexpr auto enable_if_constructible_helper(std::index_sequence<I...>) noexcept
    -> typename std::add_pointer<decltype(T{ ubiq_rref_constructor{I}... })>::type;

template <class T, std::size_t N, class /*Enable*/ = decltype( enable_if_constructible_helper<T>(detail::make_index_sequence<N>()) ) >
using enable_if_constructible_helper_t = std::size_t;

///////////////////// Helpers for range size detection
template <std::size_t Begin, std::size_t Last>
using is_one_element_range = std::integral_constant<bool, Begin == Last>;

using multi_element_range = std::false_type;
using one_element_range = std::true_type;

///////////////////// Non greedy fields count search. Templates instantiation depth is log(sizeof(T)), templates instantiation count is log(sizeof(T)).
template <class T, std::size_t Begin, std::size_t Middle>
constexpr std::size_t detect_fields_count(detail::one_element_range, long) noexcept {
    static_assert(
        Begin == Middle,
        "====================> Boost.PFR: Internal logic error."
    );
    return Begin;
}

template <class T, std::size_t Begin, std::size_t Middle>
constexpr std::size_t detect_fields_count(detail::multi_element_range, int) noexcept;

template <class T, std::size_t Begin, std::size_t Middle>
constexpr auto detect_fields_count(detail::multi_element_range, long) noexcept
    -> detail::enable_if_constructible_helper_t<T, Middle>
{
    constexpr std::size_t next_v = Middle + (Middle - Begin + 1) / 2;
    return detail::detect_fields_count<T, Middle, next_v>(detail::is_one_element_range<Middle, next_v>{}, 1L);
}

template <class T, std::size_t Begin, std::size_t Middle>
constexpr std::size_t detect_fields_count(detail::multi_element_range, int) noexcept {
    constexpr std::size_t next_v = Begin + (Middle - Begin) / 2;
    return detail::detect_fields_count<T, Begin, next_v>(detail::is_one_element_range<Begin, next_v>{}, 1L);
}

///////////////////// Greedy search. Templates instantiation depth is log(sizeof(T)), templates instantiation count is log(sizeof(T))*T in worst case.
template <class T, std::size_t N>
constexpr auto detect_fields_count_greedy_remember(long) noexcept
    -> detail::enable_if_constructible_helper_t<T, N>
{
    return N;
}

template <class T, std::size_t N>
constexpr std::size_t detect_fields_count_greedy_remember(int) noexcept {
    return 0;
}

template <class T, std::size_t Begin, std::size_t Last>
constexpr std::size_t detect_fields_count_greedy(detail::one_element_range) noexcept {
    static_assert(
        Begin == Last,
        "====================> Boost.PFR: Internal logic error."
    );
    return detail::detect_fields_count_greedy_remember<T, Begin>(1L);
}

template <class T, std::size_t Begin, std::size_t Last>
constexpr std::size_t detect_fields_count_greedy(detail::multi_element_range) noexcept {
    constexpr std::size_t middle = Begin + (Last - Begin) / 2;
    constexpr std::size_t fields_count_big_range = detail::detect_fields_count_greedy<T, middle + 1, Last>(
        detail::is_one_element_range<middle + 1, Last>{}
    );

    constexpr std::size_t small_range_begin = (fields_count_big_range ? 0 : Begin);
    constexpr std::size_t small_range_last = (fields_count_big_range ? 0 : middle);
    constexpr std::size_t fields_count_small_range = detail::detect_fields_count_greedy<T, small_range_begin, small_range_last>(
        detail::is_one_element_range<small_range_begin, small_range_last>{}
    );
    return fields_count_big_range ? fields_count_big_range : fields_count_small_range;
}

///////////////////// Choosing between array size, greedy and non greedy search.
template <class T, std::size_t N>
constexpr auto detect_fields_count_dispatch(size_t_<N>, long, long) noexcept
    -> typename std::enable_if<std::is_array<T>::value, std::size_t>::type
{
    return sizeof(T) / sizeof(typename std::remove_all_extents<T>::type);
}

template <class T, std::size_t N>
constexpr auto detect_fields_count_dispatch(size_t_<N>, long, int) noexcept
    -> decltype(sizeof(T{}))
{
    constexpr std::size_t middle = N / 2 + 1;
    return detail::detect_fields_count<T, 0, middle>(detail::multi_element_range{}, 1L);
}

template <class T, std::size_t N>
constexpr std::size_t detect_fields_count_dispatch(size_t_<N>, int, int) noexcept {
    // T is not default aggregate initialzable. It means that at least one of the members is not default constructible,
    // so we have to check all the aggregate initializations for T up to N parameters and return the bigest succeeded
    // (we can not use binary search for detecting fields count).
    return detail::detect_fields_count_greedy<T, 0, N>(detail::multi_element_range{});
}

///////////////////// Returns fields count
template <class T>
constexpr std::size_t fields_count() noexcept {
    using type = std::remove_cv_t<T>;

    static_assert(
        !std::is_reference<type>::value,
        "====================> Boost.PFR: Attempt to get fields count on a reference. This is not allowed because that could hide an issue and different library users expect different behavior in that case."
    );

    static_assert(
        std::is_copy_constructible<std::remove_all_extents_t<type>>::value || (
            std::is_move_constructible<std::remove_all_extents_t<type>>::value
            && std::is_move_assignable<std::remove_all_extents_t<type>>::value
        ),
        "====================> Boost.PFR: Type and each field in the type must be copy constructible (or move constructible and move assignable)."
    );

    static_assert(
        !std::is_polymorphic<type>::value,
        "====================> Boost.PFR: Type must have no virtual function, because otherwise it is not aggregate initializable."
    );

#ifdef __cpp_lib_is_aggregate
    static_assert(
        std::is_aggregate<type>::value             // Does not return `true` for built-in types.
        || std::is_scalar<type>::value,
        "====================> Boost.PFR: Type must be aggregate initializable."
    );
#endif

// Can't use the following. See the non_std_layout.cpp test.
//#if !BOOST_PFR_USE_CPP17
//    static_assert(
//        std::is_standard_layout<type>::value,   // Does not return `true` for structs that have non standard layout members.
//        "Type must be aggregate initializable."
//    );
//#endif

    constexpr std::size_t max_fields_count = (sizeof(type) * CHAR_BIT); // We multiply by CHAR_BIT because the type may have bitfields in T
    constexpr std::size_t result = detail::detect_fields_count_dispatch<type>(size_t_<max_fields_count>{}, 1L, 1L);

#ifndef __cpp_lib_is_aggregate
    static_assert(
        is_aggregate_initializable_n<type, result>::value,
        "====================> Boost.PFR: Types with user specified constructors (non-aggregate initializable types) are not supported."
    );
#endif

    static_assert(
        result != 0 || std::is_empty<type>::value || std::is_fundamental<type>::value || std::is_reference<type>::value,
        "====================> Boost.PFR: If there's no other failed static asserts then something went wrong. Please report this issue to the github along with the structure you're reflecting."
    );

    return result;
}

}}} // namespace boost::pfr::detail

#ifdef __clang__
#   pragma clang diagnostic pop
#endif

#endif // BOOST_PFR_DETAIL_FIELDS_COUNT_HPP


text:
/*!	@file	ArithmeticOperatorExpansion.h
	@author Anton Khayrudinov
	@email	a.khayrudinov@gmail.com
*/

#ifndef _ARITHMETIC_OPERATOR_EXPANSION_
#define _ARITHMETIC_OPERATOR_EXPANSION_

#include "Reprise/Expressions.h"

namespace OPS
{

namespace Transforms
{

namespace Scalar
{

void expandArithmeticOperators(OPS::Reprise::StatementBase&);

/*! @brief Arithmetic Operators Transformations

	This is the common note to all transformations in this group.

	Typical transformation accepts an expression and introduces
	subroutines calls to algorithms that operate on bits. For instance,
	the plus "+" operator can be replaced with a call in this way:

		a + b

	is replaced with

		f(a, b)

	where the "f" routine extracts bits of its arguments, calls a
	specific algorithm that adds two bit arrays and then collects
	the resulting bit array into a value and returns it.

	Any transformation is applied if the following conditions are met:

		• Operands are of known integer types. "Known types" are types
			that're recongnised by some internal routines of these
			transformations.

		• Subroutines that implement particular algorithms are defined: e.g.
			if "+" is transformed, then the "add" subroutine must be defined
			somewhere in the program (see below).

		• "get_bits" and "set_bits" subroutines must be defined: they're needed
			to get access to variables' bits (see below).

	Signature of a subroutine that implements the "+" operator:

		void add(
			bool* r_bits, int r_n,	// the result of addition a + b
			bool* a_bits, int a_n,	// bits of the first argument
			bool* b_bits, int b_n);	// bits of the second argument

	Signature of the "get_bits" subroutine:

		void get_bits(
			bool* bits,			// bits of the variable
			const void* var,	// a pointer to the variable
			int size);			// size in bits of the variable

	Signature of the "set_bits" subroutine:

		void set_bits(
			const bool* bits,	// bits of the variable
			void* var,			// a pointer to the variable
			int size);			// size in bits of the variable

	Normally, all these service subroutines are defined in
	a library written specially for this transformation. This means
	that you don't have to bother about these subroutines, but you have
	to known where to get the sources with them and to include
	suitable headers that conatins all these set_bits/get_bits stuff.
*/

namespace ArithmeticOperatorExpansion
{

namespace Utils
{

enum TextId
{
	// service routines

	SR_GET_BITS,			// get_bits routine
	SR_SET_BITS,			// set_bits routine
	SR_CREATE,				// sr_create routine
	SR_INT_STRUCT,			// sr_int structure
	SR_BIT,					// "bit" type

	// arithmetic algorithms

	AA_CONV,				// converts an integer to another integer of different size

	AA_BIT_NOT,
	AA_BIT_AND,
	AA_BIT_OR,
	AA_BIT_XOR,

	AA_LOG_NOT,
	AA_LOG_AND,
	AA_LOG_OR,

	AA_SHL,
	AA_SHR,

	AA_ADD,
	AA_SUB,
	AA_NEG,
	AA_MUL,
	AA_DIV,
	AA_MOD,
	AA_INC,					// ++
	AA_DEC,					// --

	AA_EQ,					// ==
	AA_NOT_EQ,				// !=
	AA_GREATER,				// >
	AA_LESS,				// <
	AA_GREATER_EQ,			// >=
	AA_LESS_EQ,				// <=
};

const std::string& getText(TextId);
std::string intToStr(int a);

} // namespace Utils

/*!	Replaces integer multiplication with the shift operation.
	Example:

		(a + b)*64		// before
		(a + b) << 6	// after

	Replaces integer division with the shift operation:
	Example:

		(a + b)/64		// before
		(a + b) >> 6	// after

	• the expression has the form A*B or A/B
	• the first argument has an integer type
	• the last argument is a StrictLiteralExpression (e.g. 4, 8)
	• the last argument is a power of 2

	@see Utils
*/

namespace MulDivToShift
{

using OPS::Reprise::BasicCallExpression;

bool canApply(const BasicCallExpression&);
void apply(BasicCallExpression&);

} // namespace MulDivToShift

/*!	Replaces the integer divison on modulo with the bitwise "and" operation.
	Example:

		(a + b) % 8

	is replaced with

		(a + b) & 7

	• the expression has the form A % B
	• the first argument has an integer type
	• the last argument is a StrictLiteralExpression (e.g. 4, 8)
	• the last argument is a power of 2

	@see Utils
*/

namespace ModToAnd
{

using OPS::Reprise::BasicCallExpression;

bool canApply(const BasicCallExpression&);
void apply(BasicCallExpression&);

} // namespace ModToAnd

/*!	Replaces an arithmetic operation with a subroutine call
	that implements this operator. Example:

		~a + b

	assuming that a is int32 and b is uint16, this expression
	is replaced with

		i32_add_i32_u16(i32_not_i32(a), b)

	where the two subroutines are created automatically.

	@see Utils
*/

namespace AopToCall
{

using OPS::Reprise::BasicCallExpression;

bool canApply(const BasicCallExpression&);
void apply(BasicCallExpression&);

} // namespace AopToCall

/*!	@brief Subroutine Call Arguments Coercion

	Adds explicit types coercion to arguments of a subroutine call
	if the arguments' types mismatch types of parameters in the subroutine
	declaration. Example:

		int shift(int a, byte bits);

		<...>

		shift(a, 3);

	assuming that a has "int" type, the transfomation will be as following:

		shift(a, u8_conv_i32(3));

	@see Utils
*/

namespace SCAC
{

using OPS::Reprise::SubroutineCallExpression;

bool canApply(const SubroutineCallExpression&);
void apply(SubroutineCallExpression&);

} // namespace SCAC

/*!	Adjusts assignment of one integer value to a variable of
	another integer type. Example:

		int a;
		byte b;

		a = b

	will be replaced with

		int a;
		byte b;

		a = i32_conv_u8(b);

	@see Utils
*/

namespace AssignmentCoercion
{

using OPS::Reprise::BasicCallExpression;

bool canApply(const BasicCallExpression&);
void apply(BasicCallExpression&);

} // namespace AssignmentCoercion

/*!	Replaces expressions like (a + 1) with a call to an increment algorithm.
	Example:

		(a - b) + 1;
		(c*d - e) - 1;

	will be replaced with

		inc(a - b);
		dec(c*d - e);

	@see Utils
*/

namespace AddToInc
{

using OPS::Reprise::BasicCallExpression;

bool canApply(const BasicCallExpression&);
void apply(BasicCallExpression&);

} // namespace AddToInc

} // namespace ArithmeticOperatorExpansion

} // namespace Scalar

} // namespace Transforms

} // namespace OPS

#endif // _ARITHMETIC_OPERATOR_EXPANSION_


text:
#ifndef _HEATMAP_COLORSCHEMES_BUGN_H
#define _HEATMAP_COLORSCHEMES_BUGN_H

#ifdef __cplusplus
extern "C" {
#endif

/* This one has only N discrete colors. */
extern const heatmap_colorscheme_t* heatmap_cs_BuGn_discrete;
/* This is a very soft gradient along abovementioned discrete colors. */
extern const heatmap_colorscheme_t* heatmap_cs_BuGn_soft;
/* This is a mix of the above two. Makes for a pretty result in many cases. */
extern const heatmap_colorscheme_t* heatmap_cs_BuGn_mixed;
/* An exponential version of the default mix of the above two. */
/* Use this if your maximum is very "spiked". */
extern const heatmap_colorscheme_t* heatmap_cs_BuGn_mixed_exp;

#ifdef __cplusplus
}
#endif

#endif /* _HEATMAP_COLORSCHEMES_BUGN_H */


text:
<?php
App::uses('BasicAppController', 'Basic.Controller');
//App::import('Plugin', 'Basic/Controller/BasicAppController');
/**
 * NOTE: thinking what this class is.
 * Do not inherit this class until I know it.
 */
class BasicAppController2 extends BasicAppController
{
    /**
     * Merges tutorial $components' array and other $components' array
     *
     * @param array $components
     */
    protected function onGetComponents(array &$components = array()){
        self::mergeArrayAny($components, array(
            'Session',
            'Auth' => array(
                'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
                'logoutRedirect' => array(
                    'controller' => 'pages',
                    'action' => 'display',
                    'home'
                ),
                'authenticate' => array(
                    'Form' => array(
                        'passwordHasher' => 'Blowfish'
                    )
                ),
                'authorize' => array('Controller') // Added
            )
        ));
        parent::onGetComponents($components);
    }

    public function isAuthorized($user) {
        if (isset($user['role']) && $user['role'] === 'admin') {
            return true;
        }

        return false;
    }

    public function beforeFilter() {
        $this->Auth->allow('index', 'view');
        parent::beforeFilter();
    }
}


text:
package com.jsoniter.output;

import com.jsoniter.any.Any;
import com.jsoniter.spi.Encoder;
import com.jsoniter.spi.TypeLiteral;

import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.Type;

class ReflectionArrayEncoder implements Encoder.ReflectionEncoder {

    private final TypeLiteral compTypeLiteral;

    public ReflectionArrayEncoder(Class clazz, Type[] typeArgs) {
        compTypeLiteral = TypeLiteral.create(clazz.getComponentType());
    }

    @Override
    public void encode(Object obj, JsonStream stream) throws IOException {
        if (null == obj) {
            stream.writeNull();
            return;
        }
        int len = Array.getLength(obj);
        if (len == 0) {
            stream.writeEmptyArray();
            return;
        }
        stream.writeArrayStart();
        stream.writeIndention();
        stream.writeVal(compTypeLiteral, Array.get(obj, 0));
        for (int i = 1; i < len; i++) {
            stream.writeMore();
            stream.writeVal(compTypeLiteral, Array.get(obj, i));
        }
        stream.writeArrayEnd();
    }

    @Override
    public Any wrap(Object obj) {
        return Any.wrapArray(obj);
    }
}


text:
mysqler CHANGELOG
===================

This file is used to list changes made in each version of the wix-cloud cookbook.

1.0.0
-----
- [tatyanak] - First public version

1.0.7
-----
- [tatyanak] - Add support for different networks for each application with fallback to default

1.0.11
-----
- [tatyanak] - Add support for systemd config with the recipes for systemd.

- - -
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.

The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.


text:
<?php

require_once ('pworks/message/IDictHelper.iface.php');
require_once ('pworks/message/LangPackConstant.class.php');

class SqliteDictHelper implements IDictHelper {

	const DSN = 'sqlite:';

	const DB_INIT_SCRIPTS = <<<SQL
CREATE TABLE IF NOT EXISTS lang_pack (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	system_name VARCHAR(50) DEFAULT 'default',
	module_name VARCHAR(50) DEFAULT 'default',
	lang_code VARCHAR(15) DEFAULT 'EN',
	label TEXT NOT NULL,
	content TEXT,
	lastupdate DATETIME DEFAULT CURRENT_TIMESTAMP,
	UNIQUE(system_name, lang_code, module_name, label)
)
SQL;

	private $depend_extension = array ('pdo_sqlite', 'sqlite3', 'PDO' );

	private $connection;

	public function init($url, $options) {
		$this->connection = new PDO ( self::DSN . $url );
		$this->connection->exec ( self::DB_INIT_SCRIPTS );

	}

	public function checkExt() {
		foreach ( $this->depend_extension as $ext ) {
			if (! extension_loaded ( $ext )) {
				//TODO add log information here...
				return false;
			}
		}
		return true;
	}

	public function getLabels($module = null, $system = null, $language = null) {
		return $this->_query ( null, null, null, $module, $system, $language );
	}

	public function getLabel($label, $module, $system, $language) {
		return $this->_query ( null, $label, null, $module, $system, $language );
	}

	public function setLabel($label, $content, $module, $system, $language) {
		$labels = $this->_query ( null, $label, null, $module, $system, $language );

		if (count ( $labels ) > 0) {
			foreach ( $labels as $row ) {

				$this->_update ( $row ['id'], $content );
			}

		} else {

			$this->_insert ( $label, $content, $module, $system, $language );
		}
	}

	public function search($label_pattern, $content_pattern, $module, $system, $language) {
		$label_pattern = is_null ( $label_pattern ) ? null : $label_pattern . '%';
		$content_pattern = is_null ( $content_pattern ) ? null : $content_pattern . '%';
		return $this->_query ( null, $label_pattern, $content_pattern, $module, $system, $language );
	}

	public function remove($id) {
		$bind_array = array ();
		$bind_array [':id'] = $id;
		$sql_statement = 'DELETE FROM lang_pack WHERE id = :id';
		$statement = $this->connection->prepare ( $sql_statement );
		$statement->execute ( $bind_array );
		return $statement->rowCount ();
	}

	public function find($id) {
		return $this->_query ( $id, null, null, null, null, null );
	}

	public function cloneLangPack($from_lang, $to_lang, $system = null, $module = null, $write_mode = LangPackConstant::MODE_WRITE_OVERRIDE) {
		if (is_null ( $from_lang )) {
			throw new Exception ( 'Please specify source language!' );

		//TODO add log information here...
		}

		if (is_null ( $to_lang )) {
			throw new Exception ( 'Please specify destination language!' );

		//TODO add log information here...
		}

		if ($to_lang == $from_lang) {
			throw new Exception ( 'The source language is same to destination language, operation is cancelled!' );

		//TODO add log information here...
		}

		if (LangPackConstant::MODE_WRITE_OVERRIDE == $write_mode) {
			$bind_array = array ();
			$bind_array [':lang'] = $to_lang;
			$sql_statement = 'DELETE FROM lang_pack WHERE lang_code = :lang';
			$statement = $this->connection->prepare ( $sql_statement );
			$statement->execute ( $bind_array );

		//TODO add log information here...
		}

		$bind_array = array ();
		$sql_statement = 'INSERT INTO lang_pack(label, content, module_name, system_name, lang_code)';
		$sql_statement .= ' SELECT label, content, module_name, system_name, :to_lang FROM lang_pack ';
		$bind_array [':to_lang'] = $to_lang;
		$sql_statement .= ' WHERE lang_code = :from_lang ';
		$bind_array [':from_lang'] = $from_lang;

		if (! is_null ( $system )) {
			$sql_statement .= ' AND system_name = :system ';
			$bind_array [':system'] = $system;
		}

		if (! is_null ( $module )) {
			$sql_statement .= ' AND module_name = :module ';
			$bind_array [':module'] = $module;
		}
		$statement = $this->connection->prepare ( $sql_statement );
		$statement->execute ( $bind_array );
		return $statement->rowCount ();
	}

	public function exportXml($system, $language) {
		$labels = $this->_query ( null, null, null, null, $system, $language, 'system_name, lang_code, module_name' );
		$xml = '';
		$system = '';
		$systemCloseTag = '';
		$lang = '';
		$langCloseTag = '';
		$module = '';
		$moduleCloseTag = '';
		foreach ( $labels as $row ) {
			if ($system != $row ['system_name']) {
				//close previous system node
				$xml .= $systemCloseTag;

				//start new system node
				$system = $row ['system_name'];
				$xml .= '<!-- SYSTEM ' . $system . ' START --><system name="' . $system . '">';
				$systemCloseTag = '</system>' . '<!-- SYSTEM ' . $system . ' END -->';
			}

			if ($lang != $row ['lang_name']) {
				//close previous lang node
				$xml .= $langCloseTag;

				//start new lang node
				$lang = $row ['lang_code'];
				$xml .= '<!-- LANGUAGE ' . $lang . ' START --><lang code="' . $lang . '">';
				$langCloseTag = '</lang>' . '<!-- LANGUAGE ' . $lang . ' END -->';
			}

			if ($module != $row ['module_name']) {
				//close previous module node
				$xml .= $moduleCloseTag;

				//start new module node
				$module = $row ['module_name'];
				$xml .= '<!-- MODULE ' . $module . ' START --><module name="' . $module . '">';
				$moduleCloseTag = '</module>' . '<!-- MODULE ' . $module . ' END -->';
			}

			$xml .= '<label id="' . $row ['label'] . '">' . '<![CDATA[' . $row ['content'] . ']]>';
		}

		$xml .= $moduleCloseTag;
		$xml .= $langCloseTag;
		$xml .= $systemCloseTag;
		return $xml;
	}

	public function importXml($xmlContent, $write_mode = LangPackConstant::MODE_WRITE_OVERRIDE) {
		$updateCount = 0;
		$insertCount = 0;
		$ignoreCount = 0;
		$dom = DOMDocument::loadXML ( $xmlContent );
		$xpath = new DOMXPath ( $dom );
		//system node
		$system = '';
		$findPathPart = array ();
		$findPath = '//system';
		$systemNodes = $xpath->query ( $findPath );
		foreach ( $systemNodes as $sysNode ) {
			$system = $sysNode->getAttribute ( 'name' );

			//language node
			$lang = '';
			$findPathPart ['s'] = 'system[@name="' . $system . '"]';
			$findPath = '//' . implode ( '/', $findPathPart ) . '/lang';
			$langNodes = $xpath->query ( $findPath );
			foreach ( $langNodes as $langNode ) {
				$lang = $langNode->getAttribute ( 'code' );

				//module name
				$module = '';
				$findPathPart ['l'] = 'lang[@code="' . $lang . '"]';
				$findPath = '//' . implode ( '/', $findPathPart ) . '/module';
				$modNodes = $xpath->query ( $findPath );
				foreach ( $modNodes as $modNode ) {
					$module = $modNode->getAttribute ( 'name' );

					//label and content
					$findPathPart ['m'] = 'module[@name="' . $module . '"]';
					$findPath = '//' . implode ( '/', $findPathPart ) . '/label';
					$labelNodes = $xpath->query ( $findPath );
					foreach ( $labelNodes as $labNode ) {
						$label = $content = '';
						$label = $labNode->getAttribute ( 'id' );
						$content = $labNode->textContent;
						$existLabRows = $this->_query ( null, $label, null, $module, $system, $lang );
						if (count ( $existLabRows ) > 0) {
							if (LangPackConstant::MODE_WRITE_OVERRIDE == $write_mode) {
								$this->_update ( $existLabRows [0] ['id'], $content );
								$updateCount ++;
							} else {
								$ignoreCount ++;

		//TODO add duplication warning message here ...
							}
						} else {
							$this->_insert ( $label, $content, $module, $system, $lang );
							$insertCount ++;
						}
					}
				}
			}
		}
		return array ('inserted' => $insertCount, 'updated' => $updateCount, 'ignored' => $ignoreCount );
	}

	private function _update($id, $content) {
		$bind_array = array ();
		$bind_array [':id'] = $id;
		$bind_array [':content'] = $content;
		$sql_statement = 'UPDATE lang_pack SET content = :content WHERE id = :id';
		$statement = $this->connection->prepare ( $sql_statement );
		$statement->execute ( $bind_array );
	}

	private function _insert($label, $content, $module, $system, $language) {
		$bind_array = array ();
		$bind_array [':label'] = $label;
		$bind_array [':content'] = $content;
		$bind_array [':module'] = $module;
		$bind_array [':system'] = $system;
		$bind_array [':language'] = $language;

		//check uniqe (system_name, lang_code, module_name, label)
		if (count ( $this->_query ( null, $label, null, $module, $system, $language ) ) > 0) {
			throw new Exception ( 'The label: ' . "[$system][$language][$module] $label had already been inserted!" );
		}

		$sql_statement = 'INSERT INTO lang_pack(label, content, module_name, system_name, lang_code) VALUES(:label, :content, :module, :system, :language)';
		$statement = $this->connection->prepare ( $sql_statement );
		$statement->execute ( $bind_array );
		return $statement->rowCount ();
	}

	private function _query($id, $label, $content, $module, $system, $language, $order = null) {
		$bind_array = array ();
		$sql_statement = 'SELECT * FROM lang_pack WHERE 1<2 ';

		if (! is_null ( $id )) {
			$sql_statement .= ' AND id = :id ';
			$bind_array [':id'] = array ($id, PDO::PARAM_INT );
		}

		if (! is_null ( $label )) {
			$sql_statement .= ' AND label LIKE :label ';
			$bind_array [':label'] = array ($label, PDO::PARAM_STR );
		}
		if (! is_null ( $content )) {
			$sql_statement .= ' AND content LIKE :content ';
			$bind_array [':content'] = array ($content, PDO::PARAM_STR );
		}
		if (! is_null ( $module )) {
			$sql_statement .= ' AND module_name = :module ';
			$bind_array [':module'] = array ($module, PDO::PARAM_STR );
		}
		if (! is_null ( $system )) {
			$sql_statement .= ' AND system_name = :system ';
			$bind_array [':system'] = array ($system, PDO::PARAM_STR );
		}
		if (! is_null ( $language )) {
			$sql_statement .= ' AND lang_code = :language ';
			$bind_array [':language'] = array ($language, PDO::PARAM_STR );
		}

		if (! is_null ( $order )) {
			$sql_statement .= ' ORDER BY ' . $order;
		}

		$statement = $this->connection->prepare ( $sql_statement, array (PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY ) );
		foreach ( $bind_array as $key => $value ) {
			$statement->bindParam ( $key, $value [0], $value [1] );
		}
		$statement->execute ();

		//$statement->debugDumpParams();

		return $statement->fetchAll ( PDO::FETCH_ASSOC );
	}

	public function getArray($label, $module, $system, $language) {
		throw new Exception ( "getArray has not been implement yet!" );
	}
}


text:
/*eslint import/namespace: ['error', { allowComputed: true }]*/
import 'dotenv/config';
import '../util/catchUnhandledRejection';
import elasticsearch from '@elastic/elasticsearch';
import getIndexName from '../util/getIndexName';
import indexSetting from '../util/indexSetting';

import * as schema from '../schema';

const client = new elasticsearch.Client({
  node: process.env.ELASTICSEARCH_URL,
});

const INDEX_NAME = process.argv[2];

if (INDEX_NAME && !schema[INDEX_NAME]) {
  console.error(
    `Specified index ${INDEX_NAME} is not exported in schema/index.js.`
  );
  process.exit(1);
}

const SCHEMA_NAMES = INDEX_NAME ? [INDEX_NAME] : Object.keys(schema);

async function loadSchema() {
  for (const index of SCHEMA_NAMES) {
    const indexName = getIndexName(index);
    try {
      await client.indices.create({
        index: indexName,
        body: {
          settings: indexSetting,
          mappings: { doc: schema[index] },
          aliases: {
            [index]: {},
          },
        },
      });
    } catch (e) {
      console.error(`Error creating index "${indexName}"`, e);
      throw e;
    }
    console.log(`Index "${indexName}" created with mappings`);
  }
}

loadSchema().catch(() => {
  process.exit(1);
});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using MahApps.Metro.Controls;

namespace CleanStart.Views
{
    /// <summary>
    /// Interaction logic for ProgressWindow.xaml
    /// </summary>
    public partial class ProgressWindow : MetroWindow
    {
        public ProgressWindow()
        {
            InitializeComponent();
        }
    }
}


text:
MillersdaughterFS
=================

Private per process $TMP directory file-system.


text:
This package is forked from
`sigs.k8s.io/kustomize/api/`
with version `api/0.8.11`.


text:
<?php

namespace Symplify\PHP7_CodeSniffer\Configuration\OptionResolver;

use Symfony\Component\OptionsResolver\OptionsResolver;
use Symplify\PHP7_CodeSniffer\Configuration\ValueNormalizer;
use Symplify\PHP7_CodeSniffer\Contract\Configuration\OptionResolver\OptionResolverInterface;
use Symplify\PHP7_CodeSniffer\Exception\Configuration\OptionResolver\StandardNotFoundException;
use Symplify\PHP7_CodeSniffer\Standard\Finder\StandardFinder;

final class StandardsOptionResolver implements OptionResolverInterface
{
    /**
     * @var string
     */
    const NAME = 'standards';

    /**
     * @var StandardFinder
     */
    private $standardFinder;

    public function __construct(StandardFinder $standardFinder)
    {
        $this->standardFinder = $standardFinder;
    }

    public function getName() : string
    {
        return self::NAME;
    }

    public function resolve(array $value) : array
    {
        $optionsResolver = new OptionsResolver();
        $optionsResolver->setDefined(self::NAME);
        $this->setAllowedValues($optionsResolver);
        $this->setNormalizer($optionsResolver);

        $values = $optionsResolver->resolve([
            self::NAME => $value
        ]);

        return $values[self::NAME];
    }

    private function setNormalizer(OptionsResolver $optionsResolver)
    {
        $optionsResolver->setNormalizer(
            self::NAME,
            function (OptionsResolver $optionsResolver, array $standardNames) {
                return ValueNormalizer::normalizeCommaSeparatedValues($standardNames);
            }
        );
    }

    private function setAllowedValues(OptionsResolver $optionsResolver)
    {
        $optionsResolver->setAllowedValues(self::NAME, function (array $standards) {
            $standards = ValueNormalizer::normalizeCommaSeparatedValues($standards);

            $availableStandards = $this->standardFinder->getStandards();
            foreach ($standards as $standardName) {
                if (!array_key_exists($standardName, $availableStandards)) {
                    throw new StandardNotFoundException(sprintf(
                        'Standard "%s" is not supported. Pick one of: %s.',
                        $standardName,
                        implode(array_keys($availableStandards), ', ')
                    ));
                }
            }

            return true;
        });
    }
}


text:
<?php

namespace Org\Schema\Thing\Place\CivicStructure\GovernmentBuilding;

/**
 * Class LegislativeBuilding
 * A legislative building—for example, the state capitol.
 * @author      AppBels <app.bels@gmail.com>
 * @name        LegislativeBuilding
 * @namespace   Org\Schema\Thing\Place\CivicStructure\GovernmentBuilding
 * @package     Org\Schema
 * @see         https://schema.org/LegislativeBuilding
 * Date         10/04/2017
 */
class LegislativeBuilding extends \Org\Schema\Thing\Place\CivicStructure\GovernmentBuilding
{

	/**
	 * LegislativeBuilding constructor.
	 * @access  public
	 * @see     \Org\Schema\Thing\Place\CivicStructure\GovernmentBuilding::__construct()
	 */
	public function __construct ()
	{
		parent::__construct();
	}

	/**
	 * LegislativeBuilding toString.
	 * @access  public
	 * @see     \Org\Schema\Thing\Place\CivicStructure\GovernmentBuilding::__toString()
	 *
	 * @return  string
	 */
	public function __toString ()
	{
		return parent::__toString();
	}

	/**
	 * LegislativeBuilding destructor.
	 * @access  public
	 * @see     \Org\Schema\Thing\Place\CivicStructure\GovernmentBuilding::__destruct()
	 */
	public function __destruct ()
	{
		parent::__destruct();
	}

}

?>


text:
import * as ts from 'typescript';

import {AbsoluteFsPath} from '../../../file_system';
import {FactoryTracker} from '../../../shims/api';

import {ExtendedTsCompilerHost, UnifiedModulesHost} from './interfaces';

/**
 * Names of methods from `ExtendedTsCompilerHost` that need to be provided by the
 * `NgCompilerAdapter`.
 */
export type ExtendedCompilerHostMethods =
    // Used to normalize filenames for the host system. Important for proper case-sensitive file
    // handling.
    'getCanonicalFileName'|
    // An optional method of `ts.CompilerHost` where an implementer can override module resolution.
    'resolveModuleNames'|
    // Retrieve the current working directory. Unlike in `ts.ModuleResolutionHost`, this is a
    // required method.
    'getCurrentDirectory'|
    // Additional methods of `ExtendedTsCompilerHost` related to resource files (e.g. HTML
    // templates). These are optional.
    'getModifiedResourceFiles'|'readResource'|'resourceNameToFileName';

/**
 * Adapter for `NgCompiler` that allows it to be used in various circumstances, such as
 * command-line `ngc`, as a plugin to `ts_library` in Bazel, or from the Language Service.
 *
 * `NgCompilerAdapter` is a subset of the `NgCompilerHost` implementation of `ts.CompilerHost`
 * which is relied upon by `NgCompiler`. A consumer of `NgCompiler` can therefore use the
 * `NgCompilerHost` or implement `NgCompilerAdapter` itself.
 */
export interface NgCompilerAdapter extends
    // getCurrentDirectory is removed from `ts.ModuleResolutionHost` because it's optional, and
    // incompatible with the `ts.CompilerHost` version which isn't. The combination of these two
    // still satisfies `ts.ModuleResolutionHost`.
        Omit<ts.ModuleResolutionHost, 'getCurrentDirectory'>,
    Pick<ExtendedTsCompilerHost, 'getCurrentDirectory'|ExtendedCompilerHostMethods> {
  /**
   * A path to a single file which represents the entrypoint of an Angular Package Format library,
   * if the current program is one.
   *
   * This is used to emit a flat module index if requested, and can be left `null` if that is not
   * required.
   */
  readonly entryPoint: AbsoluteFsPath|null;

  /**
   * An array of `ts.Diagnostic`s that occurred during construction of the `ts.Program`.
   */
  readonly constructionDiagnostics: ts.Diagnostic[];

  /**
   * A `Set` of `ts.SourceFile`s which are internal to the program and should not be emitted as JS
   * files.
   *
   * Often these are shim files such as `ngtypecheck` shims used for template type-checking in
   * command-line ngc.
   */
  readonly ignoreForEmit: Set<ts.SourceFile>;

  /**
   * A tracker for usage of symbols in `.ngfactory` shims.
   *
   * This can be left `null` if such shims are not a part of the `ts.Program`.
   */
  readonly factoryTracker: FactoryTracker|null;

  /**
   * A specialized interface provided in some environments (such as Bazel) which overrides how
   * import specifiers are generated.
   *
   * If not required, this can be `null`.
   */
  readonly unifiedModulesHost: UnifiedModulesHost|null;

  /**
   * Resolved list of root directories explicitly set in, or inferred from, the tsconfig.
   */
  readonly rootDirs: ReadonlyArray<AbsoluteFsPath>;

  /**
   * Distinguishes between shim files added by Angular to the compilation process (both those
   * intended for output, like ngfactory files, as well as internal shims like ngtypecheck files)
   * and original files in the user's program.
   *
   * This is mostly used to limit type-checking operations to only user files. It should return
   * `true` if a file was written by the user, and `false` if a file was added by the compiler.
   */
  isShim(sf: ts.SourceFile): boolean;
}


text:
@interface PodsDummy_Pods_ASAudioPlayer_Tests : NSObject
@end
@implementation PodsDummy_Pods_ASAudioPlayer_Tests
@end


text:
docker-ubuntu-apache-php
========================

Minimal Docker Image for Apache+PHP (based on minimal ubuntu)


text:
"""Test the init file of Twilio."""
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import twilio
from homeassistant.config import async_process_ha_core_config
from homeassistant.core import callback

async def test_config_flow_registers_webhook(hass, hass_client_no_auth):
    """Test setting up Twilio and sending webhook."""
    await async_process_ha_core_config(
        hass,
        {"internal_url": "http://example.local:8123"},
    )
    result = await hass.config_entries.flow.async_init(
        "twilio", context={"source": config_entries.SOURCE_USER}
    )
    assert result["type"] == data_entry_flow.FlowResultType.FORM, result

    result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
    assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
    webhook_id = result["result"].data["webhook_id"]

    twilio_events = []

    @callback
    def handle_event(event):
        """Handle Twilio event."""
        twilio_events.append(event)

    hass.bus.async_listen(twilio.RECEIVED_DATA, handle_event)

    client = await hass_client_no_auth()
    await client.post(f"/api/webhook/{webhook_id}", data={"hello": "twilio"})

    assert len(twilio_events) == 1
    assert twilio_events[0].data["webhook_id"] == webhook_id
    assert twilio_events[0].data["hello"] == "twilio"


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>ch8_html_css</artifactId>
    <version>1.0</version>
    <packaging>war</packaging>

    <parent>
        <groupId>ru.job4j</groupId>
        <artifactId>p4_web</artifactId>
        <version>1.0</version>
    </parent>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/javax.inject/javax.inject -->
        <!-- https://docs.oracle.com/javaee/7/api/javax/inject/package-summary.html -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-dbcp -->
        <!-- Tomcat Database Connection Pooling package -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-dbcp</artifactId>
            <version>9.0.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-jdbc -->
        <!-- Java Database Connectivity -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
            <version>8.0.32</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/jstl/jstl -->
        <!-- JavaServer Pages Standard Tag Library -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/taglibs/standard -->
        <!-- Standard Tag Library -->
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>jpack2p9ch8task1-travis</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <db.url>jdbc:postgresql://localhost/jpack2p9ch8task1</db.url>
                <db.username>postgres</db.username>
                <db.password />
                <db.driver>org.postgresql.Driver</db.driver>
            </properties>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
                    <!--<packagingExcludes>
                        WEB-INF/lib/some-name.jar,
                        WEB-INF/lib/another-name.jar
                    </packagingExcludes>-->
                </configuration>
            </plugin>
            <!-- Plugun for deploy war to Tomcat. Work with Tomcat 7 and 8.
            For deploy use command:   mvn tomcat7:deploy
            For redeploy use command: mvn tomcat7:redeploy -->
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <path>/${project.build.finalName}</path>
                    <update>true</update>
                    <url>http://localhost:8080/manager/text</url>
                    <username>fuckin-autodeployer</username>
                    <password>fuckin-autodeployer-pass</password>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

-->
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
  <edmx:DataServices>
    <Schema Namespace="Microsoft.Exchange.Services.OData.Model" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <EnumType Name="BodyType">
        <Member Name="Text" Value="0" />
        <Member Name="HTML" Value="1" />
      </EnumType>
      <EnumType Name="Importance">
        <Member Name="Normal" Value="0" />
        <Member Name="Low" Value="1" />
        <Member Name="High" Value="2" />
      </EnumType>
      <EnumType Name="AttendeeType">
        <Member Name="Required" Value="0" />
        <Member Name="Optional" Value="1" />
        <Member Name="Resource" Value="2" />
      </EnumType>
      <EnumType Name="ResponseType">
        <Member Name="None" Value="0" />
        <Member Name="Organizer" Value="1" />
        <Member Name="TentativelyAccepted" Value="2" />
        <Member Name="Accepted" Value="3" />
        <Member Name="Declined" Value="4" />
        <Member Name="NotResponded" Value="5" />
      </EnumType>
      <EnumType Name="EventType">
        <Member Name="SingleInstance" Value="0" />
        <Member Name="Occurrence" Value="1" />
        <Member Name="Exception" Value="2" />
        <Member Name="SeriesMaster" Value="3" />
      </EnumType>
      <EnumType Name="FreeBusyStatus">
        <Member Name="Unknown" Value="0" />
        <Member Name="Free" Value="1" />
        <Member Name="Tentative" Value="2" />
        <Member Name="Busy" Value="3" />
        <Member Name="Oof" Value="4" />
        <Member Name="WorkingElsewhere" Value="5" />
      </EnumType>
      <EnumType Name="MeetingMessageType">
        <Member Name="None" Value="0" />
        <Member Name="MeetingRequest" Value="1" />
        <Member Name="MeetingCancelled" Value="2" />
        <Member Name="MeetingAccepted" Value="3" />
        <Member Name="MeetingTenativelyAccepted" Value="4" />
        <Member Name="MeetingDeclined" Value="5" />
      </EnumType>
      <EnumType Name="RecurrencePatternType">
        <Member Name="Daily" Value="0" />
        <Member Name="Weekly" Value="1" />
        <Member Name="AbsoluteMonthly" Value="2" />
        <Member Name="RelativeMonthly" Value="3" />
        <Member Name="AbsoluteYearly" Value="4" />
        <Member Name="RelativeYearly" Value="5" />
      </EnumType>
      <EnumType Name="RecurrenceRangeType">
        <Member Name="EndDate" Value="0" />
        <Member Name="NoEnd" Value="1" />
        <Member Name="Numbered" Value="2" />
      </EnumType>
      <EnumType Name="WeekIndex">
        <Member Name="First" Value="0" />
        <Member Name="Second" Value="1" />
        <Member Name="Third" Value="2" />
        <Member Name="Fourth" Value="3" />
        <Member Name="Last" Value="4" />
      </EnumType>
      <ComplexType Name="Recipient">
        <Property Name="Name" Type="Edm.String" />
        <Property Name="Address" Type="Edm.String" />
      </ComplexType>
      <ComplexType Name="Attendee" BaseType="Microsoft.Exchange.Services.OData.Model.Recipient">
        <Property Name="Status" Type="Microsoft.Exchange.Services.OData.Model.ResponseStatus" />
        <Property Name="Type" Type="Microsoft.Exchange.Services.OData.Model.AttendeeType" />
      </ComplexType>
      <ComplexType Name="ItemBody">
        <Property Name="ContentType" Type="Microsoft.Exchange.Services.OData.Model.BodyType" />
        <Property Name="Content" Type="Edm.String" />
      </ComplexType>
      <ComplexType Name="Location">
        <Property Name="DisplayName" Type="Edm.String" />
      </ComplexType>
      <ComplexType Name="ResponseStatus" BaseType="Microsoft.Exchange.Services.OData.Model.Recipient">
        <Property Name="Response" Type="Microsoft.Exchange.Services.OData.Model.ResponseType" />
        <Property Name="Time" Type="Edm.DateTimeOffset" />
      </ComplexType>
      <ComplexType Name="RecurrencePattern">
        <Property Name="Type" Type="Microsoft.Exchange.Services.OData.Model.RecurrencePatternType" />
        <Property Name="Interval" Type="Edm.Int32" Nullable="false" />
        <Property Name="DayOfMonth" Type="Edm.Int32" Nullable="false" />
        <Property Name="Month" Type="Edm.Int32" Nullable="false" />
        <Property Name="DaysOfWeek" Type="Collection(System.DayOfWeek)" />
        <Property Name="FirstDayOfWeek" Type="System.DayOfWeek" />
        <Property Name="Index" Type="Microsoft.Exchange.Services.OData.Model.WeekIndex" />
      </ComplexType>
      <ComplexType Name="RecurrenceRange">
        <Property Name="Type" Type="Microsoft.Exchange.Services.OData.Model.RecurrenceRangeType" />
        <Property Name="StartDate" Type="Edm.DateTimeOffset" />
        <Property Name="EndDate" Type="Edm.DateTimeOffset" />
        <Property Name="NumberOfOccurrences" Type="Edm.Int32" Nullable="false" />
      </ComplexType>
      <ComplexType Name="PatternedRecurrence">
        <Property Name="Pattern" Type="Microsoft.Exchange.Services.OData.Model.RecurrencePattern" />
        <Property Name="Range" Type="Microsoft.Exchange.Services.OData.Model.RecurrenceRange" />
      </ComplexType>
      <EntityType Name="Entity" Abstract="true">
        <Key>
          <PropertyRef Name="Id" />
        </Key>
        <Property Name="Id" Type="Edm.String" Nullable="false" />
      </EntityType>
      <EntityType Name="User" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
        <Property Name="DisplayName" Type="Edm.String" />
        <Property Name="Alias" Type="Edm.String" />
        <Property Name="MailboxGuid" Type="Edm.Guid" />
        <NavigationProperty Name="Folders" Type="Collection(Microsoft.Exchange.Services.OData.Model.Folder)" ContainsTarget="true" />
        <NavigationProperty Name="Messages" Type="Collection(Microsoft.Exchange.Services.OData.Model.Message)" ContainsTarget="true" />
        <NavigationProperty Name="RootFolder" Type="Microsoft.Exchange.Services.OData.Model.Folder" ContainsTarget="true" />
        <NavigationProperty Name="Inbox" Type="Microsoft.Exchange.Services.OData.Model.Folder" ContainsTarget="true" />
        <NavigationProperty Name="Drafts" Type="Microsoft.Exchange.Services.OData.Model.Folder" ContainsTarget="true" />
        <NavigationProperty Name="SentItems" Type="Microsoft.Exchange.Services.OData.Model.Folder" ContainsTarget="true" />
        <NavigationProperty Name="DeletedItems" Type="Microsoft.Exchange.Services.OData.Model.Folder" ContainsTarget="true" />
        <NavigationProperty Name="Calendars" Type="Collection(Microsoft.Exchange.Services.OData.Model.Calendar)" ContainsTarget="true" />
        <NavigationProperty Name="Calendar" Type="Microsoft.Exchange.Services.OData.Model.Calendar" ContainsTarget="true" />
        <NavigationProperty Name="CalendarGroups" Type="Collection(Microsoft.Exchange.Services.OData.Model.CalendarGroup)" ContainsTarget="true" />
        <NavigationProperty Name="Events" Type="Collection(Microsoft.Exchange.Services.OData.Model.Event)" ContainsTarget="true" />
        <NavigationProperty Name="Contacts" Type="Collection(Microsoft.Exchange.Services.OData.Model.Contact)" ContainsTarget="true" />
        <NavigationProperty Name="ContactFolders" Type="Collection(Microsoft.Exchange.Services.OData.Model.ContactFolder)" ContainsTarget="true" />
      </EntityType>
      <EntityType Name="Folder" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
        <Property Name="ParentFolderId" Type="Edm.String" />
        <Property Name="DisplayName" Type="Edm.String" />
        <Property Name="ClassName" Type="Edm.String" />
        <Property Name="TotalCount" Type="Edm.Int32" />
        <Property Name="ChildFolderCount" Type="Edm.Int32" />
        <Property Name="UnreadItemCount" Type="Edm.Int32" />
        <NavigationProperty Name="ChildFolders" Type="Collection(Microsoft.Exchange.Services.OData.Model.Folder)" ContainsTarget="true" />
        <NavigationProperty Name="Messages" Type="Collection(Microsoft.Exchange.Services.OData.Model.Message)" ContainsTarget="true" />
      </EntityType>
      <Action Name="Copy" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
        <Parameter Name="DestinationId" Type="Edm.String" />
        <ReturnType Type="Microsoft.Exchange.Services.OData.Model.Folder" />
      </Action>
      <Action Name="Move" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
        <Parameter Name="DestinationId" Type="Edm.String" />
        <ReturnType Type="Microsoft.Exchange.Services.OData.Model.Folder" />
      </Action>
      <EntityType Name="Item" BaseType="Microsoft.Exchange.Services.OData.Model.Entity" Abstract="true">
        <Property Name="ChangeKey" Type="Edm.String" />
        <Property Name="ClassName" Type="Edm.String" />
        <Property Name="Subject" Type="Edm.String" />
        <Property Name="Body" Type="Microsoft.Exchange.Services.OData.Model.ItemBody" />
        <Property Name="BodyPreview" Type="Edm.String" />
        <Property Name="Importance" Type="Microsoft.Exchange.Services.OData.Model.Importance" />
        <Property Name="Categories" Type="Collection(Edm.String)" />
        <Property Name="HasAttachments" Type="Edm.Boolean" />
        <NavigationProperty Name="Attachments" Type="Collection(Microsoft.Exchange.Services.OData.Model.Attachment)" ContainsTarget="true" />
      </EntityType>
      <EntityType Name="Message" BaseType="Microsoft.Exchange.Services.OData.Model.Item">
        <Property Name="ParentFolderId" Type="Edm.String" />
        <Property Name="From" Type="Microsoft.Exchange.Services.OData.Model.Recipient" />
        <Property Name="Sender" Type="Microsoft.Exchange.Services.OData.Model.Recipient" />
        <Property Name="ToRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
        <Property Name="CcRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
        <Property Name="BccRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
        <Property Name="ReplyTo" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
        <Property Name="ConversationId" Type="Edm.String" />
        <Property Name="UniqueBody" Type="Microsoft.Exchange.Services.OData.Model.ItemBody" />
        <Property Name="DateTimeReceived" Type="Edm.DateTimeOffset" />
        <Property Name="DateTimeSent" Type="Edm.DateTimeOffset" />
        <Property Name="IsDeliveryReceiptRequested" Type="Edm.Boolean" />
        <Property Name="IsReadReceiptRequested" Type="Edm.Boolean" />
        <Property Name="IsDraft" Type="Edm.Boolean" />
        <Property Name="IsRead" Type="Edm.Boolean" />
        <Property Name="EventId" Type="Edm.String" />
        <Property Name="MeetingMessageType" Type="Microsoft.Exchange.Services.OData.Model.MeetingMessageType" />
        <Property Name="DateTimeCreated" Type="Edm.DateTimeOffset" />
        <Property Name="LastModifiedTime" Type="Edm.DateTimeOffset" />
      </EntityType>
      <Action Name="Copy" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
        <Parameter Name="DestinationId" Type="Edm.String" />
        <ReturnType Type="Microsoft.Exchange.Services.OData.Model.Message" />
      </Action>
      <Action Name="Move" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
        <Parameter Name="DestinationId" Type="Edm.String" />
        <ReturnType Type="Microsoft.Exchange.Services.OData.Model.Message" />
      </Action>
      <Action Name="CreateReply" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
        <ReturnType Type="Microsoft.Exchange.Services.OData.Model.Message" />
      </Action>
      <Action Name="CreateReplyAll" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
        <ReturnType Type="Microsoft.Exchange.Services.OData.Model.Message" />
      </Action>
      <Action Name="CreateForward" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
        <ReturnType Type="Microsoft.Exchange.Services.OData.Model.Message" />
      </Action>
      <Action Name="Reply" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
        <Parameter Name="Comment" Type="Edm.String" />
      </Action>
      <Action Name="ReplyAll" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
        <Parameter Name="Comment" Type="Edm.String" />
      </Action>
      <Action Name="Forward" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
        <Parameter Name="Comment" Type="Edm.String" />
        <Parameter Name="ToRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
      </Action>
      <Action Name="Send" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Message" />
      </Action>
      <EntityType Name="Attachment" BaseType="Microsoft.Exchange.Services.OData.Model.Entity" Abstract="true">
        <Property Name="Name" Type="Edm.String" />
        <Property Name="ContentType" Type="Edm.String" />
        <Property Name="Size" Type="Edm.Int32" Nullable="false" />
        <Property Name="IsInline" Type="Edm.Boolean" Nullable="false" />
        <Property Name="LastModifiedTime" Type="Edm.DateTimeOffset" />
      </EntityType>
      <EntityType Name="FileAttachment" BaseType="Microsoft.Exchange.Services.OData.Model.Attachment">
        <Property Name="ContentId" Type="Edm.String" />
        <Property Name="ContentLocation" Type="Edm.String" />
        <Property Name="IsContactPhoto" Type="Edm.Boolean" Nullable="false" />
        <Property Name="ContentBytes" Type="Edm.Binary" />
      </EntityType>
      <EntityType Name="ItemAttachment" BaseType="Microsoft.Exchange.Services.OData.Model.Attachment">
        <NavigationProperty Name="Item" Type="Microsoft.Exchange.Services.OData.Model.Item" ContainsTarget="true" />
      </EntityType>
      <EntityType Name="Calendar" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
        <Property Name="Name" Type="Edm.String" />
        <Property Name="ChangeKey" Type="Edm.String" />
        <NavigationProperty Name="Events" Type="Collection(Microsoft.Exchange.Services.OData.Model.Event)" ContainsTarget="true" />
      </EntityType>
      <EntityType Name="CalendarGroup" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
        <Property Name="Name" Type="Edm.String" />
        <Property Name="ChangeKey" Type="Edm.String" />
        <Property Name="ClassId" Type="Edm.Guid" />
        <NavigationProperty Name="Calendars" Type="Collection(Microsoft.Exchange.Services.OData.Model.Calendar)" ContainsTarget="true" />
      </EntityType>
      <EntityType Name="Event" BaseType="Microsoft.Exchange.Services.OData.Model.Item">
        <Property Name="Start" Type="Edm.DateTimeOffset" />
        <Property Name="End" Type="Edm.DateTimeOffset" />
        <Property Name="Location" Type="Microsoft.Exchange.Services.OData.Model.Location" />
        <Property Name="ShowAs" Type="Microsoft.Exchange.Services.OData.Model.FreeBusyStatus" />
        <Property Name="IsAllDay" Type="Edm.Boolean" />
        <Property Name="IsCancelled" Type="Edm.Boolean" />
        <Property Name="IsOrganizer" Type="Edm.Boolean" />
        <Property Name="ResponseRequested" Type="Edm.Boolean" />
        <Property Name="Type" Type="Microsoft.Exchange.Services.OData.Model.EventType" />
        <Property Name="SeriesId" Type="Edm.String" />
        <Property Name="Attendees" Type="Collection(Microsoft.Exchange.Services.OData.Model.Attendee)" />
        <Property Name="Recurrence" Type="Microsoft.Exchange.Services.OData.Model.PatternedRecurrence" />
        <NavigationProperty Name="Calendar" Type="Microsoft.Exchange.Services.OData.Model.Calendar" ContainsTarget="true" />
      </EntityType>
      <Action Name="Accept" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Event" />
        <Parameter Name="Comment" Type="Edm.String" />
      </Action>
      <Action Name="Decline" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Event" />
        <Parameter Name="Comment" Type="Edm.String" />
      </Action>
      <Action Name="TentativelyAccept" IsBound="true" EntitySetPath="bindingParameter">
        <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Event" />
        <Parameter Name="Comment" Type="Edm.String" />
      </Action>
      <EntityType Name="Contact" BaseType="Microsoft.Exchange.Services.OData.Model.Item">
        <Property Name="ParentFolderId" Type="Edm.String" />
        <Property Name="Birthday" Type="Edm.DateTimeOffset" />
        <Property Name="FileAs" Type="Edm.String" />
        <Property Name="DisplayName" Type="Edm.String" />
        <Property Name="GivenName" Type="Edm.String" />
        <Property Name="Initials" Type="Edm.String" />
        <Property Name="MiddleName" Type="Edm.String" />
        <Property Name="NickName" Type="Edm.String" />
        <Property Name="Surname" Type="Edm.String" />
        <Property Name="Title" Type="Edm.String" />
        <Property Name="Generation" Type="Edm.String" />
        <Property Name="EmailAddress1" Type="Edm.String" />
        <Property Name="EmailAddress2" Type="Edm.String" />
        <Property Name="EmailAddress3" Type="Edm.String" />
        <Property Name="ImAddress1" Type="Edm.String" />
        <Property Name="ImAddress2" Type="Edm.String" />
        <Property Name="ImAddress3" Type="Edm.String" />
        <Property Name="JobTitle" Type="Edm.String" />
        <Property Name="CompanyName" Type="Edm.String" />
        <Property Name="Department" Type="Edm.String" />
        <Property Name="OfficeLocation" Type="Edm.String" />
        <Property Name="Profession" Type="Edm.String" />
        <Property Name="BusinessHomePage" Type="Edm.String" />
        <Property Name="AssistantName" Type="Edm.String" />
        <Property Name="Manager" Type="Edm.String" />
        <Property Name="HomePhone1" Type="Edm.String" />
        <Property Name="HomePhone2" Type="Edm.String" />
        <Property Name="BusinessPhone1" Type="Edm.String" />
        <Property Name="BusinessPhone2" Type="Edm.String" />
        <Property Name="MobilePhone1" Type="Edm.String" />
        <Property Name="OtherPhone" Type="Edm.String" />
        <Property Name="DateTimeCreated" Type="Edm.DateTimeOffset" />
        <Property Name="LastModifiedTime" Type="Edm.DateTimeOffset" />
      </EntityType>
      <EntityType Name="ContactFolder" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
        <Property Name="ParentFolderId" Type="Edm.String" />
        <Property Name="DisplayName" Type="Edm.String" />
        <NavigationProperty Name="Contacts" Type="Collection(Microsoft.Exchange.Services.OData.Model.Contact)" ContainsTarget="true" />
        <NavigationProperty Name="ChildFolders" Type="Collection(Microsoft.Exchange.Services.OData.Model.ContactFolder)" ContainsTarget="true" />
      </EntityType>
      <EntityContainer Name="EntityContainer">
        <EntitySet Name="Users" EntityType="Microsoft.Exchange.Services.OData.Model.User" />
        <Singleton Name="Me" Type="Microsoft.Exchange.Services.OData.Model.User" />
      </EntityContainer>
    </Schema>
    <Schema Namespace="System" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <EnumType Name="DayOfWeek">
        <Member Name="Sunday" Value="0" />
        <Member Name="Monday" Value="1" />
        <Member Name="Tuesday" Value="2" />
        <Member Name="Wednesday" Value="3" />
        <Member Name="Thursday" Value="4" />
        <Member Name="Friday" Value="5" />
        <Member Name="Saturday" Value="6" />
      </EnumType>
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>


text:
        <button type="button" class="navbar-toggle" ng-init="navCollapsed = true" ng-click="navCollapsed = !navCollapsed">
          Toggle navigation

        </button>
        Vault

Accounts

Transfers

Billing

Financial Analysis

Management

Logout


text:
<?php

use Pluma\Support\System\SystemInfo;

if (! function_exists('pluma_system')) {
    /**
     * Pluma's system function.
     *
     * @param string $key
     * @return mixed
     */
    function pluma_system($key)
    {
        switch ($key) {
            case 'memory':
                return memory_get_usage();
                break;

            case 'cpu':
                $system = new SystemInfo();
                return $system;
                break;

            default:
                # code...
                break;
        }
    }
}


text:
module AAWS
  class Base
    include ClassLevelInheritableAttributes

    cattr_inheritable :default_params
    @default_params = {:service => 'AWSECommerceService'}

    def self.establish_connection(access_key)
      raise ArgumentError, "Missing access key in establish_connection" if access_key.blank?
      @default_params[:aws_access_key_id] = access_key
    end

    def self.connection
      @@aws_connection ||= Connection.new("http://ecs.amazonaws.com")
    end

    def self.get(options={})
      raise ConnectionError, 'You forgot to establish_connection with an AWS access key' if @default_params[:aws_access_key_id].blank?
      params, options = {}, default_params.merge(options)
      options.map { |k,v| params[k.to_s.camelize.gsub(/^aws/i, 'AWS')] = v }
      connection.get('/onca/xml', params)
    end

    def self.parse(xml)
      Hpricot::XML(xml)
    end
  end
end


text:
package org.apache.camel.component.github;

import org.apache.camel.spi.Metadata;

public interface GitHubConstants {

    String GITHUB_REPOSITORY_SERVICE = "githubRepositoryService";

    String GITHUB_COMMIT_SERVICE = "githubCommitService";

    String GITHUB_DATA_SERVICE = "githubDataService";

    String GITHUB_PULL_REQUEST_SERVICE = "githubPullRequestService";

    String GITHUB_ISSUE_SERVICE = "githbIssueService";
    @Metadata(description = "The pull request", javaType = "PullRequest or Integer")
    String GITHUB_PULLREQUEST = "GitHubPullRequest";
    @Metadata(label = "producer", description = "The id of the comment to reply to", javaType = "Integer")
    String GITHUB_INRESPONSETO = "GitHubInResponseTo";
    @Metadata(description = "The sha of the head of the pull request", javaType = "String")
    String GITHUB_PULLREQUEST_HEAD_COMMIT_SHA = "GitHubPullRequestHeadCommitSHA";
    @Metadata(label = "producer", description = "The title of the issue", javaType = "String")
    String GITHUB_ISSUE_TITLE = "GitHubIssueTitle";

    String GITHUB_EVENT_SERVICE = "GitHubEventService";
    @Metadata(label = "consumer", description = "The commit author", javaType = "String")
    String GITHUB_COMMIT_AUTHOR = "CamelGitHubCommitAuthor";
    @Metadata(label = "consumer", description = "The committer name", javaType = "String")
    String GITHUB_COMMIT_COMMITTER = "CamelGitHubCommitCommitter";
    @Metadata(label = "consumer", description = "The commit sha", javaType = "String")
    String GITHUB_COMMIT_SHA = "CamelGitHubCommitSha";
    @Metadata(label = "consumer", description = "The commit URL", javaType = "String")
    String GITHUB_COMMIT_URL = "CamelGitHubCommitUrl";
    @Metadata(label = "consumer", description = "The event payload",
              javaType = "org.eclipse.egit.github.core.event.EventPayload")
    String GITHUB_EVENT_PAYLOAD = "CamelGitHubEventPayload";
}


text:
package com.infonuascape.osrshelper.views;

import android.app.AlertDialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.infonuascape.osrshelper.R;
import com.infonuascape.osrshelper.utils.Utils;
import com.jjoe64.graphview.series.DataPointInterface;

import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Date;

/**
 * Created by marc_ on 2018-01-14.
 */

public class GrandExchangePointDialog {
    public static AlertDialog showDialog(final Context context, final String title, final DataPointInterface dataPoint) {
        AlertDialog dialog = null;
        if(context != null && dataPoint != null) {
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            final View dialogView = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.grand_exchange_dialog, null, false);

            ((TextView) dialogView.findViewById(R.id.serie_title)).setText(title);
            ((TextView) dialogView.findViewById(R.id.date)).setText(DateFormat.getDateInstance(DateFormat.LONG).format(new Date((long) dataPoint.getX())));
            ((TextView) dialogView.findViewById(R.id.price)).setText(NumberFormat.getInstance().format((long) dataPoint.getY()) + "gp");

            builder.setView(dialogView);
            dialog = builder.create();
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
            dialog.show();

            final AlertDialog finalDialog = dialog;
            dialog.findViewById(R.id.container).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    finalDialog.dismiss();
                }
            });

            WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
            lp.copyFrom(dialog.getWindow().getAttributes());
            lp.width = (int) Utils.convertDpToPixel(300, context);
            dialog.getWindow().setAttributes(lp);

        }
        return dialog;
    }
}


text:
.. title:: clang-tidy - bugprone-string-integer-assignment

bugprone-string-integer-assignment
==================================

The check finds assignments of an integer to ``std::basic_string<CharT>``
(``std::string``, ``std::wstring``, etc.). The source of the problem is the
following assignment operator of ``std::basic_string<CharT>``:

.. code-block:: c++

  basic_string& operator=( CharT ch );

Numeric types can be implicitly casted to character types.

.. code-block:: c++

  std::string s;
  int x = 5965;
  s = 6;
  s = x;

Use the appropriate conversion functions or character literals.

.. code-block:: c++

  std::string s;
  int x = 5965;
  s = '6';
  s = std::to_string(x);

In order to suppress false positives, use an explicit cast.

.. code-block:: c++

  std::string s;
  s = static_cast<char>(6);


text:
package calc.client.tcp;

import edu.asu.ser.jsonrpc.exception.JsonRpcException;

public class CalculatorTCPClient {
	public static void main(String args[]) throws NumberFormatException, JsonRpcException
	{
		CalculatorProxyTCPClient client = new CalculatorProxyTCPClient("localhost",8080);
		System.out.println("Received response from Server: " + client.add(10, 11));
	}
}


text: java -jar ..\..\etc\java_cup.jar < parser.cup


text:
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;
using Azure.ResourceManager.Workloads;

namespace Azure.ResourceManager.Workloads.Models
{
    internal partial class SapApplicationServerInstanceList
    {
        internal static SapApplicationServerInstanceList DeserializeSapApplicationServerInstanceList(JsonElement element)
        {
            Optional<IReadOnlyList<SapApplicationServerInstanceData>> value = default;
            Optional<string> nextLink = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List<SapApplicationServerInstanceData> array = new List<SapApplicationServerInstanceData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SapApplicationServerInstanceData.DeserializeSapApplicationServerInstanceData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return new SapApplicationServerInstanceList(Optional.ToList(value), nextLink.Value);
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="Behat">
    <behat_settings>
      <BehatSettings behat_path="$PROJECT_DIR$" />
    </behat_settings>
  </component>
  <component name="PhpUnit">
    <phpunit_settings>
      <PhpUnitSettings load_method="CUSTOM_LOADER" bootstrap_file_path="$PROJECT_DIR$/app/bootstrap.php.cache" configuration_file_path="$PROJECT_DIR$/app/phpunit.xml.dist" custom_loader_path="$PROJECT_DIR$/app/autoload.php" phpunit_phar_path="" use_bootstrap_file="true" use_configuration_file="true" />
      <phpunit_by_deployment server_id="c3709e48-90e2-4e17-bfc4-08c1643b9e26" load_method="CUSTOM_LOADER" bootstrap_file_path="C:\wamp\bin\php\php5.5.12\app\bootstrap.php.cache" configuration_file_path="C:\wamp\bin\php\php5.5.12\app\phpunit.xml.dist" custom_loader_path="C:\wamp\bin\php\php5.5.12\app\autoload.php" use_bootstrap_file="true" use_configuration_file="true" />
    </phpunit_settings>
  </component>
</project>


text:
<?php

namespace Helix\AnalyticsBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

/**
 * @Route("/push")
 */
class PushController extends Controller
{
  /**
   * @Route("/mail/{sp}/overall")
   * @Method("POST")
   * @Template("HelixAnalyticsBundle:Push:outbound.html.twig")
   */
  public function overallAction(Request $request)
  {
    $data = $request->attributes->get('_data');
    $this->doPublish('overall', array('overall' => array($data)));
    return array();
  }

  /**
   * @Route("/mail/{sp}/open")
   * @Method("POST")
   * @Template("HelixAnalyticsBundle:Push:outbound.html.twig")
   */
  public function openAction(Request $request)
  {
    $data = $request->attributes->get('_data');
    $this->doPublish('opens', $data);
    return array();
  }

  /**
   * @Route("/mail/{sp}/click")
   * @Method("POST")
   * @Template("HelixAnalyticsBundle:Push:outbound.html.twig")
   */
  public function clickAction(Request $request)
  {
    $data = $request->attributes->get('_data');
    $this->doPublish('clicks', $data);
    return array();
  }

  /**
   * @Route("/mail/{sp}/subnsub")
   * @Method("POST")
   * @Template("HelixAnalyticsBundle:Push:outbound.html.twig")
   */
  public function subnsubAction(Request $request)
  {
    $data = $request->attributes->get('_data');
    $this->doPublish('subs', $data);
    return array();
  }

  /**
   * @Route("/mail/{sp}/bounce")
   * @Method("POST")
   * @Template("HelixAnalyticsBundle:Push:outbound.html.twig")
   */
  public function bounceAction(Request $request)
  {
    $data = $request->attributes->get('_data');
    $this->doPublish('bounces', $data);
    return array();
  }

  /**
   * @Route("/mail/{sp}/outbound")
   * @Method("POST")
   * @Template()
   */
  public function outboundAction(Request $request)
  {
    $data = $request->attributes->get('_data');
    $this->doPublish('sendLogs', $data);
    return array();
  }

  /**
   * @Route("/mail/{sp}/status")
   * @Method("POST")
   * @Template("HelixAnalyticsBundle:Push:outbound.html.twig")
   */
  public function statusAction(Request $request)
  {
    $data = $request->attributes->get('_data');
    $this->doPublish('status', array('status' => array($data)));
    return array();
  }

  /**
   * @Route("/mail/{sp}/trigger")
   * @Method("POST")
   * @Template("HelixAnalyticsBundle:Push:outbound.html.twig")
   */
  public function triggerAction(Request $request)
  {
    $data = $request->attributes->get('_data');
    $this->doPublish('smtpLogs', $data);
    return array();
  }

  private function doPublish($action, $data)
  {
    $items = $data[$action];
    unset($data[$action], $data['page']);
    $producer = $this->get('old_sound_rabbit_mq.maillog_producer');
    $producer->setContentType('application/json');
    $walker = function($item) use($producer, $action, $data) {
      $message = array_merge($item, $data);
      try {
        $routingKey = "maillog.{$action}";
        $producer->publish(json_encode($message), $routingKey);
      } catch (Exception $e) {
        echo sprintf("publish error: %s", $e->getMessage());
      }
    };
    return array_walk($items, $walker);
  }
}