本文整理汇总了PHP中Phue\Client::getTransport方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getTransport方法的具体用法?PHP Client::getTransport怎么用?PHP Client::getTransport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phue\Client
的用法示例。
在下文中一共展示了Client::getTransport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send command
*
* @param Client $client
* Phue Client
*
* @return Light[] List of Light objects
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/lights");
$lights = array();
foreach ($response as $lightId => $attributes) {
$lights[$lightId] = new Light($lightId, $attributes, $client);
}
return $lights;
}
示例2: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return Group[] List of Group objects
*/
public function send(Client $client)
{
// Get response
$results = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/groups");
$groups = [];
foreach ($results as $groupId => $attributes) {
$groups[$groupId] = new Group($groupId, $attributes, $client);
}
return $groups;
}
示例3: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return Schedule[] List of Schedule objects
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/schedules");
$schedules = [];
foreach ($response as $scheduleId => $attributes) {
$schedules[$scheduleId] = new Schedule($scheduleId, $attributes, $client);
}
return $schedules;
}
示例4: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return bool True if authorized, false if not
*/
public function send(Client $client)
{
// Get response
try {
$client->getTransport()->sendRequest("/api/{$client->getUsername()}");
} catch (UnauthorizedUserException $e) {
return false;
}
return true;
}
示例5: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return Rule[] List of Rule objects
*/
public function send(Client $client)
{
// Get response
$results = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/rules");
$rules = [];
foreach ($results as $ruleId => $attributes) {
$rules[$ruleId] = new Rule($ruleId, $attributes, $client);
}
return $rules;
}
示例6: send
/**
* Send command
*
* @param Client $client
* Phue Client
*
* @return Sensor[] List of Sensor objects
*/
public function send(Client $client)
{
// Get response
$results = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/sensors");
$sensors = array();
foreach ($results as $sensorId => $attributes) {
$sensors[$sensorId] = new Sensor($sensorId, $attributes, $client);
}
return $sensors;
}
示例7: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return array List of timezones
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequestBypassBodyValidation("/api/{$client->getUsername()}/info/timezones");
$timezones = [];
foreach ($response as $timezone) {
$timezones[] = $timezone;
}
return $timezones;
}
示例8: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return self This object
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/lights/new");
$this->lastScan = $response->lastscan;
// Remove scan from response
unset($response->lastscan);
// Iterate through left over properties as lights
foreach ($response as $lightId => $light) {
$this->lights[$lightId] = $light->name;
}
return $this;
}
示例9: send
/**
* Send command
*
* @param Client $client
* Phue Client
*
* @return User[] List of User objects
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/config");
// Return empty list if no users
if (!isset($response->whitelist)) {
return array();
}
$users = array();
foreach ($response->whitelist as $username => $attributes) {
$users[$username] = new User($username, $attributes, $client);
}
return $users;
}
示例10: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return Light[] List of Light objects
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequest($client->getUsername());
// Return empty list if no lights
if (!isset($response->lights)) {
return [];
}
$lights = [];
foreach ($response->lights as $lightId => $attributes) {
$lights[$lightId] = new Light($lightId, $attributes, $client);
}
return $lights;
}
示例11: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return Group[] List of Group objects
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequest($client->getUsername());
// Return empty list if no groups
if (!isset($response->groups)) {
return [];
}
$groups = [];
foreach ($response->groups as $groupId => $attributes) {
$groups[$groupId] = new Group($groupId, $attributes, $client);
}
return $groups;
}
示例12: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return Schedule[] List of Schedule objects
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequest($client->getUsername());
// Return empty list if no schedules
if (!isset($response->schedules)) {
return [];
}
$schedules = [];
foreach ($response->schedules as $scheduleId => $attributes) {
$schedules[$scheduleId] = new Schedule($scheduleId, $attributes, $client);
}
return $schedules;
}
示例13: send
/**
* Send command
*
* @param Client $client
* Phue Client
*
* @return string Scene Id
*/
public function send(Client $client)
{
$body = (object) array('name' => $this->name, 'lights' => $this->lights);
if ($this->transitionTime !== null) {
$body->transitiontime = $this->transitionTime;
}
$client->getTransport()->sendRequest("/api/{$client->getUsername()}/scenes/{$this->id}", TransportInterface::METHOD_PUT, $body);
return $this->id;
}
示例14: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return mixed|void
*/
public function send(Client $client)
{
$client->getTransport()->sendRequest("{$client->getUsername()}/config", TransportInterface::METHOD_PUT, (object) $this->config);
}
示例15: send
/**
* Send command
*
* @param Client $client Phue Client
*
* @return \stdClass Authentication response
*/
public function send(Client $client)
{
// Get response
$response = $client->getTransport()->sendRequest('/api', TransportInterface::METHOD_POST, $this->buildRequestData($client));
return $response;
}