public function testEmpty() { $this->assertTrue(Command::hasName("PLAY")); $this->assertTrue(Command::hasValue("Play")); $this->assertFalse(Command::hasName("nosuch")); $this->assertTrue(Command::hasName("PLAY")); }
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); } } }
/** * 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"); } }