本文整理汇总了PHP中Client::put方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::put方法的具体用法?PHP Client::put怎么用?PHP Client::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::put方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateUser
public function updateUser($uid, $data)
{
$userData = $this->getUser($uid);
unset($userData['accountSetting']['login']);
unset($userData['accountSetting']['email']);
unset($userData['accountSetting']['effectiveIpWhitelist']);
$userData['accountSetting'] = array_merge($userData['accountSetting'], $data);
$this->client->put("/gdc/account/profile/{$uid}", $userData);
}
示例2: update
public function update($options = [])
{
$data = Client::put(static::endpoint() . '/' . $this->id(), $this->payload(), $options);
if (count($data) > 0) {
$data = json_decode($data, true);
}
return $this->parse($data);
}
示例3: assertPutFails
/**
* assert that putting a fetched resource fails
*
* @param string $url url
* @param Client $client client to use
*
* @return void
*/
public function assertPutFails($url, $client)
{
$client->request('GET', $url);
$client->put($url, $client->getResults());
$response = $client->getResponse();
$this->assertEquals(405, $response->getStatusCode());
$this->assertEquals('GET, HEAD, OPTIONS', $response->headers->get('Allow'));
}
示例4: testHighFrequencyPut
public function testHighFrequencyPut()
{
$this->subject->useTube('test');
for ($i = 0; $i < 10000; $i++) {
$this->subject->put(0, 0, 100, 'test' . $i);
}
$result = $this->subject->statsTube('test');
$this->assertEquals(10000, $result['current-jobs-urgent']);
}
示例5: update
/**
* @param string $endpoint
* @param array $data
* @param string $comment
* @param array $attachments
*
* @return array
*/
private function update($endpoint, $data, $comment, $attachments)
{
if ($comment) {
$data['comment'] = $comment;
}
foreach ($attachments as $index => $attachment) {
$data['attachment-' . $index] = fopen($attachment, 'r');
}
return $this->client->put(sprintf('projects/%d/issues/%d/%s', $this->projectId, $this->id, $endpoint), $data);
}
示例6: put
/**
* Either create a new job in the provided queue with the provided attributes,
* or move that job into that queue. If the job is being serviced by a worker,
* subsequent attempts by that worker to either `heartbeat` or `complete` the
* job should fail and return `false`.
*
* The `priority` argument should be negative to be run sooner rather than
* later, and positive if it's less important. The `tags` argument should be
* a JSON array of the tags associated with the instance and the `valid after`
* argument should be in how many seconds the instance should be considered
* actionable.
*
* @param string $klass The class with the 'performMethod' specified in the data.
* @param string $jid specified job id, if false is specified, a jid will be generated.
* @param mixed $data array of parameters for job.
* @param int $delay specify delay to run job.
* @param int $retries number of retries allowed.
* @param bool $replace false to prevent the job from being replaced if it is already running
* @param int $priority a greater priority will execute before jobs of lower priority
* @param array $resources a list of resource identifiers this job must acquire before being processed
* @param float $interval the minimum number of seconds required to transpire before the next instance of this job can run
* @param array $tags
* @param array $depends a list of JIDs this job must wait on before executing
*
* @return string|float the job identifier or the time remaining before the job expires if the job is already running
*/
public function put($klass, $jid, $data, $delay = 0, $retries = 5, $replace = true, $priority = 0, $resources = [], $interval = 0.0, $tags = [], $depends = [])
{
return $this->client->put(null, $this->name, $jid ?: Qless::guidv4(), $klass, json_encode($data, JSON_UNESCAPED_SLASHES), $delay, 'priority', $priority, 'tags', json_encode($tags, JSON_UNESCAPED_SLASHES), 'retries', $retries, 'depends', json_encode($depends, JSON_UNESCAPED_SLASHES), 'resources', json_encode($resources, JSON_UNESCAPED_SLASHES), 'replace', $replace ? 1 : 0, 'interval', $interval);
}
示例7: getenv
<?php
/**
* beanstalk: A minimalistic PHP beanstalk client.
*
* Copyright (c) 2009-2015 David Persson
*
* Distributed under the terms of the MIT License.
* Redistributions of files must retain the above copyright notice.
*/
namespace Beanstalk;
/**
* A small benchmark to test throughput.
*/
$host = getenv('TEST_BEANSTALKD_HOST');
$port = getenv('TEST_BEANSTALKD_PORT');
if (!$host || !$port) {
throw new \RuntimeException('TEST_BEANSTALKD_HOST and/or TEST_BEANSTALKD_PORT env variables not defined.');
}
$connection = new Connection($host, $port, false);
if (!$connection->connect()) {
throw new \RuntimeException("Unable to connect to a running beanstalkd server at {$host}:{$port}.");
}
$client = new Client($connection);
for ($i = 0; $i < 100000; $i++) {
$client->put(1024, 0, 60, $i);
}
示例8: testPutEvent
public function testPutEvent()
{
Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET);
Client::endpoint('https://api.relateiq.com/v2/events');
Client::headers(["Content-type" => "application/json", "Accept" => "application/json"]);
$data = ["subject" => "Support Ticket #12345: How do I create an event?", "body" => "Just called Tim and walked him through how to create an event with the new API.\n-James.", "participantIds" => [["type" => "email", "value" => "james.mcsales@relateiq.com"], ["type" => "email", "value" => "tim.archer@avocado.com"], ["type" => "phone", "value" => "8001235555"]]];
$res = Client::put('', $data, []);
$this->assertEquals(204, $res->code);
}
示例9: testResponseBody
public function testResponseBody()
{
$client = new Client($this->testUrl);
$client->get();
$this->assertEquals('OK', $client->getStatusMessage());
$client = new Client($this->testUrl);
$client->post();
$this->assertEquals('OK', $client->getStatusMessage());
$client = new Client($this->testUrl);
$client->put();
$this->assertEquals('OK', $client->getStatusMessage());
$client = new Client($this->testUrl);
$client->patch();
$this->assertEquals('OK', $client->getStatusMessage());
$client = new Client($this->testUrl);
$client->delete();
$this->assertEquals('OK', $client->getStatusMessage());
// TODO Why it gives OK?
$client = new Client($this->testUrl);
$client->head();
//$this->assertEquals('', $client->getStatusMessage());
$client = new Client($this->testUrl);
$client->options();
$this->assertEquals('OK', $client->getStatusMessage());
}
示例10: update
public function update($options = [])
{
$data = (array) Client::put(self::endpoint(), static::payload(), $options);
return $this;
}
示例11: updateName
/**
* Update the name of a company
*
* @param string $newName
* @return array
*/
public function updateName($newName)
{
return $this->client->put('companies/' . $this->id, ['company_name' => $newName]);
}
示例12: testPoolError
/**
* Tests a malfunctional server.
*/
public function testPoolError()
{
$this->setExpectedException('\\Jyxo\\Webdav\\Exception');
$client = new Client(array('127.0.0.1:5555'));
$client->put($this->file, 'test');
}