Created
November 26, 2018 15:22
-
-
Save melkamar/f98e8996dc55a2e457a6efeed2154ee1 to your computer and use it in GitHub Desktop.
Janephp issue
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
<?php | |
// This is what is generated by janephp | |
public static function create($httpClient = null) | |
{ | |
if (null === $httpClient) { | |
$httpClient = \Http\Discovery\HttpClientDiscovery::find(); | |
$plugins = array(); | |
$uri = \Http\Discovery\UriFactoryDiscovery::find()->createUri('relative/path/v1'); | |
$plugins[] = new \Http\Client\Common\Plugin\AddPathPlugin($uri); | |
$httpClient = new \Http\Client\Common\PluginClient($httpClient, $plugins); | |
} | |
$messageFactory = \Http\Discovery\MessageFactoryDiscovery::find(); | |
$streamFactory = \Http\Discovery\StreamFactoryDiscovery::find(); | |
$serializer = new \Symfony\Component\Serializer\Serializer(...); | |
return new static($httpClient, $messageFactory, $serializer, $streamFactory); | |
} |
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
<?php | |
// This is what I need to achieve | |
public static function create($httpClient = null) | |
{ | |
if (null === $httpClient) { | |
$httpClient = \Http\Discovery\HttpClientDiscovery::find(); | |
$plugins = array(); | |
$uri = \Http\Discovery\UriFactoryDiscovery::find()->createUri('relative/path/v1'); | |
$plugins[] = new \Http\Client\Common\Plugin\AddPathPlugin($uri); | |
// This is what I need to do: | |
$host = UriFactoryDiscovery::find()->createUri('http://api.site.com:8080'); | |
$plugins[] = new \Http\Client\Common\Plugin\AddHostPlugin($host); | |
$httpClient = new \Http\Client\Common\PluginClient($httpClient, $plugins); | |
} | |
$messageFactory = \Http\Discovery\MessageFactoryDiscovery::find(); | |
$streamFactory = \Http\Discovery\StreamFactoryDiscovery::find(); | |
$serializer = new \Symfony\Component\Serializer\Serializer(...); | |
return new static($httpClient, $messageFactory, $serializer, $streamFactory); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment