Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit 9322a4f

Browse files
Add support for "php-http/mock-client"
1 parent aea3020 commit 9322a4f

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

src/ConcreteImplementation.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ConcreteImplementation
2424
public const VENDOR_HTTPLUG_CURL = 'HttplugCurl';
2525
public const VENDOR_HTTPLUG_GUZZLE6 = 'HttplugGuzzle6';
2626
public const VENDOR_HTTPLUG_GUZZLE7 = 'HttplugGuzzle7';
27+
public const VENDOR_HTTPLUG_MOCK = 'HttplugMock';
2728
public const VENDOR_HTTPLUG_REACT = 'HttplugReact';
2829
public const VENDOR_LAMINAS = 'Laminas';
2930
public const VENDOR_NYHOLM = 'Nyholm';
@@ -50,6 +51,7 @@ class ConcreteImplementation
5051
'HttplugGuzzle6' => 'php-http/guzzle6-adapter',
5152
'HttplugCurl' => 'php-http/curl-client',
5253
'HttplugReact' => 'php-http/react-adapter',
54+
'HttplugMock' => 'php-http/mock-client',
5355
],
5456
];
5557

@@ -63,7 +65,10 @@ public static function initialize(): void
6365
continue;
6466
}
6567
foreach ([false, true] as $includeDevRequirements) {
66-
foreach ($packages as $namespace => $versions) {
68+
foreach ($packages as $vendor => $versions) {
69+
if ('HttplugMock' === $vendor && !$includeDevRequirements) {
70+
continue;
71+
}
6772
foreach ((array) $versions as $package => $version) {
6873
if (\is_int($package)) {
6974
$package = $version;
@@ -76,7 +81,7 @@ public static function initialize(): void
7681
continue 2;
7782
}
7883
}
79-
\define(__NAMESPACE__."\\{$const}_VENDOR", $namespace);
84+
\define(__NAMESPACE__."\\{$const}_VENDOR", $vendor);
8085
continue 3;
8186
}
8287
}

src/Internal/ComposerPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ private static function initializeConcreteImplementation(InstalledRepositoryInte
381381
continue;
382382
}
383383
foreach ([false, true] as $includeDevRequirements) {
384-
foreach ($packages as $namespace => $versions) {
384+
foreach ($packages as $vendor => $versions) {
385385
foreach ((array) $versions as $package => $version) {
386386
if (\is_int($package)) {
387387
$package = $version;
@@ -394,7 +394,7 @@ private static function initializeConcreteImplementation(InstalledRepositoryInte
394394
continue 2;
395395
}
396396
}
397-
\define(__NAMESPACE__."\\{$const}_VENDOR", $namespace);
397+
\define(__NAMESPACE__."\\{$const}_VENDOR", $vendor);
398398
continue 3;
399399
}
400400
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
/*
4+
* (c) Fabien Potencier <[email protected]>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
namespace FriendsOfPHP\WellKnownImplementations\Internal\HttplugMock;
11+
12+
use Http\Mock\Client;
13+
14+
class_alias(Client::class, HttplugMockHttplugClient::class);
15+
16+
if (false) {
17+
/**
18+
* @internal
19+
*/
20+
class HttplugMockHttplugClient extends Client
21+
{
22+
public function __construct()
23+
{
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)