Guest User

Untitled

a guest
Nov 17th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. class CommandBuilder
  2. {
  3. public function __construct()
  4. {
  5. //
  6. }
  7.  
  8. public function login($username, $password)
  9. {
  10. $frame = $this->frame();
  11.  
  12. $command = $frame->addChild('command');
  13. $login = $command->addChild('login');
  14. $login->addChild('username', $username);
  15. $login->addChild('password', $password);
  16. $command->addChild('authKey', 'authkey');
  17.  
  18. return $frame->asXML();
  19. }
  20.  
  21. public function info($id)
  22. {
  23. $frame = $this->frame();
  24.  
  25. $command = $frame->addChild('command');
  26. $login = $command->addChild('product');
  27. $login->addChild('id', $id);
  28. $command->addChild('authKey', 'authkey');
  29.  
  30. return $frame->asXML();
  31. }
  32.  
  33. protected function frame()
  34. {
  35. return new SimpleXMLElement(
  36. '<app/>'
  37. );
  38. }
  39. }
Add Comment
Please, Sign In to add comment