当前位置: 首页>>代码示例>>PHP>>正文


PHP Collection::getAll方法代码示例

本文整理汇总了PHP中Guzzle\Common\Collection::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::getAll方法的具体用法?PHP Collection::getAll怎么用?PHP Collection::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Guzzle\Common\Collection的用法示例。


在下文中一共展示了Collection::getAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: defaultMissingFunction

 /**
  * Default method to execute when credentials are not specified
  *
  * @param Collection $config Config options
  *
  * @return CredentialsInterface
  */
 protected function defaultMissingFunction(Collection $config)
 {
     if ($config->get(Options::KEY) && $config->get(Options::SECRET)) {
         // Credentials were not provided, so create them using keys
         return Credentials::factory($config->getAll());
     }
     // Attempt to get credentials from the EC2 instance profile server
     return new RefreshableInstanceProfileCredentials(new Credentials('', '', '', 1));
 }
开发者ID:noahkim,项目名称:kowop,代码行数:16,代码来源:CredentialsOptionResolver.php

示例2: factory

 /**
  * Create a Cookie by parsing a Cookie HTTP header
  *
  * @param string $cookieString Cookie HTTP header
  *
  * @return Cookie
  */
 public static function factory($cookieString)
 {
     $data = new Collection();
     if ($cookieString) {
         foreach (explode(';', $cookieString) as $kvp) {
             $parts = explode('=', $kvp, 2);
             $key = urldecode(trim($parts[0]));
             $value = isset($parts[1]) ? trim($parts[1]) : '';
             $data->add($key, urldecode($value));
         }
     }
     return new static($data->getAll());
 }
开发者ID:MicroSDHC,项目名称:justinribeiro.com-examples,代码行数:20,代码来源:Cookie.php

示例3: testOverwriteWithTraversable

 public function testOverwriteWithTraversable()
 {
     $c = new Collection(array('foo' => 1, 'baz' => 2, 'bar' => 3));
     $b = new Collection(array('foo' => 10, 'bar' => 300));
     $c->overwriteWith($b->getIterator());
     $this->assertEquals(array('foo' => 10, 'baz' => 2, 'bar' => 300), $c->getAll());
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:7,代码来源:CollectionTest.php

示例4: testCanReplaceAllData

 /**
  * @covers Guzzle\Common\Collection::replace
  */
 public function testCanReplaceAllData()
 {
     $this->assertSame($this->coll, $this->coll->replace(array('a' => '123')));
     $this->assertEquals(array('a' => '123'), $this->coll->getAll());
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:8,代码来源:CollectionTest.php

示例5: parseMessage

 /**
  * {@inheritdoc}
  */
 public function parseMessage($message)
 {
     if (!$message) {
         return false;
     }
     $headers = new Collection();
     $scheme = $host = $body = $method = $user = $pass = $query = $port = $version = $protocol = '';
     $path = '/';
     // Inspired by https://github.com/kriswallsmith/Buzz/blob/message-interfaces/lib/Buzz/Message/Parser/Parser.php#L16
     $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
     for ($i = 0, $c = count($lines); $i < $c; $i += 2) {
         $line = $lines[$i];
         // If two line breaks were encountered, then this is the body
         if (empty($line)) {
             $body = implode('', array_slice($lines, $i + 2));
             break;
         }
         // Parse message headers
         if (!$method) {
             list($method, $path, $proto) = explode(' ', $line);
             $method = strtoupper($method);
             list($protocol, $version) = explode('/', strtoupper($proto));
             $scheme = 'http';
         } else {
             if (strpos($line, ':')) {
                 list($key, $value) = explode(':', $line, 2);
                 $key = trim($key);
                 // Normalize standard HTTP headers
                 if (in_array(strtolower($key), static::$requestHeaders)) {
                     $key = str_replace(' ', '-', ucwords(str_replace('-', ' ', $key)));
                 }
                 // Headers are case insensitive
                 $headers->add($key, trim($value));
             }
         }
     }
     // Check for the Host header
     if (isset($headers['Host'])) {
         $host = $headers['Host'];
     }
     if (strpos($host, ':')) {
         list($host, $port) = array_map('trim', explode(':', $host));
         if ($port == 443) {
             $scheme = 'https';
         }
     } else {
         $port = '';
     }
     // Check for basic authorization
     $auth = isset($headers['Authorization']) ? $headers['Authorization'] : '';
     if ($auth) {
         list($type, $data) = explode(' ', $auth);
         if (strtolower($type) == 'basic') {
             $data = base64_decode($data);
             list($user, $pass) = explode(':', $data);
         }
     }
     // Check if a query is present
     $qpos = strpos($path, '?');
     if ($qpos) {
         $query = substr($path, $qpos);
         $path = substr($path, 0, $qpos);
     }
     return array('method' => $method, 'protocol' => $protocol, 'protocol_version' => $version, 'parts' => array('scheme' => $scheme, 'host' => $host, 'port' => $port, 'user' => $user, 'pass' => $pass, 'path' => $path, 'query' => $query), 'headers' => $headers->getAll(), 'body' => $body);
 }
开发者ID:MicroSDHC,项目名称:justinribeiro.com-examples,代码行数:68,代码来源:RequestFactory.php

示例6: getCookies

 /**
  * {@inheritdoc}
  */
 public function getCookies()
 {
     $cookieData = new Collection();
     if ($cookies = $this->getHeader('Cookie')) {
         foreach ($cookies as $cookie) {
             $parts = explode('=', $cookie, 2);
             $cookieData->add($parts[0], isset($parts[1]) ? $parts[1] : '');
         }
     }
     return $cookieData->getAll();
 }
开发者ID:nickpeirson,项目名称:guzzle,代码行数:14,代码来源:Request.php

示例7: testOverridesSettings

 public function testOverridesSettings()
 {
     $c = new Collection(array('foo' => 1, 'baz' => 2, 'bar' => 3));
     $c->overwriteWith(array('foo' => 10, 'bar' => 300));
     $this->assertEquals(array('foo' => 10, 'baz' => 2, 'bar' => 300), $c->getAll());
 }
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:6,代码来源:CollectionTest.php


注:本文中的Guzzle\Common\Collection::getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。