text:
.. _Service Level Agreement: http://www.verifyemailaddress.io/Home/Terms

Glossary
========

..	glossary::
	:sorted:

	ACL
		**Access Control List.**

		An ACL is checked against
		the domain calling the :term:`API`. ACL authentication
		does not require a license key and is best in
		situations where the :term:`API` is being called
		from client side script such as JavaScript,
		jQuery, Angular etc.

	API
		**Application Programmers Interface.**

		See `Wikipedia - API Definition <https://en.wikipedia.org/wiki/Application_programming_interface>`_ for
		more information.

	B2B
		**Business To(2) Business**

		Business email hosting services are generally private,
		enterprise grade hosting services typically hosted in either
		private data centers or in cloud based infrastructure.

		Business to business refers to the activity of businesses
		sending email to clients using business email addresses.

	B2C
		**Business To(2) Consumer**

		Consumer email hosting providers are generally well known,
		mostly web based providers such as Hotmail, Yahoo, AOL, Gmail etc.

		Business to consumer refers to the activity of businesses
		sending email to clients using consumer email addresses.

		Verifying email addresses in consumer domains is generally more
		technically challenging than :term:`B2B`

	Block List
		See :term:`DNSBL`.

	CORS
		**Cross Origin Resource Scripting**

		Allows modern browsers to work with script (e.g. JavaScript) and :term:`JSON` data
		originating form other domains.

		CORS is required to allow client script such a JavaScript, jQuery or AngularJS to
		work with results returned from an external :term:`RESTful` :term:`API`.

		See `Wikipedia - CORS <https://en.wikipedia.org/wiki/Cross-origin_resource_sharing>`_ for
		more information.

	DDoS
		**Distributed Denial of Service**

		See `Wikipedia - Denial-of-service attack <https://en.wikipedia.org/wiki/Denial-of-service_attack>`_ for
		more information.

	DEA
		**Disposable Email Address**

		There are many services available that permit users to
		use a one-time only email address. Typically, these email
		addresses are used by individuals wishing to gain access
		to content or services requiring registration of email
		addresses but same individuals not wishing to divulge
		their true identities (e.g. permanent email addresses).

		DEA addresses should not be regarded as valid for email
		send purposes as it is unlikely that messages sent to
		DEA addresses will ever be read.

	ESP
		**Email Service Provider**

		A service that sends emails on your behalf.

		See
		`Wikipedia - Email service provider (marketing) <https://en.wikipedia.org/wiki/Email_service_provider_(marketing)>`_ for
		more information.

	HTTP
		**Hypertext Transfer Protocol**

		See `Wikipedia - Hypertext Transfer Protocol <https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>`_ for
		more information.

	Grey Listing
		A technique used in mail servers as an anti-spam technique.
		Sometimes also known as \"deferred\", grey listing arbitrarily
		delays the delivery of emails with a \"try again later\" response
		to the client sending the email.

		See `Wikipedia - Grey Listing <https://en.wikipedia.org/wiki/Greylisting>`_ for more
		information.

	JSON
		**JavaScript Object Notation**

		JavaScript Object Notation, is an open standard format that uses
		human readable text to transmit data objects consisting of attribute value pairs.
		It is used primarily to transmit data between a server and web application,
		as an efficient, modern alternative to XML.

		See `Wikipedia - JSON <https://en.wikipedia.org/wiki/JSON>`_ for more information.

	License Key
		License key authentication is best for situations
		where simplicity is required and you can keep the key private.
		An ideal use case for key authentication would be for server
		based applications calling the RESTful :term:`API`.

		`Click here <https://api.emailverifyapi.com/GetLicense>`_ to request a license key.

	DNS
		**Domain Name System**

		At its simplest level, DNS converts text based queries (e.g. a domain name)
		into IP addresses.

		DNS is also responsible for providing the :term:`MX` records needed to locate a
		domains mail servers.

		See `Wikipedia - Domain Name System <https://en.wikipedia.org/wiki/Domain_Name_System>`_
		for more information.

	DNSBL
		**DNS Block List**

		As an anti-spam measure, mail servers can use spam black lists
		to 'look up' the reputation of IP addresses and domains sending
		email. If an IP or domain is on a block list, the mail server may
		reject the senders email message.

		See `Wikipedia - DNSBL <https://en.wikipedia.org/wiki/DNSBL>`_ for more information.

	Free Mail
		Addresses served by popular :term:`B2C` service providers such as Hotmail, Yahoo, Live, AOL, Gmail and so on.

	IP Address
		**Internet Protocol** Address

		See `Wikipedia - IP Address <https://en.wikipedia.org/wiki/IP_address>`_ for more information.

	ISO 3166
		International standard for country codes.

		See `Country Codes - ISO 3166 <http://www.iso.org/iso/country_codes>`_ for more information.

	ms
		Milliseconds.

	MX
		**Mail Exchanger**

		The MX is a server responsible for email interchange with a client.

	NDR
		**Non Delivery Report**

		A message that is returned to sender stating that delivery of an email address was not possible.

		See `Wikipedia - Bounce message <https://en.wikipedia.org/wiki/Bounce_message>`_ for more information.

	Office 365
		Office 365 mail servers (e.g. x-com.mail.protection.outlook.com) are always configured
		with the catch all policy, accepting all emails sent to the domain and redirecting them
		to a central email box for manual inspection. Catch all configured servers cannot
		respond to requests for email address verification.

		This does not affect our coverage of Hotmail, Live and Outlook mailboxes.

	Punycode
		Punycode is a way to represent Unicode with the limited character
		subset of ASCII supported by the Domain Name System.

		See `Wikipedia - Punycode <https://en.wikipedia.org/wiki/Punycode>`_ for more information.

	RESTful
		**Representational state transfer**

		See `Wikipedia - RESTful <https://en.wikipedia.org/wiki/Representational_state_transfer>`_
		for further information.

	Role Address
		A role address is a generic mailbox such as info@<domain>, sales@<domain> used by organizations to manage email messages of similar
		organizational types. For example, email messages sent to sales@<domain> can be routed to an organizations sales team where a team of sales
		people can deal with enquiries.

		Role addresses allow collaborative working based on groups rathert than indiviidual mailboxes.

	SLA
		**Service Level Agreement**

		See `Wikipedia - SLA <https://en.wikipedia.org/wiki/Service-level_agreement>`_ for more information and description of SLA.

		See our `Service Level Agreement`_.

	SMTP
		**Simple Mail Transport Protocol**

		SMTP is a protocol. It is the sequence of commands and responses between a client (the
		software sending an email) and server (the software receiving an email) that facilitates
		the sending and receiving of email between computer based email messaging systems.

	Spam Trap
		Spam traps are email addresses used for the sole purpose of detecting spamming activities.

		Spam traps are used by many block lists (:term:`DNSBL`) to detect spammers.

		For more information, see `Wikipedia - Spam Traps <https://en.wikipedia.org/wiki/Spamtrap>`_.


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/dialogflow/v2/intent.proto

namespace Google\Cloud\Dialogflow\V2;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent].
 *
 * Generated from protobuf message google.cloud.dialogflow.v2.CreateIntentRequest
 */
class CreateIntentRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The agent to create a intent for.
     * Format: `projects/<Project ID>/agent`.
     *
     * Generated from protobuf field string parent = 1;
     */
    private $parent = '';
    /**
     * Required. The intent to create.
     *
     * Generated from protobuf field .google.cloud.dialogflow.v2.Intent intent = 2;
     */
    private $intent = null;
    /**
     * Optional. The language of training phrases, parameters and rich messages
     * defined in `intent`. If not specified, the agent's default language is
     * used. [More than a dozen
     * languages](https://dialogflow.com/docs/reference/language) are supported.
     * Note: languages must be enabled in the agent, before they can be used.
     *
     * Generated from protobuf field string language_code = 3;
     */
    private $language_code = '';
    /**
     * Optional. The resource view to apply to the returned intent.
     *
     * Generated from protobuf field .google.cloud.dialogflow.v2.IntentView intent_view = 4;
     */
    private $intent_view = 0;

    public function __construct() {
        \GPBMetadata\Google\Cloud\Dialogflow\V2\Intent::initOnce();
        parent::__construct();
    }

    /**
     * Required. The agent to create a intent for.
     * Format: `projects/<Project ID>/agent`.
     *
     * Generated from protobuf field string parent = 1;
     * @return string
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * Required. The agent to create a intent for.
     * Format: `projects/<Project ID>/agent`.
     *
     * Generated from protobuf field string parent = 1;
     * @param string $var
     * @return $this
     */
    public function setParent($var)
    {
        GPBUtil::checkString($var, True);
        $this->parent = $var;

        return $this;
    }

    /**
     * Required. The intent to create.
     *
     * Generated from protobuf field .google.cloud.dialogflow.v2.Intent intent = 2;
     * @return \Google\Cloud\Dialogflow\V2\Intent
     */
    public function getIntent()
    {
        return $this->intent;
    }

    /**
     * Required. The intent to create.
     *
     * Generated from protobuf field .google.cloud.dialogflow.v2.Intent intent = 2;
     * @param \Google\Cloud\Dialogflow\V2\Intent $var
     * @return $this
     */
    public function setIntent($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent::class);
        $this->intent = $var;

        return $this;
    }

    /**
     * Optional. The language of training phrases, parameters and rich messages
     * defined in `intent`. If not specified, the agent's default language is
     * used. [More than a dozen
     * languages](https://dialogflow.com/docs/reference/language) are supported.
     * Note: languages must be enabled in the agent, before they can be used.
     *
     * Generated from protobuf field string language_code = 3;
     * @return string
     */
    public function getLanguageCode()
    {
        return $this->language_code;
    }

    /**
     * Optional. The language of training phrases, parameters and rich messages
     * defined in `intent`. If not specified, the agent's default language is
     * used. [More than a dozen
     * languages](https://dialogflow.com/docs/reference/language) are supported.
     * Note: languages must be enabled in the agent, before they can be used.
     *
     * Generated from protobuf field string language_code = 3;
     * @param string $var
     * @return $this
     */
    public function setLanguageCode($var)
    {
        GPBUtil::checkString($var, True);
        $this->language_code = $var;

        return $this;
    }

    /**
     * Optional. The resource view to apply to the returned intent.
     *
     * Generated from protobuf field .google.cloud.dialogflow.v2.IntentView intent_view = 4;
     * @return int
     */
    public function getIntentView()
    {
        return $this->intent_view;
    }

    /**
     * Optional. The resource view to apply to the returned intent.
     *
     * Generated from protobuf field .google.cloud.dialogflow.v2.IntentView intent_view = 4;
     * @param int $var
     * @return $this
     */
    public function setIntentView($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\IntentView::class);
        $this->intent_view = $var;

        return $this;
    }

}

redpajama_set_name: RedPajamaGithub


text:
HospitalCharges::HospitalCharges()
{
    cout << "Inside of HospitalCharges Constructor" << endl;
}

HospitalCharges::HospitalCharges(double pharmacyCharges, double doctorFees, double roomCharges, double xRayCharges)
{
    this->pharmacyCharges = pharmacyCharges;
    this->doctorFees = doctorFees;
    this->roomCharges = roomCharges;
    this->xRayCharges = xRayCharges;
}

void HospitalCharges::printCharges() const
{
    cout << fixed << showpoint << setprecision(2);
    cout << setfill(' ') << setw(10) << "" << "Pharmacy Charges: " << "$" << pharmacyCharges << endl;
    cout << setfill(' ') << setw(10) << "" << "Doctor Fees: " << setw(7) << "$" << doctorFees << endl;
    cout << setfill(' ') << setw(10) << "" << "Room Charges: " << setw(7) << "$" << roomCharges << endl;;
    cout << setfill(' ') << setw(10) << "" << "x-Ray Charges: " << setw(6) << "$" << xRayCharges << endl;;
}

HospitalCharges::~HospitalCharges()
{
    cout << "Inside of HospitalCharges Destructor" << endl;
}


text: YUI.add("axis-stacked",function(e,t){e.StackedAxis=e.Base.create("stackedAxis",e.NumericAxis,[e.StackedImpl])},"3.16.0",{requires:["axis-numeric","axis-stacked-base"]});


text:
from m5.SimObject import SimObject
from ClockedObject import ClockedObject

from m5.params import *
from m5.objects import ThermalDomain

# Represents a thermal node
class ThermalNode(SimObject):
    type = 'ThermalNode'
    cxx_header = "sim/power/thermal_model.hh"

# Represents a thermal resistor
class ThermalResistor(SimObject):
    type = 'ThermalResistor'
    cxx_header = "sim/power/thermal_model.hh"

    @classmethod
    def export_methods(cls, code):
        code('''
      void setNodes(ThermalNode * node1, ThermalNode * node2);
''')

    resistance = Param.Float(1.0, "Thermal resistance, expressed in Kelvin per Watt")

# Represents a thermal capacitor
class ThermalCapacitor(SimObject):
    type = 'ThermalCapacitor'
    cxx_header = "sim/power/thermal_model.hh"

    @classmethod
    def export_methods(cls, code):
        code('''
      void setNodes(ThermalNode * node1, ThermalNode * node2);
''')

    capacitance = Param.Float(1.0, "Thermal capacitance, expressed in Joules per Kelvin")

# Represents a fixed temperature node (ie. air)
class ThermalReference(SimObject, object):
    type = 'ThermalReference'
    cxx_header = "sim/power/thermal_model.hh"

    @classmethod
    def export_methods(cls, code):
        code('''
      void setNode(ThermalNode * node);
''')

    # Static temperature which may change over time
    temperature = Param.Float(25.0, "Operational temperature in Celsius")

# Represents a thermal capacitor
class ThermalModel(ClockedObject):
    type = 'ThermalModel'
    cxx_header = "sim/power/thermal_model.hh"

    @classmethod
    def export_methods(cls, code):
        code('''
      void addCapacitor(ThermalCapacitor *obj);
      void addResistor(ThermalResistor *obj);
      void addReference(ThermalReference *obj);
      void addDomain(ThermalDomain *obj);
      void addNode(ThermalNode *obj);
      void doStep();
''')

    step = Param.Float(0.01, "Simulation step (in seconds) for thermal simulation")

    def populate(self):
        if not hasattr(self,"_capacitors"): self._capacitors = []
        if not hasattr(self,"_resistors"): self._resistors = []
        if not hasattr(self,"_domains"): self._domains = []
        if not hasattr(self,"_references"): self._references = []
        if not hasattr(self,"_nodes"): self._nodes = []

    def init(self):
        self.populate()

        for ref, node in self._references:
            ref.getCCObject().setNode(node.getCCObject())
            self.getCCObject().addReference(ref.getCCObject())

        for dom, node in self._domains:
            dom.getCCObject().setNode(node.getCCObject())
            self.getCCObject().addDomain(dom.getCCObject())

        for cap, node1, node2 in self._capacitors:
            cap.getCCObject().setNodes(node1.getCCObject(), node2.getCCObject())
            self.getCCObject().addCapacitor(cap.getCCObject())

        for res, node1, node2 in self._resistors:
            res.getCCObject().setNodes(node1.getCCObject(), node2.getCCObject())
            self.getCCObject().addResistor(res.getCCObject())

        for node in self._nodes:
            self.getCCObject().addNode(node.getCCObject())

    def addCapacitor(self, cap, node1, node2):
        self.populate()
        self._capacitors.append( (cap, node1, node2) )
        self._parent.thermal_components.append(cap)
        self.addNodes(node1,node2)

    def addResistor(self, res, node1, node2):
        self.populate()
        self._resistors.append( (res, node1, node2) )
        self._parent.thermal_components.append(res)
        self.addNodes(node1,node2)

    def addReference(self, ref, node):
        self.populate()
        self._references.append( (ref, node) )
        self._parent.thermal_components.append(ref)
        self.addNodes(node)

    def addDomain(self, dom, node):
        self.populate()
        self._domains.append( (dom, node) )
        self.addNodes(node)

    def addNodes(self, *nodes):
        for node in nodes:
            if node not in self._nodes:
                self._nodes.append(node)
                self._parent.thermal_components.append(node)

    def doStep(self):
        self.getCCObject().doStep()


text:
<Record>
<Term>Eyelid Diseases</Term>
<SemanticType>Disease or Syndrome</SemanticType>
<ParentTerm>Eye Diseases</ParentTerm>
<ClassificationPath>Eye Diseases/Eyelid Diseases</ClassificationPath>
<BroaderTerm>Eyelid Diseases</BroaderTerm>
<BroaderTerm>Eye Diseases</BroaderTerm>
<ChildTerm>Blepharitis</ChildTerm>
<ChildTerm>Blepharoptosis</ChildTerm>
<ChildTerm>Blepharospasm</ChildTerm>
<ChildTerm>Ectropion</ChildTerm>
<ChildTerm>Entropion</ChildTerm>
<ChildTerm>Eyelid Neoplasms</ChildTerm>
<ChildTerm>Blepharophimosis</ChildTerm>
<ChildTerm>Chalazion</ChildTerm>
<ChildTerm>Hordeolum</ChildTerm>
<Synonym>Eyelid Diseases</Synonym>
<Synonym>Eyelid Disease</Synonym>
<Source>MeSH</Source>
</Record>


text:
/**
 * @description sticky封装
 * @author qianyun
 * @augments {sticky ele classname}
 *
 * @done sticky 基本功能完成
 *				支持多组sticky控件
 *				设置无限大
 *
 * @param
 * 		'infinity': '无限高,默认为false, 开启可以用来做Ajax吸顶,yeah'
 *		, 'checkEle': '检查sticky元素是否有设置样式'
 *
		sticky.init('.sticky', {
			'infinity' : false
			, 'checkEle' : true
		}
 *
 */
