Skip to content

Commit 6c668e1

Browse files
covoboMinatulaev Roman Olegovich
and
Minatulaev Roman Olegovich
authored
Fit code to eightpoints/guzzle-bundle:~8.0 (#2)
Co-authored-by: Minatulaev Roman Olegovich <[email protected]>
1 parent a773f32 commit 6c668e1

File tree

3 files changed

+13
-68
lines changed

3 files changed

+13
-68
lines changed

README.md

-9
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ This plugin integrates a generic way to include all middleware.
1111
### Installation
1212
Using [composer][2]:
1313

14-
##### composer.json
15-
``` json
16-
{
17-
"require": {
18-
"wizbit/guzzle-bundle-middleware-plugin": "^1.0"
19-
}
20-
}
21-
```
22-
2314
##### command line
2415
``` bash
2516
$ composer require wizbit/guzzle-bundle-middleware-plugin

composer.json

+6-17
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,17 @@
1818
],
1919

2020
"require": {
21-
"php": "^7.0",
22-
"guzzlehttp/guzzle": "^6.0",
23-
"eightpoints/guzzle-bundle": "~7.0",
24-
"symfony/http-kernel": "~2.7|~3.0|~4.0",
25-
"symfony/config": "~2.7|~3.0|~4.0",
26-
"symfony/dependency-injection": "~2.7|~3.0|~4.0",
27-
"symfony/expression-language": "~2.7|~3.0|~4.0"
28-
},
29-
30-
"require-dev": {
31-
"phpunit/phpunit": "~6.1"
21+
"php": ">=7.1",
22+
"eightpoints/guzzle-bundle": "~8.0",
23+
"symfony/http-kernel": "~4.0|~5.0",
24+
"symfony/config": "~4.0|~5.0",
25+
"symfony/dependency-injection": "~4.0|~5.0",
26+
"symfony/expression-language": "~4.0|~5.0"
3227
},
3328

3429
"autoload": {
3530
"psr-4": {
3631
"Wizbit\\Bundle\\GuzzleBundleMiddlewarePlugin\\": "src"
3732
}
38-
},
39-
40-
"autoload-dev": {
41-
"psr-4": {
42-
"Wizbit\\Bundle\\GuzzleBundleMiddlewarePlugin\\Tests\\": "tests"
43-
}
4433
}
4534
}

src/GuzzleBundleMiddlewarePlugin.php

+7-42
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,28 @@
22

33
namespace Wizbit\Bundle\GuzzleBundleMiddlewarePlugin;
44

5-
use EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundlePlugin;
5+
use EightPoints\Bundle\GuzzleBundle\PluginInterface;
66
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
77
use Symfony\Component\DependencyInjection\ContainerBuilder;
88
use Symfony\Component\DependencyInjection\Definition;
99
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1010
use Symfony\Component\DependencyInjection\Reference;
1111
use Symfony\Component\HttpKernel\Bundle\Bundle;
1212

13-
class GuzzleBundleMiddlewarePlugin extends Bundle implements EightPointsGuzzleBundlePlugin
13+
final class GuzzleBundleMiddlewarePlugin extends Bundle implements PluginInterface
1414
{
15-
/**
16-
* The name of this plugin. It will be used as the configuration key.
17-
*
18-
* @return string
19-
*/
2015
public function getPluginName(): string
2116
{
2217
return 'middleware';
2318
}
2419

25-
/**
26-
* @param \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $pluginNode
27-
*
28-
* @return void
29-
*/
30-
public function addConfiguration(ArrayNodeDefinition $pluginNode)
20+
public function addConfiguration(ArrayNodeDefinition $pluginNode): void
3121
{
3222
$pluginNode
3323
->beforeNormalization()
3424
->ifNotInArray(['enabled'])
35-
->then(function($value) {
36-
return array('middleware' => $value);
25+
->then(static function($value) {
26+
return ['middleware' => $value];
3727
})
3828
->end()
3929
->canBeEnabled()
@@ -54,29 +44,11 @@ public function addConfiguration(ArrayNodeDefinition $pluginNode)
5444
;
5545
}
5646

57-
/**
58-
* Load this plugin: define services, load service definition files, etc.
59-
*
60-
* @param array $configs
61-
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
62-
*
63-
* @return void
64-
*/
65-
public function load(array $configs, ContainerBuilder $container)
47+
public function load(array $configs, ContainerBuilder $container) : void
6648
{
6749
}
6850

69-
/**
70-
* Add configuration nodes for this plugin to the provided node.
71-
*
72-
* @param array $config
73-
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
74-
* @param string $clientName
75-
* @param \Symfony\Component\DependencyInjection\Definition $handler
76-
*
77-
* @return void
78-
*/
79-
public function loadForClient(array $config, ContainerBuilder $container, string $clientName, Definition $handler)
51+
public function loadForClient(array $config, ContainerBuilder $container, string $clientName, Definition $handler) : void
8052
{
8153
if (true === $config['enabled']) {
8254
foreach ($config['middleware'] as $middleware) {
@@ -85,13 +57,6 @@ public function loadForClient(array $config, ContainerBuilder $container, string
8557
}
8658
}
8759

88-
/**
89-
* Parses a callable.
90-
*
91-
* @param string|array $callable A callable
92-
*
93-
* @return string|array A parsed callable
94-
*/
9560
private function parseCallable($callable)
9661
{
9762
if (is_string($callable)) {

0 commit comments

Comments
 (0)