Phue\Client::getTransport PHP Method

getTransport() public method

Get transport
public getTransport ( ) : Phue\Transport\TransportInterface
return Phue\Transport\TransportInterface Transport
    public function getTransport()
    {
        // Set transport if haven't
        if ($this->transport === null) {
            $this->setTransport(new Http($this));
        }
        return $this->transport;
    }

Usage Example

Example #1
0
 /**
  * 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;
 }
All Usage Examples Of Phue\Client::getTransport