Пример #1
0
 /**
  * @param HttpClient|null     $httpClient     Http client to use with Docker
  * @param Serializer|null     $serializer     Deserialize docker response into php objects
  * @param MessageFactory|null $messageFactory How to create docker request (in PSR7)
  */
 public function __construct(HttpClient $httpClient = null, Serializer $serializer = null, MessageFactory $messageFactory = null)
 {
     $this->httpClient = $httpClient ?: DockerClient::createFromEnv();
     if ($serializer === null) {
         $serializer = new Serializer(NormalizerFactory::create(), [new JsonEncoder(new JsonEncode(), new JsonDecode()), new RawEncoder()]);
     }
     if ($messageFactory === null) {
         $messageFactory = new MessageFactory\GuzzleMessageFactory();
     }
     $this->serializer = $serializer;
     $this->messageFactory = $messageFactory;
 }
Пример #2
0
 public function __construct(HttpClient $httpClient = null, Serializer $serializer = null, MessageFactory $messageFactory = null)
 {
     $this->httpClient = $httpClient ?: DockerClient::createFromEnv();
     $this->messageFactory = $messageFactory ?: new GuzzleMessageFactory();
     parent::__construct($this->httpClient, $serializer, $this->messageFactory);
 }