-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Spameri/version-one
Version one
- Loading branch information
Showing
219 changed files
with
2,905 additions
and
1,100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
.PHONY: composer | ||
.PHONY: phpstan | ||
.PHONY: cs | ||
.PHONY: cs-local | ||
.PHONY: cbf | ||
.PHONY: tests | ||
.PHONY: coverage | ||
|
||
|
||
composer: | ||
composer update --no-interaction --no-suggest --no-progress --prefer-dist --prefer-stable | ||
|
||
phpstan: | ||
vendor/bin/phpstan analyse -l 7 -c phpstan.neon src tests | ||
|
||
cs: | ||
vendor/bin/phpcs --standard=ruleset.xml --cache=$HOME/phpcs-cache/.phpcs-cache src tests | ||
vendor/bin/phpcs --standard=ruleset.xml --cache=.phpcs-cache src tests/SpameriTests | ||
|
||
cs-local: | ||
vendor/bin/phpcs --standard=ruleset.xml src tests/SpameriTests | ||
|
||
cbf: | ||
vendor/bin/phpcbf --standard=ruleset.xml src tests/SpameriTests | ||
|
||
tests: | ||
vendor/bin/tester -s -p php --colors 1 -C tests | ||
vendor/bin/tester -s -p php --colors 1 -C -j 1 tests | ||
|
||
coverage: | ||
vendor/bin/tester -s -p php --colors 1 -C --coverage ./coverage.html --coverage-src ./src tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
parameters: | ||
ignoreErrors: | ||
- "#Call to function array_key_exists\\(\\) with string and array<int, mixed> will always evaluate to false#" | ||
- "#Call to function array_key_exists\\(\\) with string and array<int, string> will always evaluate to false#" | ||
|
||
checkMissingIterableValueType: false | ||
checkGenericClassInNonGenericObjectType: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Spameri\ElasticQuery\Aggregation; | ||
|
||
/** | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-avg-aggregation.html | ||
*/ | ||
class Avg implements \Spameri\ElasticQuery\Aggregation\LeafAggregationInterface | ||
{ | ||
|
||
private string $field; | ||
|
||
|
||
public function __construct( | ||
string $field | ||
) | ||
{ | ||
$this->field = $field; | ||
} | ||
|
||
|
||
public function key(): string | ||
{ | ||
return 'avg_' . $this->field; | ||
} | ||
|
||
|
||
public function toArray(): array | ||
{ | ||
return [ | ||
'avg' => [ | ||
'field' => $this->field, | ||
], | ||
]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Spameri\ElasticQuery\Aggregation; | ||
|
||
/** | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html | ||
*/ | ||
class Filter extends \Spameri\ElasticQuery\Filter\FilterCollection | ||
implements \Spameri\ElasticQuery\Aggregation\LeafAggregationInterface | ||
{ | ||
|
||
public function toArray(): array | ||
{ | ||
$array = parent::toArray(); | ||
|
||
if ($array === []) { | ||
$array['must'] = []; | ||
} | ||
|
||
return [ | ||
'filter' => [ | ||
'bool' => $array, | ||
], | ||
]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Spameri\ElasticQuery\Aggregation; | ||
|
||
class Max implements \Spameri\ElasticQuery\Aggregation\LeafAggregationInterface | ||
{ | ||
|
||
private string $field; | ||
|
||
|
||
public function __construct( | ||
string $field | ||
) | ||
{ | ||
$this->field = $field; | ||
} | ||
|
||
|
||
public function key(): string | ||
{ | ||
return 'max_' . $this->field; | ||
} | ||
|
||
|
||
/** | ||
* @return array<string, array<string, string>> | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [ | ||
'max' => [ | ||
'field' => $this->field, | ||
], | ||
]; | ||
} | ||
|
||
} |
Oops, something went wrong.