當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityBody::fromString方法代碼示例

本文整理匯總了PHP中Guzzle\Http\EntityBody::fromString方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityBody::fromString方法的具體用法?PHP EntityBody::fromString怎麽用?PHP EntityBody::fromString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Guzzle\Http\EntityBody的用法示例。


在下文中一共展示了EntityBody::fromString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 public function setUp()
 {
     $this->mockRequest = new \Guzzle\Plugin\Mock\MockPlugin();
     $body = \Guzzle\Http\EntityBody::fromString($this->responseBodyString);
     $this->mockRequest->addResponse(new Guzzle\Http\Message\Response(200, $this->responseHeaders, $body));
     $this->client = $this->getClientInstance();
     $this->client->addClientSubscriber($this->mockRequest);
 }
開發者ID:digitaldevelopers,項目名稱:merchant-esolutions-php,代碼行數:8,代碼來源:TestAbstract.php

示例2: setUp

 public function setUp()
 {
     $httpClient = $this->getMockBuilder('\\Guzzle\\Http\\Client')->getMock();
     $wdavClient = $this->getMockBuilder('\\Grale\\WebDav\\WebDavClient')->getMock();
     $wdavClient->expects($this->any())->method('getHttpClient')->will($this->returnValue($httpClient));
     $stream = EntityBody::fromString('Hello World!');
     $wdavClient->expects($this->any())->method('getStream')->will($this->returnValue($stream));
     $propfind = MultiStatus::parse($wdavClient, file_get_contents(__DIR__ . '/../../fixtures/streamwrapper.opendir.xml'));
     $wdavClient->expects($this->any())->method('setThrowExceptions')->will($this->returnValue($this->client));
     $wdavClient->expects($this->any())->method('propfind')->will($this->returnValue($propfind));
     $this->client = $wdavClient;
     StreamWrapper::register(null, $this->client);
 }
開發者ID:samizdam,項目名稱:WebDAV,代碼行數:13,代碼來源:StreamWrapperTest.php

示例3: openAppendMode

 /**
  * Initialize the stream wrapper for an append stream.
  *
  * @param Url $url URL of the resource to be opened
  * @return bool Returns true on success or false on failure
  */
 protected function openAppendMode($url)
 {
     try {
         $contents = self::$client->get($url);
         $this->stream = EntityBody::fromString($contents);
         $this->stream->seek(0, SEEK_END);
     } catch (NoSuchResourceException $exception) {
         // The resource does not exist, so use a simple write stream
         return $this->openWriteOnly($url);
     }
     return true;
 }
開發者ID:samizdam,項目名稱:WebDAV,代碼行數:18,代碼來源:StreamWrapper.php


注:本文中的Guzzle\Http\EntityBody::fromString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。