Skip to content

Commit 1fb7738

Browse files
authored
Merge pull request #1 from Spameri/result-version
Version Result Object
2 parents 2b97cf8 + e03d2be commit 1fb7738

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1203
-179
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.idea
22
/vendor
33
composer.lock
4+
tests/php.ini-local

.travis.yml

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,46 @@
11
language: php
2+
3+
os: linux
4+
5+
cache:
6+
directories:
7+
- $HOME/.composer/cache
8+
- $HOME/phpcs-cache
9+
210
php:
3-
- 7.1
4-
- 7.2
11+
- "7.1"
12+
- "7.2"
13+
- "7.3"
14+
15+
jdk:
16+
- oraclejdk8
17+
18+
env:
19+
matrix:
20+
# - RUN_TESTS=1 ES_VERSION="2.4.6"
21+
- RUN_TESTS=1 ES_VERSION="5.6.15"
22+
- RUN_TESTS=1 ES_VERSION="6.7.1"
23+
- RUN_TESTS=1 ES_VERSION="7.0.0-linux-x86_64"
24+
25+
matrix:
26+
include:
27+
- php: 7.3
28+
env: CODING_STANDARD=1 PHPSTAN=1
29+
allow_failures:
30+
- env: RUN_TESTS=1 ES_VERSION="7.0.0-linux-x86_64"
31+
32+
before_install:
33+
- travis_retry composer self-update
34+
- sudo apt-get update && sudo apt-get install oracle-java8-installer
35+
- java -version
36+
- sudo update-alternatives --set java /usr/lib/jvm/java-8-oracle/jre/bin/java
37+
- java -version
38+
- if [ "$ES_VERSION" != "" ]; then ./travis-elastic.sh; fi
539

6-
before_script:
7-
- composer self-update
8-
- composer install --no-interaction --prefer-dist
40+
install:
41+
- travis_retry composer update --no-interaction --no-suggest --no-progress --prefer-dist --prefer-stable
942

1043
script:
11-
- vendor/bin/tester -c tests/php.ini tests
12-
- vendor/bin/phpstan analyse -l 7 -c phpstan.neon src tests
44+
- if [ "$PHPSTAN" = "1" ]; then vendor/bin/phpstan analyse -l 7 -c phpstan.neon src tests; fi
45+
- if [ "$CODING_STANDARD" = "1" ]; then vendor/bin/phpcs --standard=ruleset.xml --cache=$HOME/phpcs-cache/.phpcs-cache src tests; fi
46+
- if [ "$RUN_TESTS" = "1" ]; then vendor/bin/tester $COVERAGE -s -c ./tests/php.ini ./tests; fi

