|  | 
| 8 | 8 | use Http\Client\HttpClient; | 
| 9 | 9 | use Http\Discovery\HttpClientDiscovery; | 
| 10 | 10 | use Http\Discovery\Strategy\DiscoveryStrategy; | 
| 11 |  | -use Symfony\Component\EventDispatcher\Event as LegacyEvent; | 
| 12 |  | -use Symfony\Component\EventDispatcher\EventSubscriberInterface; | 
| 13 |  | -use Symfony\Component\HttpKernel\Kernel; | 
| 14 |  | -use Symfony\Contracts\EventDispatcher\Event; | 
| 15 |  | - | 
| 16 |  | -if (Kernel::MAJOR_VERSION >= 5) { | 
| 17 |  | -    \class_alias(Event::class, 'Http\HttplugBundle\Discovery\ConfiguredClientsStrategyEventClass'); | 
| 18 |  | -} else { | 
| 19 |  | -    \class_alias(LegacyEvent::class, 'Http\HttplugBundle\Discovery\ConfiguredClientsStrategyEventClass'); | 
| 20 |  | -} | 
| 21 | 11 | 
 | 
| 22 | 12 | /** | 
| 23 | 13 |  * A strategy that provide clients configured with HTTPlug bundle. With help from this strategy | 
| 24 | 14 |  * we can use the web debug toolbar for clients found with the discovery. | 
| 25 | 15 |  * | 
| 26 | 16 |  * @author Tobias Nyholm <[email protected]> | 
| 27 | 17 |  */ | 
| 28 |  | -class ConfiguredClientsStrategy implements DiscoveryStrategy, EventSubscriberInterface | 
|  | 18 | +class ConfiguredClientsStrategy implements DiscoveryStrategy | 
| 29 | 19 | { | 
| 30 | 20 |     /** | 
| 31 | 21 |      * @var HttpClient | 
| @@ -67,25 +57,4 @@ public static function getCandidates($type) | 
| 67 | 57 | 
 | 
| 68 | 58 |         return []; | 
| 69 | 59 |     } | 
| 70 |  | - | 
| 71 |  | -    /** | 
| 72 |  | -     * Make sure to use our custom strategy. | 
| 73 |  | -     */ | 
| 74 |  | -    public function onEvent(ConfiguredClientsStrategyEventClass $e) | 
| 75 |  | -    { | 
| 76 |  | -        HttpClientDiscovery::prependStrategy(self::class); | 
| 77 |  | -    } | 
| 78 |  | - | 
| 79 |  | -    /** | 
| 80 |  | -     * Whenever these events occur we make sure to add our strategy to the discovery. | 
| 81 |  | -     * | 
| 82 |  | -     * {@inheritdoc} | 
| 83 |  | -     */ | 
| 84 |  | -    public static function getSubscribedEvents() | 
| 85 |  | -    { | 
| 86 |  | -        return [ | 
| 87 |  | -            'kernel.request' => ['onEvent', 1024], | 
| 88 |  | -            'console.command' => ['onEvent', 1024], | 
| 89 |  | -        ]; | 
| 90 |  | -    } | 
| 91 | 60 | } | 
0 commit comments