Example #1
0
 public function testEmpty()
 {
     $this->assertTrue(Command::hasName("PLAY"));
     $this->assertTrue(Command::hasValue("Play"));
     $this->assertFalse(Command::hasName("nosuch"));
     $this->assertTrue(Command::hasName("PLAY"));
 }
Example #2
0
 public function commands($commands)
 {
     $commands = explode(" ", $commands);
     foreach ($commands as $command) {
         if (\Roku\Commands\Command::hasName($command)) {
             $this->roku->{$command}();
         } else {
             $this->roku->literals($command);
         }
     }
 }
Example #3
0
 /**
  * Catchase all function calls
  *
  * @param string $name Function name
  * @param array $fargs Arguments
  */
 public function __call($name, $fargs)
 {
     if (Command::hasName($name)) {
         if (strtoupper(Command::LIT) == strtoupper($name)) {
             $command = Command::LIT . "_" . ($fargs[0] ? urlencode($fargs[0]) : "");
             return $this->keypress($command);
         } else {
             return $this->keypress($name);
         }
     } elseif (Sensor::hasName($name)) {
         $params = array();
         $axis = array("x", "y", "z");
         foreach ($fargs as $i => $value) {
             $params[strtolower($name) . "." . $axis[$i]] = $value;
         }
         return $this->input($params);
     } else {
         throw new Exception("Command Not Found");
     }
 }