composer.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
{
22
"name": "spameri/elastic-query",
3-
"description": "Objects instead of arrays for querying to ElasticSearch.",
3+
"description": "Objects instead of arrays for querying to ElasticSearch.",
44
"authors": [
55
{
66
"name": "Václav Čevela",
77
"email": "vcevela@gmail.com"
88
}
99
],
1010
"support": {
11-
"issues": "https://github.com/Spameri/ElasticQuery/issues"
11+
"issues": "https://github.com/Spameri/ElasticQuery/issues"
1212
},
1313
"require": {
14-
"php": ">=7.1"
14+
"php": ">=7.1",
15+
"ext-json": "*"
1516
},
1617
"require-dev": {
17-
"phpstan/phpstan-shim": "v0.10.3",
18+
"phpstan/phpstan-shim": "v0.11.4",
1819
"nette/tester": "v2.1.0",
1920
"elasticsearch/elasticsearch": "^6.1",
20-
"guzzlehttp/guzzle": "^6.3"
21+
"guzzlehttp/guzzle": "^6.3",
22+
"spameri/coding-standard": "@dev"
2123
},
22-
"autoload": {
23-
"psr-4": {
24-
"Spameri\\ElasticQuery\\": "src"
24+
"autoload": {
25+
"psr-4": {
26+
"Spameri\\ElasticQuery\\": "src"
2527
}
2628
},
27-
"autoload-dev": {
28-
"psr-4": {
29-
"SpameriTests\\": "tests/SpameriTests"
30-
}
29+
"autoload-dev": {
30+
"psr-4": {
31+
"SpameriTests\\": "tests/SpameriTests"
32+
}
3133
}
3234
}

doc/02-query-objects.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,41 @@ Must and should collection of objects is also **LeafQueryInterface**, so you can
1414
- [Implementation](https://github.com/Spameri/ElasticQuery/blob/master/src/Query/Match.php)
1515
- [Sample usage](https://github.com/Spameri/ElasticQuery/blob/master/tests/SpameriTests/ElasticQuery/Query/Match.phpt#L8)
1616

17+
##### MatchPhrase Query
18+
- Class `\Spameri\ElasticQuery\Query\MatchPhrase`
19+
- [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html)
20+
- [Implementation](https://github.com/Spameri/ElasticQuery/blob/master/src/Query/MatchPhrase.php)
21+
- [Sample usage](https://github.com/Spameri/ElasticQuery/blob/master/tests/SpameriTests/ElasticQuery/Query/MatchPhrase.phpt#L8)
22+
1723
##### Fuzzy Query
1824
- Class `\Spameri\ElasticQuery\Query\Fuzzy`
1925
- [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html)
2026
- [Implementation](https://github.com/Spameri/ElasticQuery/blob/master/src/Query/Fuzzy.php)
27+
- [Sample usage](https://github.com/Spameri/ElasticQuery/blob/master/tests/SpameriTests/ElasticQuery/Query/Fuzzy.phpt#L8)
2128

2229
##### Range Query
2330
- Class `\Spameri\ElasticQuery\Query\Range`
2431
- [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html)
2532
- [Implementation](https://github.com/Spameri/ElasticQuery/blob/master/src/Query/Range.php)
33+
- [Sample usage](https://github.com/Spameri/ElasticQuery/blob/master/tests/SpameriTests/ElasticQuery/Query/Range.phpt#L8)
2634

2735
##### Term Query
2836
- Class `\Spameri\ElasticQuery\Query\Term`
2937
- [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html)
3038
- [Implementation](https://github.com/Spameri/ElasticQuery/blob/master/src/Query/Term.php)
39+
- [Sample usage](https://github.com/Spameri/ElasticQuery/blob/master/tests/SpameriTests/ElasticQuery/Query/Term.phpt#L8)
3140

3241
##### Terms Query
3342
- Class `\Spameri\ElasticQuery\Query\Terms`
3443
- [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html)
3544
- [Implementation](https://github.com/Spameri/ElasticQuery/blob/master/src/Query/Terms.php)
45+
- [Sample usage](https://github.com/Spameri/ElasticQuery/blob/master/tests/SpameriTests/ElasticQuery/Query/Terms.phpt#L8)
3646

3747
##### WildCard Query
3848
- Class `\Spameri\ElasticQuery\Query\WildCard`
3949
- [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html)
4050
- [Implementation](https://github.com/Spameri/ElasticQuery/blob/master/src/Query/WildCard.php)
51+
- [Sample usage](https://github.com/Spameri/ElasticQuery/blob/master/tests/SpameriTests/ElasticQuery/Query/WildCard.phpt#L8)
4152

4253
##### QueryCollection Query
4354
- Class `\Spameri\ElasticQuery\Query\QueryCollection`

ruleset.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" ?>
2+
<ruleset name="Spameri\ElasticQuery">
3+
<rule ref="./vendor/spameri/coding-standard/src/ruleset.xml"/>
4+
5+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
6+
<properties>
7+
<property name="rootNamespaces" type="array">
8+
<element key="src" value="Spameri\ElasticQuery"/>
9+
</property>
10+
</properties>
11+
</rule>
12+
13+
</ruleset>

src/Aggregation/AggregationCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AggregationCollection implements LeafAggregationInterface
1212
private $filter;
1313

1414
/**
15-
* @var \Spameri\ElasticQuery\Aggregation\LeafAggregationCollection[]
15+
* @var array<\Spameri\ElasticQuery\Aggregation\LeafAggregationCollection>
1616
*/
1717
private $aggregations;
1818

@@ -33,7 +33,7 @@ public function __construct(
3333

3434
public function key() : string
3535
{
36-
return '';
36+
return 'top-aggs-collection';
3737
}
3838

3939

@@ -76,7 +76,7 @@ public function toArray() : array
7676
$array = [];
7777

7878
foreach ($this->aggregations as $aggregation) {
79-
$array = $array + $aggregation->toArray();
79+
$array += $aggregation->toArray();
8080
}
8181

8282
return $array;

src/Aggregation/LeafAggregationCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class LeafAggregationCollection implements LeafAggregationInterface, \IteratorAg
1717
private $filter;
1818

1919
/**
20-
* @var \Spameri\ElasticQuery\Aggregation\LeafAggregationInterface[]
20+
* @var array<\Spameri\ElasticQuery\Aggregation\LeafAggregationInterface>
2121
*/
2222
private $aggregations;
2323

src/Aggregation/RangeValueCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class RangeValueCollection implements \IteratorAggregate
77
{
88

99
/**
10-
* @var \Spameri\ElasticQuery\Aggregation\RangeValue[]
10+
* @var array<\Spameri\ElasticQuery\Aggregation\RangeValue>
1111
*/
1212
private $collection;
1313

src/Collection/AbstractCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ abstract class AbstractCollection implements CollectionInterface
77
{
88

99
/**
10-
* @var \Spameri\ElasticQuery\Entity\EntityInterface[]
10+
* @var array<\Spameri\ElasticQuery\Entity\EntityInterface>
1111
*/
1212
protected $collection;
1313

0 commit comments

Comments
 (0)