ICheck.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Morris Jobke <hey@morrisjobke.de>
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\WorkflowEngine;
  25. /**
  26. * Interface ICheck
  27. *
  28. * @package OCP\WorkflowEngine
  29. * @since 9.1
  30. */
  31. interface ICheck {
  32. /**
  33. * @param string $operator
  34. * @param string $value
  35. * @return bool
  36. * @since 9.1
  37. */
  38. public function executeCheck($operator, $value);
  39. /**
  40. * @param string $operator
  41. * @param string $value
  42. * @throws \UnexpectedValueException
  43. * @since 9.1
  44. */
  45. public function validateCheck($operator, $value);
  46. /**
  47. * returns a list of Entities the checker supports. The values must match
  48. * the class name of the entity.
  49. *
  50. * An empty result means the check is universally available.
  51. *
  52. * @since 18.0.0
  53. */
  54. public function supportedEntities(): array;
  55. /**
  56. * returns whether the operation can be used in the requested scope.
  57. *
  58. * Scope IDs are defined as constants in OCP\WorkflowEngine\IManager. At
  59. * time of writing these are SCOPE_ADMIN and SCOPE_USER.
  60. *
  61. * For possibly unknown future scopes the recommended behaviour is: if
  62. * user scope is permitted, the default behaviour should return `true`,
  63. * otherwise `false`.
  64. *
  65. * @since 18.0.0
  66. */
  67. public function isAvailableForScope(int $scope): bool;
  68. }