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


PHP Client::getConnection方法代码示例

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


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

示例1: getConnection

 public function getConnection($method, $path, $data = null, array $headers = array())
 {
     $start = microtime(true);
     $response = $this->client->getConnection($method, $path, $data, $headers);
     $duration = microtime(true) - $start;
     $this->requests[] = array('duration' => $duration, 'method' => $method, 'path' => rawurldecode($path), 'request' => $data, 'request_size' => strlen($data), 'response_status' => $response->status, 'response' => $response->body, 'response_headers' => $response->headers);
     $this->totalDuration += $duration;
     return $response;
 }
开发者ID:swysor,项目名称:couchdb-client,代码行数:9,代码来源:LoggingClient.php

示例2: execute

 /**
  * Execute query
  *
  * @access public
  * @param  string    $baseDn
  * @param  string    $filter
  * @param  array     $attributes
  * @return Query
  */
 public function execute($baseDn, $filter, array $attributes)
 {
     $sr = ldap_search($this->client->getConnection(), $baseDn, $filter, $attributes);
     if ($sr === false) {
         return $this;
     }
     $entries = ldap_get_entries($this->client->getConnection(), $sr);
     if ($entries === false || count($entries) === 0 || $entries['count'] == 0) {
         return $this;
     }
     $this->entries = $entries;
     return $this;
 }
开发者ID:peripatetic-sojourner,项目名称:kanboard,代码行数:22,代码来源:Query.php

示例3: testConnectFailureWithTLS

 public function testConnectFailureWithTLS()
 {
     self::$functions->expects($this->once())->method('ldap_connect')->with($this->equalTo('my_ldap_server'), $this->equalTo(389))->will($this->returnValue('my_ldap_resource'));
     self::$functions->expects($this->once())->method('ldap_start_tls')->with($this->equalTo('my_ldap_resource'))->will($this->returnValue(false));
     $this->setExpectedException('\\Kanboard\\Core\\Ldap\\ClientException');
     $ldap = new Client();
     $this->assertNotEquals('my_ldap_resource', $ldap->getConnection('my_ldap_server', 389, true));
 }
开发者ID:Folcky,项目名称:kanboard,代码行数:8,代码来源:ClientTest.php

示例4: checkCapabilities

 /**
  * Checks if the passed client instance satisfies the required conditions
  * needed to initialize a monitor context.
  *
  * @param Client Client instance used by the context.
  */
 private function checkCapabilities(Client $client)
 {
     if (Helpers::isCluster($client->getConnection())) {
         throw new ClientException('Cannot initialize a monitor context over a cluster of connections');
     }
     if ($client->getProfile()->supportsCommand('monitor') === false) {
         throw new ClientException('The current profile does not support the MONITOR command');
     }
 }
开发者ID:GunioRobot,项目名称:predis,代码行数:15,代码来源:MonitorContext.php

示例5: checkCapabilities

 /**
  * Checks if the passed client instance satisfies the required conditions
  * needed to initialize a Publish / Subscribe context.
  *
  * @param Client Client instance used by the context.
  */
 private function checkCapabilities(Client $client)
 {
     if (Helpers::isCluster($client->getConnection())) {
         throw new ClientException('Cannot initialize a PUB/SUB context over a cluster of connections');
     }
     $commands = array('publish', 'subscribe', 'unsubscribe', 'psubscribe', 'punsubscribe');
     if ($client->getProfile()->supportsCommands($commands) === false) {
         throw new ClientException('The current profile does not support PUB/SUB related commands');
     }
 }
开发者ID:GunioRobot,项目名称:predis,代码行数:16,代码来源:PubSubContext.php

示例6: execute

 /**
  * Execute query
  *
  * @access public
  * @param  string    $baseDn
  * @param  string    $filter
  * @param  array     $attributes
  * @return Query
  */
 public function execute($baseDn, $filter, array $attributes)
 {
     if (DEBUG && $this->client->hasLogger()) {
         $this->client->getLogger()->debug('BaseDN=' . $baseDn);
         $this->client->getLogger()->debug('Filter=' . $filter);
         $this->client->getLogger()->debug('Attributes=' . implode(', ', $attributes));
     }
     $sr = ldap_search($this->client->getConnection(), $baseDn, $filter, $attributes);
     if ($sr === false) {
         return $this;
     }
     $entries = ldap_get_entries($this->client->getConnection(), $sr);
     if ($entries === false || count($entries) === 0 || $entries['count'] == 0) {
         return $this;
     }
     $this->entries = $entries;
     if (DEBUG && $this->client->hasLogger()) {
         $this->client->getLogger()->debug('NbEntries=' . $entries['count']);
     }
     return $this;
 }
开发者ID:rammstein4o,项目名称:kanboard,代码行数:30,代码来源:Query.php

示例7: removeClient

 public function removeClient(Client $client)
 {
     if ($this->disconnect_callback) {
         call_user_func_array($this->disconnect_callback, [$client]);
     }
     $buf = $client->getBuffer();
     $conn = $client->getConnection();
     event_buffer_disable($buf, EV_READ | EV_WRITE);
     event_buffer_free($buf);
     fclose($conn);
 }
开发者ID:danielmunro,项目名称:beehive,代码行数:11,代码来源:Server.php


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