Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

"beberlei/assert": "^3.2",

"symfony/property-access": "^3.1 || ^4.0 || ^5.0",
"symfony/property-access": "^3.4 || ^4.4 || ^5.1",

"psr/http-client": "^1.0",
"psr/http-client-implementation": "^1.0",
Expand All @@ -35,9 +35,7 @@
"psr/http-factory-implementation": "^1.0",

"php-http/discovery": "^1.11",
"php-http/client-common": "^2.0",

"psr/container": "^1.0"
"php-http/client-common": "^2.0"
},

"suggest": {
Expand All @@ -46,8 +44,7 @@

"conflict": {
"php-http/discovery": "< 1.11",
"behat/behat": "< 3.7",
"symfony/dependency-injection": "< 2.8"
"behat/behat": "< 3.7"
},

"prefer-stable": true,
Expand All @@ -60,9 +57,7 @@

"php-http/message": "^1.0",

"symfony/http-client": "^4.3 || ^5.0",
"symfony/var-dumper": "^2.8 || ^3.3 || ^4.0",

"vimeo/psalm": "^3.8"
"symfony/http-client": "^4.4 || ^5.1",
"symfony/var-dumper": "^3.4 || ^4.4 || ^5.1"
}
}
15 changes: 8 additions & 7 deletions src/Container.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?php declare(strict_types=1);
namespace Behapi;

use Behat\Behat\HelperContainer\ContainerInterface;
use Behat\Behat\HelperContainer\Exception\ServiceNotFoundException;

use Http\Client\Common\Plugin\BaseUriPlugin;
use Http\Client\Common\Plugin\HistoryPlugin;
use Http\Client\Common\Plugin\ContentLengthPlugin;

use Behapi\Http\PluginClientBuilder;
use Behapi\HttpHistory\History as HttpHistory;

use Http\Discovery\Psr17FactoryDiscovery;

use Psr\Container\ContainerInterface;

use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;

use Behapi\Http\PluginClientBuilder;
use Behapi\HttpHistory\History as HttpHistory;

use function in_array;
use function array_key_exists;

Expand All @@ -41,12 +40,14 @@ public function __construct(HttpHistory $history, string $baseUrl)
$this->services[HttpHistory::class] = $history;
}

public function has($id)
/** @param string $id */
public function has($id): bool
{
return in_array($id, self::SERVICES, true);
}

public function get($id)
/** @param string $id */
public function get($id): object
{
if (array_key_exists($id, $this->services)) {
return $this->services[$id];
Expand Down