-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,149 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
; EditorConfig helps developers define and maintain consistent | ||
; coding styles between different editors and IDEs. | ||
|
||
; For more visit http://editorconfig.org. | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{yml, yaml}] | ||
indent_size = 2 |
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,5 +1,6 @@ | ||
/bin | ||
!/bin/wait-for-elasticsearch.sh | ||
/composer.lock | ||
/vendor/ | ||
/.php_cs.cache | ||
/.phpunit.result.cache | ||
/.phpunit.result.cache |
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,32 +1,27 @@ | ||
<?php | ||
|
||
if (!file_exists(__DIR__.'/src')) { | ||
exit(0); | ||
} | ||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
->in(__DIR__.'/src') | ||
->in(__DIR__.'/tests') | ||
->append([__FILE__]) | ||
; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'@PHPUnit75Migration:risky' => true, | ||
'php_unit_dedicate_assert' => ['target' => '5.6'], | ||
'phpdoc_no_empty_return' => false, // triggers almost always false positive | ||
'array_syntax' => ['syntax' => 'short'], | ||
'fopen_flags' => false, | ||
'ordered_imports' => true, | ||
'phpdoc_trim_consecutive_blank_line_separation' => true, | ||
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], | ||
'protected_to_private' => false, | ||
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading | ||
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true], | ||
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading | ||
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], | ||
'combine_nested_dirname' => true, | ||
'@PHPUnit75Migration:risky' => true, | ||
'@PhpCsFixer' => true, | ||
'@PhpCsFixer:risky' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'ordered_imports' => true, | ||
'no_superfluous_phpdoc_tags' => ['allow_mixed' => false], | ||
'binary_operator_spaces' => ['default' => 'align_single_space_minimal'], | ||
'php_unit_test_class_requires_covers' => false, | ||
'php_unit_internal_class' => false, | ||
'php_unit_test_case_static_method_calls' => [ | ||
'call_type' => 'this', | ||
], | ||
]) | ||
->setRiskyAllowed(true) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__.'/src') | ||
->append([__FILE__]) | ||
) | ||
->setFinder($finder) | ||
; |
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 +1,15 @@ | ||
# PHP elasticsearch utilities | ||
# Elasticsearch | ||
![](https://github.com/amenophis/elasticsearch/workflows/CI/badge.svg) | ||
|
||
## About | ||
This bundle simplify the configuration to use elasticsearch for symfony projects. | ||
|
||
## Status | ||
:construction: Under construction :construction: | ||
|
||
## Documentation | ||
Read the documentation [here](doc/index.md). | ||
|
||
## Licence | ||
See [LICENSE](LICENSE). | ||
|
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,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
host="$1" | ||
url="${host}/_cat/health?h=status" | ||
maxAttempt=100 | ||
sleep=1 | ||
|
||
function try { | ||
echo "$(curl --fail --silent --connect-timeout 1 --max-time 1 ${url} | grep -o "[a-z]*" || true)" | ||
} | ||
|
||
attempt=0 | ||
health="$(try)" | ||
until [[ "${health}" = 'green' || "${health}" = 'yellow' || ${attempt} -ge ${maxAttempt} ]]; do | ||
health="$(try)" | ||
printf '.' | ||
sleep ${sleep} | ||
((attempt+=1)) | ||
done | ||
|
||
echo | ||
|
||
if [[ ${attempt} -ge ${maxAttempt} ]]; then | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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 @@ | ||
:construction: Under construction :construction: |
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,16 @@ | ||
version: '3.7' | ||
|
||
services: | ||
es: | ||
image: docker.elastic.co/elasticsearch/elasticsearch:7.3.2 | ||
environment: | ||
- discovery.type=single-node | ||
ports: | ||
- '9200:9200' | ||
|
||
kibana: | ||
image: docker.elastic.co/kibana/kibana:7.3.2 | ||
environment: | ||
ELASTICSEARCH_HOSTS: '["http://es:9200"]' | ||
ports: | ||
- '5601:5601' |
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Amenophis\Elasticsearch; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class ArrayHelper | ||
{ | ||
private function __construct() | ||
{ | ||
} | ||
|
||
public static function ksort_recursive(&$array): bool | ||
{ | ||
if (!\is_array($array)) { | ||
return false; | ||
} | ||
|
||
ksort($array); | ||
foreach ($array as &$arr) { | ||
self::ksort_recursive($arr); | ||
} | ||
|
||
return true; | ||
} | ||
} |
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
Oops, something went wrong.