Skip to content

Commit

Permalink
🧑‍💻 improve standalone ci task
Browse files Browse the repository at this point in the history
✨ add new directory path pattern for standalone ci tasks (#11)
:recycle: some refactoring for removing duplicated code
:hammer: add phpcbf to make file
  • Loading branch information
julianzimmermann authored Mar 23, 2022
1 parent e116bcc commit 51a0dd8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ install:
phpcs:
./vendor/bin/phpcs --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfCodeception/* ./src/Propel/ ./tests/FondOfCodeception/* ./tests/Propel/

.PHONY: phpcbf
phpcbf:
./vendor/bin/phpcbf --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfCodeception/* ./src/Propel/ ./tests/FondOfCodeception/* ./tests/Propel/

.PHONY: codeception
codeception:
./vendor/bin/codecept run --coverage --coverage-xml --coverage-html
Expand Down
20 changes: 12 additions & 8 deletions src/FondOfCodeception/Lib/SearchFacadeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,25 @@ protected function createSearchElasticsearchBusinessFactory(): AbstractBusinessF
protected function createSearchElasticsearchConfig(): SearchElasticsearchConfig
{
$searchElasticsearchConfig = new class extends SearchElasticsearchConfig {
/** @var array */
protected const POSSIBLE_DIRECTORY_PATTERNS = [
'%s/vendor/*/*/src/*/Shared/*/Schema/',
'%s/*/*/src/*/Shared/*/Schema/',
'%s/src/*/Shared/*/Schema/',
];

/**
* @return array
*/
public function getJsonSchemaDefinitionDirectories(): array
{
$directories = [];

$directory = sprintf('%s/vendor/*/*/src/*/Shared/*/Schema/', APPLICATION_ROOT_DIR);
if (glob($directory, GLOB_NOSORT | GLOB_ONLYDIR)) {
$directories[] = $directory;
}

$directory = sprintf('%s/*/*/src/*/Shared/*/Schema/', APPLICATION_ROOT_DIR);
if (glob($directory, GLOB_NOSORT | GLOB_ONLYDIR)) {
$directories[] = $directory;
foreach (static::POSSIBLE_DIRECTORY_PATTERNS as $possibleDirectoryPattern) {
$directory = sprintf($possibleDirectoryPattern, APPLICATION_ROOT_DIR);
if (glob($directory, GLOB_NOSORT | GLOB_ONLYDIR)) {
$directories[] = $directory;
}
}

return $directories;
Expand Down

0 comments on commit 51a0dd8

Please sign in to comment.