Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
sudo: false
language: php
php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4snapshot
matrix:
allow_failures:
- php: 7.4snapshot
env:
global:
- ES_VERSION=6.7.1 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
- ES_VERSION=7.4.0 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}-linux-x86_64.tar.gz
install:
- wget ${ES_DOWNLOAD_URL}
- tar -xzf elasticsearch-${ES_VERSION}.tar.gz
- tar -xzf elasticsearch-${ES_VERSION}-linux-x86_64.tar.gz
- ./elasticsearch-${ES_VERSION}/bin/elasticsearch -d
before_script:
- if [ "$GITHUB_COMPOSER_AUTH" ]; then composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH; fi
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
Introducing Elasticsearch DSL library to provide objective query builder for [Elasticsearch bundle](https://github.com/ongr-io/ElasticsearchBundle) and [elasticsearch-php](https://github.com/elastic/elasticsearch-php) client. You can easily build any Elasticsearch query and transform it to an array.

If you need any help, [stack overflow](http://stackoverflow.com/questions/tagged/ongr)
is the preffered and recommended way to ask ONGR support questions.
is the preferred and recommended way to ask ONGR support questions.

[![Build Status](https://travis-ci.org/ongr-io/ElasticsearchDSL.svg?branch=master)](https://travis-ci.org/ongr-io/ElasticsearchDSL)
[![codecov](https://codecov.io/gh/ongr-io/ElasticsearchDSL/branch/master/graph/badge.svg)](https://codecov.io/gh/ongr-io/ElasticsearchDSL)
[![Latest Stable Version](https://poser.pugx.org/ongr/elasticsearch-dsl/v/stable)](https://packagist.org/packages/ongr/elasticsearch-dsl)
[![Total Downloads](https://poser.pugx.org/ongr/elasticsearch-dsl/downloads)](https://packagist.org/packages/ongr/elasticsearch-dsl)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ongr-io/ElasticsearchDSL/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ongr-io/ElasticsearchDSL/?branch=master)


If you like this library, help me to develop it by buying a cup of coffee

<a href="https://www.buymeacoffee.com/zIKBXRc" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>

## Version matrix

| Elasticsearch version | ElasticsearchDSL version |
Expand Down
6 changes: 6 additions & 0 deletions src/ParametersTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ public function hasParameter($name)
* Removes parameter.
*
* @param string $name
* @return $this
*/
public function removeParameter($name)
{
if ($this->hasParameter($name)) {
unset($this->parameters[$name]);
}

return $this;
}

/**
Expand Down Expand Up @@ -70,10 +73,13 @@ public function getParameters()
/**
* @param string $name
* @param array|string|int|bool|\stdClass $value
* @return $this
*/
public function addParameter($name, $value)
{
$this->parameters[$name] = $value;

return $this;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/ParametersTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace ONGR\ElasticsearchDSL\Tests\Unit;

use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
use ONGR\ElasticsearchDSL\ParametersTrait;

/**
Expand All @@ -36,9 +37,10 @@ public function setUp()
*/
public function testGetAndAddParameter()
{
$this->parametersTraitMock->addParameter('acme', 123);
$this->assertTrue(is_object($this->parametersTraitMock->addParameter('acme', 123)));
$this->assertEquals(123, $this->parametersTraitMock->getParameter('acme'));
$this->parametersTraitMock->addParameter('bar', 321);
$this->assertEquals(321, $this->parametersTraitMock->getParameter('bar'));
$this->assertTrue(is_object($this->parametersTraitMock->removeParameter('acme')));
}
}