Example #1
0
 /**
  * {@inheritdoc}
  */
 public static function fromCommand(OperationCommand $command)
 {
     $instance = new self();
     $response = $command->getResponse();
     $body = $response->getBody();
     if ($body instanceof Stream) {
         $contentDispositionParts = self::parseContentDisposition($response->getContentDisposition());
         $instance->setStream($body)->setSize($response->getBody()->getSize())->setMimeType($response->getContentType())->setFileExtension($contentDispositionParts['extension'])->setFileName($contentDispositionParts['filename'])->setData($response->getBody(true));
     }
     return $instance;
 }
Example #2
0
 /**
  * Optional method to set the internal stream handle
  *
  * @static
  * @access public
  * @return void
  */
 public static function createFromStream($stream)
 {
     $socket = new self('localhost', 0);
     $socket->setStream($stream);
     return $socket;
 }