User.php 905 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * ApiClient
  4. *
  5. * PHP version 5
  6. *
  7. * @category Services
  8. * @package Authy
  9. * @author David Cuadrado <[email protected]>
  10. * @license http://creativecommons.org/licenses/MIT/ MIT
  11. * @link http://authy.github.com/pear
  12. */
  13. /**
  14. * User implementation. Extends from Authy_Response
  15. *
  16. * @category Services
  17. * @package Authy
  18. * @author David Cuadrado <[email protected]>
  19. * @license http://creativecommons.org/licenses/MIT/ MIT
  20. * @link http://authy.github.com/pear
  21. */
  22. class Authy_User extends \Authy_Response
  23. {
  24. /**
  25. * Constructor.
  26. *
  27. * @param array $raw_response Raw server response
  28. */
  29. public function __construct($raw_response)
  30. {
  31. if (isset($raw_response['body']->user)) {
  32. // response is {user: {id: id}}
  33. $raw_response['body'] = $raw_response['body']->user;
  34. }
  35. parent::__construct($raw_response);
  36. }
  37. }