本文整理匯總了PHP中Guzzle\Common\Collection::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Collection::toArray方法的具體用法?PHP Collection::toArray怎麽用?PHP Collection::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Guzzle\Common\Collection
的用法示例。
在下文中一共展示了Collection::toArray方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testConstructorCanBeCalledWithParams
public function testConstructorCanBeCalledWithParams()
{
$testData = array('test' => 'value', 'test_2' => 'value2');
$this->coll = new Collection($testData);
$this->assertEquals($this->coll->getAll(), $testData, '-> getAll() must return the data passed in the constructor');
$this->assertEquals($this->coll->getAll(), $this->coll->toArray());
}
示例2: headerCollectionToArray
/**
* @param Collection $headers
* @return array
*/
private function headerCollectionToArray(Collection $headers)
{
$headers_arr = array();
foreach ($headers->toArray() as $name => $val) {
$headers_arr[$name] = current($val);
}
return $headers_arr;
}
示例3: fireOffPostRequest
private function fireOffPostRequest($action, Collection $params, array $options = [])
{
$response = $this->client->post($action, ['Content-Type' => 'application/json'], json_encode($params->toArray()), $options)->send();
return $this->responseFactory->buildFromResponse($response);
}