예제 #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"));
 }
예제 #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);
         }
     }
 }
예제 #3
0
파일: Roku.php 프로젝트: svilborg/php-roku
 /**
  * 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");
     }
 }