-
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
30 changed files
with
105 additions
and
215 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Tests | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
coverage: pcov | ||
|
||
- name: Composer install | ||
run: composer install --dev --no-progress | ||
|
||
- name: Check coding standard | ||
run: vendor/bin/phpcs --standard=PSR12 ./src ./tests | ||
|
||
- name: Check phpstan | ||
run: vendor/bin/phpstan | ||
|
||
- name: Check tests | ||
run: vendor/bin/tester tests -C --coverage coverage.xml --coverage-src ./src | ||
|
||
- name: Upload coverage | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
composer global require php-coveralls/php-coveralls | ||
php-coveralls --coverage_clover=coverage.xml --json_path=upload.json |
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,5 +1,5 @@ | ||
test: | ||
rm -rf tests/tmp/cache | ||
php vendor/bin/phpstan analyse ./src ./tests --level max | ||
php vendor/bin/phpstan | ||
php vendor/bin/phpcs --standard=PSR12 ./src ./tests | ||
php vendor/bin/tester ./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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
parameters: | ||
checkMissingIterableValueType: false | ||
level: 8 | ||
paths: | ||
- src | ||
- tests | ||
|
||
checkUninitializedProperties: 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
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
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 |
---|---|---|
|
@@ -6,8 +6,9 @@ | |
|
||
use Http\Client\Common\Plugin\CachePlugin; | ||
use Nette\DI\ContainerBuilder; | ||
use Nette\DI\ServiceDefinition; | ||
use Nette\DI\Definitions\Definition; | ||
use Nette\StaticClass; | ||
use Nette\Utils\Strings; | ||
|
||
/** | ||
* @author Jakub Janata <[email protected]> | ||
|
@@ -16,19 +17,12 @@ class Cache implements IPluginServiceDefinitonCreator | |
{ | ||
use StaticClass; | ||
|
||
/** | ||
* @param ContainerBuilder $containerBuilder | ||
* @param string $extensionName | ||
* @param string $clientName | ||
* @param array[] $pluginConfig | ||
* @return ServiceDefinition | ||
*/ | ||
public static function createPluginServiceDefinition( | ||
ContainerBuilder $containerBuilder, | ||
string $extensionName, | ||
string $clientName, | ||
array $pluginConfig | ||
): ServiceDefinition { | ||
): Definition { | ||
|
||
$args = []; | ||
|
||
|
@@ -44,7 +38,8 @@ public static function createPluginServiceDefinition( | |
|
||
$config = []; | ||
foreach ($pluginConfig['config'] as $key => $value) { | ||
$config[strtolower(preg_replace('#(.)(?=[A-Z])#', '$1_', $key) ?: '')] = $value; | ||
$newKey = Strings::replace($key, '#(.)(?=[A-Z])#', '$1_'); | ||
$config[strtolower($newKey)] = $value; | ||
} | ||
$args['config'] = $config; | ||
|
||
|
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.