;(function($, window, document){
	var stickyIndex = 0

	function getParentId(){
		var id = '#wrap_ykcits_' + stickyIndex
		stickyIndex += 1
		return id
	}

	function getIntValue($ele, style_name){
		return parseInt($ele.css(style_name), 10) || 0
	}

	var Sticky = function(ele, options){
		this.$ele = $(ele)
		this.$win = $(window)
		this.options = options
		this.endPos = 0
		this.fixTop = 0
		this.fixLeft = 0
		this.startPos = 0
		this.bottomTop = 0
		this.marginB = 0
		this.marginT = 0
		this.useFixedFlag = true
	}

	Sticky.prototype = {
		defaults: {
			'infinity': false
			, 'checkEle': true
			, 'sticky_top': undefined
			, 'sticky_left': undefined
		},

		init: function(){
			var _self = this

			_self.config = $.extend({}, _self.defaults, _self.options)

			_self.fixTop = _self.config.sticky_top
			if(_self.fixTop == 'auto'){ _self.useFixedFlag = false }
			_self.fixLeft = _self.config.sticky_left

			if(!_self.hasSticky()){
				_self.useFixed()
			} else {
				_self.stickyCssAdd()
			}

			return _self
		},

		hasSticky: function(){
			var element = document.createElement('div')

			if ('position' in element.style){
				element.style['position'] = '-webkit-sticky'
				element.style['position'] = '-moz-sticky'
				element.style['position'] = '-o-sticky'
				element.style['position'] = '-ms-sticky'
				element.style['position'] = 'sticky'
				return element.style['position'].indexOf('sticky') > -1
			} else {
				return false
			}
		},

		stickyCssAdd: function(){
			var _self = this

			_self.$ele
				.css('position', 'sticky')
				.css({
					'position': '-webkit-sticky'
					, 'left': _self.fixLeft
					, 'top': _self.fixTop
				})
		},

		useFixed: function(){
			var _self = this

			_self.eleInit()
				.parentInit()

			if(!_self.useFixedFlag) return _self

			_self.setPos()
				.handleScroll()
				.bindEvents()

			return _self
		},

		eleInit: function(){
			var _self = this

			if(!_self.config.checkEle) return false

			var $ele = _self.$ele
				, top = $ele.css('top')
				, left = $ele.css('left')
				, width = $ele.css('width')
				, ele_style = {}

			if(top == 'auto'){
				_self.useFixedFlag = false
			}

			ele_style['top'] = top == 'auto' ? 0 : top
			ele_style['left'] = left == 'auto' ? 0 : left
			ele_style['width'] = width

			ele_style['border'] = $ele.css('border')
			ele_style['padding'] = $ele.css('padding')
			ele_style['z-index'] = $ele.css('position', 'relative').css('z-index')
			$ele.css('position', 'static')

			_self.fixLeft = $ele.offset().left

			$ele.css(ele_style)

			// 计算正确的左右位置,必须在父元素框内
			var fixML = 0
				, style_l = parseInt(left, 10) || 0
				, style_pw = getIntValue(_self.$ele.parent(), 'width')
				, style_w = parseInt(width, 10) || 0
				, ele_left = _self.fixLeft

			if(style_l > ele_left){
				if(style_w < style_pw){
					var max_ml = style_pw - style_w
						, dd_ml = style_l - ele_left

					fixML = dd_ml < max_ml ? dd_ml : max_ml - ele_left
				}

				$ele.css('margin-left', fixML)
			}

			return _self
		},

		parentInit: function(){
			var _self = this
				, $ele = _self.$ele
				, $parent

			// getParentId()之后 stickyIndex 会自动加1
			_self.stickyIndex = stickyIndex

			$ele.wrapAll('

')

			$parent = $ele.parents('.sticky_ele_copy')
			$parent.css('float', $ele.css('float'))
			$parent.css({'height': $parent.height(), 'width': $ele.width(), 'overflow': 'visible', 'margin-top': $ele.css('margin-top'), 'margin-bottom': $ele.css('margin-bottom')})

			_self.$parent = $parent

			return _self
		},

		handleScroll: function(){
			var _self = this
				, winPos = _self.$win.scrollTop()
				, ele_style = {
					'position' : 'fixed'
					, 'top' : 0
					, 'left' : 0
					, 'margin-top' : 0
				}

			if(_self.config.infinity){
				if(winPos > _self.startPos){
					ele_style['top'] = _self.fixTop
					ele_style['left'] = _self.fixLeft
				} else {
					ele_style['position'] = 'static'
					ele_style['margin-top'] = _self.marginT
				}
			} else {
				if(winPos > _self.endPos){
					ele_style['position'] = 'absolute'
					ele_style['top'] = _self.bottomTop
				} else if(winPos < _self.startPos) {
					ele_style['position'] = 'static'
					ele_style['margin-top'] = _self.marginT
				} else if(winPos < _self.endPos && winPos > _self.startPos){
					ele_style['top'] = _self.fixTop
					ele_style['left'] = _self.fixLeft
				}
			}

			_self.$ele.css(ele_style)

			return _self
		},

		handleResize: function(){
			var _self = this

			_self.setPos()
		},

		setPos: function(){
			var _self = this
				, $ele = _self.$ele

			_self.marginT = getIntValue($ele, 'margin-top')
			_self.marginB = getIntValue($ele, 'margin-bottom')
			_self.fixTop = getIntValue($ele, 'top')

			_self.startPos = _self.$parent.offset().top - _self.fixTop

			var container = _self.$parent.parent()
				, containerPt = getIntValue(container, 'padding-top')
				, containerPb = getIntValue(container, 'padding-bottom')
				, containerBt = getIntValue(container, 'border-top')
				, containerBb = getIntValue(container, 'border-bottom')
				, eleH = _self.$ele.height()
				, containerH = container.height()
				, containerT = container.offset().top

			_self.endPos = containerH - containerPb - containerBb - eleH + containerT - _self.marginB - _self.fixTop
			_self.bottomTop = _self.endPos - _self.startPos

			return _self
		},

		bindEvents: function() {
			var _self = this;

			_self.$win.on('scroll.sticky' + _self.stickyIndex, $.proxy(_self.handleScroll, _self));
			_self.$win.on('resize.sticky' + _self.stickyIndex, $.proxy(_self.handleResize, _self));

			return _self
		},

		destroy: function(){
			var _self = this;

			if(!_self.hasSticky()){
				_self.$win.off('scroll.sticky' + _self.stickyIndex);
				_self.$win.off('resize.sticky' + _self.stickyIndex);
			} else {
				var old_style = _self.$ele.attr('style')

				if(typeof old_style == 'string'){
					old_style = old_style.replace(/position:.*;/g, '')

					_self.$ele.attr('style', old_style)
				}
			}
		}
	}

	$.fn.stick = function(options){
		this.destroy = function(){
			this.each(function(){
				new Sticky(this, options).destroy()
			})
		}

		this.reset = function(){
			this.each(function(){
				new Sticky(this, options).resize()
			})
		}

		return this.each(function(){
			new Sticky(this, options).init()
		})
	}
})(Zepto, window, document)


text:
[![Build Status](https://travis-ci.org/andela-pbirir/CP2-DMS.svg?branch=develop)](https://travis-ci.org/andela-pbirir/CP2-DMS)
[![Coverage Status](https://coveralls.io/repos/github/andela-pbirir/CP2-DMS/badge.svg?branch=develop)](https://coveralls.io/github/andela-pbirir/CP2-DMS?branch=develop)

# Document Managemet System
Document management system is a simple API used to track, manage and store documents.

Development
-----------
The application was developed with [NodeJs](http://nodejs.org) while using [Express](http://expressjs.com) for routing. The [Postgres](http://postgresql.com) database was used with [sequelize](http://sequelizejs.com) as the ORM

Installation
------------
Make sure that  you have [NodeJs](http://nodejs.org) and [Postgres](http://postgresql.com) installed
1.  Clone the repository
```
git@github.com:puritybirir/CP2-DMS.git

```
3.  Navigate to the directory.
4.  Install the project  dependencies using
```
npm install

```
5.  Run tests
```
npm test

```
6. create an environment file that will be read by the
project everytime it starts up by running and set the secret key and salt rounds
```
SECRET="coolSecret"
SALTROUNDS=10

```

## API ENDPOINTS
**Users**

Request      | Endpoint | Description
-------------| -------- | ------
POST | [/users/login](#login) | Logs a user in.
POST | [/users/logout](#logout) | Logs a user out.
POST | [/users](#create-users) |Creates a new user.
GET | [/users](#get-users) | Find matching instances of user.
GET | [/users/?limit={integer}&offset={integer}](#paginate-users)|Pagination for users.
GET | [/users/:id](#find-user) |  Find user.
PUT | [/users/:id](#update-user) | Update user attributes.
DELETE | [/users/:id](#delete-user) | Delete user.
GET | [/search/users/?q={username}](#search-for-user) | Search for a user.
POST | [/documents](#create-document) | Creates a new document instance.
GET | [/documents](#get-documents) | Find matching instances of document.
GET | [/documents/?limit={integer}&offset={integer}}](#paginate-docs)|Pagination for docs.
GET | [/documents/:id](#find-document) | Find document.
PUT | [/documents/:id](#update-document) | Update document attributes.
DELETE | [/documents/:id](#delete-document) | Delete document.
GET | [/users/:id/documents](#get-documents-by-user) | Find all documents belonging to the user.
GET | [/search/documents/?q={doctitle}}](#search-for-doc) | Search for a doc.
POST | [/role](#create-role) | Creates a new role
GET | [/roles/:id](#get-roles) | Finds one specific role
UPDATE | [/roles/:id](#get-roles) | Updates a role
GET | [/roles](#get-roles) | Lists all the roles
DELETE | [/roles/:id](#get-roles) | Deletes a specific role by id.


text:
/**
 * @fileoverview Helper methods that operate on Map-like objects (e.g. ES6
 * Maps).
 */

goog.module('goog.collections.maps');
goog.module.declareLegacyNamespace();

/**
 * A MapLike implements the same public interface as an ES6 Map, without tying
 * the underlying code directly to the implementation. Any additions to this
 * type should also be present on ES6 Maps.
 * @template K,V
 * @record
 */
class MapLike {
  constructor() {
    /** @const {number} The number of items in this map. */
    this.size;
  }

  /**
   * @param {K} key The key to set in the map.
   * @param {V} val The value to set for the given key in the map.
   */
  set(key, val) {};

  /**
   * @param {K} key The key to retrieve from the map.
   * @return {V|undefined} The value for this key, or undefined if the key is
   *     not present in the map.
   */
  get(key) {};

  /**
   * @return {!IteratorIterable<K>} An ES6 Iterator that iterates over the keys
   *     in the map.
   */
  keys() {};

  /**
   * @return {!IteratorIterable<V>} An ES6 Iterator that iterates over the
   *     values in the map.
   */
  values() {};

  /**
   * @param {K} key The key to check.
   * @return {boolean} True iff this key is present in the map.
   */
  has(key) {};
}
exports.MapLike = MapLike;

/**
 * Iterates over each entry in the given entries and sets the entry in
 * the map, overwriting any existing entries for the key.
 * @param {!MapLike<K,V>} map The map to set entries on.
 * @param {?Iterable<!Array<K|V>>} entries The iterable of entries. This
 *     iterable should really be of type Iterable<Array<[K,V]>>, but the tuple
 *     type is not representable in the Closure Type System.
 * @template K,V
 */
function setAll(map, entries) {
  if (!entries) return;
  for (const [k, v] of entries) {
    map.set(k, v);
  }
}
exports.setAll = setAll;

/**
 * Determines if a given map contains the given value, optionally using
 * a custom comparison function.
 * @param {!MapLike<?,V1>} map The map whose values to check.
 * @param {V2} val The value to check for.
 * @param {(function(V1,V2): boolean)=} valueEqualityFn The comparison function
 *     used to determine if the given value is equivalent to any of the values
 *     in the map. If no function is provided, defaults to strict equality
 *     (===).
 * @return {boolean} True iff the given map contains the given value according
 *     to the comparison function.
 * @template V1,V2
 */
function hasValue(map, val, valueEqualityFn = defaultEqualityFn) {
  for (const v of map.values()) {
    if (valueEqualityFn(v, val)) return true;
  }
  return false;
}
exports.hasValue = hasValue;

/** @const {function(?,?): boolean} */
const defaultEqualityFn = (a, b) => a === b;

/**
 * Compares two maps using their public APIs to determine if they have
 * equal contents, optionally using a custom comparison function when comaring
 * values.
 * @param {!MapLike<K,V1>} map The first map
 * @param {!MapLike<K,V2>} otherMap The other map
 * @param {(function(V1,V2): boolean)=} valueEqualityFn The comparison function
 *     used to determine if the values obtained from each map are equivalent. If
 *     no function is provided, defaults to strict equality (===).
 * @return {boolean}
 * @template K,V1,V2
 */
function equals(map, otherMap, valueEqualityFn = defaultEqualityFn) {
  if (map === otherMap) return true;
  if (map.size !== otherMap.size) return false;
  for (const key of map.keys()) {
    if (!otherMap.has(key)) return false;
    if (!valueEqualityFn(map.get(key), otherMap.get(key))) return false;
  }
  return true;
}
exports.equals = equals;

/**
 * Returns a new ES6 Map in which all the keys and values from the
 * given map are interchanged (keys become values and values become keys). If
 * multiple keys in the given map to the same value, the resulting value in the
 * transposed map is implementation-dependent.
 *
 * It acts very similarly to {goog.object.transpose(Object)}.
 * @param {!MapLike<K,V>} map The map to transpose.
 * @return {!Map<V,K>} A transposed version of the given map.
 * @template K,V
 */
function transpose(map) {
  const /** !Map<V,K> */ transposed = new Map();
  for (const key of map.keys()) {
    const val = map.get(key);
    transposed.set(val, key);
  }
  return transposed;
}
exports.transpose = transpose;

/**
 * ToObject returns a new object whose properties are the keys from the Map.
 * @param {!MapLike<K,V>} map The map to convert into an object.
 * @return {!Object<K,V>} An object representation of the Map.
 * @template K,V
 */
function toObject(map) {
  const /** !Object<K,V> */ obj = {};
  for (const key of map.keys()) {
    obj[key] = map.get(key);
  }
  return obj;
}
exports.toObject = toObject;


text:
Since 1.3.0:

* The Jenkins launcher is replaced with Gearman launcher.  An internal
  Gearman server is provided, and there is a Gearman plugin for
  Jenkins, so migration to the new system should be fairly
  straightforward.  See the Launchers section of the documentation for
  details.

* The custom parameter function signature has changed.  It now takes a
  QueueItem as the first argument, rather than the Change.  The
  QueueItem has the full context for why the change is being run
  (including the pipeline, items ahead and behind, etc.).  The Change
  is still available via the "change" attribute on the QueueItem.  The
  second argument is now the Job that is about to be run, and the
  parameter dictionary is shifted to the third position.

* The ZUUL_SHORT_* parameters have been removed (the same
  functionality may be achieved with a custom parameter function that
  matches all jobs).

* Multiple triggers are now supported (currently Gerrit and a simple
  Timer trigger ar supported).  Your layout.yaml file will need to
  change to add the key "gerrit:" inside of the "triggers:" list to
  specify a Gerrit trigger (and facilitate adding other kinds of
  triggers later).  See the sample layout.yaml and Zuul section of the
  documentation.

* Some statsd keys have changed in a backwards incompatible way:
  * The counters and timers of the form zuul.job.{name} is now split
    into several keys of the form:
    zuul.pipeline.{pipeline-name}.job.{job-name}.{result}
  * Job names in statsd keys now have the '_' character substituted
    for the '.' character.

* The layout.yaml structure has changed to introduce configurable
  reporters. This requires restructuring the start/success/failure
  actions to include a dictionary of reporters and their parameters.
  See reporters in the docs and layout.yaml-sample.

* The zuul_url configuration option is required in zuul.conf.  It
  specifies the URL of the git repositories that should be used by
  workers when fetching Zuul refs and is passed to the workers as the
  ZUUL_URL parameter.  It should probably be set to
  "http://zuul-host-name/p/".


text:
<?php

class Solarium_ClientTest extends PHPUnit_Framework_TestCase
{

    /**
     * @var Solarium_Client
     */
    protected $_client;

    public function setUp()
    {
        $this->_client = new Solarium_Client();
    }

    public function testConfigMode()
    {
        $options = array(
            'adapter' => 'MyAdapter',
            'adapteroptions' => array(
                'host' => 'myhost',
                'port' => 8080,
            ),
            'querytype' => array(
                'myquerytype' => array(
                    'query'          => 'MyQuery',
                    'requestbuilder' => 'MyRequestBuilder',
                    'responseparser' => 'MyResponseParser'
                )
            ),
            'plugin' => array(
                'myplugin' => array(
                    'plugin' => 'MyClientPlugin',
                    'options' => array(
                        'option1' => 'value1',
                        'option2' => 'value2',
                    )
                )
            ),
        );

        $this->_client->setOptions($options);

        $adapter = $this->_client->getAdapter();

        $this->assertThat($adapter, $this->isInstanceOf('MyAdapter'));
        $this->assertEquals(8080, $adapter->getPort());

        $queryTypes = $this->_client->getQueryTypes();
        $this->assertEquals(
            $options['querytype']['myquerytype'],
            $queryTypes['myquerytype']
        );

        $plugin = $this->_client->getPlugin('myplugin');
        $this->assertThat($plugin, $this->isInstanceOf('MyClientPlugin'));
        $this->assertEquals($options['plugin']['myplugin']['options'], $plugin->getOptions());

    }

    public function testConfigModeWithoutKeys()
    {
        $options = array(
            'adapter' => 'MyAdapter',
            'adapteroptions' => array(
                'host' => 'myhost',
                'port' => 8080,
            ),
            'querytype' => array(
                array(
                    'type'           => 'myquerytype',
                    'query'          => 'MyQuery',
                    'requestbuilder' => 'MyRequestBuilder',
                    'responseparser' => 'MyResponseParser',
                )
            ),
            'plugin' => array(
                 array(
                    'key'     => 'myplugin',
                    'plugin'  => 'MyClientPlugin',
                    'options' => array(
                        'option1' => 'value1',
                        'option2' => 'value2',
                    )
                )
            ),
        );

        $this->_client->setOptions($options);

        $adapter = $this->_client->getAdapter();

        $this->assertThat($adapter, $this->isInstanceOf('MyAdapter'));
        $this->assertEquals(8080, $adapter->getPort());

        $queryTypes = $this->_client->getQueryTypes();
        $this->assertEquals(
            array(
                'requestbuilder' => 'MyRequestBuilder',
                'responseparser' => 'MyResponseParser',
                'query'          => 'MyQuery',
            ),
            $queryTypes['myquerytype']
        );

        $plugin = $this->_client->getPlugin('myplugin');
        $this->assertThat($plugin, $this->isInstanceOf('MyClientPlugin'));
        $this->assertEquals($options['plugin'][0]['options'], $plugin->getOptions());
    }

    public function testSetAndGetAdapterWithDefaultAdapter()
    {
        $defaultAdapter = $this->_client->getOption('adapter');
        $adapter = $this->_client->getAdapter();
        $this->assertThat($adapter, $this->isInstanceOf($defaultAdapter));
    }

    public function testSetAndGetAdapterWithString()
    {
        $adapterClass = 'MyAdapter';
        $this->_client->setAdapter($adapterClass);
        $this->assertThat($this->_client->getAdapter(), $this->isInstanceOf($adapterClass));
    }

    public function testSetAndGetAdapterWithObject()
    {
        $adapterClass = 'MyAdapter';
        $this->_client->setAdapter(new $adapterClass);
        $this->assertThat($this->_client->getAdapter(), $this->isInstanceOf($adapterClass));
    }

    public function testRegisterQueryTypeAndGetQueryTypes()
    {
        $queryTypes = $this->_client->getQueryTypes();

        $this->_client->registerQueryType('myquerytype','myquery','mybuilder','myparser');

        $queryTypes['myquerytype'] = array(
            'query' => 'myquery',
            'requestbuilder' => 'mybuilder',
            'responseparser' => 'myparser',
        );

        $this->assertEquals(
            $queryTypes,
            $this->_client->getQueryTypes()
        );
    }

    public function testRegisterAndGetPlugin()
    {
        $options = array('option1' => 1);
        $this->_client->registerPlugin('testplugin','MyClientPlugin',$options);

        $plugin = $this->_client->getPlugin('testplugin');

        $this->assertThat(
            $plugin,
            $this->isInstanceOf('MyClientPlugin')
        );

        $this->assertEquals(
            $options,
            $plugin->getOptions()
        );
    }

    public function testRegisterInvalidPlugin()
    {
        $this->setExpectedException('Solarium_Exception');
        $this->_client->registerPlugin('testplugin','StdClass');
    }

    public function testGetInvalidPlugin()
    {
        $this->assertEquals(
            null,
            $this->_client->getPlugin('invalidplugin', false)
        );
    }

    public function testAutoloadPlugin()
    {
        $loadbalancer = $this->_client->getPlugin('loadbalancer');
        $this->assertThat(
            $loadbalancer,
            $this->isInstanceOf('Solarium_Plugin_Loadbalancer')
        );
    }

    public function testAutoloadInvalidPlugin()
    {
        $this->setExpectedException('Solarium_Exception');
        $this->_client->getPlugin('invalidpluginname');
    }

    public function testRemoveAndGetPlugins()
    {
        $options = array('option1' => 1);
        $this->_client->registerPlugin('testplugin','MyClientPlugin',$options);

        $plugin = $this->_client->getPlugin('testplugin');
        $plugins = $this->_client->getPlugins();

        $this->assertEquals(
            array('testplugin' => $plugin),
            $plugins
        );

        $this->_client->removePlugin('testplugin');
        $plugins = $this->_client->getPlugins();

        $this->assertEquals(
            array(),
            $plugins
        );
    }

    public function testRemovePluginAndGetPluginsWithObjectInput()
    {
        $options = array('option1' => 1);
        $this->_client->registerPlugin('testplugin','MyClientPlugin',$options);

        $plugin = $this->_client->getPlugin('testplugin');
        $plugins = $this->_client->getPlugins();

        $this->assertEquals(
            array('testplugin' => $plugin),
            $plugins
        );

        $this->_client->removePlugin($plugin);
        $plugins = $this->_client->getPlugins();

        $this->assertEquals(
            array(),
            $plugins
        );
    }

    public function testCreateRequest()
    {
        $queryStub = $this->getMock('Solarium_Query_Select');
        $queryStub->expects($this->any())
             ->method('getType')
             ->will($this->returnValue('testquerytype'));

        $observer = $this->getMock('Solarium_Client_RequestBuilder', array('build'));
        $observer->expects($this->once())
                 ->method('build')
                 ->with($this->equalTo($queryStub));

        $this->_client->registerQueryType('testquerytype', 'Solarium_Query_Select', $observer, '');
        $this->_client->createRequest($queryStub);
    }

    public function testCreateRequestInvalidQueryType()
    {
        $queryStub = $this->getMock('Solarium_Query_Select');
        $queryStub->expects($this->any())
             ->method('getType')
             ->will($this->returnValue('testquerytype'));

        $this->setExpectedException('Solarium_Exception');
        $this->_client->createRequest($queryStub);
    }

    public function testCreateRequestPrePlugin()
    {
        $query = new Solarium_Query_Select();

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preCreateRequest')
                 ->with($this->equalTo($query));

        $this->_client->registerPlugin('testplugin', $observer);
        $this->_client->createRequest($query);
    }

    public function testCreateRequestPostPlugin()
    {
        $query = new Solarium_Query_Select();
        $request = $this->_client->createRequest($query);

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('postCreateRequest')
                 ->with($this->equalTo($query),$this->equalTo($request));

        $this->_client->registerPlugin('testplugin', $observer);
        $this->_client->createRequest($query);
    }

    public function testCreateRequestWithOverridingPlugin()
    {
        $overrideValue =  'dummyvalue';
        $query = new Solarium_Query_Select();

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preCreateRequest')
                 ->with($this->equalTo($query))
                 ->will($this->returnValue($overrideValue));

        $this->_client->registerPlugin('testplugin', $observer);
        $request = $this->_client->createRequest($query);

        $this->assertEquals(
            $overrideValue,
            $request
        );
    }

    public function testCreateResult()
    {
        $query = new Solarium_Query_Select();
        $response = new Solarium_Client_Response('',array('HTTP 1.0 200 OK'));
        $result = $this->_client->createResult($query, $response);

        $this->assertThat(
            $result,
            $this->isInstanceOf($query->getResultClass())
        );
    }

    public function testCreateResultPrePlugin()
    {
        $query = new Solarium_Query_Select();
        $response = new Solarium_Client_Response('',array('HTTP 1.0 200 OK'));

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preCreateResult')
                 ->with($this->equalTo($query),$this->equalTo($response));

        $this->_client->registerPlugin('testplugin', $observer);
        $this->_client->createResult($query, $response);
    }

    public function testCreateResultPostPlugin()
    {
        $query = new Solarium_Query_Select();
        $response = new Solarium_Client_Response('',array('HTTP 1.0 200 OK'));
        $result = $this->_client->createResult($query, $response);

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('postCreateResult')
                 ->with($this->equalTo($query), $this->equalTo($response), $this->equalTo($result));

        $this->_client->registerPlugin('testplugin', $observer);
        $this->_client->createResult($query, $response);
    }

    public function testCreateResultWithOverridingPlugin()
    {
        $overrideValue =  'dummyvalue';
        $query = new Solarium_Query_Select();
        $response = new Solarium_Client_Response('',array('HTTP 1.0 200 OK'));

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preCreateResult')
                 ->with($this->equalTo($query), $this->equalTo($response))
                 ->will($this->returnValue($overrideValue));

        $this->_client->registerPlugin('testplugin', $observer);
        $result = $this->_client->createResult($query, $response);

        $this->assertEquals(
            $overrideValue,
            $result
        );
    }

    public function testExecute()
    {
        $query = new Solarium_Query_Ping();

        $observer = $this->getMock('Solarium_Client', array('createRequest','executeRequest','createResult'));

        $observer->expects($this->once())
                 ->method('createRequest')
                 ->with($this->equalTo($query))
                 ->will($this->returnValue('dummyrequest'));

        $observer->expects($this->once())
                 ->method('executeRequest')
                 ->with($this->equalTo('dummyrequest'))
                 ->will($this->returnValue('dummyresponse'));

        $observer->expects($this->once())
                 ->method('createResult')
                 ->with($this->equalTo($query),$this->equalTo('dummyresponse'));

        $observer->execute($query);
    }

    public function testExecutePrePlugin()
    {
        $query = new Solarium_Query_Ping();

        $mock = $this->getMock('Solarium_Client', array('createRequest','executeRequest','createResult'));

        $mock->expects($this->once())
             ->method('createRequest')
             ->will($this->returnValue('dummyrequest'));

        $mock->expects($this->once())
             ->method('executeRequest')
             ->will($this->returnValue('dummyresponse'));

        $mock->expects($this->once())
             ->method('createResult')
             ->will($this->returnValue('dummyresult'));

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preExecute')
                 ->with($this->equalTo($query));

        $mock->registerPlugin('testplugin', $observer);
        $mock->execute($query);
    }

    public function testExecutePostPlugin()
    {
        $query = new Solarium_Query_Ping();

        $mock = $this->getMock('Solarium_Client', array('createRequest','executeRequest','createResult'));

        $mock->expects($this->once())
             ->method('createRequest')
             ->will($this->returnValue('dummyrequest'));

        $mock->expects($this->once())
             ->method('executeRequest')
             ->will($this->returnValue('dummyresponse'));

        $mock->expects($this->once())
             ->method('createResult')
             ->will($this->returnValue('dummyresult'));

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('postExecute')
                 ->with($this->equalTo($query), $this->equalTo('dummyresult'));

        $mock->registerPlugin('testplugin', $observer);
        $mock->execute($query);
    }

    public function testExecuteWithOverridingPlugin()
    {
        $query = new Solarium_Query_Ping();

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preExecute')
                 ->with($this->equalTo($query))
                 ->will($this->returnValue('dummyoverride'));

        $this->_client->registerPlugin('testplugin', $observer);
        $result = $this->_client->execute($query);

        $this->assertEquals(
            'dummyoverride',
            $result
        );
    }

    public function testExecuteRequest()
    {
        $request = new Solarium_Client_Request();
        $dummyResponse = 'dummyresponse';

        $observer = $this->getMock('Solarium_Client_Adapter', array('execute'));
        $observer->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($request))
                 ->will($this->returnValue($dummyResponse));

        $this->_client->setAdapter($observer);
        $response = $this->_client->executeRequest($request);

        $this->assertEquals(
            $dummyResponse,
            $response
        );
    }

    public function testExecuteRequestPrePlugin()
    {
        $request = new Solarium_Client_Request();
        $dummyResponse = 'dummyresponse';

        $mockAdapter = $this->getMock('Solarium_Client_Adapter', array('execute'));
        $mockAdapter->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($request))
                 ->will($this->returnValue($dummyResponse));
        $this->_client->setAdapter($mockAdapter);

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preExecuteRequest')
                 ->with($this->equalTo($request));

        $this->_client->registerPlugin('testplugin', $observer);
        $this->_client->executeRequest($request);
    }

    public function testExecuteRequestPostPlugin()
    {
        $request = new Solarium_Client_Request();
        $dummyResponse = 'dummyresponse';

        $mockAdapter = $this->getMock('Solarium_Client_Adapter', array('execute'));
        $mockAdapter->expects($this->any())
                 ->method('execute')
                 ->with($this->equalTo($request))
                 ->will($this->returnValue($dummyResponse));
        $this->_client->setAdapter($mockAdapter);

        $response = $this->_client->executeRequest($request);

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('postExecuteRequest')
                 ->with($this->equalTo($request), $this->equalTo($response));

        $this->_client->registerPlugin('testplugin', $observer);
        $this->_client->executeRequest($request);
    }

    public function testExecuteRequestWithOverridingPlugin()
    {
        $request = new Solarium_Client_Request();
        $dummyOverride = 'dummyoverride';

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preExecuteRequest')
                 ->with($this->equalTo($request))
                    ->will($this->returnValue($dummyOverride));

        $this->_client->registerPlugin('testplugin', $observer);
        $response = $this->_client->executeRequest($request);

        $this->assertEquals(
            $dummyOverride,
            $response
        );
    }

    public function testPing()
    {
        $query = new Solarium_Query_Ping();

        $observer = $this->getMock('Solarium_Client', array('execute'));
        $observer->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($query));

        $observer->ping($query);
    }

    public function testSelect()
    {
        $query = new Solarium_Query_Select();

        $observer = $this->getMock('Solarium_Client', array('execute'));
        $observer->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($query));

        $observer->select($query);
    }

    public function testUpdate()
    {
        $query = new Solarium_Query_Update();

        $observer = $this->getMock('Solarium_Client', array('execute'));
        $observer->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($query));

        $observer->update($query);
    }

    public function testMoreLikeThis()
    {
        $query = new Solarium_Query_MoreLikeThis();

        $observer = $this->getMock('Solarium_Client', array('execute'));
        $observer->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($query));

        $observer->moreLikeThis($query);
    }

    public function testAnalyze()
    {
        $query = new Solarium_Query_Analysis_Field();

        $observer = $this->getMock('Solarium_Client', array('execute'));
        $observer->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($query));

        $observer->analyze($query);
    }

    public function testTerms()
    {
        $query = new Solarium_Query_Terms();

        $observer = $this->getMock('Solarium_Client', array('execute'));
        $observer->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($query));

        $observer->terms($query);
    }

    public function testSuggester()
    {
        $query = new Solarium_Query_Suggester();

        $observer = $this->getMock('Solarium_Client', array('execute'));
        $observer->expects($this->once())
                 ->method('execute')
                 ->with($this->equalTo($query));

        $observer->suggester($query);
    }

    public function testCreateQuery()
    {
        $options = array('optionA' => 1, 'optionB' => 2);
        $query = $this->_client->createQuery(Solarium_Client::QUERYTYPE_SELECT, $options);

        // check class mapping
        $this->assertThat($query, $this->isInstanceOf('Solarium_Query_Select'));

        // check option forwarding
        $queryOptions = $query->getOptions();
        $this->assertEquals(
            $options['optionB'],
            $queryOptions['optionB']
        );
    }

    public function testCreateQueryWithInvalidQueryType()
    {
        $this->setExpectedException('Solarium_Exception');
        $this->_client->createQuery('invalidtype');
    }

    public function testCreateQueryPrePlugin()
    {
        $type = Solarium_Client::QUERYTYPE_SELECT;
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preCreateQuery')
                 ->with($this->equalTo($type), $this->equalTo($options));

        $this->_client->registerPlugin('testplugin', $observer);
        $this->_client->createQuery($type, $options);
    }

    public function testCreateQueryWithOverridingPlugin()
    {
        $type = Solarium_Client::QUERYTYPE_SELECT;
        $options = array('optionA' => 1, 'optionB' => 2);
        $dummyvalue = 'test123';

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('preCreateQuery')
                 ->with($this->equalTo($type), $this->equalTo($options))
                 ->will($this->returnValue($dummyvalue));

        $this->_client->registerPlugin('testplugin', $observer);
        $query = $this->_client->createQuery($type, $options);

        $this->assertEquals(
            $dummyvalue,
            $query
        );
    }

    public function testCreateQueryPostPlugin()
    {
        $type = Solarium_Client::QUERYTYPE_SELECT;
        $options = array('optionA' => 1, 'optionB' => 2);
        $query = $this->_client->createQuery($type, $options);

        $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client,array()));
        $observer->expects($this->once())
                 ->method('postCreateQuery')
                 ->with($this->equalTo($type), $this->equalTo($options), $this->equalTo($query));

        $this->_client->registerPlugin('testplugin', $observer);
        $this->_client->createQuery($type, $options);
    }

    public function testCreateSelect()
    {
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Client', array('createQuery'));
        $observer->expects($this->once())
                 ->method('createQuery')
                 ->with($this->equalTo(Solarium_Client::QUERYTYPE_SELECT), $this->equalTo($options));

        $observer->createSelect($options);
    }

    public function testCreateUpdate()
    {
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Client', array('createQuery'));
        $observer->expects($this->once())
                 ->method('createQuery')
                 ->with($this->equalTo(Solarium_Client::QUERYTYPE_UPDATE), $this->equalTo($options));

        $observer->createUpdate($options);
    }

    public function testCreatePing()
    {
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Client', array('createQuery'));
        $observer->expects($this->once())
                 ->method('createQuery')
                 ->with($this->equalTo(Solarium_Client::QUERYTYPE_PING), $this->equalTo($options));

        $observer->createPing($options);
    }

    public function testCreateMoreLikeThis()
    {
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Client', array('createQuery'));
        $observer->expects($this->once())
                 ->method('createQuery')
                 ->with($this->equalTo(Solarium_Client::QUERYTYPE_MORELIKETHIS), $this->equalTo($options));

        $observer->createMoreLikeThis($options);
    }

    public function testCreateAnalysisField()
    {
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Client', array('createQuery'));
        $observer->expects($this->once())
                 ->method('createQuery')
                 ->with($this->equalTo(Solarium_Client::QUERYTYPE_ANALYSIS_FIELD), $this->equalTo($options));

        $observer->createAnalysisField($options);
    }

    public function testCreateAnalysisDocument()
    {
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Client', array('createQuery'));
        $observer->expects($this->once())
                 ->method('createQuery')
                 ->with($this->equalTo(Solarium_Client::QUERYTYPE_ANALYSIS_DOCUMENT), $this->equalTo($options));

        $observer->createAnalysisDocument($options);
    }

    public function testCreateTerms()
    {
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Client', array('createQuery'));
        $observer->expects($this->once())
                 ->method('createQuery')
                 ->with($this->equalTo(Solarium_Client::QUERYTYPE_TERMS), $this->equalTo($options));

        $observer->createTerms($options);
    }

    public function testCreateSuggester()
    {
        $options = array('optionA' => 1, 'optionB' => 2);

        $observer = $this->getMock('Solarium_Client', array('createQuery'));
        $observer->expects($this->once())
                 ->method('createQuery')
                 ->with($this->equalTo(Solarium_Client::QUERYTYPE_SUGGESTER), $this->equalTo($options));

        $observer->createSuggester($options);
    }

    public function testTriggerEvent()
    {
        $eventName = 'Test';
        $params = array('a', 'b');
        $override = true;

        $clientMock = $this->getMock('Solarium_Client', array('_callPlugins'));
        $clientMock->expects($this->once())
             ->method('_callPlugins')
             ->with($this->equalTo('event'.$eventName), $this->equalTo($params), $override);

        $clientMock->triggerEvent($eventName, $params, $override);
    }

}

class MyAdapter extends Solarium_Client_Adapter_Http{

    public function execute($request)
    {
        $response = new Solarium_Client_Response('{}', array('HTTP/1.1 200 OK'));
        return $response;
    }
}

class MyClientPlugin extends Solarium_Plugin_Abstract{

}


text:
title: Arrived in Perth
author: Greg
layout: post
permalink: /2007/03/arrived-in-perth/
comments: True
categories:
  - Uncategorized
---
I Arrived in Perth.


text:
layout: leaf-node
title: "Why Project Based Learning?"
title-url: "http://www.bie.org/about/why_pbl"
author: "n.a."
groups: pedagogical-styles
categories: project-based-learning
topics: introductory-resources
summary: >
    BIE explains why Project Based Learning should be used as a pedagogical style.
cite: >
    About BIE. (2017, April 24). Buck Institute for Education.
    Retrieved from http://www.bie.org/about/what_pbl
pub-date: 2017-04-24
added-date: 2017-04-24
resource-type: video
---


text:
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context
                           http://www.springframework.org/schema/context/spring-context.xsd">

  <context:component-scan base-package="pl.matsuo">
    <context:exclude-filter type="assignable" expression="pl.matsuo.gitlab.service.build.PartialBuilder"/>
    <context:exclude-filter type="assignable" expression="pl.matsuo.gitlab.service.build.BuildService"/>
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    <context:exclude-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice"/>
    <context:exclude-filter type="annotation" expression="pl.matsuo.gitlab.annotation.WebConfiguration"/>
  </context:component-scan>
</beans>


text:
// Copyright 2013 Care Zone Inc.
//
// Licensed 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.

#import <UIKit/UIKit.h>

@interface CZPhotoPreviewViewController : UIViewController

/**
 `CZPhotoPreviewViewController` shows an image to the user for review. It should act
 like the preview in Mail.app and Messages.app. It does not support pinch to zoom.

 @param anImage The `UIImage` to show. Will be presented aspect fit.
 @param chooseBlock Block to be called if choose/use button is tapped.
 @param cancelBlock Block to be called if they cancel.
 */
- (id)initWithImage:(UIImage *)anImage chooseBlock:(dispatch_block_t)chooseBlock cancelBlock:(dispatch_block_t)cancelBlock;

@end


text:
Reports rules of switch expression or enhanced switch statement which have redundant code block.

This inspection only reports if the language level of the project or module is 14 or higher

New in 2019.1