當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Client::getTransport方法代碼示例

本文整理匯總了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;
 }
開發者ID:sqmk,項目名稱:phue,代碼行數:18,代碼來源:GetLights.php

示例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;
 }
開發者ID:wardcraigj,項目名稱:gametime,代碼行數:17,代碼來源:GetGroups.php

示例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;
 }
開發者ID:wardcraigj,項目名稱:gametime,代碼行數:17,代碼來源:GetSchedules.php

示例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;
 }
開發者ID:bendspoons,項目名稱:Phue,代碼行數:17,代碼來源:IsAuthorized.php

示例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;
 }
開發者ID:bendspoons,項目名稱:Phue,代碼行數:17,代碼來源:GetRules.php

示例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;
 }
開發者ID:sqmk,項目名稱:phue,代碼行數:18,代碼來源:GetSensors.php

示例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;
 }
開發者ID:bendspoons,項目名稱:Phue,代碼行數:17,代碼來源:GetTimezones.php

示例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;
 }
開發者ID:wardcraigj,項目名稱:gametime,代碼行數:20,代碼來源:GetNewLights.php

示例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;
 }
開發者ID:sqmk,項目名稱:phue,代碼行數:22,代碼來源:GetUsers.php

示例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;
 }
開發者ID:Mahlstrom,項目名稱:Phue,代碼行數:21,代碼來源:GetLights.php

示例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;
 }
開發者ID:Mahlstrom,項目名稱:Phue,代碼行數:21,代碼來源:GetGroups.php

示例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;
 }
開發者ID:Mahlstrom,項目名稱:Phue,代碼行數:21,代碼來源:GetSchedules.php

示例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;
 }
開發者ID:sqmk,項目名稱:phue,代碼行數:17,代碼來源:CreateScene.php

示例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);
 }
開發者ID:Mahlstrom,項目名稱:Phue,代碼行數:11,代碼來源:SetBridgeConfig.php

示例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;
 }
開發者ID:bendspoons,項目名稱:Phue,代碼行數:13,代碼來源:CreateUser.php


注:本文中的Phue\Client::getTransport方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。