UserCollectionInterface.php 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @package Grav\Common\User
  4. *
  5. * @copyright Copyright (C) 2015 - 2019 Trilby Media, LLC. All rights reserved.
  6. * @license MIT License; see LICENSE file for details.
  7. */
  8. namespace Grav\Common\User\Interfaces;
  9. interface UserCollectionInterface extends \Countable
  10. {
  11. /**
  12. * Load user account.
  13. *
  14. * Always creates user object. To check if user exists, use $this->exists().
  15. *
  16. * @param string $username
  17. * @return UserInterface
  18. */
  19. public function load($username): UserInterface;
  20. /**
  21. * Find a user by username, email, etc
  22. *
  23. * @param string $query the query to search for
  24. * @param array $fields the fields to search
  25. * @return UserInterface
  26. */
  27. public function find($query, $fields = ['username', 'email']): UserInterface;
  28. /**
  29. * Delete user account.
  30. *
  31. * @param string $username
  32. * @return bool True if user account was found and was deleted.
  33. */
  34. public function delete($username): bool;
  35. }